From: Reza Rastak Date: Wed, 18 Sep 2019 18:35:07 +0000 (-0700) Subject: enum Strategy is removed from TimestepControl X-Git-Tag: v9.2.0-rc1~1076^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8789%2Fhead;p=dealii.git enum Strategy is removed from TimestepControl --- diff --git a/doc/news/changes/incompatibilities/20190918RezaRastak b/doc/news/changes/incompatibilities/20190918RezaRastak new file mode 100644 index 0000000000..42aa2c23ba --- /dev/null +++ b/doc/news/changes/incompatibilities/20190918RezaRastak @@ -0,0 +1,3 @@ +Removed: The enum TimestepControl::Strategy is removed. +
+(Reza Rastak, 2019/09/18) diff --git a/include/deal.II/algorithms/timestep_control.h b/include/deal.II/algorithms/timestep_control.h index 1f0ce0340b..a7e5ed74ad 100644 --- a/include/deal.II/algorithms/timestep_control.h +++ b/include/deal.II/algorithms/timestep_control.h @@ -55,27 +55,6 @@ namespace Algorithms class TimestepControl : public Subscriptor { public: - /** - * The time stepping strategies. These are controlled by the value of - * tolerance() and start_step(). - */ - enum Strategy - { - /** - * Choose a uniform time step size. The step size is determined by - * start_step(), tolerance() is ignored. - */ - uniform, - /** - * Start with the time step size given by start_step() and double it in - * every step. tolerance() is ignored. - * - * This strategy is intended for pseudo-timestepping schemes computing a - * stationary limit. - */ - doubling - }; - /** * Constructor setting default values */ @@ -152,10 +131,6 @@ namespace Algorithms */ void tolerance(double); - /** - * Set strategy. - */ - void strategy(Strategy); /** * Set size of the first step. This may be overwritten by the time @@ -214,11 +189,6 @@ namespace Algorithms */ double tolerance_val; - /** - * Time-stepping strategy. - */ - Strategy strategy_val; - /** * The size of the first step. */ @@ -325,13 +295,6 @@ namespace Algorithms } - inline void - TimestepControl::strategy(Strategy t) - { - strategy_val = t; - } - - inline void TimestepControl::start_step(const double t) { diff --git a/source/algorithms/timestep_control.cc b/source/algorithms/timestep_control.cc index a54a0a1599..ea5048a5ed 100644 --- a/source/algorithms/timestep_control.cc +++ b/source/algorithms/timestep_control.cc @@ -31,7 +31,6 @@ TimestepControl::TimestepControl(double start, : start_val(start) , final_val(final) , tolerance_val(tolerance) - , strategy_val(uniform) , start_step_val(start_step) , max_step_val(max_step) , min_step_val(0) @@ -58,9 +57,6 @@ TimestepControl::declare_parameters(ParameterHandler ¶m) param.declare_entry("Max step", "1.", Patterns::Double(0.)); param.declare_entry("Tolerance", "1.e-2", Patterns::Double(0.)); param.declare_entry("Print step", "-1.", Patterns::Double()); - param.declare_entry("Strategy", - "uniform", - Patterns::Selection("uniform|doubling")); } @@ -73,13 +69,7 @@ TimestepControl::parse_parameters(ParameterHandler ¶m) max_step(param.get_double("Max step")); final(param.get_double("Final")); tolerance(param.get_double("Tolerance")); - print_step = param.get_double("Print step"); - const std::string strategy = param.get("Strategy"); - if (strategy == std::string("uniform")) - strategy_val = uniform; - else if (strategy == std::string("doubling")) - strategy_val = doubling; - restart(); + print_step = param.get_double("Print step"); } @@ -87,41 +77,24 @@ TimestepControl::parse_parameters(ParameterHandler ¶m) bool TimestepControl::advance() { - bool changed = false; - double s = step_val; - - // Do time step control, but not in - // first step. - if (now_val != start()) - { - if (strategy_val == doubling && 2 * s <= tolerance_val) - s *= 2; - if (s > max_step_val) - s = max_step_val; - } + bool changed = false; // Try incrementing time by s - double h = now_val + s; - changed = s != step_val; - - step_val = s; - current_step_val = s; - // If we just missed the final - // time, increase the step size a - // bit. This way, we avoid a very - // small final step. If the step - // shot over the final time, adjust - // it so we hit the final time - // exactly. - double s1 = .01 * s; - if (h > final_val - s1) + double now_trial = now_val + step_val; + current_step_val = step_val; + + // If we just missed the final time, increase the step size a bit. This way, + // we avoid a very small final step. If the step shot over the final time, + // adjust it so we hit the final time exactly. + double s1 = .01 * step_val; + if (now_trial > final_val - s1) { current_step_val = final_val - now_val; - h = final_val; + now_trial = final_val; changed = true; } - now_val = h; + now_val = now_trial; return changed; }