https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
16class FEProblemBase;
17class TransientBase;
18
23{
24public:
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
85 Real getCurrentDT() { return _current_dt; }
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
107
108protected:
112 virtual Real computeInitialDT() = 0;
113
117 virtual Real computeDT() = 0;
118
122 virtual Real computeFailedDT();
123
127
129 Real & _time;
130 Real & _time_old;
131 int & _t_step;
132 Real & _dt;
133 Real & _dt_min;
134 Real & _dt_max;
135 Real & _end_time;
136 std::set<Real> & _sync_times;
137
139
141 const bool & _verbose;
142
145
148
151
154
157
159 unsigned int _failure_count;
160
161private:
164};
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
A class for creating restricted objects.
Definition Restartable.h:29
Interface for objects that needs scalar coupling capabilities.
Base class for time stepping.
Definition TimeStepper.h:23
virtual Real computeDT()=0
Computes time step size after the initial time step.
virtual Real computeFailedDT()
Computes time step size after a failed time step.
const bool & _verbose
whether a detailed diagnostic output should be printed
virtual void postSolve()
Definition TimeStepper.h:37
virtual Real computeInitialDT()=0
Computes time step size for the initial time step.
virtual bool converged() const
If the time step converged.
virtual void init()
Initialize the time stepper.
Definition TimeStepper.C:66
virtual ~TimeStepper()
Definition TimeStepper.C:63
virtual void postExecute()
Definition TimeStepper.h:38
unsigned int _failure_count
Cumulative amount of steps that have failed.
bool justFailedTimeStep() const
Whether we are currently solving a failed time step Note: you should first try to use the restartable...
Real & _current_dt
Size of the current time step as computed by the Stepper. Note that the actual dt that was taken migh...
FEProblemBase & _fe_problem
Real & _dt_max
virtual void rejectStep()
This gets called when time step is rejected.
unsigned int numFailures() const
Gets the number of failures and returns them.
virtual void postStep()
Definition TimeStepper.h:40
bool _converged
Whether or not the previous solve converged.
bool _reset_dt
If true then the next dt will be computed by computeInitialDT()
static InputParameters validParams()
Definition TimeStepper.C:16
virtual void acceptStep()
This gets called when time step is accepted.
virtual void preExecute()
Definition TimeStepper.C:71
virtual void preSolve()
Definition TimeStepper.h:36
bool _currently_restepping
If we are currently solving a failed step.
TransientBase & _executioner
Reference to transient executioner.
Real & _end_time
void addSyncTime(const std::set< Real > &times)
virtual void preStep()
Definition TimeStepper.h:39
Real & _timestep_tolerance
Real & _dt_min
std::set< Real > & _sync_times
virtual void forceNumSteps(const unsigned int num_steps)
Set the number of time steps.
Real & _time_old
virtual void forceTimeStep(Real dt)
bool _has_reset_dt
True if dt has been reset.
virtual void step()
Take a time step.
void computeStep()
Called before a new step is started.
Definition TimeStepper.C:79
void addSyncTime(Real sync_time)
Add a sync time.
virtual bool constrainStep(Real &dt)
Called after computeStep() is called.
const Real _cutback_factor_at_failure
Cutback factor if a time step fails to converge.
Real getCurrentDT()
Get the current_dt.
Definition TimeStepper.h:85
Real & _time
Values from executioner.
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...