https://mooseframework.inl.gov
Loading...
Searching...
No Matches
TransientBase.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "TransientBase.h"
11
12// MOOSE includes
13#include "Factory.h"
14#include "SubProblem.h"
15#include "TimeStepper.h"
16#include "MooseApp.h"
17#include "Conversion.h"
18#include "FEProblem.h"
19#include "NonlinearSystem.h"
20#include "Control.h"
21#include "TimePeriod.h"
22#include "MooseMesh.h"
23#include "TimeIntegrator.h"
24#include "Console.h"
25#include "AuxiliarySystem.h"
26#include "Convergence.h"
28
29#include "libmesh/implicit_system.h"
30#include "libmesh/nonlinear_implicit_system.h"
31#include "libmesh/transient_system.h"
32#include "libmesh/numeric_vector.h"
33
34// C++ Includes
35#include <iomanip>
36#include <iostream>
37#include <fstream>
38#include <sstream>
39#include <iomanip>
40
43{
45
46 params.addParam<Real>("steady_state_tolerance",
47 1.0e-08,
48 "Whenever the relative residual changes by less "
49 "than this the solution will be considered to be "
50 "at steady state.");
51 params.addParam<bool>("check_aux",
52 false,
53 "Whether to check the auxiliary system for convergence to steady-state. If "
54 "false, then the solution vector from the solver system is used.");
55 params.addParam<bool>(
56 "normalize_solution_diff_norm_by_dt",
57 true,
58 "Whether to divide the solution difference norm by dt. If taking 'small' "
59 "time steps you probably want this to be true. If taking very 'large' timesteps in an "
60 "attempt to *reach* a steady-state, you probably want this parameter to be false.");
61
62 params.addParamNamesToGroup("steady_state_tolerance check_aux normalize_solution_diff_norm_by_dt",
63 "Steady State Detection");
64
65 return params;
66}
67
70{
73
74 params.addClassDescription("Executioner for time varying simulations.");
75
76 std::vector<Real> sync_times(1);
77 sync_times[0] = -std::numeric_limits<Real>::max();
78
84 MooseEnum schemes("implicit-euler explicit-euler crank-nicolson bdf2 explicit-midpoint dirk "
85 "explicit-tvd-rk-2 newmark-beta",
86 "implicit-euler");
87
88 params.addParam<Real>("start_time", 0.0, "The start time of the simulation");
89 params.addParam<Real>("end_time", 1.0e30, "The end time of the simulation");
90 params.addParam<Real>("dt", 1., "The timestep size between solves");
91 params.addParam<Real>("dtmin", 1.0e-12, "The minimum timestep size in an adaptive run");
92 params.addParam<Real>("dtmax", 1.0e30, "The maximum timestep size in an adaptive run");
93 params.addParam<bool>(
94 "reset_dt", false, "Use when restarting a calculation to force a change in dt.");
95 params.addParam<unsigned int>("num_steps",
96 std::numeric_limits<unsigned int>::max(),
97 "The number of timesteps in a transient run");
98 params.addParam<int>("n_startup_steps", 0, "The number of timesteps during startup");
99
100 params.addParam<bool>(
101 "steady_state_detection", false, "Whether or not to check for steady state conditions");
102 params.addParam<ConvergenceName>(
103 "steady_state_convergence",
104 "Name of the Convergence object to use to assess whether the solution has reached a steady "
105 "state. If not provided, a default Convergence will be constructed internally from the "
106 "executioner parameters.");
107 params.addParam<Real>(
108 "steady_state_start_time",
109 0.0,
110 "Minimum amount of time to run before checking for steady state conditions.");
111
112 params.addParam<std::vector<std::string>>("time_periods", "The names of periods");
113 params.addParam<std::vector<Real>>("time_period_starts", "The start times of time periods");
114 params.addParam<std::vector<Real>>("time_period_ends", "The end times of time periods");
115 params.addParam<bool>(
116 "abort_on_solve_fail", false, "abort if solve not converged rather than cut timestep");
117 params.addParam<bool>(
118 "error_on_dtmin",
119 true,
120 "Throw error when timestep is less than dtmin instead of just aborting solve.");
121 params.addParam<MooseEnum>("scheme", schemes, "Time integration scheme used.");
122 params.addParam<Real>("timestep_tolerance",
123 1.0e-12,
124 "the tolerance setting for final timestep size and sync times");
125
126 params.addParam<bool>("use_multiapp_dt",
127 false,
128 "If true then the dt for the simulation will be "
129 "chosen by the MultiApps. If false (the "
130 "default) then the minimum over the master dt "
131 "and the MultiApps is used");
132
134 "steady_state_detection steady_state_convergence steady_state_start_time",
135 "Steady State Detection");
136
137 params.addParamNamesToGroup("start_time dtmin dtmax n_startup_steps "
138 "abort_on_solve_fail timestep_tolerance use_multiapp_dt",
139 "Advanced");
140
141 params.addParamNamesToGroup("time_periods time_period_starts time_period_ends", "Time Periods");
142
143 // This Executioner supports --test-restep
144 params.set<bool>("_supports_test_restep") = true;
145
146 return params;
147}
148
150 : Executioner(parameters),
151 _problem(_fe_problem),
152 _aux(_fe_problem.getAuxiliarySystem()),
153 _time_scheme(getParam<MooseEnum>("scheme").getEnum<Moose::TimeIntegratorType>()),
154 _time_stepper(nullptr),
155 _t_step(_problem.timeStep()),
156 _time(_problem.time()),
157 _time_old(_problem.timeOld()),
158 _time_older(_problem.timeOlder()),
159 _dt(_problem.dt()),
160 _dt_old(_problem.dtOld()),
161 _unconstrained_dt(declareRecoverableData<Real>("unconstrained_dt", -1)),
162 _at_sync_point(declareRecoverableData<bool>("at_sync_point", false)),
163 _last_solve_converged(declareRecoverableData<bool>("last_solve_converged", true)),
164 _xfem_repeat_step(false),
165 _end_time(getParam<Real>("end_time")),
166 _dtmin(getParam<Real>("dtmin")),
167 _dtmax(getParam<Real>("dtmax")),
168 _num_steps(getParam<unsigned int>("num_steps")),
169 _n_startup_steps(getParam<int>("n_startup_steps")),
170 _steady_state_detection(getParam<bool>("steady_state_detection")),
171 _steady_state_start_time(getParam<Real>("steady_state_start_time")),
172 _sync_times(_app.getOutputWarehouse().getSyncTimes()),
173 _abort(getParam<bool>("abort_on_solve_fail")),
174 _error_on_dtmin(getParam<bool>("error_on_dtmin")),
175 _time_interval(declareRecoverableData<bool>("time_interval", false)),
176 _start_time(getParam<Real>("start_time")),
177 _timestep_tolerance(getParam<Real>("timestep_tolerance")),
178 _target_time(declareRecoverableData<Real>("target_time", -std::numeric_limits<Real>::max())),
179 _use_multiapp_dt(getParam<bool>("use_multiapp_dt")),
180 _testing_restep(false)
181{
182 _t_step = 0;
183 _dt = 0;
185
186 // Either a start_time has been forced on us, or we want to tell the App about what our start time
187 // is (in case anyone else is interested.
188 if (_app.hasStartTime())
190 else if (parameters.isParamSetByUser("start_time"))
192
194 _problem.transient(true);
195
197
198 // Cut timesteps and end_time in half
200 {
201 mooseAssert(!_app.testReStep(), "Cannot use with restep");
202 _end_time = (_start_time + _end_time) / 2.0;
203 _num_steps /= 2.0;
204
205 if (_num_steps == 0) // Always do one step in the first half
206 _num_steps = 1;
207 }
208 // Retest a timestep (see options below for which timestep)
209 else if (_app.testReStep())
210 {
211 if (_problem.shouldSolve())
212 {
213 // If num_steps is defined, we'll use that to determine restep timestep
214 if (!parameters.isParamSetByAddParam("num_steps"))
216 // If end_time is defined, we'll use the half time to determine when to restep
217 if (!parameters.isParamSetByAddParam("end_time"))
219 // If neither was set or we are doing pseudo-transient, pick the second timestep
222
223 std::stringstream msg;
225 msg << "Timestep " << *_test_restep_step << " or time " << *_test_restep_time
226 << " (whichever happens first)";
227 else if (_test_restep_step)
228 msg << "Timestep " << *_test_restep_step;
229 else if (_test_restep_time)
230 msg << "Time " << *_test_restep_time;
231 mooseInfo(msg.str(), " will be forcefully retried due to --test-restep.");
232 }
233 else
234 mooseInfo(
235 "A timestep is not being retried with --test-restep because Problem/solve=false.\n\nTo "
236 "avoid this test being ran, you could set `restep = false` in the test specification.");
237 }
238
239 if (isParamValid("steady_state_convergence"))
240 _problem.setSteadyStateConvergenceName(getParam<ConvergenceName>("steady_state_convergence"));
241 else
242 // Note that we create a steady-state Convergence object even if steady_state_detection ==
243 // false. This could possibly be changed in the future, but TransientMultiApp would need to be
244 // able to signal for the Convergence object to be created in case it uses steady-state
245 // detection for sub-stepping.
247}
248
249void
251{
254 _fixed_point_solve->initialSetup();
255
256 mooseAssert(getTimeStepper(), "No time stepper was set");
257
259
262
263 if (_app.isRecovering()) // Recover case
264 {
265 if (_t_step == 0)
267 "Internal error in TransientBase executioner: _t_step is equal to 0 while recovering "
268 "in init().");
269
270 _dt_old = _dt;
271 }
272}
273
274void
276{
278
279 if (!_app.isRecovering())
280 {
281 _t_step = 0;
282 _dt = 0;
284 if (!_app.isRestarting())
286
288
289 computeDT();
290 _dt = getDT();
291 if (_dt == 0)
292 mooseError("Time stepper computed zero time step size on initial which is not allowed.\n"
293 "1. If you are using an existing time stepper, double check the values in your "
294 "input file or report an error.\n"
295 "2. If you are developing a new time stepper, make sure that initial time step "
296 "size in your code is computed correctly.");
297 const auto & tis = getTimeIntegrators();
298 for (auto & ti : tis)
299 ti->init();
300 }
301}
302
303void
308
309void
314
315void
317{
318 preExecute();
319
320 // Start time loop...
321 while (keepGoing())
322 {
324 preStep();
325 computeDT();
326 takeStep();
327 endStep();
328 postStep();
329 }
330
331 if (lastSolveConverged())
332 {
333 _t_step++;
334
335 /*
336 * Call the multi-app executioners endStep and
337 * postStep methods when doing Picard or when not automatically advancing sub-applications for
338 * some other reason. We do not perform these calls for loose-coupling/auto-advancement
339 * problems because TransientBase::endStep and TransientBase::postStep get called from
340 * TransientBaseMultiApp::solveStep in that case.
341 */
342 if (!_fixed_point_solve->autoAdvance())
343 {
345 /*recurse_through_multiapp_levels=*/true);
346 _problem.finishMultiAppStep(EXEC_TIMESTEP_BEGIN, /*recurse_through_multiapp_levels=*/true);
347 _problem.finishMultiAppStep(EXEC_TIMESTEP_END, /*recurse_through_multiapp_levels=*/true);
349 /*recurse_through_multiapp_levels=*/true);
350 }
351 }
352
354 {
355 TIME_SECTION("final", 1, "Executing Final Objects");
360 }
361
362 // This method is to finalize anything else we want to do on the problem side.
364
365 // This method can be overridden for user defined activities in the Executioner.
366 postExecute();
367
369 mooseError((_test_restep_step ? "Timestep " : "Time "),
371 " was never retried because the simulation did not get to this timestep.\n\nTo "
372 "support restep testing, specify `num_steps` in the input.\nOtherwise, set "
373 "`restep = false` in this test specification.");
374}
375
376void
378{
379 // We're repeating the solve of the previous timestep,
380 // so we use the same dt
381 if (_testing_restep)
382 {
383 mooseAssert(!_test_restep_step && !_test_restep_time, "Should not be set");
384 return;
385 }
386
387 _time_stepper->computeStep(); // This is actually when DT gets computed
388}
389
390void
392{
393 if (lastSolveConverged())
394 {
396 {
397#ifdef LIBMESH_ENABLE_AMR
398 if (_t_step != 0)
400#endif
401
404 _t_step++;
405
406 bool advance_problem_state = true;
407 const auto & tis = getTimeIntegrators();
408 for (auto & ti : tis)
409 // We do not want to advance the problem state here if a time integrator is already doing so
410 // itself
411 if (ti->advancesProblemState())
412 {
413 advance_problem_state = false;
414 break;
415 }
416
417 if (advance_problem_state)
419 else if (tis.size() > 1)
420 mooseError("Either there must be a single time integrator which advances state or none of "
421 "the time integrators should advance state.");
422
423 if (_t_step == 1)
424 return;
425
426 /*
427 * Call the multi-app executioners endStep and
428 * postStep methods when doing Picard or when not automatically advancing sub-applications for
429 * some other reason. We do not perform these calls for loose-coupling/auto-advancement
430 * problems because TransientBase::endStep and TransientBase::postStep get called from
431 * TransientBaseMultiApp::solveStep in that case.
432 */
433 if (!_fixed_point_solve->autoAdvance())
434 {
439 }
440
441 /*
442 * Ensure that we increment the sub-application time steps so that
443 * when dt selection is made in the master application, we are using
444 * the correct time step information
445 */
450 }
451 }
452 else
453 {
460 }
461}
462
463void
465{
466 if (lastSolveConverged())
467 _dt_old = _dt;
468
469 // We're repeating the solve of the previous timestep,
470 // so we use the same dt
471 if (_testing_restep)
472 {
473 mooseAssert(!_test_restep_step && !_test_restep_time, "Should not be set");
474 _testing_restep = false;
475 }
476 else if (input_dt == -1.0)
478 else
479 _dt = input_dt;
480
482
483 // Increment time
484 _time = _time_old + _dt;
485
487
489
491 _xfem_repeat_step = _fixed_point_solve->XFEMRepeatStep();
492
494
495 // We're running with --test-restep and we have just solved
496 // the timestep we are to repeat for the first time
499 {
500 mooseAssert(!_testing_restep, "Should not be set");
501
502 mooseInfo("Aborting and retrying solve for timestep ", _t_step, " due to --test-restep");
503 _last_solve_converged = false;
504 _testing_restep = true;
505 _test_restep_step.reset();
506 _test_restep_time.reset();
507
508 return;
509 }
510
511 if (!lastSolveConverged())
512 {
513 _console << "Aborting as solve did not converge" << std::endl;
514 return;
515 }
516
517 if (!(_problem.haveXFEM() && _fixed_point_solve->XFEMRepeatStep()))
518 {
519 if (lastSolveConverged())
521 else
523 }
524
526
528
529 return;
530}
531
532void
534{
535 if (input_time == -1.0)
536 _time = _time_old + _dt;
537 else
538 _time = input_time;
539
540 if (lastSolveConverged())
541 {
544 else
545 {
546 // TODO: add linear system support
547 const auto & tis = getTimeIntegrators();
548 for (auto & ti : tis)
549 ti->postStep();
550
551 // Compute the Error Indicators and Markers
554
555 // Perform the output of the current time step
557
558 // output
561 }
562 }
563}
564
565Real
567{
568 // // If start up steps are needed
569 // if (_t_step == 1 && _n_startup_steps > 1)
570 // _dt = _input_dt/(double)(_n_startup_steps);
571 // else if (_t_step == 1+_n_startup_steps && _n_startup_steps > 1)
572 // _dt = _input_dt;
573
574 Real dt_cur = _dt;
575 std::ostringstream diag;
576
577 // After startup steps, compute new dt
579 dt_cur = getDT();
580
581 else
582 {
583 diag << "Timestep < n_startup_steps, using old dt: " << std::setw(9) << std::setprecision(6)
584 << std::setfill('0') << std::showpoint << std::left << _dt << " tstep: " << _t_step
585 << " n_startup_steps: " << _n_startup_steps << std::endl;
586 }
587 _unconstrained_dt = dt_cur;
588
589 if (_verbose)
590 _console << diag.str() << std::flush;
591
592 diag.str("");
593 diag.clear();
594
595 // Allow the time stepper to limit the time step
597
598 // Don't let time go beyond next time interval output if specified
600 {
602 _at_sync_point = true;
603
604 diag << "Limiting dt for time interval output at time: " << std::setw(9) << std::setprecision(6)
605 << std::setfill('0') << std::showpoint << std::left << _next_interval_output_time
606 << " dt: " << std::setw(9) << std::setprecision(6) << std::setfill('0') << std::showpoint
607 << std::left << dt_cur << std::endl;
608 }
609
610 // If a target time is set and the current dt would exceed it, limit dt to match the target
611 if (_target_time > -std::numeric_limits<Real>::max() + _timestep_tolerance &&
613 {
614 dt_cur = _target_time - _time;
615 _at_sync_point = true;
616
617 diag << "Limiting dt for target time: " << std::setw(9) << std::setprecision(6)
618 << std::setfill('0') << std::showpoint << std::left << _next_interval_output_time
619 << " dt: " << std::setw(9) << std::setprecision(6) << std::setfill('0') << std::showpoint
620 << std::left << dt_cur << std::endl;
621 }
622
623 // Constrain by what the multi apps are doing
628
629 if (_verbose)
630 _console << diag.str() << std::flush;
631
632 return dt_cur;
633}
634
635void
637 std::ostringstream & diag,
638 const ExecFlagType & execute_on) const
639{
640 Real multi_app_dt = _problem.computeMultiAppsDT(execute_on);
641 if (_use_multiapp_dt || multi_app_dt < dt_cur)
642 {
643 dt_cur = multi_app_dt;
644 _at_sync_point = false;
645 diag << "Limiting dt for MultiApps on " << execute_on.name() << ": " << std::setw(9)
646 << std::setprecision(6) << std::setfill('0') << std::showpoint << std::left << dt_cur
647 << std::endl;
648 }
649}
650
651Real
656
657bool
659{
660 bool keep_going = !_problem.isSolveTerminationRequested();
661
662 // Check for stop condition based upon steady-state check flag:
663 if (lastSolveConverged())
664 {
666 {
668 {
669 // Check solution difference relative norm against steady-state tolerance
671 {
672 _console << "Steady-State Solution Achieved at time: " << _time << std::endl;
673 // Output last solve if not output previously by forcing it
674 keep_going = false;
675 }
676 }
677
678 // Check for stop condition based upon number of simulation steps and/or solution end time:
679 if (static_cast<unsigned int>(_t_step) >= _num_steps)
680 keep_going = false;
681
682 if ((_time >= _end_time) || (fabs(_time - _end_time) <= _timestep_tolerance))
683 keep_going = false;
684 }
685 }
686 else if (_abort)
687 {
688 _console << "Aborting as solve did not converge and input selected to abort" << std::endl;
689 keep_going = false;
690 }
691 else if (!_error_on_dtmin && _dt <= _dtmin)
692 {
693 _console << "Aborting as timestep already at or below dtmin" << std::endl;
694 keep_going = false;
695 }
696
697 return keep_going;
698}
699
700void
704
705bool
710
711void
716
717void
719{
720 _target_time = target_time;
721}
722
723Real
724TransientBase::computeSolutionChangeNorm(bool check_aux, bool normalize_by_dt) const
725{
726 return relativeSolutionDifferenceNorm(check_aux) / (normalize_by_dt ? _dt : Real(1));
727}
728
729void
731{
733 mooseError("You cannot specify time_scheme in the Executioner and independently add a "
734 "TimeIntegrator to the system at the same time");
735
737 {
738 // backwards compatibility
739 std::string ti_str;
740 using namespace Moose;
741
742 switch (_time_scheme)
743 {
744 case TI_IMPLICIT_EULER:
745 ti_str = "ImplicitEuler";
746 break;
747 case TI_EXPLICIT_EULER:
748 ti_str = "ExplicitEuler";
749 break;
750 case TI_CRANK_NICOLSON:
751 ti_str = "CrankNicolson";
752 break;
753 case TI_BDF2:
754 ti_str = "BDF2";
755 break;
756 case TI_EXPLICIT_MIDPOINT:
757 ti_str = "ExplicitMidpoint";
758 break;
759 case TI_LSTABLE_DIRK2:
760 ti_str = "LStableDirk2";
761 break;
762 case TI_EXPLICIT_TVD_RK_2:
763 ti_str = "ExplicitTVDRK2";
764 break;
765 case TI_NEWMARK_BETA:
766 ti_str = "NewmarkBeta";
767 break;
768 default:
769 mooseError("Unknown scheme: ", _time_scheme);
770 break;
771 }
772
774 _problem.addTimeIntegrator(ti_str, ti_str, params);
775 }
776}
777
778std::string
780{
781 if (_time_stepper)
782 {
784 return demangle(typeid(ts).name());
785 }
786 else
787 return std::string();
788}
789
790std::vector<std::string>
792{
793 const auto & tis = getTimeIntegrators();
794 if (tis.empty())
795 mooseError("Time integrator has not been built yet so we can't retrieve its name");
796
797 std::vector<std::string> ret;
798 for (const auto & ti : tis)
799 {
800 const auto & sys = ti->getCheckedPointerParam<SystemBase *>("_sys")->system();
801 const auto & uvars = ti->getParam<std::vector<VariableName>>("variables");
802
803 std::vector<VariableName> vars;
804 for (const auto & var : uvars)
805 if (sys.has_variable(var))
806 vars.push_back(var);
807
808 if (!uvars.empty() && vars.empty())
809 continue;
810
811 if (tis.size() > 1)
812 {
813 const std::string sys_prefix = _problem.numSolverSystems() > 1 ? sys.name() : "";
814 const std::string var_prefix = MooseUtils::join(vars, ", ");
815 const bool both = !sys_prefix.empty() && !var_prefix.empty();
816 ret.push_back("[" + sys_prefix + (both ? " (" : "") + var_prefix + (both ? ")" : "") + "]:");
817 }
818
819 ret.push_back(ti->type());
820 }
821 return ret;
822}
823
824void
826{
827 mooseAssert(!_time_stepper, "Already set");
828 _time_stepper = &ts;
829}
830
831bool
833{
835 const auto status = convergence.checkConvergence(_t_step);
836
839 "The steady-state Convergence object (", convergence.name(), ") reported divergence.");
841 return true;
842 else // status == Convergence::MooseConvergenceStatus::ITERATING
843 return false;
844}
845
846void
InputParameters emptyInputParameters()
const ExecFlagType EXEC_PRE_MULTIAPP_SETUP
Definition Moose.C:57
const ExecFlagType EXEC_MULTIAPP_FIXED_POINT_END
Definition Moose.C:41
const ExecFlagType EXEC_TIMESTEP_END
Definition Moose.C:37
const ExecFlagType EXEC_TIMESTEP_BEGIN
Definition Moose.C:38
const ExecFlagType EXEC_INITIAL
Definition Moose.C:31
const ExecFlagType EXEC_MULTIAPP_FIXED_POINT_BEGIN
Definition Moose.C:43
const ExecFlagType EXEC_FINAL
Definition Moose.C:49
char ** vars
void ErrorVector unsigned int
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
virtual void checkIterationType(IterationType) const
Perform checks related to the iteration type.
Definition Convergence.h:48
Executioners are objects that do the actual work of solving your problem.
Definition Executioner.h:37
static InputParameters validParams()
Definition Executioner.C:26
FEProblemBase & _fe_problem
std::unique_ptr< FixedPointSolve > _fixed_point_solve
const bool & _verbose
True if printing out additional information.
const ConvergenceName & getSteadyStateConvergenceName() const
Gets the steady-state detection convergence object name.
bool haveXFEM()
Find out whether the current analysis is using XFEM.
virtual std::size_t numSolverSystems() const override
virtual void addTimeIntegrator(const std::string &type, const std::string &name, InputParameters &parameters)
void incrementMultiAppTStep(ExecFlagType type)
Advance the MultiApps t_step (incrementStepOrReject) associated with the ExecFlagType.
void setSteadyStateConvergenceName(const ConvergenceName &convergence_name)
Sets the steady-state detection convergence object name if there is one.
bool shouldSolve() const
void parentOutputPositionChanged()
Calls parentOutputPositionChanged() on all sub apps.
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep.
virtual void postExecute()
Method called at the end of the simulation.
Real computeMultiAppsDT(ExecFlagType type)
Find the smallest timestep over all MultiApps.
virtual Convergence & getConvergence(const std::string &name, const THREAD_ID tid=0) const
Gets a Convergence object.
virtual void transient(bool trans)
void restoreMultiApps(ExecFlagType type, bool force=false)
Restore the MultiApps associated with the ExecFlagType.
bool execMultiApps(ExecFlagType type, bool auto_advance=true)
Execute the MultiApps associated with the ExecFlagType.
void timestepSetup() override
virtual void computeIndicators()
virtual void onTimestepBegin() override
void finalizeMultiApps()
virtual void execute(const ExecFlagType &exec_type)
Convenience function for performing execution of MOOSE systems.
void finishMultiAppStep(ExecFlagType type, bool recurse_through_multiapp_levels=false)
Finish the MultiApp time step (endStep, postStep) associated with the ExecFlagType.
bool hasTimeIntegrator() const
Returns whether or not this Problem has a TimeIntegrator.
virtual bool adaptMesh()
virtual void computeMarkers()
void initialSetup() override
virtual void outputStep(ExecFlagType type)
Output the current step.
void setNeedToAddDefaultSteadyStateConvergence()
Sets _need_to_add_default_steady_state_convergence to true.
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
Definition Factory.C:68
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was set by the user.
bool isParamSetByAddParam(const std::string &name) const
Returns whether or not the parameter was set due to addParam.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
void setStartTime(Real time)
Set the starting time for the simulation.
Definition MooseApp.C:2401
bool testReStep() const
Whether or not this simulation should fail a timestep and repeat (for testing).
Definition MooseApp.h:530
bool hasStartTime() const
Definition MooseApp.h:301
bool isRestarting() const
Whether or not this is a "restart" calculation.
Definition MooseApp.C:1680
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
Definition MooseApp.h:407
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition MooseApp.C:1674
bool testCheckpointHalfTransient() const
Whether or not this simulation should only run half its transient (useful for testing recovery)
Definition MooseApp.h:524
Real getStartTime() const
Definition MooseApp.h:306
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
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...
Definition MooseBase.h:271
const InputParameters & _pars
The object's parameters.
Definition MooseBase.h:384
void mooseInfo(Args &&... args) const
Definition MooseBase.h:334
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
Class for containing MooseEnum item information.
const std::string & name() const
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
virtual bool isSolveTerminationRequested() const
Check of termination has been requested.
Definition Problem.h:43
Base class for a system (of equations)
Definition SystemBase.h:87
Base class for time stepping.
Definition TimeStepper.h:23
virtual void postSolve()
Definition TimeStepper.h:37
virtual bool converged() const
If the time step converged.
virtual void init()
Initialize the time stepper.
Definition TimeStepper.C:66
virtual void postExecute()
Definition TimeStepper.h:38
virtual void rejectStep()
This gets called when time step is rejected.
virtual void postStep()
Definition TimeStepper.h:40
virtual void acceptStep()
This gets called when time step is accepted.
virtual void preExecute()
Definition TimeStepper.C:71
virtual void preSolve()
Definition TimeStepper.h:36
virtual void preStep()
Definition TimeStepper.h:39
virtual void step()
Take a time step.
void computeStep()
Called before a new step is started.
Definition TimeStepper.C:79
virtual bool constrainStep(Real &dt)
Called after computeStep() is called.
Real getCurrentDT()
Get the current_dt.
Definition TimeStepper.h:85
bool _testing_restep
Whether or not the last timestep we solved is being repeated with –test-restep.
TransientBase(const InputParameters &parameters)
bool & _last_solve_converged
Whether or not the last solve converged.
std::optional< Real > _test_restep_time
If the time is greater than this then we fail and repeat if –test-restep is enabled.
void setTimeStepper(TimeStepper &ts)
Set the timestepper to use.
virtual void incrementStepOrReject()
This is where the solve step is actually incremented.
FEProblemBase & _problem
Here for backward compatibility.
Real _time_interval_output_interval
virtual Real relativeSolutionDifferenceNorm(bool check_aux) const =0
The relative L2 norm of the difference between solution and old solution vector.
virtual void takeStep(Real input_dt=-1.0)
Do whatever is necessary to advance one step.
static InputParameters defaultSteadyStateConvergenceParams()
virtual void postStep()
Real & _time_old
Previous time.
TimeStepper * getTimeStepper()
Pointer to the TimeStepper.
Real & _unconstrained_dt
virtual std::set< TimeIntegrator * > getTimeIntegrators() const =0
Get the time integrators (time integration scheme) used Note that because some systems might be stead...
virtual bool lastSolveConverged() const override
Whether or not the last solve converged.
void setupTimeIntegrator()
Real & _time
Current time.
const bool _error_on_dtmin
This parameter controls how the system will deal with _dt <= _dtmin If true, the time stepper is expe...
virtual void endStep(Real input_time=-1.0)
Moose::TimeIntegratorType _time_scheme
void constrainDTFromMultiApp(Real &dt_cur, std::ostringstream &diag, const ExecFlagType &execute_on) const
Constrain the timestep dt_cur by looking at the timesteps for the MultiApps on execute_on.
virtual Real computeConstrainedDT()
Real & _time_older
The time two steps back, kept so that functors can be evaluated at the older solution.
virtual void execute() override
Pure virtual execute function MUST be overridden by children classes.
virtual bool keepGoing()
Transient loop will continue as long as this keeps returning true.
bool convergedToSteadyState() const
Determines whether the problem has converged to steady state.
virtual void preExecute() override
Override this for actions that should take place before execution.
unsigned int _num_steps
bool _xfem_repeat_step
Whether step should be repeated due to xfem modifying the mesh.
const bool _steady_state_detection
Steady state detection variables:
virtual Real getDT()
void parentOutputPositionChanged() override
Can be used by subclasses to call parentOutputPositionChanged() on the underlying FEProblemBase.
TimeStepper * _time_stepper
virtual void preStep()
static InputParameters validParams()
virtual void init() override
Initialize the executioner.
virtual void setTargetTime(Real target_time)
Can be used to set the next "target time" which is a time to nail perfectly.
bool & _at_sync_point
std::optional< int > _test_restep_step
The timestep we fail and repeat if –test-restep is enabled.
virtual std::string getTimeStepperName() const override
Get the name of the timestepper.
const Real _steady_state_start_time
Real computeSolutionChangeNorm(bool check_aux, bool normalize_by_dt) const
Compute the relative L2 norm of the change in the solution.
int & _t_step
Current timestep.
bool & _time_interval
if to use time interval output
virtual void estimateTimeError()
virtual void postExecute() override
Override this for actions that should take place after execution.
virtual std::vector< std::string > getTimeIntegratorNames() const override
Get the name of the time integrator (time integration scheme) used.
Real & _dt
Current delta t... or timestep size.
Real _next_interval_output_time
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...