From: bangerth Date: Sun, 13 Feb 2011 22:37:10 +0000 (+0000) Subject: Make the number of time steps between mesh refinement a parameter. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=796f532a8a0e88ef112067f9be0c257c33053d83;p=dealii-svn.git Make the number of time steps between mesh refinement a parameter. git-svn-id: https://svn.dealii.org/trunk@23351 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-32/step-32.cc b/deal.II/examples/step-32/step-32.cc index b971f40ac2..cc53398060 100644 --- a/deal.II/examples/step-32/step-32.cc +++ b/deal.II/examples/step-32/step-32.cc @@ -861,6 +861,8 @@ class BoussinesqFlowProblem bool generate_graphical_output; unsigned int graphical_output_interval; + unsigned int adaptive_refinement_interval; + double stabilization_alpha; double stabilization_c_R; double stabilization_beta; @@ -971,6 +973,7 @@ BoussinesqFlowProblem::Parameters::Parameters () end_time (1e8), initial_global_refinement (2), initial_adaptive_refinement (2), + adaptive_refinement_interval (10), stabilization_alpha (2), stabilization_c_R (0.11), stabilization_beta (0.078) @@ -995,6 +998,10 @@ declare_parameters (ParameterHandler &prm) Patterns::Integer (0), "The number of adaptive refinement steps performed after " "initial global refinement."); + prm.declare_entry ("Time steps between mesh refinement", "10", + Patterns::Integer (10), + "The number of time steps after which the mesh is to be " + "adapted based on computed error indicators."); prm.declare_entry ("Generate graphical output", "false", Patterns::Bool (), "Whether graphical output is to be generated or not. " @@ -1034,6 +1041,8 @@ parse_parameters (ParameterHandler &prm) initial_global_refinement = prm.get_integer ("Initial global refinement"); initial_adaptive_refinement = prm.get_integer ("Initial adaptive refinement"); + adaptive_refinement_interval= prm.get_integer ("Time steps between mesh refinement"); + generate_graphical_output = prm.get_bool ("Generate graphical output"); graphical_output_interval = prm.get_integer ("Time steps between graphical output"); @@ -3532,7 +3541,9 @@ void BoussinesqFlowProblem::run (const std::string parameter_filename) goto start_time_iteration; } else - if ((timestep_number > 0) && (timestep_number % 10 == 0)) + if ((timestep_number > 0) + && + (timestep_number % parameters.adaptive_refinement_interval == 0)) refine_mesh (parameters.initial_global_refinement + parameters.initial_adaptive_refinement); @@ -3566,12 +3577,12 @@ void BoussinesqFlowProblem::run (const std::string parameter_filename) TrilinosWrappers::MPI::Vector distributed_old_old_temperature_solution (temperature_rhs); distributed_old_old_temperature_solution.reinit(old_old_temperature_solution, false, true); - + distributed_temperature_solution.sadd (1.+time_step/old_time_step, -time_step/old_time_step, distributed_old_old_temperature_solution); - temperature_solution.reinit(distributed_temperature_solution, false, true); + temperature_solution.reinit(distributed_temperature_solution, false, true); } } while (time <= parameters.end_time * EquationData::year_in_seconds); diff --git a/deal.II/examples/step-32/step-32.prm b/deal.II/examples/step-32/step-32.prm index 3ddcd8521a..b8777bc30a 100644 --- a/deal.II/examples/step-32/step-32.prm +++ b/deal.II/examples/step-32/step-32.prm @@ -11,6 +11,10 @@ set Initial adaptive refinement = 2 # before the problem is first solved there. set Initial global refinement = 1 +# The number of time steps after which the mesh is to be adapted based on +# computed error indicators. +set Time steps between mesh refinement = 10 + # Whether graphical output is to be generated or not. You may not want to get # graphical output if the number of processors is large. set Generate graphical output = false