https://mooseframework.inl.gov
IterationAdaptiveDT.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // MOOSE includes
11 #include "IterationAdaptiveDT.h"
12 #include "Function.h"
13 #include "PiecewiseLinear.h"
14 #include "Transient.h"
15 #include "NonlinearSystem.h"
16 #include "FEProblemBase.h"
17 #include "LinearSystem.h"
18 
19 #include <limits>
20 #include <set>
21 
23 
26 {
28  params.addClassDescription("Adjust the timestep based on the number of iterations");
29  params.addParam<int>(
30  "optimal_iterations",
31  "The target number of solver outer iterations for adaptive timestepping. "
32  "For a problem using nonlinear systems, the total number of nonlinear iterations is used. "
33  "For a problem using linear systems, the total number of linear iterations is used.");
34  params.addParam<int>("iteration_window",
35  "Attempt to grow/shrink timestep if the iteration count "
36  "is below/above 'optimal_iterations plus/minus "
37  "iteration_window' (default = optimal_iterations/5).");
38  params.addParam<unsigned>("linear_iteration_ratio",
39  "The ratio of linear to nonlinear iterations "
40  "to determine target linear iterations and "
41  "window for adaptive timestepping (default = "
42  "25)");
43  params.addParam<std::vector<PostprocessorName>>("timestep_limiting_postprocessor",
44  "If specified, a list of postprocessor values "
45  "used as an upper limit for the "
46  "current time step length");
47  params.addParam<std::vector<FunctionName>>(
48  "timestep_limiting_function",
49  "A list of 'PiecewiseBase' type functions used to control the timestep by "
50  "limiting the change in the function over a timestep");
51  params.addParam<Real>(
52  "max_function_change",
53  "The absolute value of the maximum change in timestep_limiting_function over a timestep");
54  params.addParam<bool>("force_step_every_function_point",
55  false,
56  "Forces the timestepper to take "
57  "a step that is consistent with "
58  "points defined in the function");
59  params.addRangeCheckedParam<Real>(
60  "post_function_sync_dt",
61  "post_function_sync_dt>0",
62  "Timestep to apply after time sync with function point. To be used in "
63  "conjunction with 'force_step_every_function_point'.");
64  params.addRequiredParam<Real>("dt", "The default timestep size between solves");
65  params.addParam<std::vector<Real>>("time_t", {}, "The values of t");
66  params.addParam<std::vector<Real>>("time_dt", {}, "The values of dt");
67  params.addParam<Real>("growth_factor",
68  2.0,
69  "Factor to apply to timestep if easy convergence (if "
70  "'optimal_iterations' is specified) or if recovering "
71  "from failed solve");
72  params.addParam<Real>("cutback_factor",
73  0.5,
74  "Factor to apply to timestep if difficult convergence "
75  "occurs (if 'optimal_iterations' is specified). "
76  "For failed solves, use cutback_factor_at_failure");
77 
78  params.addParam<bool>("reject_large_step",
79  false,
80  "If 'true', time steps that are too large compared to the "
81  "ideal time step will be rejected and repeated");
82  params.addRangeCheckedParam<Real>("reject_large_step_threshold",
83  0.1,
84  "reject_large_step_threshold > 0 "
85  "& reject_large_step_threshold < 1",
86  "Ratio between the the ideal time step size and the "
87  "current time step size below which a time step will "
88  "be rejected if 'reject_large_step' is 'true'");
89 
90  params.declareControllable("growth_factor cutback_factor");
91 
92  return params;
93 }
94 
96  : TimeStepper(parameters),
98  _dt_old(declareRestartableData<Real>("dt_old", 0.0)),
99  _input_dt(getParam<Real>("dt")),
100  _tfunc_last_step(declareRestartableData<bool>("tfunc_last_step", false)),
101  _sync_last_step(declareRestartableData<bool>("sync_last_step", false)),
102  _linear_iteration_ratio(isParamValid("linear_iteration_ratio")
103  ? getParam<unsigned>("linear_iteration_ratio")
104  : 25), // Default to 25
105  _adaptive_timestepping(false),
106  _pps_value(
107  parameters.get<std::vector<PostprocessorName>>("timestep_limiting_postprocessor").size()),
108  _timestep_limiting_functions(),
109  _piecewise_timestep_limiting_functions(),
110  _piecewise_linear_timestep_limiting_functions(),
111  _times(0),
112  _max_function_change(-1),
113  _force_step_every_function_point(getParam<bool>("force_step_every_function_point")),
114  _post_function_sync_dt(isParamValid("force_step_every_function_point") &&
115  isParamValid("post_function_sync_dt")
116  ? getParam<Real>("post_function_sync_dt")
117  : 0.0),
118  _tfunc_times(getParam<std::vector<Real>>("time_t").begin(),
119  getParam<std::vector<Real>>("time_t").end()),
120  _time_ipol(getParam<std::vector<Real>>("time_t"), getParam<std::vector<Real>>("time_dt")),
121  _use_time_ipol(_time_ipol.getSampleSize() > 0),
122  _growth_factor(getParam<Real>("growth_factor")),
123  _cutback_factor(getParam<Real>("cutback_factor")),
124  _outer_its(declareRestartableData<unsigned int>("outer_its", 0)),
125  _nl_its(_outer_its),
126  _l_its(declareRestartableData<unsigned int>("l_its", 0)),
127  _cutback_occurred(declareRestartableData<bool>("cutback_occurred", false)),
128  _at_function_point(false),
129  _reject_large_step(getParam<bool>("reject_large_step")),
130  _large_step_rejection_threshold(getParam<Real>("reject_large_step_threshold"))
131 {
132  auto timestep_limiting_postprocessor_names =
133  parameters.get<std::vector<PostprocessorName>>("timestep_limiting_postprocessor");
134  for (size_t i = 0; i < _pps_value.size(); ++i)
135  _pps_value[i] = &getPostprocessorValueByName(timestep_limiting_postprocessor_names[i]);
136 
137  if (isParamValid("optimal_iterations"))
138  {
139  _adaptive_timestepping = true;
140  _optimal_iterations = getParam<int>("optimal_iterations");
141 
142  if (isParamValid("iteration_window"))
143  _iteration_window = getParam<int>("iteration_window");
144  else
146  }
147  else
148  {
149  if (isParamValid("iteration_window"))
150  mooseError("'optimal_iterations' must be used for 'iteration_window' to be used");
151  if (isParamValid("linear_iteration_ratio"))
152  mooseError("'optimal_iterations' must be used for 'linear_iteration_ratio' to be used");
153  }
154 
155  if (isParamValid("timestep_limiting_function"))
157  isParamValid("max_function_change") ? getParam<Real>("max_function_change") : -1;
158  else
159  {
160  if (isParamValid("max_function_change"))
161  mooseError("'timestep_limiting_function' must be used for 'max_function_change' to be used");
163  mooseError("'timestep_limiting_function' must be used for 'force_step_every_function_point' "
164  "to be used");
165  }
166 
167  if (!isParamValid("force_step_every_function_point") && isParamValid("post_function_sync_dt"))
168  paramError("post_function_sync_dt",
169  "Not applicable if 'force_step_every_function_point = false'");
170 }
171 
172 void
174 {
175  if (isParamValid("timestep_limiting_function"))
176  {
177  std::set<Real> times;
178 
179  const auto tid = isParamValid("_tid") ? getParam<THREAD_ID>("_tid") : 0;
180  for (const auto & name : getParam<std::vector<FunctionName>>("timestep_limiting_function"))
181  {
182  const auto * func = &_fe_problem.getFunction(name, tid);
183  _timestep_limiting_functions.push_back(func);
184 
185  const auto * pfunc = dynamic_cast<const PiecewiseBase *>(func);
187 
188  if (pfunc)
189  {
190  const auto * plfunc = dynamic_cast<const PiecewiseLinear *>(pfunc);
192 
193  const auto ntimes = pfunc->functionSize();
194  for (unsigned int i = 0; i < ntimes; ++i)
195  times.insert(pfunc->domain(i));
196  }
197  else
198  mooseError("timestep_limiting_function must be a PiecewiseBase function");
199  }
200  _times.resize(times.size());
201  std::copy(times.begin(), times.end(), _times.begin());
202 
203  mooseAssert(_timestep_limiting_functions.size() ==
205  "Timestep limiting function count inconsistency");
206  mooseAssert(_piecewise_timestep_limiting_functions.size() ==
208  "Timestep limiting function count inconsistency");
209  }
210 }
211 
212 void
214 {
216 
217  // Delete all tfunc times that are at or before the begin time
218  while (!_tfunc_times.empty() && _time + _timestep_tolerance >= *_tfunc_times.begin())
219  _tfunc_times.erase(_tfunc_times.begin());
220 }
221 
222 Real
224 {
225  Real dt;
226  if (_tfunc_last_step)
227  {
229  if (_verbose)
230  _console << "Setting initial dt to value specified by dt function: " << std::setw(9) << dt
231  << std::endl;
232  }
233  else
234  {
235  dt = _input_dt;
236  if (_verbose)
237  _console << "Setting initial dt to input value: " << std::setw(9) << dt << std::endl;
238  }
239  return dt;
240 }
241 
242 Real
244 {
245  Real dt = _dt_old;
246 
247  if (_cutback_occurred)
248  {
249  _cutback_occurred = false;
251  {
252  // Don't allow it to grow this step, but shrink if needed
253  bool allowToGrow = false;
254  computeAdaptiveDT(dt, allowToGrow);
255  }
256  }
257  else if (_tfunc_last_step)
258  {
259  _sync_last_step = false;
261 
262  if (_verbose)
263  _console << "Setting dt to value specified by dt function: " << std::setw(9) << dt
264  << std::endl;
265  }
266  else if (_sync_last_step)
267  {
268  _sync_last_step = false;
270  {
272 
273  if (_verbose)
274  _console << "Setting dt to 'post_function_sync_dt': " << std::setw(9) << dt << std::endl;
275  }
276  else
277  {
279 
280  if (_verbose)
281  _console << "Setting dt to unconstrained value used before sync: " << std::setw(9) << dt
282  << std::endl;
283  }
284  }
285  else if (_adaptive_timestepping)
286  computeAdaptiveDT(dt);
287  else if (_use_time_ipol)
288  dt = computeInterpolationDT();
289  else
290  {
291  dt *= _growth_factor;
292  if (dt > _dt_old * _growth_factor)
293  dt = _dt_old * _growth_factor;
294  if (_verbose)
295  _console << "Growing dt based on growth factor (" << _growth_factor
296  << ") and previous dt before sync (" << _dt_old << ") : " << std::setw(9) << dt
297  << std::endl;
298  }
299 
300  return dt;
301 }
302 
303 bool
305 {
306  bool at_sync_point = TimeStepper::constrainStep(dt);
307 
308  // Use value from computed dt while rejecting the timestep
309  if (_dt_from_reject)
310  {
311  dt = *_dt_from_reject;
312  _dt_from_reject.reset();
313  }
314  // Otherwise, limit the timestep to the current postprocessor value
315  else
317 
318  // Limit the timestep to limit change in the function
319  limitDTByFunction(dt);
320 
321  // Adjust to the next tfunc time if needed
322  if (!_tfunc_times.empty() && _time + dt + _timestep_tolerance >= *_tfunc_times.begin())
323  {
324  dt = *_tfunc_times.begin() - _time;
325 
326  if (_verbose)
327  _console << "Limiting dt to sync with dt function time: " << std::setw(9)
328  << *_tfunc_times.begin() << " dt: " << std::setw(9) << dt << std::endl;
329  }
330 
331  return at_sync_point;
332 }
333 
334 Real
336 {
337  _cutback_occurred = true;
338 
339  // Can't cut back any more
340  if (_dt <= _dt_min)
341  mooseError("Solve failed and timestep already at dtmin, cannot continue!");
342 
343  if (_verbose)
344  {
345  _console << "\nSolve failed with dt: " << std::setw(9) << _dt
346  << "\nRetrying with reduced dt: " << std::setw(9) << _dt * _cutback_factor_at_failure
347  << std::endl;
348  }
349  else
350  _console << "\nSolve failed, cutting timestep." << std::endl;
351 
353 }
354 
355 bool
357 {
358  if (!_reject_large_step)
359  return TimeStepper::converged();
360 
361  // the solver has not converged
362  if (!TimeStepper::converged())
363  return false;
364 
365  // we are already at dt_min or at the start of the simulation
366  // in which case we can move on to the next step
367  if (_dt == _dt_min || _t_step < 2)
368  return true;
369 
370  // This means we haven't tried constraining the latest step yet
371  if (_dt_from_reject)
372  return false;
373 
374  // we get what the next time step should be
375  Real dt_test = _dt;
377 
378  // we cannot constrain the time step any further
379  if (dt_test == 0)
380  return true;
381 
382  // if the time step is much smaller than the current time step
383  // we need to repeat the current iteration with a smaller time step
384  if (dt_test < _dt * _large_step_rejection_threshold)
385  {
386  _dt_from_reject = dt_test;
387  return false;
388  }
389 
390  // otherwise we move one
391  return true;
392 }
393 
394 void
396 {
397  if (_pps_value.size() != 0 && _t_step > 1)
398  {
399  Real limiting_pps_value = *_pps_value[0];
400  unsigned int i_min = 0;
401  for (size_t i = 1; i < _pps_value.size(); ++i)
402  if (*_pps_value[i] < limiting_pps_value)
403  {
404  limiting_pps_value = *_pps_value[i];
405  i_min = i;
406  }
407 
408  if (limitedDT > limiting_pps_value)
409  {
410  if (limiting_pps_value < 0)
411  mooseWarning(
412  "Negative timestep limiting postprocessor '" +
413  getParam<std::vector<PostprocessorName>>("timestep_limiting_postprocessor")[i_min] +
414  "': " + std::to_string(limiting_pps_value));
415  limitedDT = std::max(_dt_min, limiting_pps_value);
416 
417  if (_verbose)
418  _console << "Limiting dt to postprocessor value. dt = " << limitedDT << std::endl;
419  }
420  }
421 }
422 
423 void
425 {
426  Real orig_dt = limitedDT;
427  const auto nfunc = _timestep_limiting_functions.size();
428  Real restricted_step = std::numeric_limits<Real>::max();
429 
430  for (unsigned int j = 0; j < nfunc; ++j)
431  {
432  // Limit by function change for piecewise linear functions.
434  {
435  const auto current_function_value =
437 
438  const auto ntimes = _piecewise_linear_timestep_limiting_functions[j]->functionSize();
439  for (std::size_t next_time_index = 1; next_time_index < ntimes; ++next_time_index)
440  {
441  const auto next_time =
442  _piecewise_linear_timestep_limiting_functions[j]->domain(next_time_index);
443 
444  // Skip ahead to find time point that is just past the current time.
445  if (next_time + _timestep_tolerance <= _time)
446  continue;
447 
448  // Find out how far we can go without exceeding the max function change.
449  const auto next_function_value =
450  _piecewise_linear_timestep_limiting_functions[j]->range(next_time_index);
451  const auto change = std::abs(next_function_value - current_function_value);
452  if (change > _max_function_change)
453  {
454  // Interpolate to find step.
455  restricted_step =
456  std::min(restricted_step, (_max_function_change / change) * (next_time - _time));
457  break;
458  }
459 
460  // Don't keep going if we've already passed the current limited step.
461  if (next_time > _time + limitedDT)
462  break;
463  }
464  }
465  else if (_timestep_limiting_functions[j])
466  {
467  const Real old_value = _timestep_limiting_functions[j]->value(_time_old);
468  Real new_value = _timestep_limiting_functions[j]->value(_time_old + limitedDT);
469  Real change = std::abs(new_value - old_value);
470 
471  if (_max_function_change > 0.0 && change > _max_function_change)
472  do
473  {
474  limitedDT /= 2.0;
475  new_value = _timestep_limiting_functions[j]->value(_time_old + limitedDT);
476  change = std::abs(new_value - old_value);
477  } while (change > _max_function_change);
478  }
479  }
480 
481  if (restricted_step < limitedDT)
482  limitedDT = std::max(_dt_min, restricted_step);
483 
484  _at_function_point = false;
486  for (unsigned int i = 0; i + 1 < _times.size(); ++i)
487  if (_time >= _times[i] && _time < _times[i + 1])
488  {
489  if (limitedDT > _times[i + 1] - _time - _timestep_tolerance)
490  {
491  limitedDT = _times[i + 1] - _time;
492  _at_function_point = true;
493  }
494  break;
495  }
496 
497  if (_verbose && limitedDT != orig_dt)
498  {
499  if (_at_function_point)
500  _console << "Limiting dt to match function point. dt = ";
501  else
502  _console << "Limiting dt to limit change in function. dt = ";
503 
504  _console << limitedDT << std::endl;
505  }
506 }
507 
508 void
509 IterationAdaptiveDT::computeAdaptiveDT(Real & dt, bool allowToGrow, bool allowToShrink)
510 {
511  const unsigned int growth_outer_its(
513  const unsigned int shrink_outer_its(_optimal_iterations + _iteration_window);
514  const unsigned int growth_l_its(_optimal_iterations > _iteration_window
517  : 0);
518  const unsigned int shrink_l_its(_linear_iteration_ratio *
520  const std::string ite_type = (_fe_problem.numLinearSystems() == 0) ? "nl" : "solver";
521 
522  if (allowToGrow && (_outer_its < growth_outer_its && _l_its < growth_l_its))
523  {
524  // Grow the timestep
525  dt *= _growth_factor;
526 
527  if (_verbose)
528  _console << "Growing dt: " + ite_type + " its = " << _outer_its << " < " << growth_outer_its
529  << " && lin its = " << _l_its << " < " << growth_l_its << " old dt: " << std::setw(9)
530  << _dt_old << " new dt: " << std::setw(9) << dt << '\n';
531  }
532  else if (allowToShrink && (_outer_its > shrink_outer_its || _l_its > shrink_l_its))
533  {
534  // Shrink the timestep
535  dt *= _cutback_factor;
536 
537  if (_verbose)
538  _console << "Shrinking dt: " + ite_type + " its = " << _outer_its << " > " << shrink_outer_its
539  << " || lin its = " << _l_its << " > " << shrink_l_its << " old dt: " << std::setw(9)
540  << _dt_old << " new dt: " << std::setw(9) << dt << '\n';
541  }
542 
543  _console << std::flush;
544 }
545 
546 Real
548 {
550 
551  if (dt > _dt_old * _growth_factor)
552  {
553  dt = _dt_old * _growth_factor;
554 
555  if (_verbose)
556  _console << "Growing dt to recover from cutback. "
557  << " old dt: " << std::setw(9) << _dt_old << " new dt: " << std::setw(9) << dt
558  << std::endl;
559  }
560 
561  return dt;
562 }
563 
564 void
566 {
568 }
569 
570 void
572 {
574 
575  _tfunc_last_step = false;
576  while (!_tfunc_times.empty() && _time + _timestep_tolerance >= *_tfunc_times.begin())
577  {
578  if (std::abs(_time - *_tfunc_times.begin()) <= _timestep_tolerance)
579  _tfunc_last_step = true;
580 
581  _tfunc_times.erase(_tfunc_times.begin());
582  }
583 
584  // Reset counts
585  _outer_its = 0;
586  _l_its = 0;
587 
588  // Use the total number of iterations for multi-system
589  for (const auto i : make_range(_fe_problem.numNonlinearSystems()))
591  // Add linear iterations for both nonlinear and linear systems for multi-system
592  for (const auto i : make_range(_fe_problem.numNonlinearSystems()))
594  for (const auto i : make_range(_fe_problem.numLinearSystems()))
595  {
598  }
599 
602  {
604  _sync_last_step = true;
605 
606  if (_verbose)
607  _console << "Sync point hit in current step, using previous dt for old dt: " << std::setw(9)
608  << _dt_old << std::endl;
609  }
610  else
611  _dt_old = _dt;
612 }
std::optional< Real > _dt_from_reject
Timestep used to reject a timestep, used to constrain the next attempt.
TransientBase & _executioner
Reference to transient executioner.
Definition: TimeStepper.h:122
static InputParameters validParams()
Definition: TimeStepper.C:16
Real & _timestep_tolerance
Definition: TimeStepper.h:134
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:42
unsigned int nLinearIterations() const
Return the number of linear iterations.
Function base which provides a piecewise approximation to a specified (x,y) point data set...
Definition: PiecewiseBase.h:20
virtual Real & dtOld() const
virtual std::size_t numNonlinearSystems() const override
const Real & _cutback_factor
cut the timestep by by this factor
bool atSyncPoint()
Is the current step at a sync point (sync times, time interval, target time, etc)?
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
std::vector< const Function * > _timestep_limiting_functions
std::vector< const PostprocessorValue * > _pps_value
if specified, the postprocessor values used to determine an upper limit for the time step length ...
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1155
Real & _time_old
Definition: TimeStepper.h:126
virtual Real computeDT() override
Computes time step size after the initial time step.
Adjust the timestep based on the number of iterations.
Base class for time stepping.
Definition: TimeStepper.h:22
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
T sample(const T &x) const
This function will take an independent variable input and will return the dependent variable based on...
const Real _input_dt
The dt from the input file.
Function which provides a piecewise continuous linear interpolation of a provided (x...
virtual Real computeInitialDT() override
Computes time step size for the initial time step.
IterationAdaptiveDT(const InputParameters &parameters)
virtual bool constrainStep(Real &dt)
Called after computeStep() is called.
Definition: TimeStepper.C:102
bool _reject_large_step
Indicates whether we need to reject a time step much larger than its ideal size.
void limitDTByFunction(Real &limitedDT)
virtual bool constrainStep(Real &dt) override
Called after computeStep() is called.
virtual bool converged() const
If the time step converged.
Definition: TimeStepper.C:197
unsigned int nLinearIterations() const
Return the number of linear iterations.
Definition: LinearSystem.h:105
std::vector< const PiecewiseLinear * > _piecewise_linear_timestep_limiting_functions
const Real _cutback_factor_at_failure
Cutback factor if a time step fails to converge.
Definition: TimeStepper.h:143
const Real & _growth_factor
grow the timestep by this factor
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
int _optimal_iterations
Adapt the timestep to maintain this non-linear iteration count...
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
auto max(const L &left, const R &right)
virtual Real computeFailedDT() override
Computes time step size after a failed time step.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
const bool _force_step_every_function_point
insert sync points at the time nodes of the _piecewise_timestep_limiting_function ...
const bool & _verbose
whether a detailed diagnostic output should be printed
Definition: TimeStepper.h:137
FEProblemBase & _fe_problem
Definition: TimeStepper.h:120
virtual Function & getFunction(const std::string &name, const THREAD_ID tid=0)
const bool _use_time_ipol
true if we want to use piecewise-defined time stepping
std::vector< const PiecewiseBase * > _piecewise_timestep_limiting_functions
unsigned int & _l_its
Number of linear iterations in previous solve.
static InputParameters validParams()
virtual void preExecute() override
virtual void acceptStep()
This gets called when time step is accepted.
Definition: TimeStepper.C:175
LinearInterpolation _time_ipol
PiecewiseBase linear definition of time stepping.
const Real _post_function_sync_dt
Set timestep size if previous timestep is synced with function.
Real unconstrainedDT()
Get the unconstrained dt.
virtual void rejectStep() override
This gets called when time step is rejected.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
std::set< Real > _tfunc_times
bool _adaptive_timestepping
adaptive timestepping is active if the optimal_iterations input parameter is specified ...
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
void limitDTToPostprocessorValue(Real &limitedDT) const
LinearSystem & getLinearSystem(unsigned int sys_num)
Get non-constant reference to a linear system.
virtual bool converged() const override
If the time step converged.
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
Retrieve the value of the Postprocessor.
virtual void init() override
Initialize the time stepper.
void computeAdaptiveDT(Real &dt, bool allowToGrow=true, bool allowToShrink=true)
unsigned int nNonlinearIterations() const
Return the number of non-linear iterations.
const int _linear_iteration_ratio
use _optimal_iterations and _iteration_window multiplied with this factor for linear iterations ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< Real > _times
time point defined in the piecewise function
registerMooseObject("MooseApp", IterationAdaptiveDT)
int _iteration_window
...plus/minus this value.
unsigned int & _outer_its
Number of outer solver iterations in previous solve.
virtual void preExecute()
Definition: TimeStepper.C:70
virtual void rejectStep()
This gets called when time step is rejected.
Definition: TimeStepper.C:185
IntRange< T > make_range(T beg, T end)
Real & _dt_min
Definition: TimeStepper.h:129
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
const InputParameters & parameters() const
Get the parameters of the object.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
int & _t_step
Definition: TimeStepper.h:127
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
double _large_step_rejection_threshold
Threshold used to detect whether we need to reject a step.
virtual std::size_t numLinearSystems() const override
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
auto min(const L &left, const R &right)
Real & _dt
Definition: TimeStepper.h:128
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
void ErrorVector unsigned int
Real & _time
Values from executioner.
Definition: TimeStepper.h:125
Interface class for classes which interact with Postprocessors.
virtual void acceptStep() override
This gets called when time step is accepted.