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;
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...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real