www.mooseframework.org
IterationAdaptiveDT.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 #ifndef ITERATIONADAPTIVEDT_H
15 #define ITERATIONADAPTIVEDT_H
16 
17 #include "TimeStepper.h"
18 #include "LinearInterpolation.h"
19 #include "PostprocessorInterface.h"
20 
21 class Function;
22 class Piecewise;
23 
37 {
38 public:
40 
41  virtual void init() override;
42  virtual void preExecute() override;
43 
44  virtual void rejectStep() override;
45  virtual void acceptStep() override;
46 
47  virtual bool constrainStep(Real & dt) override;
48 
49 protected:
50  virtual Real computeInitialDT() override;
51  virtual Real computeDT() override;
52  virtual Real computeFailedDT() override;
53 
54  void computeAdaptiveDT(Real & dt, bool allowToGrow = true, bool allowToShrink = true);
56  void limitDTByFunction(Real & limitedDT);
57  void limitDTToPostprocessorValue(Real & limitedDT);
58 
59  Real & _dt_old;
60 
62  const Real _input_dt;
63 
66 
75 
78 
82  std::vector<Real> _times;
83 
87 
88  std::set<Real> _tfunc_times;
89 
93  const bool _use_time_ipol;
94 
96  const Real _growth_factor;
98  const Real _cutback_factor;
99 
101  unsigned int & _nl_its;
103  unsigned int & _l_its;
104 
107 };
108 
109 template <>
111 
112 #endif /* ITERATIONADAPTIVEDT_H */
Base class for function objects.
Definition: Function.h:46
This class interpolates values given a set of data pairs and an abscissa.
unsigned int & _nl_its
Number of nonlinear iterations in previous solve.
Piecewise * _piecewise_timestep_limiting_function
virtual Real computeDT() override
Called to compute _current_dt for a normal step.
Adjust the timestep based on the number of iterations.
InputParameters validParams< IterationAdaptiveDT >()
Base class for time stepping.
Definition: TimeStepper.h:31
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Real _input_dt
The dt from the input file.
virtual Real computeInitialDT() override
Called to compute _current_dt for the first timestep.
IterationAdaptiveDT(const InputParameters &parameters)
void limitDTByFunction(Real &limitedDT)
virtual bool constrainStep(Real &dt) override
Called after computeStep() is called.
int _optimal_iterations
Adapt the timestep to maintain this non-linear iteration count...
virtual Real computeFailedDT() override
Called to compute _current_dt after a solve has failed.
const bool _use_time_ipol
true if we want to use piecewise-defined time stepping
unsigned int & _l_its
Number of linear iterations in previous solve.
virtual void preExecute() override
Function * _timestep_limiting_function
LinearInterpolation _time_ipol
Piecewise linear definition of time stepping.
const PostprocessorValue * _pps_value
if specified, the postprocessor value is an upper limit for the time step length
Real PostprocessorValue
MOOSE typedefs.
Definition: MooseTypes.h:73
virtual void rejectStep() override
This gets called when time step is rejected.
std::set< Real > _tfunc_times
bool _adaptive_timestepping
adaptive timestepping is active if the optimal_iterations input parameter is specified ...
virtual void init() override
Initialize the time stepper.
void computeAdaptiveDT(Real &dt, bool allowToGrow=true, bool allowToShrink=true)
const int _linear_iteration_ratio
use _optimal_iterations and _iteration_window multiplied with this factor for linear iterations ...
const Real _growth_factor
grow the timestep by this factor
bool _force_step_every_function_point
insert sync points at the time nodes of the _piecewise_timestep_limiting_function ...
std::vector< Real > _times
time point defined in the piecewise function
const Real _cutback_factor
cut the timestep by by this factor
int _iteration_window
...plus/minus this value.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
Function which provides a piecewise approximation to a provided (x,y) point data set.
Definition: Piecewise.h:31
Interface class for classes which interact with Postprocessors.
void limitDTToPostprocessorValue(Real &limitedDT)
virtual void acceptStep() override
This gets called when time step is accepted.