16#include "libmesh/numeric_vector.h"
23 "The scale factor for the predictor (can range from 0 to 1)");
25 "skip_times", {},
"Skip the predictor if the current solution time is in this list of times");
29 "Skip the predictor if the previous solution time is in this list of times");
30 params.
addParam<
bool>(
"skip_after_failed_timestep",
32 "Skip prediction in a repeated time step after a failed time step");
33 params.
addParam<NonlinearSystemName>(
34 "nl_sys",
"nl0",
"The nonlinear system that this predictor should be applied to.");
44 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
45 _nl(_fe_problem.getNonlinearSystemBase(
46 _fe_problem.nlSysNum(getParam<NonlinearSystemName>(
"nl_sys")))),
47 _t_step(_fe_problem.timeStep()),
48 _dt(_fe_problem.dt()),
49 _dt_old(_fe_problem.dtOld()),
50 _solution(*_nl.currentSolution()),
51 _solution_old(_nl.solutionOld()),
52 _solution_older(_nl.solutionOlder()),
53 _solution_predictor(_nl.addVector(
"predictor", true, GHOSTED)),
54 _t_step_old(declareRestartableData<
int>(
"t_step_old", 0)),
55 _is_repeated_timestep(declareRestartableData<bool>(
"is_repeated_timestep", false)),
56 _scale(getParam<Real>(
"scale")),
57 _skip_times(getParam<
std::vector<Real>>(
"skip_times")),
58 _skip_times_old(getParam<
std::vector<Real>>(
"skip_times_old")),
59 _skip_after_failed_timetep(getParam<bool>(
"skip_after_failed_timestep")),
60 _timestep_tolerance(dynamic_cast<
TransientBase *>(_app.getExecutioner())->timestepTol())
62 if (_scale < 0.0 || _scale > 1.0)
63 mooseError(
"Input value for scale = ",
_scale,
" is outside of permissible range (0 to 1)");
84 bool should_apply =
true;
92 for (
unsigned int i = 0; i <
_skip_times.size() && should_apply; ++i)
97 for (
unsigned int i = 0; i <
_skip_times_old.size() && should_apply; ++i)
100 should_apply =
false;
void ErrorVector unsigned int
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual Real & timeOld() const
virtual Real & time() const
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Every object that can be built by the factory should be derived from this class.
static InputParameters validParams()
FEProblemBase & _fe_problem
virtual bool shouldApply()
std::vector< Real > _skip_times_old
Old times for which the predictor should not be applied.
std::vector< Real > _skip_times
Times for which the predictor should not be applied.
bool & _is_repeated_timestep
Real _scale
Amount by which to scale the predicted value. Must be in [0,1].
Predictor(const InputParameters ¶meters)
const Real & _timestep_tolerance
Timestep tolerance from Transient executioner.
const bool & _skip_after_failed_timetep
Option to skip prediction after a failed timestep.
static InputParameters validParams()
virtual void timestepSetup()
A class for creating restricted objects.
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...