Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
IterationAdaptiveDT.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 "TimeStepper.h"
13 #include "LinearInterpolation.h"
14 #include "PostprocessorInterface.h"
15 
16 class Function;
17 class PiecewiseBase;
18 class PiecewiseLinear;
19 
33 {
34 public:
36 
38 
39  virtual void init() override;
40  virtual void preExecute() override;
41 
42  virtual void rejectStep() override;
43  virtual void acceptStep() override;
44 
45  virtual bool constrainStep(Real & dt) override;
46 
47 protected:
48  virtual Real computeInitialDT() override;
49  virtual Real computeDT() override;
50  virtual Real computeFailedDT() override;
51  virtual bool converged() const override;
52 
53  void computeAdaptiveDT(Real & dt, bool allowToGrow = true, bool allowToShrink = true);
55  void limitDTByFunction(Real & limitedDT);
56  void limitDTToPostprocessorValue(Real & limitedDT) const;
57 
59 
61  const Real _input_dt;
62 
65 
74 
76  std::vector<const PostprocessorValue *> _pps_value;
77 
78  std::vector<const Function *> _timestep_limiting_functions;
79  std::vector<const PiecewiseBase *> _piecewise_timestep_limiting_functions;
80  std::vector<const PiecewiseLinear *> _piecewise_linear_timestep_limiting_functions;
81 
83  std::vector<Real> _times;
84 
90 
91  std::set<Real> _tfunc_times;
92 
96  const bool _use_time_ipol;
97 
102 
104  unsigned int & _nl_its;
106  unsigned int & _l_its;
107 
110 
116  mutable std::optional<Real> _dt_from_reject;
117 };
std::optional< Real > _dt_from_reject
Timestep used to reject a timestep, used to constrain the next attempt.
Function base which provides a piecewise approximation to a specified (x,y) point data set...
Definition: PiecewiseBase.h:20
Base class for function objects.
Definition: Function.h:36
This class interpolates values given a set of data pairs and an abscissa.
const Real & _cutback_factor
cut the timestep by by this factor
unsigned int & _nl_its
Number of nonlinear iterations in previous solve.
std::vector< const Function * > _timestep_limiting_functions
std::vector< const PostprocessorValue * > _pps_value
if specified, the postprocessor values used to determine an upper limit for the time step length ...
virtual Real computeDT() override
Computes time step size after the initial time step.
Adjust the timestep based on the number of iterations.
Base class for time stepping.
Definition: TimeStepper.h:22
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.
Function which provides a piecewise continuous linear interpolation of a provided (x...
virtual Real computeInitialDT() override
Computes time step size for the initial time step.
IterationAdaptiveDT(const InputParameters &parameters)
bool _reject_large_step
Indicates whether we need to reject a time step much larger than its ideal size.
void limitDTByFunction(Real &limitedDT)
virtual bool constrainStep(Real &dt) override
Called after computeStep() is called.
std::vector< const PiecewiseLinear * > _piecewise_linear_timestep_limiting_functions
const Real & _growth_factor
grow the timestep by this factor
int _optimal_iterations
Adapt the timestep to maintain this non-linear iteration count...
virtual Real computeFailedDT() override
Computes time step size after a failed time step.
const bool _force_step_every_function_point
insert sync points at the time nodes of the _piecewise_timestep_limiting_function ...
const bool _use_time_ipol
true if we want to use piecewise-defined time stepping
std::vector< const PiecewiseBase * > _piecewise_timestep_limiting_functions
unsigned int & _l_its
Number of linear iterations in previous solve.
static InputParameters validParams()
virtual void preExecute() override
LinearInterpolation _time_ipol
PiecewiseBase linear definition of time stepping.
const Real _post_function_sync_dt
Set timestep size if previous timestep is synced with function.
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 ...
void limitDTToPostprocessorValue(Real &limitedDT) const
virtual bool converged() const override
If the time step converged.
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 ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< Real > _times
time point defined in the piecewise function
int _iteration_window
...plus/minus this value.
const InputParameters & parameters() const
Get the parameters of the object.
double _large_step_rejection_threshold
Threshold used to detect whether we need to reject a step.
Interface class for classes which interact with Postprocessors.
virtual void acceptStep() override
This gets called when time step is accepted.