www.mooseframework.org
Transient.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 
15 #ifndef TRANSIENT_H
16 #define TRANSIENT_H
17 
18 #include "Executioner.h"
19 
20 // System includes
21 #include <string>
22 #include <fstream>
23 
24 // Forward Declarations
25 class Transient;
26 class TimeStepper;
27 class FEProblemBase;
28 
29 template <>
31 
36 class Transient : public Executioner
37 {
38 public:
46 
47  virtual void init() override;
48 
49  virtual void execute() override;
50 
54  virtual void takeStep(Real input_dt = -1.0);
55 
59  virtual Real computeConstrainedDT();
60  virtual void estimateTimeError();
61 
65  virtual Real getDT();
66 
70  virtual bool keepGoing();
71 
75  virtual bool lastSolveConverged() override;
76 
77  virtual void preExecute() override;
78 
79  virtual void postExecute() override;
80 
81  virtual void computeDT();
82 
83  virtual void preStep();
84 
85  virtual void postStep();
86 
90  virtual void incrementStepOrReject();
91 
92  virtual void endStep(Real input_time = -1.0);
93 
98  virtual void setTargetTime(Real target_time);
99 
103  virtual Real getTime() { return _time; };
104 
108  virtual void setTime(Real t) { _time = t; };
109 
113  virtual void setTimeOld(Real t) { _time_old = t; };
114 
118  Real getSolutionChangeNorm();
119 
125 
131  void setTimeStepper(std::shared_ptr<TimeStepper> ts) { _time_stepper = ts; }
132 
136  virtual std::string getTimeStepperName() override;
137 
143 
148  std::set<Real> & syncTimes() { return _sync_times; }
149 
154  Real & dtMax() { return _dtmax; }
155 
160  Real & dtMin() { return _dtmin; }
161 
166  Real getStartTime() { return _start_time; }
167 
172  Real & endTime() { return _end_time; }
173 
178  Real & timestepTol() { return _timestep_tolerance; }
179 
184  bool & verbose() { return _verbose; }
185 
190  bool atSyncPoint() { return _at_sync_point; }
191 
197 
199 
204  // Because this returns the number of Picard iterations, rather than the current
205  // iteration count (which starts at 0), increment by 1.
206  Real numPicardIts() { return _picard_it + 1; }
207 
211  virtual Real relativeSolutionDifferenceNorm();
212 
213 protected:
217  virtual void solveStep(Real input_dt = -1.0);
218 
221 
223  std::shared_ptr<TimeStepper> _time_stepper;
224 
226  int & _t_step;
228  Real & _time;
230  Real & _time_old;
232  Real & _dt;
233  Real & _dt_old;
234 
237 
239  bool & _first;
240 
243 
246 
249  unsigned int _xfem_update_count;
250  unsigned int _max_xfem_update;
251 
252  Real _end_time;
253  Real _dtmin;
254  Real _dtmax;
255  unsigned int _num_steps;
257  unsigned int _steps_taken;
258 
264  Real _ss_tmin;
267 
268  std::set<Real> & _sync_times;
269 
270  bool _abort;
271 
276 
279  Real & _target_time;
281 
285  int & _picard_it;
294 
296  bool _verbose;
297 
299 
301  NumericVector<Number> & _sln_diff;
302 
303  void setupTimeIntegrator();
304 
307 
312 
314  std::vector<std::string> _relaxed_vars;
315 
317  std::set<dof_id_type> _relaxed_dofs;
318 };
319 
320 #endif // TRANSIENTEXECUTIONER_H
Moose::TimeIntegratorType _time_scheme
Definition: Transient.h:222
virtual Real getDT()
Definition: Transient.C:694
bool atSyncPoint()
Is the current step at a sync point (sync times, time interval, target time, etc)?
Definition: Transient.h:190
Real _dtmax
Definition: Transient.h:254
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:36
Real & _unconstrained_dt
Definition: Transient.h:235
virtual bool lastSolveConverged() override
Whether or not the last solve converged.
Definition: Transient.C:745
Real & dtMin()
Get the minimal dt.
Definition: Transient.h:160
Real _picard_abs_tol
Definition: Transient.h:293
bool & _picard_converged
Definition: Transient.h:288
virtual void setTargetTime(Real target_time)
Can be used to set the next "target time" which is a time to nail perfectly.
Definition: Transient.C:763
Real _prev_time
The _time when this app solved last.
Definition: Transient.h:311
virtual void computeDT()
Definition: Transient.C:347
Real _picard_max_its
Definition: Transient.h:287
Real & _picard_initial_norm
Definition: Transient.h:289
void parentOutputPositionChanged()
Calls parentOutputPositionChanged() on all sub apps.
FEProblemBase & _problem
Here for backward compatibility.
Definition: Transient.h:220
int _n_startup_steps
Definition: Transient.h:256
virtual void init() override
Initialize the executioner.
Definition: Transient.C:236
virtual void setTimeOld(Real t)
Set the old time.
Definition: Transient.h:113
Base class for time stepping.
Definition: TimeStepper.h:31
virtual void execute() override
Pure virtual execute function MUST be overridden by children classes.
Definition: Transient.C:298
virtual void endStep(Real input_time=-1.0)
Definition: Transient.C:586
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void postExecute() override
Override this for actions that should take place after execution.
Definition: Transient.C:757
bool & _multiapps_converged
Whether or not the multiapps failed during the last timestem.
Definition: Transient.h:242
virtual void setTime(Real t)
Set the current time.
Definition: Transient.h:108
unsigned int _steps_taken
Definition: Transient.h:257
Real & _picard_timestep_end_norm
Definition: Transient.h:291
Real _relax_factor
Relaxation factor for Picard Iteration.
Definition: Transient.h:306
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
bool _xfem_repeat_step
Whether step should be repeated due to xfem modifying the mesh.
Definition: Transient.h:248
virtual Real getTime()
Get the current time.
Definition: Transient.h:103
unsigned int _xfem_update_count
Definition: Transient.h:249
Real _dtmin
Definition: Transient.h:253
Real & _time_old
Previous time.
Definition: Transient.h:230
bool & _time_interval
if to use time interval output
Definition: Transient.h:273
Real unconstrainedDT()
Get the unconstrained dt.
Definition: Transient.h:196
std::shared_ptr< TimeStepper > _time_stepper
Definition: Transient.h:223
virtual void solveStep(Real input_dt=-1.0)
This should execute the solve for one timestep.
Definition: Transient.C:421
InputParameters validParams< Transient >()
Definition: Transient.C:44
virtual void takeStep(Real input_dt=-1.0)
Do whatever is necessary to advance one step.
Definition: Transient.C:392
Transient(const InputParameters &parameters)
Constructor.
Definition: Transient.C:143
std::set< Real > & _sync_times
Definition: Transient.h:268
unsigned int _num_steps
Definition: Transient.h:255
virtual Real computeConstrainedDT()
Definition: Transient.C:613
TimeStepper * getTimeStepper()
Pointer to the TimeStepper.
Definition: Transient.h:124
Real getStartTime()
Return the start time.
Definition: Transient.h:166
std::vector< std::string > _relaxed_vars
The transferred variables that are going to be relaxed.
Definition: Transient.h:314
int & _picard_it
Picard Related.
Definition: Transient.h:286
bool _use_multiapp_dt
Definition: Transient.h:280
bool _verbose
should detailed diagnostic output be printed
Definition: Transient.h:296
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:41
Real & _target_time
Definition: Transient.h:279
bool & _first
Is it our first time through the execution loop?
Definition: Transient.h:239
void setupTimeIntegrator()
Definition: Transient.C:775
Real _start_time
Definition: Transient.h:277
virtual void incrementStepOrReject()
This is where the solve step is actually incremented.
Definition: Transient.C:353
std::set< dof_id_type > _relaxed_dofs
The DoFs associates with all of the relaxed variables.
Definition: Transient.h:317
virtual void estimateTimeError()
Definition: Transient.C:740
Real & _sln_diff_norm
Definition: Transient.h:265
Real _timestep_tolerance
Definition: Transient.h:278
bool _trans_ss_check
Steady state detection variables:
Definition: Transient.h:262
bool _abort
Definition: Transient.h:270
Real & _dt
Current delta t... or timestep size.
Definition: Transient.h:232
unsigned int _max_xfem_update
Definition: Transient.h:250
Real & _dt_old
Definition: Transient.h:233
void parentOutputPositionChanged() override
Can be used by subsclasses to call parentOutputPositionChanged() on the underlying FEProblemBase...
Definition: Transient.h:198
virtual void preExecute() override
Override this for actions that should take place before execution.
Definition: Transient.C:751
Real _time_interval_output_interval
Definition: Transient.h:275
NumericVector< Number > & _sln_diff
The difference of current and old solutions.
Definition: Transient.h:301
Real & _picard_timestep_begin_norm
Definition: Transient.h:290
bool & _at_sync_point
Definition: Transient.h:236
Real & _time
Current time.
Definition: Transient.h:228
Real _solution_change_norm
Definition: Transient.h:298
Moose::TimeIntegratorType getTimeScheme()
Get the time scheme used.
Definition: Transient.h:142
Real & endTime()
Get the end time.
Definition: Transient.h:172
Real _ss_tmin
Definition: Transient.h:264
Real & timestepTol()
Get the timestep tolerance.
Definition: Transient.h:178
void setTimeStepper(std::shared_ptr< TimeStepper > ts)
Set the timestepper to use.
Definition: Transient.h:131
std::set< Real > & syncTimes()
Get the set of sync times.
Definition: Transient.h:148
Real _picard_rel_tol
Definition: Transient.h:292
bool & verbose()
Get the verbose output flag.
Definition: Transient.h:184
virtual Real relativeSolutionDifferenceNorm()
The relative L2 norm of the difference between solution and old solution vector.
Definition: Transient.C:833
Real & _old_time_solution_norm
Definition: Transient.h:266
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
TimeIntegratorType
Time integrators.
Definition: MooseTypes.h:304
virtual void preStep()
Definition: Transient.C:286
virtual bool keepGoing()
Transient loop will continue as long as this keeps returning true.
Definition: Transient.C:700
Real & dtMax()
Get the maximum dt.
Definition: Transient.h:154
Real _end_time
Definition: Transient.h:252
virtual void postStep()
Definition: Transient.C:292
Real numPicardIts()
Get the number of Picard iterations performed.
Definition: Transient.h:206
Real _next_interval_output_time
Definition: Transient.h:274
int & _t_step
Current timestep.
Definition: Transient.h:226
virtual std::string getTimeStepperName() override
Get the timestepper.
Definition: Transient.C:821
Real getSolutionChangeNorm()
Get the Relative L2 norm of the change in the solution.
Definition: Transient.C:769
Real _ss_check_tol
Definition: Transient.h:263
bool & _last_solve_converged
Whether or not the last solve converged.
Definition: Transient.h:245
FEProblemBase & _fe_problem
Definition: Executioner.h:126