31 _min_fixed_point_its(getSharedExecutionerParam<unsigned
int>(
"fixed_point_min_its")),
32 _max_fixed_point_its(getSharedExecutionerParam<unsigned
int>(
"fixed_point_max_its")),
33 _has_fixed_point_norm(
34 !getSharedExecutionerParam<bool>(
"disable_fixed_point_residual_norm_check")),
35 _fixed_point_force_norms(getSharedExecutionerParam<bool>(
"fixed_point_force_norms")),
36 _accept_max_it(getSharedExecutionerParam<bool>(
"accept_on_max_fixed_point_iteration")),
37 _fixed_point_rel_tol(getSharedExecutionerParam<Real>(
"fixed_point_rel_tol")),
38 _fixed_point_abs_tol(getSharedExecutionerParam<Real>(
"fixed_point_abs_tol")),
39 _custom_pp_rel_tol(getSharedExecutionerParam<Real>(
"custom_rel_tol")),
40 _custom_pp_abs_tol(getSharedExecutionerParam<Real>(
"custom_abs_tol")),
41 _fixed_point_custom_pp(isParamValid(
"custom_pp") ? &getPostprocessorValue(
"custom_pp")
43 _fixed_point_custom_pp_old(isParamValid(
"custom_pp") ? &getPostprocessorValueOld(
"custom_pp")
46 _pp_current(
std::numeric_limits<Real>::max()),
48 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
49 _fp_solve(getMooseApp().getExecutioner()->fixedPointSolve())
53 "The minimum number of fixed point iterations may not exceed the maximum.");
56 "disable_fixed_point_residual_norm_check",
57 "fixed_point_rel_tol will be ignored because the fixed point residual check is disabled.");
60 "disable_fixed_point_residual_norm_check",
61 "fixed_point_abs_tol will be ignored because the fixed point residual check is disabled.");
64 "fixed_point_force_norms will be ignored because the fixed point residual check "
83 "DefaultMultiAppFixedPointConvergence can only be used with MultiApp fixed point solves.");
102 _console << COLOR_MAGENTA <<
"Initial fixed point residual norm: " << COLOR_DEFAULT;
107 _console << COLOR_DEFAULT <<
"\n" << std::endl;
124 Real begin_norm_old =
137 const auto iter = n_iter - 1;
220 _console << COLOR_MAGENTA <<
"Fixed point residual norm after " << execute_on_str
227 if (!getParam<bool>(
"direct_pp_value"))
230 if ((iter == 0 && getParam<bool>(
"direct_pp_value")) || !getParam<bool>(
"direct_pp_value"))
234 const auto pp_name = getParam<PostprocessorName>(
"custom_pp");
235 _pp_history << std::setw(2) << iter + 1 <<
" fixed point " << pp_name <<
" = "
registerMooseObject("MooseApp", DefaultMultiAppFixedPointConvergence)
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_TIMESTEP_BEGIN
void ErrorVector unsigned int
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
static std::string outputNorm(const Real &old_norm, const Real &norm, const unsigned int precision=6)
A helper function for outputting norms in color.
PerfID _perfid_check_convergence
Performance ID for checkConvergence.
virtual void initialize()
Method that gets called before each iteration loop.
MooseConvergenceStatus
Status returned by calls to checkConvergence.
virtual void preExecute()
Method that gets called in each iteration before the solve.
virtual void checkIterationType(IterationType) const
Perform checks related to the iteration type.
Base class for default convergence criteria.
static InputParameters validParams()
Default fixed point convergence criteria.
std::vector< Real > _fixed_point_timestep_begin_norm
Full history of residual norm after evaluation of timestep_begin, indexed by iteration index.
Real _fixed_point_initial_norm
Initial residual norm.
std::ostringstream _pp_history
Convergence history of the custom convergence check postprocessor.
unsigned int _min_fixed_point_its
Minimum fixed point iterations.
void computeCustomConvergencePostprocessor(unsigned int iter)
Computes and prints the user-specified postprocessor assessing convergence.
FEProblemBase & _fe_problem
FE Problem.
Real _pp_previous
Value of the custom convergence check postprocessor from previous iteration.
DefaultMultiAppFixedPointConvergence(const InputParameters ¶meters)
FixedPointSolve & _fp_solve
Fixed point solve.
void outputResidualNorm(const std::string &execute_on_str, Real old_norm, Real new_norm) const
Outputs residual norm to console.
const PostprocessorValue *const _fixed_point_custom_pp_old
Postprocessor value for user-defined fixed point convergence check from previous timestep.
const Real _fixed_point_abs_tol
Absolute tolerance on residual norm.
virtual void preExecute() override
Method that gets called in each iteration before the solve.
static InputParameters validParams()
std::vector< Real > _fixed_point_timestep_end_norm
Full history of residual norm after evaluation of timestep_end, indexed by iteration index.
unsigned int _max_fixed_point_its
Maximum fixed point iterations.
const bool _accept_max_it
Whether or not to treat reaching maximum number of fixed point iteration as converged.
const Real _custom_pp_rel_tol
Relative tolerance on postprocessor value.
Real _pp_scaling
Scaling of custom convergence check postprocessor (its initial value)
const bool _fixed_point_force_norms
Whether or not we force evaluation of residual norms even without multiapps.
virtual void initialize() override
Method that gets called before each iteration loop.
const Real _custom_pp_abs_tol
Absolute tolerance on postprocessor value.
virtual void checkIterationType(IterationType it_type) const override
Perform checks related to the iteration type.
Real _pp_current
Value of the custom convergence check postprocessor from current iteration.
const bool _has_fixed_point_norm
Whether or not to use residual norm to check the fixed point convergence.
const Real _fixed_point_rel_tol
Relative tolerance on residual norm.
virtual MooseConvergenceStatus checkConvergence(unsigned int n_iter) override
Returns convergence status.
const PostprocessorValue *const _fixed_point_custom_pp
Postprocessor value for user-defined fixed point convergence check.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Real computeResidualL2Norm(NonlinearSystemBase &sys)
Computes the residual of a nonlinear system using whatever is sitting in the current solution vector ...
bool hasMultiApps() const
Returns whether or not the current simulation has any multiapps.
void setFixedPointStatus(MooseFixedPointConvergenceReason status)
Set fixed point status.
@ DIVERGED_MAX_ITS
FP converged according to Convergence object.
@ CONVERGED_ABS
Main app nonlinear solve converged, FP unassessed.
@ REACH_MAX_ITS
FP converged by absolute or relative PP tolerance.
@ CONVERGED_PP
FP converged by relative residual tolerance.
@ CONVERGED_RELATIVE
FP converged by absolute residual tolerance.
unsigned int numFixedPointIts() const
Get the number of fixed point iterations performed Because this returns the number of fixed point ite...
static InputParameters fixedPointDefaultConvergenceParams()
virtual void printFixedPointConvergenceHistory(Real initial_norm, const std::vector< Real > ×tep_begin_norms, const std::vector< Real > ×tep_end_norms) const =0
Print the convergence history of the coupling, at every fixed point iteration.
const InputParameters & parameters() const
Get the parameters of the object.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Class for containing MooseEnum item information.
void paramWarning(const std::string ¶m, Args... args) const
const auto MULTIAPP_FIXED_POINT