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<
Transient *>(_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;
Transient executioners usually loop through a number of timesteps...
A class for creating restricted objects.
virtual Real & time() const
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
std::vector< Real > _skip_times
Times for which the predictor should not be applied.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void timestepSetup()
Every object that can be built by the factory should be derived from this class.
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()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
Real _scale
Amount by which to scale the predicted value. Must be in [0,1].
FEProblemBase & _fe_problem
virtual Real & timeOld() const
bool & _is_repeated_timestep
std::vector< Real > _skip_times_old
Old times for which the predictor should not be applied.
static InputParameters validParams()
virtual bool shouldApply()
void ErrorVector unsigned int
Predictor(const InputParameters ¶meters)