16#include "libmesh/enum_norm_type.h"
33 "method", method,
"The method used for pseudotimestep timemarching");
36 "alpha",
"alpha > 0",
"The parameter alpha used in the scaling of the timestep");
37 params.
addParam<Real>(
"max_dt",
"The largest timestep allowed");
40 "For how many iterations should the residual be tracked (only applies to the SER method)");
46 params.
addClassDescription(
"Computes pseudo-time steps for obtaining steady-state solutions "
47 "through a pseudo transient process.");
55 _initial_dt(getParam<Real>(
"initial_dt")),
56 _alpha(getParam<Real>(
"alpha")),
57 _bound(isParamValid(
"max_dt")),
58 _max_dt(_bound ? getParam<Real>(
"max_dt") :
std::numeric_limits<Real>::max()),
59 _residual_norms_sequence(declareRestartableData<
std::vector<Real>>(
"residual_norms_sequence")),
60 _iterations_step_sequence(declareRestartableData<
std::vector<Real>>(
"iterations_step_sequence"))
63 mooseError(
"This pseudotimestepper can only be used if the steady state is computed via time "
74 mooseError(
"The iterations window can be only provided for the SER method.");
81 _dt = std::numeric_limits<Real>::max();
95 for (
const auto var_num : make_range(nl.
system().
n_vars()))
99 res_norm = res_norm +
std::pow(var_res, 2);
101 res_norm = std::sqrt(res_norm);
113 _console <<
"Current step " << curr_step <<
" and current dt " << step_dt
115 <<
" at time " << curr_time << std::endl;
180 "Vector is improper length.");
182 "Vectors should be same length.");
189 curr_dt = transient->
getDT();
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_TIMESTEP_END
const ExecFlagType EXEC_INITIAL
registerMooseObject("MooseApp", PseudoTimestep)
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
A MultiMooseEnum object to hold "execute_on" flags.
virtual Real & dt() const
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
virtual Real & time() const
virtual int & timeStep() const
virtual bool isTransient() const override
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
const InputParameters & parameters() const
Get the parameters of the object.
void addDocumentation(const std::string &name, const std::string &doc)
Add an item documentation string.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
MooseApp & _app
The MOOSE application this is associated with.
Nonlinear system to be solved.
NumericVector< Number > & getResidualNonTimeVector()
Return a numeric vector that is associated with the nontime tag.
virtual libMesh::System & system() override
Get the reference to the libMesh system.
Computes a time step size based on pseudo-timestep continuation.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
const Real _initial_dt
Required parameters for the pseudotimestepper.
Real _dt
Transient pseudotimestep.
Real timestepSER() const
implementation of SER method
PseudotimeMethod
Enum class containing the different options for selecting the timestep size for pseudo-transient simu...
const PseudotimeMethod _method
The timestep selection method.
Real timestepRDM() const
implementation of RDM method
PseudoTimestep(const InputParameters ¶meters)
Real currentResidualNorm() const
Computes the norm of the non-time dependent residual.
bool _bound
Boolean to check if an upper bound was provided.
void outputPseudoTimestep(Real curr_dt) const
Outputs the status of the residual and timestep at the end of time step.
virtual void execute() override
Execute method.
Real _max_dt
Upper bound on timestep.
std::vector< Real > & _iterations_step_sequence
static InputParameters validParams()
unsigned int _iterations_window
Number of iterations over which the residual can be lagged.
std::vector< Real > & _residual_norms_sequence
arrays for storing residual and iterations sequence
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Real timestepEXP() const
implementation of EXP method
const ExecFlagType & _current_execute_flag
Reference to FEProblemBase.
unsigned int number() const
Gets the number of this system.
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
SystemBase & _sys
Reference to the system object for this user object.
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
unsigned int n_vars() const
MooseUnits pow(const MooseUnits &, int)