https://mooseframework.inl.gov
TimeStepper.h
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 #pragma once
11 
12 #include "MooseObject.h"
13 #include "Restartable.h"
14 #include "ScalarCoupleable.h"
15 
16 class FEProblemBase;
17 class TransientBase;
18 
22 class TimeStepper : public MooseObject, public Restartable, public ScalarCoupleable
23 {
24 public:
26 
28  virtual ~TimeStepper();
29 
33  virtual void init();
34 
35  virtual void preExecute();
36  virtual void preSolve() {}
37  virtual void postSolve() {}
38  virtual void postExecute() {}
39  virtual void preStep() {}
40  virtual void postStep() {}
41 
50  void computeStep();
51 
56  virtual bool constrainStep(Real & dt);
57 
61  virtual void step();
62 
66  virtual void acceptStep();
67 
71  virtual void rejectStep();
72 
74  unsigned int numFailures() const;
75 
80  virtual bool converged() const;
81 
86 
87  virtual void forceTimeStep(Real dt);
88 
93  virtual void forceNumSteps(const unsigned int num_steps);
94 
96 
100  void addSyncTime(Real sync_time);
101  void addSyncTime(const std::set<Real> & times);
103 
104 protected:
108  virtual Real computeInitialDT() = 0;
109 
113  virtual Real computeDT() = 0;
114 
118  virtual Real computeFailedDT();
119 
123 
127  int & _t_step;
132  std::set<Real> & _sync_times;
133 
135 
137  const bool & _verbose;
138 
141 
144 
146  bool _reset_dt;
147 
150 
152  unsigned int _failure_count;
153 
154 private:
157 };
TransientBase & _executioner
Reference to transient executioner.
Definition: TimeStepper.h:122
static InputParameters validParams()
Definition: TimeStepper.C:16
Real & _timestep_tolerance
Definition: TimeStepper.h:134
virtual ~TimeStepper()
Definition: TimeStepper.C:62
virtual Real computeInitialDT()=0
Computes time step size for the initial time step.
virtual Real computeFailedDT()
Computes time step size after a failed time step.
Definition: TimeStepper.C:203
virtual void forceNumSteps(const unsigned int num_steps)
Set the number of time steps.
Definition: TimeStepper.C:222
A class for creating restricted objects.
Definition: Restartable.h:28
void computeStep()
Called before a new step is started.
Definition: TimeStepper.C:78
unsigned int numFailures() const
Gets the number of failures and returns them.
Definition: TimeStepper.C:191
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:127
virtual void preStep()
Definition: TimeStepper.h:39
Real & _time_old
Definition: TimeStepper.h:126
Base class for time stepping.
Definition: TimeStepper.h:22
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void preSolve()
Definition: TimeStepper.h:36
virtual void postExecute()
Definition: TimeStepper.h:38
virtual bool constrainStep(Real &dt)
Called after computeStep() is called.
Definition: TimeStepper.C:102
virtual bool converged() const
If the time step converged.
Definition: TimeStepper.C:197
const Real _cutback_factor_at_failure
Cutback factor if a time step fails to converge.
Definition: TimeStepper.h:143
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:156
void addSyncTime(Real sync_time)
Add a sync time.
std::set< Real > & _sync_times
Definition: TimeStepper.h:132
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const bool & _verbose
whether a detailed diagnostic output should be printed
Definition: TimeStepper.h:137
FEProblemBase & _fe_problem
Definition: TimeStepper.h:120
virtual void acceptStep()
This gets called when time step is accepted.
Definition: TimeStepper.C:175
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:27
virtual Real computeDT()=0
Computes time step size after the initial time step.
TimeStepper(const InputParameters &parameters)
Definition: TimeStepper.C:35
bool _has_reset_dt
True if dt has been reset.
Definition: TimeStepper.h:149
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
Definition: TransientBase.h:27
virtual void forceTimeStep(Real dt)
Definition: TimeStepper.C:216
bool _converged
Whether or not the previous solve converged.
Definition: TimeStepper.h:140
Real & _end_time
Definition: TimeStepper.h:131
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void preExecute()
Definition: TimeStepper.C:70
virtual void rejectStep()
This gets called when time step is rejected.
Definition: TimeStepper.C:185
Real & _dt_min
Definition: TimeStepper.h:129
Interface for objects that needs scalar coupling capabilities.
virtual void postSolve()
Definition: TimeStepper.h:37
virtual void step()
Take a time step.
Definition: TimeStepper.C:166
int & _t_step
Definition: TimeStepper.h:127
virtual void postStep()
Definition: TimeStepper.h:40
bool _reset_dt
If true then the next dt will be computed by computeInitialDT()
Definition: TimeStepper.h:146
unsigned int _failure_count
Cumulative amount of steps that have failed.
Definition: TimeStepper.h:152
Real & _dt_max
Definition: TimeStepper.h:130
virtual void init()
Initialize the time stepper.
Definition: TimeStepper.C:65
Real & _dt
Definition: TimeStepper.h:128
Real getCurrentDT()
Get the current_dt.
Definition: TimeStepper.h:85
Real & _time
Values from executioner.
Definition: TimeStepper.h:125