16 #include "libmesh/numeric_vector.h" 25 "The scale factor for the predictor (can range from 0 to 1)");
27 "skip_times", {},
"Skip the predictor if the current solution time is in this list of times");
31 "Skip the predictor if the previous solution time is in this list of times");
32 params.
addParam<
bool>(
"skip_after_failed_timestep",
34 "Skip prediction in a repeated time step after a failed time step");
35 params.
addParam<NonlinearSystemName>(
36 "nl_sys",
"nl0",
"The nonlinear system that this predictor should be applied to.");
46 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
47 _nl(_fe_problem.getNonlinearSystemBase(
48 _fe_problem.nlSysNum(getParam<NonlinearSystemName>(
"nl_sys")))),
49 _t_step(_fe_problem.timeStep()),
50 _dt(_fe_problem.dt()),
51 _dt_old(_fe_problem.dtOld()),
52 _solution(*_nl.currentSolution()),
53 _solution_old(_nl.solutionOld()),
54 _solution_older(_nl.solutionOlder()),
55 _solution_predictor(_nl.addVector(
"predictor", true,
GHOSTED)),
56 _t_step_old(declareRestartableData<
int>(
"t_step_old", 0)),
57 _is_repeated_timestep(declareRestartableData<bool>(
"is_repeated_timestep", false)),
58 _scale(getParam<
Real>(
"scale")),
59 _skip_times(getParam<
std::vector<
Real>>(
"skip_times")),
60 _skip_times_old(getParam<
std::vector<
Real>>(
"skip_times_old")),
61 _skip_after_failed_timetep(getParam<bool>(
"skip_after_failed_timestep")),
62 _timestep_tolerance(dynamic_cast<
TransientBase *>(_app.getExecutioner())->timestepTol())
64 if (_scale < 0.0 || _scale > 1.0)
65 mooseError(
"Input value for scale = ",
_scale,
" is outside of permissible range (0 to 1)");
86 bool should_apply =
true;
94 for (
unsigned int i = 0; i <
_skip_times.size() && should_apply; ++i)
99 for (
unsigned int i = 0; i <
_skip_times_old.size() && should_apply; ++i)
102 should_apply =
false;
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.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
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.
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
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)