www.mooseframework.org
TimeStepper.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
12 #include "MooseObject.h"
13 #include "Restartable.h"
14 #include "ScalarCoupleable.h"
15 
16 class TimeStepper;
17 class FEProblemBase;
18 class Transient;
19 
20 template <>
22 
26 class TimeStepper : public MooseObject, public Restartable, public ScalarCoupleable
27 {
28 public:
30  virtual ~TimeStepper();
31 
35  virtual void init();
36 
37  virtual void preExecute();
38  virtual void preSolve() {}
39  virtual void postSolve() {}
40  virtual void postExecute() {}
41  virtual void preStep() {}
42  virtual void postStep() {}
43 
52  void computeStep();
53 
58  virtual bool constrainStep(Real & dt);
59 
63  virtual void step();
64 
68  virtual void acceptStep();
69 
73  virtual void rejectStep();
74 
79  virtual bool converged() const;
80 
84  Real getCurrentDT() { return _current_dt; }
85 
86  virtual void forceTimeStep(Real dt);
87 
89 
93  void addSyncTime(Real sync_time);
94  void addSyncTime(const std::set<Real> & times);
96 
97 protected:
103  virtual Real computeInitialDT() = 0;
104 
110  virtual Real computeDT() = 0;
111 
117  virtual Real computeFailedDT();
118 
122 
124  Real & _time;
125  Real & _time_old;
126  int & _t_step;
127  Real & _dt;
128  Real & _dt_min;
129  Real & _dt_max;
130  Real & _end_time;
131  std::set<Real> & _sync_times;
132 
134 
136  bool & _verbose;
137 
140 
142  bool _reset_dt;
143 
146 
147 private:
149  Real & _current_dt;
150 };
151 
Real & _timestep_tolerance
Definition: TimeStepper.h:133
virtual ~TimeStepper()
Definition: TimeStepper.C:53
virtual Real computeInitialDT()=0
Called to compute _current_dt for the first timestep.
virtual Real computeFailedDT()
Called to compute _current_dt after a solve has failed.
Definition: TimeStepper.C:182
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:30
A class for creating restricted objects.
Definition: Restartable.h:29
void computeStep()
Called before a new step is started.
Definition: TimeStepper.C:69
virtual void preStep()
Definition: TimeStepper.h:41
Real & _time_old
Definition: TimeStepper.h:125
Base class for time stepping.
Definition: TimeStepper.h:26
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void preSolve()
Definition: TimeStepper.h:38
Transient & _executioner
Reference to transient executioner.
Definition: TimeStepper.h:121
virtual void postExecute()
Definition: TimeStepper.h:40
virtual bool constrainStep(Real &dt)
Called after computeStep() is called.
Definition: TimeStepper.C:90
virtual bool converged() const
If the time step converged.
Definition: TimeStepper.C:176
Real & _current_dt
Size of the current time step as computed by the Stepper. Note that the actual dt that was taken migh...
Definition: TimeStepper.h:149
void addSyncTime(Real sync_time)
Add a sync time.
std::set< Real > & _sync_times
Definition: TimeStepper.h:131
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
FEProblemBase & _fe_problem
Definition: TimeStepper.h:119
virtual void acceptStep()
This gets called when time step is accepted.
Definition: TimeStepper.C:160
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
virtual Real computeDT()=0
Called to compute _current_dt for a normal step.
TimeStepper(const InputParameters &parameters)
Definition: TimeStepper.C:28
bool _has_reset_dt
True if dt has been reset.
Definition: TimeStepper.h:145
virtual void forceTimeStep(Real dt)
Definition: TimeStepper.C:195
bool _converged
Whether or not the previous solve converged.
Definition: TimeStepper.h:139
InputParameters validParams< TimeStepper >()
Definition: TimeStepper.C:17
Real & _end_time
Definition: TimeStepper.h:130
virtual void preExecute()
Definition: TimeStepper.C:61
virtual void rejectStep()
This gets called when time step is rejected.
Definition: TimeStepper.C:170
Real & _dt_min
Definition: TimeStepper.h:128
Interface for objects that needs scalar coupling capabilities.
virtual void postSolve()
Definition: TimeStepper.h:39
virtual void step()
Take a time step.
Definition: TimeStepper.C:154
int & _t_step
Definition: TimeStepper.h:126
virtual void postStep()
Definition: TimeStepper.h:42
bool _reset_dt
If true then the next dt will be computed by computeInitialDT()
Definition: TimeStepper.h:142
Real & _dt_max
Definition: TimeStepper.h:129
virtual void init()
Initialize the time stepper.
Definition: TimeStepper.C:56
bool & _verbose
should detailed diagnostic output be printed
Definition: TimeStepper.h:136
Real & _dt
Definition: TimeStepper.h:127
Real getCurrentDT()
Get the current_dt.
Definition: TimeStepper.h:84
Real & _time
Values from executioner.
Definition: TimeStepper.h:124