19 #include "libmesh/mesh_tools.h" 29 "keep_full_output_history",
31 "Whether or not to keep the full output history when this multiapp has multiple entries");
32 params.
addParam<
bool>(
"ignore_solve_not_converge",
34 "True to continue main app even if a sub app's solve does not converge.");
35 params.
addParam<
bool>(
"update_old_solution_when_keeping_solution_during_restore",
37 "Whether to update the old solution vector (to the previous fixed point " 38 "iteration solution) when keeping the solution during restore.");
44 _ignore_diverge(getParam<bool>(
"ignore_solve_not_converge")),
45 _update_old_state_when_keeping_solution_during_restore(
46 getParam<bool>(
"update_old_solution_when_keeping_solution_during_restore"))
52 "The parent app is restarting or recovering, restoration cannot be disabled");
55 !
isParamSetByUser(
"update_old_solution_when_keeping_solution_during_restore"))
56 paramError(
"update_old_solution_when_keeping_solution_during_restore",
57 "Due to 'keep_solution_during_restore' parameter being true, which is an " 58 "optimization for fixed point iterations, the " 59 "unrestored solution will be kept as the starting solution for the next solve " 60 "of the MultiApp. You must set this parameter to decide if this solution should " 61 "be copied as the old solution at the beginning of the next time step, " 62 "or not. If the MultiApp is running a transient, you likely want to set this to " 63 "true. If the MultiApp is a quasi-static simulation, you likely want to set " 64 "this to false. If you don't know what this error message means, please set " 65 "'keep_solution_during_restore' to false and no need to set " 66 "'update_old_solution_when_keeping_solution_during_restore'.");
67 if (
isParamSetByUser(
"update_old_solution_when_keeping_solution_during_restore") &&
69 paramError(
"update_old_solution_when_keeping_solution_during_restore",
70 "Should not be set if not keeping the solution during restore " 71 "(keep_solution_during_restore=false)");
95 auto & app =
_apps[i];
105 mooseError(
"Requesting to ignore failed solutions, but 'Executioner/error_on_dtmin' is " 106 "true in sub-application. Set this parameter to false in sub-application to " 107 "avoid an error if Transient solve fails.");
114 #ifdef KOKKOS_ENABLED
116 .getKokkosMaterialPropertyStorage()
117 .hasStatefulProperties()
121 "update_old_solution_when_keeping_solution_during_restore",
122 "While we are updating old solutions using the solution from the previous fixed " 123 "point iteration, we are not updating the old stateful material properties as " 124 "well. This is not consistent. We recommend you consider using the 'no_restore' " 125 "parameter instead of 'keep_solution_during_restore', or stop using the latter.");
130 "keep_solution_during_restore",
131 "This FullSolveMultiApp simulation(s) uses older time step variable states (notably " 132 "from two time steps prior in transients). Due to 'keep_solution_during_restore' " 133 "parameter being true, which is an optimization for fixed point iterations, the " 134 "unrestored solution will be kept as the starting solution. It would normally be " 135 "copied onto the 'old' state at the beginning of the first time step. This copy can be " 136 "skipped using 'update_old_solution_when_keeping_solution_during_restore', while the " 137 "copy of the old state onto the 'older' state and the stateful material properties " 138 "state updates do not have such an option at this time. This warning relates to this " 139 "inconsistency. If you suspect this is a problem, please set " 140 "'keep_solution_during_restore' to false"));
151 mooseError(
"FullSolveMultiApp is not compatible with auto_advance=false");
163 mooseCheckMPIErr(ierr);
165 bool last_solve_converged =
true;
169 if (!getParam<bool>(
"keep_full_output_history"))
170 _apps[i]->getOutputWarehouse().reset();
190 _apps[i]->getOutputWarehouse().getOutputs<
Console>().size() > 0)
193 _console << COLOR_RED <<
"Subapp " <<
_apps[i]->
name() <<
" solve Did NOT Converge!" 194 << COLOR_DEFAULT << std::endl;
196 _console << COLOR_GREEN <<
"Subapp " <<
_apps[i]->name() <<
" solve converged!" << COLOR_DEFAULT
virtual void initialSetup() override
Method to be called in main-app initial setup for create sub-apps if using positions is false...
virtual void restore(bool force=true)
Restore the state of every Sub App.
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 ...
bool verboseMultiApps() const
Whether or not to use verbose printing for MultiApps.
virtual void init()
Initialize the executioner.
An output object for writing to the console (screen)
const PerfID _solve_step_timer
Timers.
const InputParameters & parameters() const
Get the parameters of the object.
std::vector< std::shared_ptr< MooseApp > > _apps
Pointers to each of the Apps.
const Parallel::Communicator & _communicator
FEProblemBase & _fe_problem
The FEProblemBase this MultiApp is part of.
bool isRestarting() const
Whether or not this is a "restart" calculation.
void skipNextForwardSolutionCopyToOld()
Prevents the copy of the solution vector to the old solution vector in each system.
const bool _ignore_diverge
Switch to tell executioner to keep going despite app solve not converging.
virtual void execute()=0
Pure virtual execute function MUST be overridden by children classes.
const std::string & name() const
Get the name of the class.
FullSolveMultiApp(const InputParameters ¶meters)
bool _keep_solution_during_restore
Flag indicates if or not restart from the latest solution.
std::vector< Executioner * > _executioners
FEProblemBase & appProblemBase(unsigned int app)
Get the FEProblemBase for the global app desired.
Executioners are objects that do the actual work of solving your problem.
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
MooseApp & _app
The MOOSE application this is associated with.
static InputParameters validParams()
unsigned int _my_num_apps
The number of apps this object is involved in simulating.
bool _has_an_app
Whether or not this processor as an App at all
registerMooseObject("MooseApp", FullSolveMultiApp)
unsigned int _first_local_app
The number of the first app on this processor.
const bool _no_restore
Whether or not to skip restoring completely.
virtual void initialSetup() override
Method to be called in main-app initial setup for create sub-apps if using positions is false...
virtual void restore(bool force=true) override
Restore the state of every Sub App.
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...
virtual void showStatusMessage(unsigned int i) const
This function is called after each sub-application solve and is meant to display information about th...
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
void paramWarning(const std::string ¶m, Args... args) const
virtual bool lastSolveConverged() const =0
Whether or not the last solve converged.
static InputParameters validParams()
A MultiApp represents one or more MOOSE applications that are running simultaneously.
virtual bool solveStep(Real dt, Real target_time, bool auto_advance=true) override
Re-solve all of the Apps.
bool isRecovering() const
Whether or not this is a "recover" calculation.
const bool _update_old_state_when_keeping_solution_during_restore
Switch to tell the systems or not to update the old solution using the unrestored solution (the one w...
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
MPI_Comm & _my_comm
The MPI communicator this object is going to use.
This type of MultiApp will do a full solve when it is asked to take a step.