www.mooseframework.org
TransientMultiApp.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 // MOOSE includes
11 #include "TransientMultiApp.h"
12 
14 #include "AuxiliarySystem.h"
15 #include "Console.h"
16 #include "LayeredSideFluxAverage.h"
17 #include "MooseMesh.h"
18 #include "Output.h"
19 #include "TimeStepper.h"
20 #include "Transient.h"
21 #include "NonlinearSystem.h"
22 
23 #include "libmesh/mesh_tools.h"
24 #include "libmesh/numeric_vector.h"
25 
27 
29 
32 {
35  params.addClassDescription("MultiApp for performing coupled simulations with the master and "
36  "sub-application both progressing in time.");
37 
38  params.addParam<bool>("sub_cycling",
39  false,
40  "Set to true to allow this MultiApp to take smaller "
41  "timesteps than the rest of the simulation. More "
42  "than one timestep will be performed for each "
43  "'master' timestep");
44 
45  params.addParam<bool>("interpolate_transfers",
46  false,
47  "Only valid when sub_cycling. This allows "
48  "transferred values to be interpolated "
49  "over the time frame the MultiApp is "
50  "executing over when sub_cycling");
51 
52  params.addParam<bool>("detect_steady_state",
53  false,
54  "If true then while sub_cycling a steady state check will be "
55  "done. In this mode output will only be done once the "
56  "MultiApp reaches the target time or steady state is reached");
57 
58  params.addParam<Real>("steady_state_tol",
59  1e-8,
60  "The relative difference between the new "
61  "solution and the old solution that will be "
62  "considered to be at steady state");
63 
64  params.addParam<bool>("output_sub_cycles", false, "If true then every sub-cycle will be output.");
65  params.addParam<bool>(
66  "print_sub_cycles", true, "Toggle the display of sub-cycles on the screen.");
67 
68  params.addParam<unsigned int>(
69  "max_failures", 0, "Maximum number of solve failures tolerated while sub_cycling.");
70 
71  params.addParam<bool>("tolerate_failure",
72  false,
73  "If true this MultiApp won't participate in dt "
74  "decisions and will always be fast-forwarded to "
75  "the current time.");
76 
77  params.addParam<bool>(
78  "catch_up",
79  false,
80  "If true this will allow failed solves to attempt to 'catch up' using smaller timesteps.");
81 
82  params.addParam<bool>("keep_solution_during_restore",
83  false,
84  "This is useful when doing Picard with catch_up steps. It takes the "
85  "solution from the final catch_up step and re-uses it as the initial guess "
86  "for the next picard iteration");
87 
88  params.addParam<Real>("max_catch_up_steps",
89  2,
90  "Maximum number of steps to allow an app to take "
91  "when trying to catch back up after a failed "
92  "solve.");
93 
94  return params;
95 }
96 
98  : MultiApp(parameters),
99  _sub_cycling(getParam<bool>("sub_cycling")),
100  _interpolate_transfers(getParam<bool>("interpolate_transfers")),
101  _detect_steady_state(getParam<bool>("detect_steady_state")),
102  _steady_state_tol(getParam<Real>("steady_state_tol")),
103  _output_sub_cycles(getParam<bool>("output_sub_cycles")),
104  _max_failures(getParam<unsigned int>("max_failures")),
105  _tolerate_failure(getParam<bool>("tolerate_failure")),
106  _failures(0),
107  _catch_up(getParam<bool>("catch_up")),
108  _max_catch_up_steps(getParam<Real>("max_catch_up_steps")),
109  _keep_solution_during_restore(getParam<bool>("keep_solution_during_restore")),
110  _first(declareRecoverableData<bool>("first", true)),
111  _auto_advance(false),
112  _print_sub_cycles(getParam<bool>("print_sub_cycles"))
113 {
114  // Transfer interpolation only makes sense for sub-cycling solves
116  paramError("interpolate_transfers",
117  "MultiApp ",
118  name(),
119  " is set to interpolate_transfers but is not sub_cycling! That is not valid!");
120 
121  // Subcycling overrides catch up, we don't want to confuse users by allowing them to set both.
122  if (_sub_cycling && _catch_up)
123  paramError("catch_up",
124  "MultiApp ",
125  name(),
126  " \"sub_cycling\" and \"catch_up\" cannot both be set to true simultaneously.");
127 
129  paramError("keep_solution_during_restore",
130  "In MultiApp ",
131  name(),
132  " it doesn't make any sense to keep a solution during restore when doing "
133  "sub_cycling. Consider trying \"catch_up\" steps instead");
134 
136  paramError("keep_solution_during_restore",
137  "In MultiApp ",
138  name(),
139  " \"keep_solution_during_restore\" requires \"catch_up = true\". Either disable "
140  "\"keep_solution_during_restart\" or set \"catch_up = true\"");
141 
143  paramInfo("tolerate_failure",
144  "In MultiApp ",
145  name(),
146  " both \"sub_cycling\" and \"tolerate_failure\" are set to true. \"tolerate_failure\""
147  " will be ignored.");
148 }
149 
150 NumericVector<Number> &
151 TransientMultiApp::appTransferVector(unsigned int app, std::string var_name)
152 {
153  if (std::find(_transferred_vars.begin(), _transferred_vars.end(), var_name) ==
154  _transferred_vars.end())
155  _transferred_vars.push_back(var_name);
156 
158  return appProblemBase(app).getAuxiliarySystem().system().get_vector("transfer");
159 
161 }
162 
163 void
165 {
167 
168  if (!_has_an_app)
169  return;
170 
172 
173  if (_has_an_app)
174  {
176  // Grab Transient Executioners from each app
177  for (unsigned int i = 0; i < _my_num_apps; i++)
178  setupApp(i);
179  }
180 }
181 
182 void
184 {
185  // Must be restarting / recovering so hold off on restoring
186  // Instead - the restore will happen in createApp()
187  // Note that _backups was already populated by dataLoad()
188  if (_apps.empty())
189  return;
190 
192  {
194 
195  for (unsigned int i = 0; i < _my_num_apps; i++)
196  _end_solutions[i] =
198  }
199 
201 
203  {
204  for (unsigned int i = 0; i < _my_num_apps; i++)
206 
207  _end_solutions.clear();
208  }
209 }
210 
211 bool
212 TransientMultiApp::solveStep(Real dt, Real target_time, bool auto_advance)
213 {
214  if (!_has_an_app)
215  return true;
216 
217  _auto_advance = auto_advance;
218 
219  _console << COLOR_CYAN << "Solving MultiApp '" << name() << "' with target time " << target_time
220  << " and dt " << dt << " with auto-advance " << (auto_advance ? "on" : "off")
221  << COLOR_DEFAULT << std::endl;
222 
223  // "target_time" must always be in global time
224  target_time += _app.getGlobalTimeOffset();
225 
227  bool return_value = true;
228 
229  // Make sure we swap back the communicator regardless of how this routine is exited
230  try
231  {
232  int rank;
233  int ierr;
234  ierr = MPI_Comm_rank(_communicator.get(), &rank);
235  mooseCheckMPIErr(ierr);
236 
237  for (unsigned int i = 0; i < _my_num_apps; i++)
238  {
240 
242 
243  // The App might have a different local time from the rest of the problem
244  Real app_time_offset = _apps[i]->getGlobalTimeOffset();
245 
246  // Maybe this MultiApp was already solved
247  if ((ex->getTime() + app_time_offset + 2e-14 >= target_time) ||
248  (ex->getTime() >= ex->endTime()))
249  continue;
250 
251  if (_sub_cycling)
252  {
253  Real time_old = ex->getTime() + app_time_offset;
254 
256  {
257  AuxiliarySystem & aux_system = problem.getAuxiliarySystem();
258  System & libmesh_aux_system = aux_system.system();
259 
260  NumericVector<Number> & solution = *libmesh_aux_system.solution;
261  NumericVector<Number> & transfer_old = libmesh_aux_system.get_vector("transfer_old");
262 
263  solution.close();
264 
265  // Save off the current auxiliary solution
266  transfer_old = solution;
267 
268  transfer_old.close();
269 
270  // Snag all of the local dof indices for all of these variables
271  AllLocalDofIndicesThread aldit(libmesh_aux_system, _transferred_vars);
272  ConstElemRange & elem_range = *problem.mesh().getActiveLocalElementRange();
273  Threads::parallel_reduce(elem_range, aldit);
274 
276  }
277 
278  // Disable/enable output for sub cycling
279  problem.allowOutput(_output_sub_cycles); // disables all outputs, including console
280  problem.allowOutput<Console>(_print_sub_cycles); // re-enables Console to print, if desired
281 
282  ex->setTargetTime(target_time - app_time_offset);
283 
284  // unsigned int failures = 0;
285 
286  bool at_steady = false;
287 
288  if (_first && !_app.isRecovering())
289  problem.advanceState();
290 
291  bool local_first = _first;
292 
293  // Now do all of the solves we need
294  while ((!at_steady && ex->getTime() + app_time_offset + 2e-14 < target_time) ||
295  !ex->lastSolveConverged())
296  {
297  if (local_first != true)
298  ex->incrementStepOrReject();
299 
300  local_first = false;
301 
302  ex->preStep();
303  ex->computeDT();
304 
306  {
307  // See what time this executioner is going to go to.
308  Real future_time = ex->getTime() + app_time_offset + ex->getDT();
309 
310  // How far along we are towards the target time:
311  Real step_percent = (future_time - time_old) / (target_time - time_old);
312 
313  Real one_minus_step_percent = 1.0 - step_percent;
314 
315  // Do the interpolation for each variable that was transferred to
317  AuxiliarySystem & aux_system = problem.getAuxiliarySystem();
318  System & libmesh_aux_system = aux_system.system();
319 
320  NumericVector<Number> & solution = *libmesh_aux_system.solution;
321  NumericVector<Number> & transfer = libmesh_aux_system.get_vector("transfer");
322  NumericVector<Number> & transfer_old = libmesh_aux_system.get_vector("transfer_old");
323 
324  solution.close(); // Just to be sure
325  transfer.close();
326  transfer_old.close();
327 
328  for (const auto & dof : _transferred_dofs)
329  {
330  solution.set(dof,
331  (transfer_old(dof) * one_minus_step_percent) +
332  (transfer(dof) * step_percent));
333  // solution.set(dof, transfer_old(dof));
334  // solution.set(dof, transfer(dof));
335  // solution.set(dof, 1);
336  }
337 
338  solution.close();
339  }
340 
341  ex->takeStep();
342 
343  bool converged = ex->lastSolveConverged();
344 
345  if (!converged)
346  {
347  mooseWarning(
348  "While sub_cycling ", name(), _first_local_app + i, " failed to converge!\n");
349 
350  _failures++;
351 
352  if (_failures > _max_failures)
353  {
354  std::stringstream oss;
355  oss << "While sub_cycling " << name() << _first_local_app << i << " REALLY failed!";
356  throw MultiAppSolveFailure(oss.str());
357  }
358  }
359 
360  Real solution_change_norm = ex->getSolutionChangeNorm();
361 
363  _console << "Solution change norm: " << solution_change_norm << std::endl;
364 
365  if (converged && _detect_steady_state && solution_change_norm < _steady_state_tol)
366  {
367  _console << "Detected Steady State! Fast-forwarding to " << target_time << std::endl;
368 
369  at_steady = true;
370 
371  // Indicate that the next output call (occurs in ex->endStep()) should output,
372  // regardless of intervals etc...
373  problem.forceOutput();
374 
375  // Clean up the end
376  ex->endStep(target_time - app_time_offset);
377  ex->postStep();
378  }
379  else
380  {
381  ex->endStep();
382  ex->postStep();
383  }
384  }
385 
386  // If we were looking for a steady state, but didn't reach one, we still need to output one
387  // more time, regardless of interval
388  // Note: if we turn off the output for all time steps for sub-scycling, we still need to
389  // have one output at the end.
390  if ((!at_steady && _detect_steady_state) || !_output_sub_cycles)
391  problem.outputStep(EXEC_FORCED);
392 
393  } // sub_cycling
394  else if (_tolerate_failure)
395  {
396  ex->takeStep(dt);
397  ex->endStep(target_time - app_time_offset);
398  ex->postStep();
399  }
400  else
401  {
402  if (_first && !_app.isRecovering())
403  problem.advanceState();
404 
405  if (auto_advance)
406  problem.allowOutput(true);
407 
408  ex->takeStep(dt);
409 
410  if (auto_advance)
411  {
412  ex->endStep();
413  ex->postStep();
414 
415  if (!ex->lastSolveConverged())
416  {
417  mooseWarning(name(), _first_local_app + i, " failed to converge!\n");
418 
419  if (_catch_up)
420  {
421  _console << "Starting Catch Up!" << std::endl;
422 
423  bool caught_up = false;
424 
425  unsigned int catch_up_step = 0;
426 
427  Real catch_up_dt = dt / 2;
428 
429  while (!caught_up && catch_up_step < _max_catch_up_steps)
430  {
431  _console << "Solving " << name() << " catch up step " << catch_up_step << std::endl;
432  ex->incrementStepOrReject();
433 
434  ex->computeDT();
435  ex->takeStep(catch_up_dt); // Cut the timestep in half to try two half-step solves
436  ex->endStep();
437 
438  if (ex->lastSolveConverged())
439  {
440  if (ex->getTime() + app_time_offset +
441  (ex->timestepTol() * std::abs(ex->getTime())) >=
442  target_time)
443  {
444  problem.outputStep(EXEC_FORCED);
445  caught_up = true;
446  }
447  }
448  else
449  catch_up_dt /= 2.0;
450 
451  ex->postStep();
452 
453  catch_up_step++;
454  }
455 
456  if (!caught_up)
457  throw MultiAppSolveFailure(name() + " Failed to catch up!\n");
458  }
459  }
460  }
461  else // auto_advance == false
462  {
463  if (!ex->lastSolveConverged())
464  {
465  // Even if we don't allow auto_advance - we can still catch up to the current time if
466  // possible
467  if (_catch_up)
468  {
469  _console << "Starting Catch Up!" << std::endl;
470 
471  bool caught_up = false;
472 
473  unsigned int catch_up_step = 0;
474 
475  Real catch_up_dt = dt / 2;
476 
477  // Note: this loop will _break_ if target_time is satisfied
478  while (catch_up_step < _max_catch_up_steps)
479  {
480  _console << "Solving " << name() << " catch up step " << catch_up_step << std::endl;
481  ex->incrementStepOrReject();
482 
483  ex->computeDT();
484  ex->takeStep(catch_up_dt); // Cut the timestep in half to try two half-step solves
485 
486  // This is required because we can't call endStep() yet
487  // (which normally increments time)
488  Real current_time = ex->getTime() + ex->getDT();
489 
490  if (ex->lastSolveConverged())
491  {
492  if (current_time + app_time_offset +
493  (ex->timestepTol() * std::abs(current_time)) >=
494  target_time)
495  {
496  caught_up = true;
497  break; // break here so that we don't run endStep() or postStep() since this
498  // MultiApp should NOT be auto_advanced
499  }
500  }
501  else
502  catch_up_dt /= 2.0;
503 
504  ex->endStep();
505  ex->postStep();
506 
507  catch_up_step++;
508  }
509 
510  if (!caught_up)
511  throw MultiAppSolveFailure(name() + " Failed to catch up!\n");
512  }
513  else
514  throw MultiAppSolveFailure(name() + " failed to converge");
515  }
516  }
517  }
518 
519  // Re-enable all output (it may of been disabled by sub-cycling)
520  problem.allowOutput(true);
521  }
522 
523  _first = false;
524 
525  _console << "Successfully Solved MultiApp " << name() << "." << std::endl;
526  }
527  catch (MultiAppSolveFailure & e)
528  {
529  mooseWarning(e.what());
530  _console << "Failed to Solve MultiApp " << name() << ", attempting to recover." << std::endl;
531  return_value = false;
532  }
533 
534  _transferred_vars.clear();
535 
536  return return_value;
537 }
538 
539 void
541 {
542  if (!_sub_cycling)
543  {
544  for (unsigned int i = 0; i < _my_num_apps; i++)
545  {
547 
548  // The App might have a different local time from the rest of the problem
549  Real app_time_offset = _apps[i]->getGlobalTimeOffset();
550 
551  // Only increment the step if we are after (target_time) the
552  // start_time (app_time_offset) of this sub_app.
553  if (app_time_offset < target_time)
554  ex->incrementStepOrReject();
555  }
556  }
557 }
558 
559 void
561 {
562  if (!_sub_cycling)
563  {
564  for (unsigned int i = 0; i < _my_num_apps; i++)
565  {
567  ex->endStep();
568  ex->postStep();
569  }
570  }
571 }
572 
573 bool
575 {
577 }
578 
579 Real
581 {
582  if (_sub_cycling) // Bow out of the timestep selection dance
583  return std::numeric_limits<Real>::max();
584 
585  Real smallest_dt = std::numeric_limits<Real>::max();
586 
587  if (_has_an_app)
588  {
590 
591  for (unsigned int i = 0; i < _my_num_apps; i++)
592  {
594  ex->computeDT();
595  Real dt = ex->getDT();
596 
597  smallest_dt = std::min(dt, smallest_dt);
598  }
599  }
600 
601  if (_tolerate_failure) // Bow out of the timestep selection dance, we do this down here because we
602  // need to call computeConstrainedDT at least once for these
603  // executioners...
604  return std::numeric_limits<Real>::max();
605 
606  _communicator.min(smallest_dt);
607  return smallest_dt;
608 }
609 
611  unsigned int global_app,
612  Real /*time*/) // FIXME: Note that we are passing in time but also grabbing it below
613 {
614  if (hasLocalApp(global_app))
615  {
616  unsigned int local_app = globalAppToLocal(global_app);
617 
618  // Grab the current time the App is at so we can start the new one at the same place
619  Real time =
620  _transient_executioners[local_app]->getTime() + _apps[local_app]->getGlobalTimeOffset();
621 
622  // Reset the Multiapp
623  MultiApp::resetApp(global_app, time);
624 
626 
627  // Setup the app, disable the output so that the initial condition does not output
628  // When an app is reset the initial condition was effectively already output before reset
629  FEProblemBase & problem = appProblemBase(local_app);
630  problem.allowOutput(false);
631  setupApp(local_app, time);
632  problem.allowOutput(true);
633  }
634 }
635 
636 void TransientMultiApp::setupApp(unsigned int i, Real /*time*/) // FIXME: Should we be passing time?
637 {
638  auto & app = _apps[i];
639  Transient * ex = dynamic_cast<Transient *>(app->getExecutioner());
640  if (!ex)
641  mooseError("MultiApp ", name(), " is not using a Transient Executioner!");
642 
643  // Get the FEProblemBase for the current MultiApp
645 
646  // Update the file numbers for the outputs from the parent application
647  app->getOutputWarehouse().setFileNumbers(_app.getOutputFileNumbers());
648 
649  // Call initialization method of Executioner (Note, this preforms the output of the initial time
650  // step, if desired)
651  ex->init();
652 
654  {
655  AuxiliarySystem & aux_system = problem.getAuxiliarySystem();
656  System & libmesh_aux_system = aux_system.system();
657 
658  // We'll store a copy of the auxiliary system's solution at the old time in here
659  libmesh_aux_system.add_vector("transfer_old", false);
660 
661  // This will be where we'll transfer the value to for the "target" time
662  libmesh_aux_system.add_vector("transfer", false);
663  }
664 
665  ex->preExecute();
666  if (!_app.isRecovering())
667  {
668  problem.timeStep()++;
669  problem.advanceState();
670  }
671  _transient_executioners[i] = ex;
672 }
MultiApp::_my_comm
MPI_Comm & _my_comm
The MPI communicator this object is going to use.
Definition: MultiApp.h:360
TransientMultiApp::incrementTStep
virtual void incrementTStep(Real target_time) override
Advances the multi-apps time step which is important for dt selection.
Definition: TransientMultiApp.C:540
Transient
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:30
Transient::computeDT
virtual void computeDT()
Definition: Transient.C:341
TransientMultiApp::_print_sub_cycles
bool _print_sub_cycles
Flag for toggling console output on sub cycles.
Definition: TransientMultiApp.h:100
TransientMultiApp::_interpolate_transfers
bool _interpolate_transfers
Definition: TransientMultiApp.h:69
AllLocalDofIndicesThread.h
Moose::ScopedCommSwapper
Definition: Moose.h:216
MultiApp::_my_num_apps
unsigned int _my_num_apps
The number of apps this object is involved in simulating.
Definition: MultiApp.h:348
TransientMultiApp::restore
virtual void restore() override
Restore the state of every Sub App.
Definition: TransientMultiApp.C:183
TransientMultiApp::solveStep
virtual bool solveStep(Real dt, Real target_time, bool auto_advance=true) override
Re-solve all of the Apps.
Definition: TransientMultiApp.C:212
MultiApp::appProblemBase
FEProblemBase & appProblemBase(unsigned int app)
Get the FEProblemBase for the global app is part of.
Definition: MultiApp.C:494
AuxiliarySystem::solution
NumericVector< Number > & solution() override
Definition: AuxiliarySystem.h:161
TransientMultiApp::_auto_advance
bool _auto_advance
Definition: TransientMultiApp.h:95
TransientMultiApp::initialSetup
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
Definition: TransientMultiApp.C:164
TransientMultiApp
MultiApp Implementation for Transient Apps.
Definition: TransientMultiApp.h:28
MooseMesh.h
TransientMultiApp::_catch_up
bool _catch_up
Definition: TransientMultiApp.h:79
AuxiliarySystem
A system that holds auxiliary variables.
Definition: AuxiliarySystem.h:40
AuxiliarySystem.h
MooseObject::mooseError
void mooseError(Args &&... args) const
Definition: MooseObject.h:141
FEProblemBase::getNonlinearSystem
virtual NonlinearSystem & getNonlinearSystem()
Definition: FEProblemBase.C:1925
TransientMultiApp::validParams
static InputParameters validParams()
Definition: TransientMultiApp.C:31
TransientInterface::validParams
static InputParameters validParams()
Definition: TransientInterface.C:16
TransientMultiApp::_max_catch_up_steps
Real _max_catch_up_steps
Definition: TransientMultiApp.h:80
TransientMultiApp::_max_failures
unsigned int _max_failures
Definition: TransientMultiApp.h:74
MooseMesh::getActiveLocalElementRange
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems,...
Definition: MooseMesh.C:758
FEProblemBase::timeStep
virtual int & timeStep() const
Definition: FEProblemBase.h:442
std::abs
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
FEProblemBase::allowOutput
void allowOutput(bool state)
Ability to enable/disable all output calls.
Definition: FEProblemBase.C:4813
EXEC_FORCED
const ExecFlagType EXEC_FORCED
MultiApp::validParams
static InputParameters validParams()
Definition: MultiApp.C:44
MultiApp::getExecutioner
virtual Executioner * getExecutioner(unsigned int app)
Definition: MultiApp.C:373
InputParameters::addParam
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.
Definition: InputParameters.h:1198
Transient::preExecute
virtual void preExecute() override
Override this for actions that should take place before execution.
Definition: Transient.C:260
FEProblemBase::advanceState
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep.
Definition: FEProblemBase.C:4744
Transient::postStep
virtual void postStep()
Definition: Transient.C:293
Executioner::feProblem
FEProblemBase & feProblem()
Return a reference to this Executioner's FEProblemBase instance.
Definition: Executioner.C:102
Transient::setTargetTime
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:628
MultiApp::hasLocalApp
bool hasLocalApp(unsigned int global_app)
Whether or not the given global app number is on this processor.
Definition: MultiApp.C:542
MultiApp::globalAppToLocal
unsigned int globalAppToLocal(unsigned int global_app)
Map a global App number to the local number.
Definition: MultiApp.C:809
TransientMultiApp::resetApp
virtual void resetApp(unsigned int global_app, Real time) override
"Reset" the App corresponding to the global App number passed in.
Definition: TransientMultiApp.C:610
Transient::timestepTol
Real & timestepTol()
Get the timestep tolerance.
Definition: Transient.h:174
TransientMultiApp.h
MultiApp::_has_an_app
bool _has_an_app
Whether or not this processor as an App at all
Definition: MultiApp.h:420
TransientMultiApp::_keep_solution_during_restore
bool _keep_solution_during_restore
Definition: TransientMultiApp.h:82
AllLocalDofIndicesThread::_all_dof_indices
std::set< dof_id_type > _all_dof_indices
Definition: AllLocalDofIndicesThread.h:38
TransientMultiApp::_end_solutions
std::vector< std::unique_ptr< NumericVector< Real > > > _end_solutions
The solution from the end of the previous solve, this is cloned from the Nonlinear solution during re...
Definition: TransientMultiApp.h:103
MultiApp
A MultiApp represents one or more MOOSE applications that are running simultaneously.
Definition: MultiApp.h:57
Transient::getSolutionChangeNorm
Real getSolutionChangeNorm()
Get the Relative L2 norm of the change in the solution.
Definition: Transient.C:634
LayeredSideFluxAverage.h
NonlinearSystemBase::solution
NumericVector< Number > & solution() override
Definition: NonlinearSystemBase.h:615
Transient::preStep
virtual void preStep()
Definition: Transient.C:287
MooseObject::paramError
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition: MooseObject.h:215
ConsoleStreamInterface::_console
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
Definition: ConsoleStreamInterface.h:31
Transient::endStep
virtual void endStep(Real input_time=-1.0)
Definition: Transient.C:450
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
TransientMultiApp::_steady_state_tol
Real _steady_state_tol
Definition: TransientMultiApp.h:71
TransientMultiApp::setupApp
void setupApp(unsigned int i, Real time=0.0)
Setup the executioner for the local app.
Definition: TransientMultiApp.C:636
MultiApp::_apps
std::vector< std::shared_ptr< MooseApp > > _apps
Pointers to each of the Apps.
Definition: MultiApp.h:375
Transient::lastSolveConverged
virtual bool lastSolveConverged() const override
Whether or not the last solve converged.
Definition: Transient.C:616
TimeStepper.h
Console.h
NonlinearSystem.h
registerMooseObject
registerMooseObject("MooseApp", TransientMultiApp)
TransientMultiApp::needsRestoration
virtual bool needsRestoration() override
Whether or not this MultiApp should be restored at the beginning of each Picard iteration.
Definition: TransientMultiApp.C:574
TransientMultiApp::_detect_steady_state
bool _detect_steady_state
Definition: TransientMultiApp.h:70
TransientMultiApp::_transient_executioners
std::vector< Transient * > _transient_executioners
Definition: TransientMultiApp.h:66
FEProblemBase::forceOutput
void forceOutput()
Indicates that the next call to outputStep should be forced.
Definition: FEProblemBase.C:4819
AllLocalDofIndicesThread
Grab all the local dof indices for the variables passed in, in the system passed in.
Definition: AllLocalDofIndicesThread.h:27
TransientMultiApp::_transferred_dofs
std::set< dof_id_type > _transferred_dofs
The DoFs associated with all of the currently transferred variables.
Definition: TransientMultiApp.h:91
InputParameters::addClassDescription
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.
Definition: InputParameters.C:70
MultiAppSolveFailure
Utility class for catching solve failure errors so that MOOSE can recover state before continuing.
Definition: TransientMultiApp.h:110
ierr
ierr
Definition: PetscDMMoose.C:1270
Transient::init
virtual void init() override
Initialize the executioner.
Definition: Transient.C:203
Output.h
MooseApp::getOutputFileNumbers
const std::map< std::string, unsigned int > & getOutputFileNumbers() const
Store a map of outputter names and file numbers The MultiApp system requires this to get the file num...
Definition: MooseApp.h:435
MultiApp::restore
virtual void restore()
Restore the state of every Sub App.
Definition: MultiApp.C:416
TransientMultiApp::_first
bool & _first
Is it our first time through the execution loop?
Definition: TransientMultiApp.h:85
Transient::incrementStepOrReject
virtual void incrementStepOrReject()
This is where the solve step is actually incremented.
Definition: Transient.C:347
MultiApp::initialSetup
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
Definition: MultiApp.C:237
TransientMultiApp::_transferred_vars
std::vector< std::string > _transferred_vars
The variables that have been transferred to. Used when doing transfer interpolation....
Definition: TransientMultiApp.h:88
TransientMultiApp::TransientMultiApp
TransientMultiApp(const InputParameters &parameters)
Definition: TransientMultiApp.C:97
MooseApp::isRecovering
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition: MooseApp.C:934
TransientMultiApp::_output_sub_cycles
bool _output_sub_cycles
Definition: TransientMultiApp.h:72
TransientMultiApp::computeDT
Real computeDT()
Finds the smallest dt from among any of the apps.
Definition: TransientMultiApp.C:580
Transient.h
Transient::endTime
Real & endTime()
Get the end time.
Definition: Transient.h:168
Transient::getTime
virtual Real getTime()
Get the current time.
Definition: Transient.h:99
TransientMultiApp::_failures
unsigned int _failures
Definition: TransientMultiApp.h:77
FEProblemBase::getAuxiliarySystem
AuxiliarySystem & getAuxiliarySystem()
Definition: FEProblemBase.h:648
TransientMultiApp::_sub_cycling
bool _sub_cycling
Definition: TransientMultiApp.h:68
MultiApp::resetApp
virtual void resetApp(unsigned int global_app, Real time=0.0)
"Reset" the App corresponding to the global App number passed in.
Definition: MultiApp.C:559
Transient::takeStep
virtual void takeStep(Real input_dt=-1.0)
Do whatever is necessary to advance one step.
Definition: Transient.C:397
TransientMultiApp::_tolerate_failure
bool _tolerate_failure
Definition: TransientMultiApp.h:75
MultiApp::_first_local_app
unsigned int _first_local_app
The number of the first app on this processor.
Definition: MultiApp.h:351
TransientMultiApp::finishStep
virtual void finishStep() override
Calls multi-apps executioners' endStep and postStep methods which creates output and advances time (n...
Definition: TransientMultiApp.C:560
FEProblemBase
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: FEProblemBase.h:139
Console
An output object for writing to the console (screen)
Definition: Console.h:24
AuxiliarySystem::system
virtual System & system() override
Get the reference to the libMesh system.
Definition: AuxiliarySystem.h:179
MooseObject::_app
MooseApp & _app
The MooseApp this object is associated with.
Definition: MooseObject.h:172
defineLegacyParams
defineLegacyParams(TransientMultiApp)
TransientMultiApp::appTransferVector
virtual NumericVector< Number > & appTransferVector(unsigned int app, std::string var_name) override
Get the vector to transfer to for this MultiApp.
Definition: TransientMultiApp.C:151
FEProblemBase::mesh
virtual MooseMesh & mesh() override
Definition: FEProblemBase.h:148
MooseObject::mooseWarning
void mooseWarning(Args &&... args) const
Definition: MooseObject.h:150
MooseObject::name
virtual const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:70
MooseApp::getGlobalTimeOffset
Real getGlobalTimeOffset() const
Each App has it's own local time.
Definition: MooseApp.h:254
MooseObject::paramInfo
void paramInfo(const std::string &param, Args... args) const
Emits an informational message prefixed with the file and line number of the given param (from the in...
Definition: MooseObject.h:231
FEProblemBase::outputStep
virtual void outputStep(ExecFlagType type)
Output the current step.
Definition: FEProblemBase.C:4801
Transient::getDT
virtual Real getDT()
Definition: Transient.C:561