www.mooseframework.org
Transient.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "Transient.h"
16 
17 // MOOSE includes
18 #include "Factory.h"
19 #include "SubProblem.h"
20 #include "TimeStepper.h"
21 #include "MooseApp.h"
22 #include "Conversion.h"
23 #include "FEProblem.h"
24 #include "NonlinearSystem.h"
25 #include "Control.h"
26 #include "TimePeriod.h"
27 #include "MooseMesh.h"
29 
30 #include "libmesh/implicit_system.h"
31 #include "libmesh/nonlinear_implicit_system.h"
32 #include "libmesh/transient_system.h"
33 #include "libmesh/numeric_vector.h"
34 
35 // C++ Includes
36 #include <iomanip>
37 #include <iostream>
38 #include <fstream>
39 #include <sstream>
40 #include <iomanip>
41 
42 template <>
45 {
47  std::vector<Real> sync_times(1);
48  sync_times[0] = -std::numeric_limits<Real>::max();
49 
55  MooseEnum schemes(
56  "implicit-euler explicit-euler crank-nicolson bdf2 explicit-midpoint dirk explicit-tvd-rk-2",
57  "implicit-euler");
58 
59  params.addParam<Real>("start_time", 0.0, "The start time of the simulation");
60  params.addParam<Real>("end_time", 1.0e30, "The end time of the simulation");
61  params.addParam<Real>("dt", 1., "The timestep size between solves");
62  params.addParam<Real>("dtmin", 2.0e-14, "The minimum timestep size in an adaptive run");
63  params.addParam<Real>("dtmax", 1.0e30, "The maximum timestep size in an adaptive run");
64  params.addParam<bool>(
65  "reset_dt", false, "Use when restarting a calculation to force a change in dt.");
66  params.addParam<unsigned int>("num_steps",
67  std::numeric_limits<unsigned int>::max(),
68  "The number of timesteps in a transient run");
69  params.addParam<int>("n_startup_steps", 0, "The number of timesteps during startup");
70  params.addParam<bool>(
71  "trans_ss_check", false, "Whether or not to check for steady state conditions");
72  params.addParam<Real>("ss_check_tol",
73  1.0e-08,
74  "Whenever the relative residual changes by less "
75  "than this the solution will be considered to be "
76  "at steady state.");
77  params.addParam<Real>(
78  "ss_tmin",
79  0.0,
80  "Minimum number of timesteps to take before checking for steady state conditions.");
81 
82  params.addParam<std::vector<std::string>>("time_periods", "The names of periods");
83  params.addParam<std::vector<Real>>("time_period_starts", "The start times of time periods");
84  params.addParam<std::vector<Real>>("time_period_ends", "The end times of time periods");
85  params.addParam<bool>(
86  "abort_on_solve_fail", false, "abort if solve not converged rather than cut timestep");
87  params.addParam<MooseEnum>("scheme", schemes, "Time integration scheme used.");
88  params.addParam<Real>("timestep_tolerance",
89  2.0e-14,
90  "the tolerance setting for final timestep size and sync times");
91 
92  params.addParam<bool>("use_multiapp_dt",
93  false,
94  "If true then the dt for the simulation will be "
95  "chosen by the MultiApps. If false (the "
96  "default) then the minimum over the master dt "
97  "and the MultiApps is used");
98 
99  params.addParam<unsigned int>("picard_max_its",
100  1,
101  "Number of times each timestep will be solved. Mainly used when "
102  "wanting to do Picard iterations with MultiApps that are set to "
103  "execute_on timestep_end or timestep_begin");
104  params.addParam<Real>("picard_rel_tol",
105  1e-8,
106  "The relative nonlinear residual drop to shoot for "
107  "during Picard iterations. This check is "
108  "performed based on the Master app's nonlinear "
109  "residual.");
110  params.addParam<Real>("picard_abs_tol",
111  1e-50,
112  "The absolute nonlinear residual to shoot for "
113  "during Picard iterations. This check is "
114  "performed based on the Master app's nonlinear "
115  "residual.");
116 
117  params.addParam<Real>("relaxation_factor",
118  1.0,
119  "Fraction of newly computed value to keep."
120  "Set between 0 and 2.");
121  params.addParam<std::vector<std::string>>("relaxed_variables",
122  std::vector<std::string>(),
123  "List of variables to relax during Picard Iteration");
124 
125  params.addParamNamesToGroup("start_time dtmin dtmax n_startup_steps trans_ss_check ss_check_tol "
126  "ss_tmin abort_on_solve_fail timestep_tolerance use_multiapp_dt",
127  "Advanced");
128 
129  params.addParamNamesToGroup("time_periods time_period_starts time_period_ends", "Time Periods");
130 
131  params.addParamNamesToGroup(
132  "picard_max_its picard_rel_tol picard_abs_tol relaxation_factor relaxed_variables", "Picard");
133 
134  params.addParam<bool>("verbose", false, "Print detailed diagnostics on timestep calculation");
135  params.addParam<unsigned int>(
136  "max_xfem_update",
137  std::numeric_limits<unsigned int>::max(),
138  "Maximum number of times to update XFEM crack topology in a step due to evolving cracks");
139 
140  return params;
141 }
142 
144  : Executioner(parameters),
145  _problem(_fe_problem),
146  _time_scheme(getParam<MooseEnum>("scheme").getEnum<Moose::TimeIntegratorType>()),
147  _t_step(_problem.timeStep()),
148  _time(_problem.time()),
149  _time_old(_problem.timeOld()),
150  _dt(_problem.dt()),
151  _dt_old(_problem.dtOld()),
152  _unconstrained_dt(declareRecoverableData<Real>("unconstrained_dt", -1)),
153  _at_sync_point(declareRecoverableData<bool>("at_sync_point", false)),
154  _first(declareRecoverableData<bool>("first", true)),
155  _multiapps_converged(declareRecoverableData<bool>("multiapps_converged", true)),
156  _last_solve_converged(declareRecoverableData<bool>("last_solve_converged", true)),
157  _xfem_repeat_step(false),
158  _xfem_update_count(0),
159  _max_xfem_update(getParam<unsigned int>("max_xfem_update")),
160  _end_time(getParam<Real>("end_time")),
161  _dtmin(getParam<Real>("dtmin")),
162  _dtmax(getParam<Real>("dtmax")),
163  _num_steps(getParam<unsigned int>("num_steps")),
164  _n_startup_steps(getParam<int>("n_startup_steps")),
165  _steps_taken(0),
166  _trans_ss_check(getParam<bool>("trans_ss_check")),
167  _ss_check_tol(getParam<Real>("ss_check_tol")),
168  _ss_tmin(getParam<Real>("ss_tmin")),
169  _sln_diff_norm(declareRecoverableData<Real>("sln_diff_norm", 0.0)),
170  _old_time_solution_norm(declareRecoverableData<Real>("old_time_solution_norm", 0.0)),
171  _sync_times(_app.getOutputWarehouse().getSyncTimes()),
172  _abort(getParam<bool>("abort_on_solve_fail")),
173  _time_interval(declareRecoverableData<bool>("time_interval", false)),
174  _start_time(getParam<Real>("start_time")),
175  _timestep_tolerance(getParam<Real>("timestep_tolerance")),
176  _target_time(declareRecoverableData<Real>("target_time", -1)),
177  _use_multiapp_dt(getParam<bool>("use_multiapp_dt")),
178  _picard_it(declareRecoverableData<int>("picard_it", 0)),
179  _picard_max_its(getParam<unsigned int>("picard_max_its")),
180  _picard_converged(declareRecoverableData<bool>("picard_converged", false)),
181  _picard_initial_norm(declareRecoverableData<Real>("picard_initial_norm", 0.0)),
182  _picard_timestep_begin_norm(declareRecoverableData<Real>("picard_timestep_begin_norm", 0.0)),
183  _picard_timestep_end_norm(declareRecoverableData<Real>("picard_timestep_end_norm", 0.0)),
184  _picard_rel_tol(getParam<Real>("picard_rel_tol")),
185  _picard_abs_tol(getParam<Real>("picard_abs_tol")),
186  _verbose(getParam<bool>("verbose")),
187  _sln_diff(_problem.getNonlinearSystemBase().addVector("sln_diff", false, PARALLEL)),
188  _relax_factor(getParam<Real>("relaxation_factor")),
189  _relaxed_vars(getParam<std::vector<std::string>>("relaxed_variables"))
190 {
192  _t_step = 0;
193  _dt = 0;
195 
196  // Either a start_time has been forced on us, or we want to tell the App about what our start time
197  // is (in case anyone else is interested.
198  if (_app.hasStartTime())
200  else if (parameters.isParamSetByUser("start_time"))
202 
204  _problem.transient(true);
205 
206  if (!_restart_file_base.empty())
208 
210 
211  if (_app.halfTransient()) // Cut timesteps and end_time in half...
212  {
213  _end_time /= 2.0;
214  _num_steps /= 2.0;
215 
216  if (_num_steps == 0) // Always do one step in the first half
217  _num_steps = 1;
218  }
219 
220  // Set up relaxation
221  if (_relax_factor != 1.0)
222  {
223  if (_relax_factor >= 2.0 || _relax_factor <= 0.0)
224  mooseError("The Picard iteration relaxation factor should be between 0.0 and 2.0");
226 
227  // Store a copy of the previous solution here
228  _nl_system.addVector("relax_previous", false, PARALLEL);
229  }
230  // This lets us know if we are at Picard iteration > 0, works for both master- AND sub-app.
231  // Initialize such that _prev_time != _time for the first Picard iteration
232  _prev_time = _time - 1.0;
233 }
234 
235 void
237 {
238  if (!_time_stepper.get())
239  {
240  InputParameters pars = _app.getFactory().getValidParams("ConstantDT");
241  pars.set<FEProblemBase *>("_fe_problem_base") = &_problem;
242  pars.set<Transient *>("_executioner") = this;
243 
251  if (!_pars.isParamSetByAddParam("end_time") && !_pars.isParamSetByAddParam("num_steps") &&
253  pars.set<Real>("dt") = (getParam<Real>("end_time") - getParam<Real>("start_time")) /
254  static_cast<Real>(getParam<unsigned int>("num_steps"));
255  else
256  pars.set<Real>("dt") = getParam<Real>("dt");
257 
258  pars.set<bool>("reset_dt") = getParam<bool>("reset_dt");
259  _time_stepper = _app.getFactory().create<TimeStepper>("ConstantDT", "TimeStepper", pars);
260  }
261 
263  _time_stepper->init();
264 
265  if (_app.isRestarting())
266  _time_old = _time;
267 
269 
270  // If this is the first step
271  if (_t_step == 0)
272  _t_step = 1;
273 
274  if (_t_step > 1) // Recover case
275  _dt_old = _dt;
276 
277  else
278  {
279  computeDT();
280  // _dt = computeConstrainedDT();
281  _dt = getDT();
282  }
283 }
284 
285 void
287 {
288  _time_stepper->preStep();
289 }
290 
291 void
293 {
294  _time_stepper->postStep();
295 }
296 
297 void
299 {
300 
301  preExecute();
302 
303  // NOTE: if you remove this line, you will see a subset of tests failing. Those tests might have a
304  // wrong answer and might need to be regolded.
305  // The reason is that we actually move the solution back in time before we actually start solving
306  // (which I think is wrong). So this call here
307  // is to maintain backward compatibility and so that MOOSE is giving the same answer. However, we
308  // might remove this call and regold the test
309  // in the future eventually.
310  if (!_app.isRecovering())
312 
313  // Start time loop...
314  while (true)
315  {
316  if (_first != true)
318 
319  _first = false;
320 
321  if (!keepGoing())
322  break;
323 
324  preStep();
325  computeDT();
326  takeStep();
327  endStep();
328  postStep();
329 
330  _steps_taken++;
331  }
332 
333  if (!_app.halfTransient())
334  {
337  }
338 
339  // This method is to finalize anything else we want to do on the problem side.
341 
342  // This method can be overridden for user defined activities in the Executioner.
343  postExecute();
344 }
345 
346 void
348 {
349  _time_stepper->computeStep(); // This is actually when DT gets computed
350 }
351 
352 void
354 {
355  if (lastSolveConverged())
356  {
357  if (_xfem_repeat_step)
358  {
359  _time = _time_old;
360  }
361  else
362  {
363 #ifdef LIBMESH_ENABLE_AMR
365 #endif
366 
367  _time_old = _time; // = _time_old + _dt;
368  _t_step++;
369 
371 
372  // Advance (and Output) MultiApps if we were doing Picard iterations
373  if (_picard_max_its > 1)
374  {
377  }
378  }
379  }
380  else
381  {
384  _time_stepper->rejectStep();
385  _time = _time_old;
386  }
387 
388  _first = false;
389 }
390 
391 void
392 Transient::takeStep(Real input_dt)
393 {
394  _picard_it = 0;
395 
398 
399  while (_picard_it < _picard_max_its && _picard_converged == false)
400  {
401  // For every iteration other than the first, we need to restore the state of the MultiApps
402  if (_picard_it > 0)
403  {
406  }
407 
408  solveStep(input_dt);
409 
410  // If the last solve didn't converge then we need to exit this step completely (even in the case
411  // of Picard)
412  // So we can retry...
413  if (!lastSolveConverged())
414  return;
415 
416  ++_picard_it;
417  }
418 }
419 
420 void
421 Transient::solveStep(Real input_dt)
422 {
423  _dt_old = _dt;
424 
425  if (input_dt == -1.0)
427  else
428  _dt = input_dt;
429 
430  Real current_dt = _dt;
431 
433 
434  // Increment time
435  _time = _time_old + _dt;
436 
437  if (_picard_max_its > 1)
438  {
439  _console << "\nBeginning Picard Iteration " << _picard_it << "\n" << std::endl;
440 
441  if (_picard_it == 0) // First Picard iteration - need to save off the initial nonlinear residual
442  {
444  _console << "Initial Picard Norm: " << _picard_initial_norm << '\n';
445  }
446  }
447 
450 
452  return;
453 
454  preSolve();
455  _time_stepper->preSolve();
456 
458 
460 
461  if (_picard_max_its > 1)
462  {
464 
465  _console << "Picard Norm after TIMESTEP_BEGIN MultiApps: " << _picard_timestep_begin_norm
466  << '\n';
467  }
468 
469  // Perform output for timestep begin
471 
472  // Update warehouse active objects
474 
475  // Prepare to relax variables.
476  // _prev_time == _time is like _picard_it > 0, but it also works for the sub-app
477  if (_prev_time == _time && _relax_factor != 1.0)
478  {
480  NumericVector<Number> & solution = _nl_system.solution();
481  NumericVector<Number> & relax_previous = _nl_system.getVector("relax_previous");
482 
483  // Save off the current solution
484  relax_previous = solution;
485 
486  // Snag all of the local dof indices for all of these variables
487  System & libmesh_nl_system = _nl_system.system();
488  AllLocalDofIndicesThread aldit(libmesh_nl_system, _relaxed_vars);
489  ConstElemRange & elem_range = *_fe_problem.mesh().getActiveLocalElementRange();
490  Threads::parallel_reduce(elem_range, aldit);
491 
493  }
494 
495  _time_stepper->step();
496 
497  // Relax the "relaxed_variables" if this is not the first Picard iteration of the timestep.
498  // _prev_time == _time is like _picard_it > 0, but it also works for the sub-app
499  if (_prev_time == _time && _relax_factor != 1.0)
500  {
502  NumericVector<Number> & solution = _nl_system.solution();
503  NumericVector<Number> & relax_previous = _nl_system.getVector("relax_previous");
504  for (const auto & dof : _relaxed_dofs)
505  solution.set(dof,
506  (relax_previous(dof) * (1.0 - _relax_factor)) + (solution(dof) * _relax_factor));
507  solution.close();
508  _nl_system.update();
509  }
510  // This keeps track of Picard iteration, even if this is the sub-app.
511  // It is used for relaxation logic
512  _prev_time = _time;
513 
514  // We know whether or not the nonlinear solver thinks it converged, but we need to see if the
515  // executioner concurs
516  if (lastSolveConverged())
517  {
518  _console << COLOR_GREEN << " Solve Converged!" << COLOR_DEFAULT << std::endl;
519 
521  {
522  _console << "XFEM modifying mesh, repeating step" << std::endl;
523  _xfem_repeat_step = true;
525  }
526  else
527  {
528  if (_problem.haveXFEM())
529  {
530  _xfem_repeat_step = false;
531  _xfem_update_count = 0;
532  _console << "XFEM not modifying mesh, continuing" << std::endl;
533  }
534 
535  if (_picard_max_its <= 1)
536  _time_stepper->acceptStep();
537 
540 
543 
546 
548  return;
549  }
550  }
551  else
552  {
553  _console << COLOR_RED << " Solve Did NOT Converge!" << COLOR_DEFAULT << std::endl;
554 
555  // Perform the output of the current, failed time step (this only occurs if desired)
557  }
558 
559  postSolve();
560  _time_stepper->postSolve();
561 
562  if (_picard_max_its > 1 && lastSolveConverged())
563  {
565 
566  _console << "Picard Norm after TIMESTEP_END MultiApps: " << _picard_timestep_end_norm << '\n';
567 
568  Real max_norm = std::max(_picard_timestep_begin_norm, _picard_timestep_end_norm);
569 
570  Real max_relative_drop = max_norm / _picard_initial_norm;
571 
572  if (max_norm < _picard_abs_tol || max_relative_drop < _picard_rel_tol)
573  {
574  _console << "Picard converged!" << std::endl;
575 
576  _picard_converged = true;
577  return;
578  }
579  }
580 
581  _dt = current_dt; // _dt might be smaller than this at this point for multistep methods
582  _time = _time_old;
583 }
584 
585 void
586 Transient::endStep(Real input_time)
587 {
588  if (input_time == -1.0)
589  _time = _time_old + _dt;
590  else
591  _time = input_time;
592 
593  _picard_converged = false;
594 
596 
598  {
599  // Compute the Error Indicators and Markers
602 
603  // Perform the output of the current time step
605 
606  // output
609  }
610 }
611 
612 Real
614 {
615  // // If start up steps are needed
616  // if (_t_step == 1 && _n_startup_steps > 1)
617  // _dt = _input_dt/(double)(_n_startup_steps);
618  // else if (_t_step == 1+_n_startup_steps && _n_startup_steps > 1)
619  // _dt = _input_dt;
620 
621  Real dt_cur = _dt;
622  std::ostringstream diag;
623 
624  // After startup steps, compute new dt
626  dt_cur = getDT();
627 
628  else
629  {
630  diag << "Timestep < n_startup_steps, using old dt: " << std::setw(9) << std::setprecision(6)
631  << std::setfill('0') << std::showpoint << std::left << _dt << " tstep: " << _t_step
632  << " n_startup_steps: " << _n_startup_steps << std::endl;
633  }
634  _unconstrained_dt = dt_cur;
635 
636  if (_verbose)
637  _console << diag.str();
638 
639  diag.str("");
640  diag.clear();
641 
642  // Allow the time stepper to limit the time step
643  _at_sync_point = _time_stepper->constrainStep(dt_cur);
644 
645  // Don't let time go beyond next time interval output if specified
647  {
649  _at_sync_point = true;
650 
651  diag << "Limiting dt for time interval output at time: " << std::setw(9) << std::setprecision(6)
652  << std::setfill('0') << std::showpoint << std::left << _next_interval_output_time
653  << " dt: " << std::setw(9) << std::setprecision(6) << std::setfill('0') << std::showpoint
654  << std::left << dt_cur << std::endl;
655  }
656 
657  // Adjust to a target time if set
658  if (_target_time > 0 && _time + dt_cur + _timestep_tolerance >= _target_time)
659  {
660  dt_cur = _target_time - _time;
661  _at_sync_point = true;
662 
663  diag << "Limiting dt for target time: " << std::setw(9) << std::setprecision(6)
664  << std::setfill('0') << std::showpoint << std::left << _next_interval_output_time
665  << " dt: " << std::setw(9) << std::setprecision(6) << std::setfill('0') << std::showpoint
666  << std::left << dt_cur << std::endl;
667  }
668 
669  // Constrain by what the multi apps are doing
670  Real multi_app_dt = _problem.computeMultiAppsDT(EXEC_TIMESTEP_BEGIN);
671  if (_use_multiapp_dt || multi_app_dt < dt_cur)
672  {
673  dt_cur = multi_app_dt;
674  _at_sync_point = false;
675  diag << "Limiting dt for MultiApps: " << std::setw(9) << std::setprecision(6)
676  << std::setfill('0') << std::showpoint << std::left << dt_cur << std::endl;
677  }
679  if (multi_app_dt < dt_cur)
680  {
681  dt_cur = multi_app_dt;
682  _at_sync_point = false;
683  diag << "Limiting dt for MultiApps: " << std::setw(9) << std::setprecision(6)
684  << std::setfill('0') << std::showpoint << std::left << dt_cur << std::endl;
685  }
686 
687  if (_verbose)
688  _console << diag.str();
689 
690  return dt_cur;
691 }
692 
693 Real
695 {
696  return _time_stepper->getCurrentDT();
697 }
698 
699 bool
701 {
702  bool keep_going = !_problem.isSolveTerminationRequested();
703 
704  // Check for stop condition based upon steady-state check flag:
706  {
707  // Check solution difference relative norm against steady-state tolerance
709  {
710  _console << "Steady-State Solution Achieved at time: " << _time << std::endl;
711  // Output last solve if not output previously by forcing it
712  keep_going = false;
713  }
714  else // Keep going
715  {
716  // Update solution norm for next time step
718  // Print steady-state relative error norm
719  _console << "Steady-State Relative Differential Norm: " << _sln_diff_norm << std::endl;
720  }
721  }
722 
723  // Check for stop condition based upon number of simulation steps and/or solution end time:
724  if (static_cast<unsigned int>(_t_step) > _num_steps)
725  keep_going = false;
726 
727  if ((_time > _end_time) || (fabs(_time - _end_time) <= _timestep_tolerance))
728  keep_going = false;
729 
730  if (!lastSolveConverged() && _abort)
731  {
732  _console << "Aborting as solve did not converge and input selected to abort" << std::endl;
733  keep_going = false;
734  }
735 
736  return keep_going;
737 }
738 
739 void
741 {
742 }
743 
744 bool
746 {
747  return _multiapps_converged && _time_stepper->converged();
748 }
749 
750 void
752 {
753  _time_stepper->preExecute();
754 }
755 
756 void
758 {
759  _time_stepper->postExecute();
760 }
761 
762 void
763 Transient::setTargetTime(Real target_time)
764 {
765  _target_time = target_time;
766 }
767 
768 Real
770 {
771  return _solution_change_norm;
772 }
773 
774 void
776 {
778  mooseError("You cannot specify time_scheme in the Executioner and independently add a "
779  "TimeIntegrator to the system at the same time");
780 
782  {
783  // backwards compatibility
784  std::string ti_str;
785  using namespace Moose;
786 
787  switch (_time_scheme)
788  {
789  case TI_IMPLICIT_EULER:
790  ti_str = "ImplicitEuler";
791  break;
792  case TI_EXPLICIT_EULER:
793  ti_str = "ExplicitEuler";
794  break;
795  case TI_CRANK_NICOLSON:
796  ti_str = "CrankNicolson";
797  break;
798  case TI_BDF2:
799  ti_str = "BDF2";
800  break;
802  ti_str = "ExplicitMidpoint";
803  break;
804  case TI_LSTABLE_DIRK2:
805  ti_str = "LStableDirk2";
806  break;
808  ti_str = "ExplicitTVDRK2";
809  break;
810  default:
811  mooseError("Unknown scheme");
812  break;
813  }
814 
815  InputParameters params = _app.getFactory().getValidParams(ti_str);
816  _problem.addTimeIntegrator(ti_str, ti_str, params);
817  }
818 }
819 
820 std::string
822 {
823  if (_time_stepper)
824  {
825  TimeStepper & ts = *_time_stepper;
826  return demangle(typeid(ts).name());
827  }
828  else
829  return std::string();
830 }
831 
832 Real
834 {
835  const NumericVector<Number> & current_solution =
837  const NumericVector<Number> & old_solution = _problem.getNonlinearSystemBase().solutionOld();
838 
839  _sln_diff = current_solution;
840  _sln_diff -= old_solution;
841 
842  return (_sln_diff.l2_norm() / current_solution.l2_norm());
843 }
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:47
virtual const NumericVector< Number > *& currentSolution() override
The solution vector that is currently being operated on.
Moose::TimeIntegratorType _time_scheme
Definition: Transient.h:222
bool hasStartTime()
Definition: MooseApp.h:190
virtual Real getDT()
Definition: Transient.C:694
bool hasTimeIntegrator() const
Returns whether or not this Problem has a TimeIntegrator.
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:724
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
Definition: Factory.C:46
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:36
Real & _unconstrained_dt
Definition: Transient.h:235
virtual bool lastSolveConverged() override
Whether or not the last solve converged.
Definition: Transient.C:745
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was by the user.
virtual bool isSolveTerminationRequested()
Check of termination has been requested.
Definition: Problem.h:51
Real _picard_abs_tol
Definition: Transient.h:293
bool & _picard_converged
Definition: Transient.h:288
NonlinearSystemBase & getNonlinearSystemBase()
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition: MooseApp.C:607
virtual void setTargetTime(Real target_time)
Can be used to set the next "target time" which is a time to nail perfectly.
Definition: Transient.C:763
Real _prev_time
The _time when this app solved last.
Definition: Transient.h:311
virtual NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:490
Object is evaluated only once at the beginning of the simulation.
Definition: MooseTypes.h:94
virtual void postExecute()
Method called at the end of the simulation.
InputParameters getValidParams(const std::string &name)
Get valid parameters for the object.
Definition: Factory.C:26
virtual NumericVector< Number > & solutionOld()=0
virtual void computeDT()
Definition: Transient.C:347
Real _picard_max_its
Definition: Transient.h:287
Real & _picard_initial_norm
Definition: Transient.h:289
FEProblemBase & _problem
Here for backward compatibility.
Definition: Transient.h:220
virtual void computeMarkers()
int _n_startup_steps
Definition: Transient.h:256
virtual void init() override
Initialize the executioner.
Definition: Transient.C:236
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
void updateActiveObjects()
Update the active objects in the warehouses.
void setDecomposition(const std::vector< std::string > &decomposition)
If called with a single string, it is used as the name of a the top-level decomposition split...
Base class for time stepping.
Definition: TimeStepper.h:31
virtual void execute() override
Pure virtual execute function MUST be overridden by children classes.
Definition: Transient.C:298
virtual void endStep(Real input_time=-1.0)
Definition: Transient.C:586
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void onTimestepEnd() override
bool halfTransient()
Whether or not this simulation should only run half its transient (useful for testing recovery) ...
Definition: MooseApp.h:339
virtual void postExecute() override
Override this for actions that should take place after execution.
Definition: Transient.C:757
bool & _multiapps_converged
Whether or not the multiapps failed during the last timestem.
Definition: Transient.h:242
bool haveXFEM()
Find out whether the current analysis is using XFEM.
unsigned int _steps_taken
Definition: Transient.h:257
Real & _picard_timestep_end_norm
Definition: Transient.h:291
Real _relax_factor
Relaxation factor for Picard Iteration.
Definition: Transient.h:306
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
bool _xfem_repeat_step
Whether step should be repeated due to xfem modifying the mesh.
Definition: Transient.h:248
Object is evaluated at the end of every time step.
Definition: MooseTypes.h:100
Real computeMultiAppsDT(ExecFlagType type)
Find the smallest timestep over all MultiApps.
Factory & getFactory()
Retrieve the Factory associated with this App.
Definition: MooseApp.h:253
unsigned int _xfem_update_count
Definition: Transient.h:249
virtual void timestepSetup()
virtual void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:665
InputParameters validParams< Transient >()
Definition: Transient.C:44
std::string _restart_file_base
Definition: Executioner.h:133
Real & _time_old
Previous time.
Definition: Transient.h:230
Grab all the local dof indices for the variables passed in, in the system passed in.
virtual NumericVector< Number > & solution() override
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep...
bool & _time_interval
if to use time interval output
Definition: Transient.h:273
std::shared_ptr< TimeStepper > _time_stepper
Definition: Transient.h:223
virtual void solveStep(Real input_dt=-1.0)
This should execute the solve for one timestep.
Definition: Transient.C:421
void execute(const ExecFlagType &exec_type)
Convenience function for performing execution of MOOSE systems.
virtual void takeStep(Real input_dt=-1.0)
Do whatever is necessary to advance one step.
Definition: Transient.C:392
Transient(const InputParameters &parameters)
Constructor.
Definition: Transient.C:143
unsigned int _num_steps
Definition: Transient.h:255
virtual Real computeConstrainedDT()
Definition: Transient.C:613
void setStartTime(const Real time)
Set the starting time for the simulation.
Definition: MooseApp.C:827
std::set< dof_id_type > _all_dof_indices
Real getStartTime()
Definition: MooseApp.h:195
std::vector< std::string > _relaxed_vars
The transferred variables that are going to be relaxed.
Definition: Transient.h:314
int & _picard_it
Picard Related.
Definition: Transient.h:286
virtual void computeIndicators()
virtual bool updateMeshXFEM()
Update the mesh due to changing XFEM cuts.
bool _use_multiapp_dt
Definition: Transient.h:280
virtual void addTimeIntegrator(const std::string &type, const std::string &name, InputParameters parameters)
bool _verbose
should detailed diagnostic output be printed
Definition: Transient.h:296
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:37
InputParameters validParams< Executioner >()
Definition: Executioner.C:30
virtual void adaptMesh()
bool isParamSetByAddParam(const std::string &name) const
Returns whether or not the parameter was set due to addParam.
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:41
Real & _target_time
Definition: Transient.h:279
bool & _first
Is it our first time through the execution loop?
Definition: Transient.h:239
void setupTimeIntegrator()
Definition: Transient.C:775
Real _start_time
Definition: Transient.h:277
virtual void incrementStepOrReject()
This is where the solve step is actually incremented.
Definition: Transient.C:353
std::set< dof_id_type > _relaxed_dofs
The DoFs associates with all of the relaxed variables.
Definition: Transient.h:317
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
Definition: MooseObject.h:111
virtual void estimateTimeError()
Definition: Transient.C:740
Real & _sln_diff_norm
Definition: Transient.h:265
Real _timestep_tolerance
Definition: Transient.h:278
void backupMultiApps(ExecFlagType type)
Backup the MultiApps associated with the ExecFlagType.
std::vector< std::string > _splitting
Definition: Executioner.h:136
bool _trans_ss_check
Steady state detection variables:
Definition: Transient.h:262
bool _abort
Definition: Transient.h:270
Real & _dt
Current delta t... or timestep size.
Definition: Transient.h:232
unsigned int _max_xfem_update
Definition: Transient.h:250
Real & _dt_old
Definition: Transient.h:233
virtual void preExecute() override
Override this for actions that should take place before execution.
Definition: Transient.C:751
Real _time_interval_output_interval
Definition: Transient.h:275
NumericVector< Number > & _sln_diff
The difference of current and old solutions.
Definition: Transient.h:301
Real & _picard_timestep_begin_norm
Definition: Transient.h:290
bool & _at_sync_point
Definition: Transient.h:236
virtual void preSolve()
Override this for actions that should take place before execution.
Definition: Executioner.C:145
Forces execution on failed solve (output only)
Definition: MooseTypes.h:108
Real & _time
Current time.
Definition: Transient.h:228
Real _solution_change_norm
Definition: Transient.h:298
Real _ss_tmin
Definition: Transient.h:264
virtual System & system() override
Get the reference to the libMesh system.
Real _picard_rel_tol
Definition: Transient.h:292
void restoreMultiApps(ExecFlagType type, bool force=false)
Restore the MultiApps associated with the ExecFlagType.
void setRestartFile(const std::string &file_name)
Communicate to the Resurector the name of the restart filer.
virtual void onTimestepBegin() override
Nonlinear system to be solved.
virtual Real relativeSolutionDifferenceNorm()
The relative L2 norm of the difference between solution and old solution vector.
Definition: Transient.C:833
MooseApp & _app
The MooseApp this object is associated with.
Definition: MooseObject.h:108
virtual Real computeResidualL2Norm()
Computes the residual using whatever is sitting in the current solution vector then returns the L2 no...
Real & _old_time_solution_norm
Definition: Transient.h:266
virtual void transient(bool trans)
virtual MooseMesh & mesh() override
TimeIntegratorType
Time integrators.
Definition: MooseTypes.h:304
Object is evaluated at the end of the simulations (output only)
Definition: MooseTypes.h:104
virtual void preStep()
Definition: Transient.C:286
Object is evaluated at the beginning of every time step.
Definition: MooseTypes.h:102
virtual bool keepGoing()
Transient loop will continue as long as this keeps returning true.
Definition: Transient.C:700
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
virtual void initialSetup()
bool isRestarting() const
Whether or not this is a "restart" calculation.
Definition: MooseApp.C:613
Definition: Moose.h:84
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
Real _end_time
Definition: Transient.h:252
bool execMultiApps(ExecFlagType type, bool auto_advance=true)
Execute the MultiApps associated with the ExecFlagType.
virtual void postSolve()
Override this for actions that should take place after execution.
Definition: Executioner.C:150
virtual void postStep()
Definition: Transient.C:292
virtual NonlinearSystem & getNonlinearSystem()
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector.
Definition: SystemBase.C:598
void advanceMultiApps(ExecFlagType type)
Advance the MultiApps associated with the ExecFlagType.
Real _next_interval_output_time
Definition: Transient.h:274
int & _t_step
Current timestep.
Definition: Transient.h:226
virtual void outputStep(ExecFlagType type)
Output the current step.
virtual std::string getTimeStepperName() override
Get the timestepper.
Definition: Transient.C:821
Real getSolutionChangeNorm()
Get the Relative L2 norm of the change in the solution.
Definition: Transient.C:769
void execTransfers(ExecFlagType type)
Execute the Transfers associated with the ExecFlagType.
Real _ss_check_tol
Definition: Transient.h:263
bool & _last_solve_converged
Whether or not the last solve converged.
Definition: Transient.h:245
FEProblemBase & _fe_problem
Definition: Executioner.h:126
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...