|
SpECTRE
2021.08.02
|
Suggests a step size based on a target absolute and/or relative error measure. More...
#include <ErrorControl.hpp>
Classes | |
| struct | AbsoluteTolerance |
| struct | MaxFactor |
| struct | MinFactor |
| struct | RelativeTolerance |
| struct | SafetyFactor |
Public Types | |
| using | evolved_variable_type = typename EvolvedVariableTag::type |
| using | error_variable_type = typename db::add_tag_prefix<::Tags::StepperError, EvolvedVariableTag >::type |
| using | options = tmpl::list< AbsoluteTolerance, RelativeTolerance, MaxFactor, MinFactor, SafetyFactor > |
| using | argument_tags = tmpl::list<::Tags::HistoryEvolvedVariables< EvolvedVariableTag >, db::add_tag_prefix<::Tags::StepperError, EvolvedVariableTag >, ::Tags::StepperErrorUpdated, ::Tags::TimeStepper<> > |
| using | return_tags = tmpl::list< Tags::PreviousStepError< EvolvedVariableTag > > |
| using | simple_tags = tmpl::list< Tags::PreviousStepError< EvolvedVariableTag > > |
Public Member Functions | |
| ErrorControl (const double absolute_tolerance, const double relative_tolerance, const double max_factor, const double min_factor, const double safety_factor) noexcept | |
| template<typename Metavariables , typename History , typename TimeStepper > | |
| std::pair< double, bool > | operator() (const gsl::not_null< std::optional< double > * > previous_step_error, const History &history, const error_variable_type &error, const bool &stepper_error_updated, const TimeStepper &stepper, const double previous_step, const Parallel::GlobalCache< Metavariables > &) const noexcept |
| void | pup (PUP::er &p) noexcept override |
Public Member Functions inherited from StepChooser< StepChooserUse::LtsStep > | |
| WRAPPED_PUPable_abstract (StepChooser) | |
| template<typename Metavariables , typename DbTags > | |
| std::pair< double, bool > | desired_step (const gsl::not_null< db::DataBox< DbTags > * > box, const double last_step_magnitude, const Parallel::GlobalCache< Metavariables > &cache) const noexcept |
The last_step_magnitude parameter describes the step size to be adjusted. It may be the step size or the slab size, or may be infinite if the appropriate size cannot be determined. More... | |
Static Public Member Functions | |
| static std::string | name () noexcept |
Static Public Attributes | |
| static constexpr Options::String | help |
Suggests a step size based on a target absolute and/or relative error measure.
The suggested step is calculated via a simple specialization of the scheme suggested in [52]. We first compute the aggregated error measure from the stepper error:
\[ E = \max_i(|E_i| / sc_i), \]
where \(E_i\) is the ODE error reported for each individual grid point, reported by the time stepper, and \(sc_i\) is the step control measure determined by the tolerances:
\[ sc_i = Atol_i + \max(|y_i|,|y_i + E_i|) Rtol_i, \]
and \(y_i\) is the value of the function at the current step at grid point \(i\).
When no previous record of previous error is available, the step has size:
\[ h_{\text{new}} = h \cdot \min\left(F_{\text{max}}, \max\left(F_{\text{min}}, \frac{F_{\text{safety}}}{E^{1/(q + 1)}}\right)\right), \]
where \(h_{\text{new}}\) is the new suggested step size \(h\) is the previous step size, \(F_{\text{max}}\) is the maximum factor by which we allow the step to increase, \(F_{\text{min}}\) is the minimum factor by which we allow the step to decrease. \(F_{\text{safety}}\) is the safety factor on the computed error – this forces the step size slightly lower than we would naively compute so that the result of the step will likely be within the target error. \(q\) is the order of the stepper error calculation. Intuitively, we should change the step less drastically for a higher order stepper.
After the first error calculation, the error \(E\) is recorded in the DataBox using tag StepChoosers::Tags::PreviousStepError<EvolvedVariablesTag>, and subsequent error calculations use a simple PI scheme suggested in [90] section 17.2.1:
\[ h_{\text{new}} = h \cdot \min\left(F_{\text{max}}, \max\left(F_{\text{min}}, \frac{F_{\text{safety}}}{E^{0.7 / (q + 1)} E_{\text{prev}}^{0.4 / (q + 1)}}\right)\right), \]
where \(E_{\text{prev}}\) is the error computed in the previous step.
ErrorControlSelector is used to disambiguate in the input-file options between ErrorControl step choosers that are based on different variables. This is needed if multiple systems are evolved in the same executable. The name used for the input file includes ErrorControlSelector::name() if it is provided.
|
staticconstexpr |