https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
15
16class Function;
17class PiecewiseBase;
18class PiecewiseLinear;
19
33{
34public:
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
47protected:
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
58 Real & _dt_old;
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
99 const Real & _growth_factor;
101 const Real & _cutback_factor;
102
107 unsigned int & _outer_its;
108 // Compatibility with SAM
109 unsigned int & _nl_its;
111 unsigned int & _l_its;
112
115
121 mutable std::optional<Real> _dt_from_reject;
122};
Base class for function objects.
Definition Function.h:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Adjust the timestep based on the number of iterations.
const int _linear_iteration_ratio
use _optimal_iterations and _iteration_window multiplied with this factor for linear iterations
std::vector< const Function * > _timestep_limiting_functions
const Real & _growth_factor
grow the timestep by this factor
std::vector< const PiecewiseBase * > _piecewise_timestep_limiting_functions
std::optional< Real > _dt_from_reject
Timestep used to reject a timestep, used to constrain the next attempt.
unsigned int & _outer_its
Number of outer solver iterations in previous solve.
const Real & _cutback_factor
cut the timestep by by this factor
virtual void preExecute() override
const Real _input_dt
The dt from the input file.
virtual Real computeDT() override
Computes time step size after the initial time step.
virtual Real computeFailedDT() override
Computes time step size after a failed time step.
virtual bool constrainStep(Real &dt) override
Called after computeStep() is called.
virtual bool converged() const override
If the time step converged.
LinearInterpolation _time_ipol
PiecewiseBase linear definition of time stepping.
std::vector< Real > _times
time point defined in the piecewise function
unsigned int & _l_its
Number of linear iterations in previous solve.
void computeAdaptiveDT(Real &dt, bool allowToGrow=true, bool allowToShrink=true)
const bool _force_step_every_function_point
insert sync points at the time nodes of the _piecewise_timestep_limiting_function
double _large_step_rejection_threshold
Threshold used to detect whether we need to reject a step.
std::set< Real > _tfunc_times
virtual void init() override
Initialize the time stepper.
int _iteration_window
...plus/minus this value.
std::vector< const PostprocessorValue * > _pps_value
if specified, the postprocessor values used to determine an upper limit for the time step length
void limitDTByFunction(Real &limitedDT)
std::vector< const PiecewiseLinear * > _piecewise_linear_timestep_limiting_functions
void limitDTToPostprocessorValue(Real &limitedDT) const
virtual void acceptStep() override
This gets called when time step is accepted.
bool _adaptive_timestepping
adaptive timestepping is active if the optimal_iterations input parameter is specified
static InputParameters validParams()
const bool _use_time_ipol
true if we want to use piecewise-defined time stepping
virtual Real computeInitialDT() override
Computes time step size for the initial time step.
const Real _post_function_sync_dt
Set timestep size if previous timestep is synced with function.
int _optimal_iterations
Adapt the timestep to maintain this non-linear iteration count...
virtual void rejectStep() override
This gets called when time step is rejected.
bool _reject_large_step
Indicates whether we need to reject a time step much larger than its ideal size.
This class interpolates values given a set of data pairs and an abscissa.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Function base which provides a piecewise approximation to a specified (x,y) point data set.
Function which provides a piecewise continuous linear interpolation of a provided (x,...
Interface class for classes which interact with Postprocessors.
Base class for time stepping.
Definition TimeStepper.h:23