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"
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 
30 {
33  params.addClassDescription("MultiApp for performing coupled simulations with the parent and "
34  "sub-application both progressing in time.");
35 
36  params.addParam<bool>("sub_cycling",
37  false,
38  "Set to true to allow this MultiApp to take smaller "
39  "timesteps than the rest of the simulation. More "
40  "than one timestep will be performed for each "
41  "parent application timestep");
42 
43  params.addParam<bool>("interpolate_transfers",
44  false,
45  "Only valid when sub_cycling. This allows "
46  "transferred values to be interpolated "
47  "over the time frame the MultiApp is "
48  "executing over when sub_cycling");
49 
50  params.addParam<bool>("detect_steady_state",
51  false,
52  "If true then while sub_cycling a steady state check will be "
53  "done. In this mode output will only be done once the "
54  "MultiApp reaches the target time or steady state is reached");
55 
56  params.addParam<Real>("steady_state_tol",
57  1e-8,
58  "The relative difference between the new "
59  "solution and the old solution that will be "
60  "considered to be at steady state");
61 
62  params.addParam<bool>("output_sub_cycles", false, "If true then every sub-cycle will be output.");
63  params.addParam<bool>(
64  "print_sub_cycles", true, "Toggle the display of sub-cycles on the screen.");
65 
66  params.addParam<unsigned int>(
67  "max_failures", 0, "Maximum number of solve failures tolerated while sub_cycling.");
68 
69  params.addParamNamesToGroup("sub_cycling interpolate_transfers detect_steady_state "
70  "steady_state_tol output_sub_cycles print_sub_cycles max_failures",
71  "Sub cycling");
72 
73  params.addParam<bool>("tolerate_failure",
74  false,
75  "If true this MultiApp won't participate in dt "
76  "decisions and will always be fast-forwarded to "
77  "the current time.");
78 
79  params.addParam<bool>(
80  "catch_up",
81  false,
82  "If true this will allow failed solves to attempt to 'catch up' using smaller timesteps.");
83 
84  params.addParam<Real>("max_catch_up_steps",
85  2,
86  "Maximum number of steps to allow an app to take "
87  "when trying to catch back up after a failed "
88  "solve.");
89 
90  params.addParamNamesToGroup("catch_up max_catch_up_steps", "Recovering failed solutions");
91  params.addParamNamesToGroup("tolerate_failure", "Accepting failed solutions");
92 
93  return params;
94 }
95 
97  : MultiApp(parameters),
98  _sub_cycling(getParam<bool>("sub_cycling")),
99  _interpolate_transfers(getParam<bool>("interpolate_transfers")),
100  _detect_steady_state(getParam<bool>("detect_steady_state")),
101  _steady_state_tol(getParam<Real>("steady_state_tol")),
102  _output_sub_cycles(getParam<bool>("output_sub_cycles")),
103  _max_failures(getParam<unsigned int>("max_failures")),
104  _tolerate_failure(getParam<bool>("tolerate_failure")),
105  _failures(0),
106  _catch_up(getParam<bool>("catch_up")),
107  _max_catch_up_steps(getParam<Real>("max_catch_up_steps")),
108  _first(declareRecoverableData<bool>("first", true)),
109  _auto_advance(false),
110  _print_sub_cycles(getParam<bool>("print_sub_cycles"))
111 {
112  // Transfer interpolation only makes sense for sub-cycling solves
114  paramError("interpolate_transfers",
115  "MultiApp ",
116  name(),
117  " is set to interpolate_transfers but is not sub_cycling! That is not valid!");
118 
119  // Subcycling overrides catch up, we don't want to confuse users by allowing them to set both.
120  if (_sub_cycling && _catch_up)
121  paramError("catch_up",
122  "MultiApp ",
123  name(),
124  " \"sub_cycling\" and \"catch_up\" cannot both be set to true simultaneously.");
125 
127  paramError("keep_solution_during_restore",
128  "In MultiApp ",
129  name(),
130  " it doesn't make any sense to keep a solution during restore when doing "
131  "sub_cycling. Consider trying \"catch_up\" steps instead");
132 
134  paramError("keep_solution_during_restore",
135  "In MultiApp ",
136  name(),
137  " \"keep_solution_during_restore\" requires \"catch_up = true\". Either disable "
138  "\"keep_solution_during_restart\" or set \"catch_up = true\"");
139 
141  paramInfo("tolerate_failure",
142  "In MultiApp ",
143  name(),
144  " both \"sub_cycling\" and \"tolerate_failure\" are set to true. \"tolerate_failure\""
145  " will be ignored.");
146 }
147 
149 TransientMultiApp::appTransferVector(unsigned int app, std::string var_name)
150 {
151  if (std::find(_transferred_vars.begin(), _transferred_vars.end(), var_name) ==
152  _transferred_vars.end())
153  _transferred_vars.push_back(var_name);
154 
156  return appProblemBase(app).getAuxiliarySystem().system().get_vector("transfer");
157 
159 }
160 
161 void
163 {
165 
166  if (!_has_an_app)
167  return;
168 
170 
171  if (_has_an_app)
172  {
174  // Grab Transient Executioners from each app
175  for (unsigned int i = 0; i < _my_num_apps; i++)
176  setupApp(i);
177  }
178 }
179 
180 bool
181 TransientMultiApp::solveStep(Real dt, Real target_time, bool auto_advance)
182 {
183  if (!_has_an_app)
184  return true;
185 
186  TIME_SECTION(_solve_step_timer);
187 
188  _auto_advance = auto_advance;
189 
191  _console << COLOR_CYAN << "Solving MultiApp '" << name() << "' with target time " << target_time
192  << " and dt " << dt << " with auto-advance " << (auto_advance ? "on" : "off")
193  << COLOR_DEFAULT << std::endl;
194 
195  // "target_time" must always be in global time
196  target_time += _app.getGlobalTimeOffset();
197 
199  bool return_value = true;
200 
201  // Make sure we swap back the communicator regardless of how this routine is exited
202  try
203  {
204  int rank;
205  int ierr;
206  ierr = MPI_Comm_rank(_communicator.get(), &rank);
207  mooseCheckMPIErr(ierr);
208 
209  for (unsigned int i = 0; i < _my_num_apps; i++)
210  {
212 
214 
215  // The App might have a different local time from the rest of the problem
216  Real app_time_offset = _apps[i]->getGlobalTimeOffset();
217 
218  // Maybe this MultiApp was already solved
219  if ((ex->getTime() + app_time_offset + ex->timestepTol() >= target_time) ||
220  (ex->getTime() >= ex->endTime()))
221  continue;
222 
223  // Examine global time synchronization
224  if (!_sub_cycling && !_reset_happened.size())
225  {
226  // The multi-app general offset is substracted to go into local time.
227  if (std::abs(target_time - _app.getGlobalTimeOffset() - ex->getTime() - dt) >
228  ex->timestepTol())
229  mooseDoOnce(mooseWarning(
230  "The target time (time a multiapp must reach at the end of the time step) "
231  "is desynchronized between this app and subapp ",
232  i,
233  ".\n If this is desired: use the 'global_time_offset' multiapp parameter to "
234  "declare a constant offset\n"
235  "If the apps should (eventually) be synchronized in time, please either: \n"
236  " - match the 'start_time' in the main app and the multiapp, in the Executioner "
237  "block\n"
238  " - set 'sub_cycling' to true in the multiapp parameters\n"
239  "This message will only print once for all apps and all time steps."));
240  }
241 
242  if (_sub_cycling)
243  {
244  Real time_old = ex->getTime() + app_time_offset;
245 
247  {
248  AuxiliarySystem & aux_system = problem.getAuxiliarySystem();
249  System & libmesh_aux_system = aux_system.system();
250 
251  NumericVector<Number> & solution = *libmesh_aux_system.solution;
252  NumericVector<Number> & transfer_old = libmesh_aux_system.get_vector("transfer_old");
253 
254  solution.close();
255 
256  // Save off the current auxiliary solution
257  transfer_old = solution;
258 
259  transfer_old.close();
260 
261  // Snag all of the local dof indices for all of these variables
263  ConstElemRange & elem_range = *problem.mesh().getActiveLocalElementRange();
264  Threads::parallel_reduce(elem_range, aldit);
265 
267  }
268 
269  // Disable/enable output for sub cycling
270  problem.allowOutput(_output_sub_cycles); // disables all outputs, including console
271  problem.allowOutput<Console>(_print_sub_cycles); // re-enables Console to print, if desired
272 
273  ex->setTargetTime(target_time - app_time_offset);
274 
275  // unsigned int failures = 0;
276 
277  bool at_steady = false;
278 
279  // ADL: During restart, there is already an FEProblemBase::advanceState that occurs at the
280  // end of TransientMultiApp::setupApp. advanceState, along with copying the solutions
281  // backwards in time/state, also *moves* (note it doesn't copy!) stateful material
282  // properties backwards (through swapping). So if restarting from a full-solve steady
283  // multi-app for example, then after one advance state, we will have good information in old
284  // and no information in current. But then if we advance again we no longer have good data
285  // in the old material properties, so don't advance here if we're restarting
286  if (_first && !_app.isRecovering() && !_app.isRestarting())
287  problem.advanceState();
288 
289  bool local_first = _first;
290 
291  // Now do all of the solves we need
292  while ((!at_steady && ex->getTime() + app_time_offset + ex->timestepTol() < target_time) ||
293  !ex->lastSolveConverged())
294  {
295  if (local_first != true)
296  ex->incrementStepOrReject();
297 
298  local_first = false;
299 
300  ex->preStep();
301  ex->computeDT();
302 
304  {
305  // See what time this executioner is going to go to.
306  Real future_time = ex->getTime() + app_time_offset + ex->getDT();
307 
308  // How far along we are towards the target time:
309  Real step_percent = (future_time - time_old) / (target_time - time_old);
310 
311  Real one_minus_step_percent = 1.0 - step_percent;
312 
313  // Do the interpolation for each variable that was transferred to
315  AuxiliarySystem & aux_system = problem.getAuxiliarySystem();
316  System & libmesh_aux_system = aux_system.system();
317 
318  NumericVector<Number> & solution = *libmesh_aux_system.solution;
319  NumericVector<Number> & transfer = libmesh_aux_system.get_vector("transfer");
320  NumericVector<Number> & transfer_old = libmesh_aux_system.get_vector("transfer_old");
321 
322  solution.close(); // Just to be sure
323  transfer.close();
324  transfer_old.close();
325 
326  for (const auto & dof : _transferred_dofs)
327  {
328  solution.set(dof,
329  (transfer_old(dof) * one_minus_step_percent) +
330  (transfer(dof) * step_percent));
331  // solution.set(dof, transfer_old(dof));
332  // solution.set(dof, transfer(dof));
333  // solution.set(dof, 1);
334  }
335 
336  solution.close();
337  }
338 
339  ex->takeStep();
340 
341  bool converged = ex->lastSolveConverged();
342 
343  if (!converged)
344  {
345  mooseWarning(
346  "While sub_cycling ", name(), _first_local_app + i, " failed to converge!\n");
347 
348  _failures++;
349 
350  if (_failures > _max_failures)
351  {
352  std::stringstream oss;
353  oss << "While sub_cycling " << name() << _first_local_app << i << " REALLY failed!";
354  throw MultiAppSolveFailure(oss.str());
355  }
356  }
357 
358  Real solution_change_norm = ex->getSolutionChangeNorm();
359 
361  _console << "Solution change norm: " << solution_change_norm << std::endl;
362 
363  if (converged && _detect_steady_state && solution_change_norm < _steady_state_tol)
364  {
366  _console << "Detected Steady State! Fast-forwarding to " << target_time << std::endl;
367 
368  at_steady = true;
369 
370  // Indicate that the next output call (occurs in ex->endStep()) should output,
371  // regardless of intervals etc...
372  problem.forceOutput();
373 
374  // Clean up the end
375  ex->endStep(target_time - app_time_offset);
376  ex->postStep();
377  }
378  else
379  {
380  ex->endStep();
381  ex->postStep();
382  }
383  }
384 
385  // If we were looking for a steady state, but didn't reach one, we still need to output one
386  // more time, regardless of interval
387  // Note: if we turn off the output for all time steps for sub-cycling, we still need to
388  // have one output at the end.
389  if ((!at_steady && _detect_steady_state) || !_output_sub_cycles)
390  problem.outputStep(EXEC_FORCED);
391 
392  } // sub_cycling
393  else if (_tolerate_failure)
394  {
395  ex->takeStep(dt);
396  ex->endStep(target_time - app_time_offset);
397  ex->postStep();
398  }
399  else
400  {
401  // ADL: During restart, there is already an FEProblemBase::advanceState that occurs at the
402  // end of TransientMultiApp::setupApp. advanceState, along with copying the solutions
403  // backwards in time/state, also *moves* (note it doesn't copy!) stateful material
404  // properties backwards (through swapping). So if restarting from a full-solve steady
405  // multi-app for example, then after one advance state, we will have good information in old
406  // and no information in current. But then if we advance again we no longer have good data
407  // in the old material properties, so don't advance here if we're restarting
408  if (_first && !_app.isRecovering() && !_app.isRestarting())
409  problem.advanceState();
410 
411  if (auto_advance)
412  problem.allowOutput(true);
413 
414  ex->takeStep(dt);
415 
416  if (auto_advance)
417  {
418  ex->endStep();
419  ex->postStep();
420 
421  if (!ex->lastSolveConverged())
422  {
423  mooseWarning(name(), _first_local_app + i, " failed to converge!\n");
424 
425  if (_catch_up)
426  {
428  _console << "Starting time step catch up!" << std::endl;
429 
430  bool caught_up = false;
431 
432  unsigned int catch_up_step = 0;
433 
434  // Cut the timestep in half to first try two half-step solves
435  Real catch_up_dt = dt / 2;
436  Real catch_up_time = 0;
437 
438  while (!caught_up && catch_up_step < _max_catch_up_steps)
439  {
441  _console << "Solving " << name() << " catch up step " << catch_up_step
442  << std::endl;
443  ex->incrementStepOrReject();
444 
445  // Avoid numerical precision errors on target time
446  if (catch_up_time + catch_up_dt > dt)
447  catch_up_dt = dt - catch_up_time;
448 
449  ex->computeDT();
450  ex->takeStep(catch_up_dt);
451  ex->endStep();
452 
453  if (ex->lastSolveConverged())
454  {
455  catch_up_time += catch_up_dt;
456  if (std::abs(catch_up_time - dt) <
457  (1 + std::abs(ex->getTime())) * ex->timestepTol())
458  {
459  problem.outputStep(EXEC_FORCED);
460  caught_up = true;
461  }
462  }
463  else
464  // Keep cutting time step in half until it converges
465  catch_up_dt /= 2.0;
466 
467  ex->postStep();
468 
469  catch_up_step++;
470  }
471 
472  if (!caught_up)
473  throw MultiAppSolveFailure(name() + " Failed to catch up!\n");
474  }
475  }
476  }
477  else // auto_advance == false
478  {
479  if (!ex->lastSolveConverged())
480  {
481  // Even if we don't allow auto_advance - we can still catch up to the current time if
482  // possible
483  if (_catch_up)
484  {
486  _console << "Starting Catch Up!" << std::endl;
487 
488  bool caught_up = false;
489 
490  unsigned int catch_up_step = 0;
491 
492  Real catch_up_dt = dt / 2;
493 
494  // Note: this loop will _break_ if target_time is satisfied
495  while (catch_up_step < _max_catch_up_steps)
496  {
498  _console << "Solving " << name() << " catch up step " << catch_up_step
499  << std::endl;
500  ex->incrementStepOrReject();
501 
502  ex->computeDT();
503  ex->takeStep(catch_up_dt); // Cut the timestep in half to try two half-step solves
504 
505  // This is required because we can't call endStep() yet
506  // (which normally increments time)
507  Real current_time = ex->getTime() + ex->getDT();
508 
509  if (ex->lastSolveConverged())
510  {
511  if (current_time + app_time_offset +
512  (ex->timestepTol() * std::abs(current_time)) >=
513  target_time)
514  {
515  caught_up = true;
516  break; // break here so that we don't run endStep() or postStep() since this
517  // MultiApp should NOT be auto_advanced
518  }
519  }
520  else
521  catch_up_dt /= 2.0;
522 
523  ex->endStep();
524  ex->postStep();
525 
526  catch_up_step++;
527  }
528 
529  if (!caught_up)
530  throw MultiAppSolveFailure(name() + " Failed to catch up!\n");
531  }
532  else
533  throw MultiAppSolveFailure(name() + " failed to converge");
534  }
535  }
536  }
537 
538  // Re-enable all output (it may of been disabled by sub-cycling)
539  problem.allowOutput(true);
540  }
541 
542  _first = false;
543 
545  _console << "Successfully Solved MultiApp " << name() << "." << std::endl;
546  }
547  catch (MultiAppSolveFailure & e)
548  {
549  mooseWarning(e.what());
550  _console << "Failed to Solve MultiApp " << name() << ", attempting to recover." << std::endl;
551  return_value = false;
552  }
553 
554  _transferred_vars.clear();
555 
556  return return_value;
557 }
558 
559 void
561 {
562  if (!_sub_cycling)
563  {
564  for (unsigned int i = 0; i < _my_num_apps; i++)
565  {
567 
568  // The App might have a different local time from the rest of the problem
569  Real app_time_offset = _apps[i]->getGlobalTimeOffset();
570 
571  // Only increment the step if we are after (target_time) the
572  // start_time (added to app_time_offset) of this sub_app.
573  if (_apps[i]->getStartTime() + app_time_offset < target_time)
574  ex->incrementStepOrReject();
575  }
576  }
577 }
578 
579 void
580 TransientMultiApp::finishStep(bool recurse_through_multiapp_levels)
581 {
582  if (!_sub_cycling)
583  {
584  for (unsigned int i = 0; i < _my_num_apps; i++)
585  {
587  ex->endStep();
588  ex->postStep();
589  if (recurse_through_multiapp_levels)
590  {
592  /*recurse_through_multiapp_levels=*/true);
594  /*recurse_through_multiapp_levels=*/true);
595  }
596  }
597  }
598 }
599 
600 bool
602 {
604 }
605 
606 Real
608 {
609  if (_sub_cycling) // Bow out of the timestep selection dance
611 
612  Real smallest_dt = std::numeric_limits<Real>::max();
613 
614  if (_has_an_app)
615  {
617 
618  for (unsigned int i = 0; i < _my_num_apps; i++)
619  {
621  ex->computeDT();
622  Real dt = ex->getDT();
623 
624  smallest_dt = std::min(dt, smallest_dt);
625  }
626  }
627 
628  if (_tolerate_failure) // Bow out of the timestep selection dance, we do this down here because we
629  // need to call computeConstrainedDT at least once for these
630  // executioners...
632 
633  _communicator.min(smallest_dt);
634  return smallest_dt;
635 }
636 
637 void
639  unsigned int global_app,
640  Real /*time*/) // FIXME: Note that we are passing in time but also grabbing it below
641 {
642  if (hasLocalApp(global_app))
643  {
644  unsigned int local_app = globalAppToLocal(global_app);
645 
646  // Grab the current time the App is at so we can start the new one at the same place
647  Real time =
648  _transient_executioners[local_app]->getTime() + _apps[local_app]->getGlobalTimeOffset();
649 
650  // Reset the Multiapp
651  MultiApp::resetApp(global_app, time);
652 
654 
655  // Setup the app, disable the output so that the initial condition does not output
656  // When an app is reset the initial condition was effectively already output before reset
657  FEProblemBase & problem = appProblemBase(local_app);
658  problem.allowOutput(false);
659  setupApp(local_app, time);
660  problem.allowOutput(true);
661  }
662 }
663 
664 void
665 TransientMultiApp::setupApp(unsigned int i, Real /*time*/) // FIXME: Should we be passing time?
666 {
667  auto & app = _apps[i];
668  Transient * ex = dynamic_cast<Transient *>(app->getExecutioner());
669  if (!ex)
670  mooseError("MultiApp ", name(), " is not using a Transient Executioner!");
671 
672  // Get the FEProblemBase for the current MultiApp
674 
675  // Update the file numbers for the outputs from the parent application
676  app->getOutputWarehouse().setFileNumbers(_app.getOutputFileNumbers());
677 
678  // Add these vectors before we call init on the executioner because that will try to restore these
679  // vectors in a restart context
681  {
682  AuxiliarySystem & aux_system = problem.getAuxiliarySystem();
683  System & libmesh_aux_system = aux_system.system();
684 
685  // We'll store a copy of the auxiliary system's solution at the old time in here
686  libmesh_aux_system.add_vector("transfer_old", false);
687 
688  // This will be where we'll transfer the value to for the "target" time
689  libmesh_aux_system.add_vector("transfer", false);
690  }
691 
692  // Call initialization method of Executioner (Note, this performs the output of the initial time
693  // step, if desired)
694  ex->init();
695 
696  ex->preExecute();
697  if (!_app.isRecovering())
698  {
699  problem.timeStep()++;
700  problem.advanceState();
701  }
702  _transient_executioners[i] = ex;
703 }
virtual NumericVector< Number > & appTransferVector(unsigned int app, std::string var_name) override
Get the vector to transfer to for this MultiApp.
bool hasLocalApp(unsigned int global_app) const
Whether or not the given global app number is on this processor.
Definition: MultiApp.C:990
Utility class for catching solve failure errors so that MOOSE can recover state before continuing...
virtual Real getDT()
Definition: Transient.C:562
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1040
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:26
bool _print_sub_cycles
Flag for toggling console output on sub cycles.
bool verboseMultiApps() const
Whether or not to use verbose printing for MultiApps.
const ExecFlagType EXEC_FORCED
Definition: Moose.C:39
NumericVector< Number > & solution()
Definition: SystemBase.h:176
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:550
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:634
static InputParameters validParams()
virtual void computeDT()
Definition: Transient.C:335
An output object for writing to the console (screen)
Definition: Console.h:18
unsigned int _max_failures
const PerfID _solve_step_timer
Timers.
Definition: MultiApp.h:613
virtual void initialSetup() override
Method to be called in main-app initial setup for create sub-apps if using positions is false...
std::vector< std::shared_ptr< MooseApp > > _apps
Pointers to each of the Apps.
Definition: MultiApp.h:538
virtual void init() override
Initialize the executioner.
Definition: Transient.C:222
FEProblemBase & feProblem()
Return a reference to this Executioner&#39;s FEProblemBase instance.
Definition: Executioner.C:112
void setupApp(unsigned int i, Real time=0.0)
Setup the executioner for the local app.
virtual void endStep(Real input_time=-1.0)
Definition: Transient.C:446
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void resetApp(unsigned int global_app, Real time) override
"Reset" the App corresponding to the global App number passed in.
MultiApp Implementation for Transient Apps.
void finishMultiAppStep(ExecFlagType type, bool recurse_through_multiapp_levels=false)
Finish the MultiApp time step (endStep, postStep) associated with the ExecFlagType.
const Parallel::Communicator & _communicator
const ExecFlagType EXEC_TIMESTEP_END
Definition: Moose.C:32
static InputParameters validParams()
FEProblemBase & _fe_problem
The FEProblemBase this MultiApp is part of.
Definition: MultiApp.h:479
bool isRestarting() const
Whether or not this is a "restart" calculation.
Definition: MooseApp.C:1173
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:56
ierr
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
const std::set< dof_id_type > & getDofIndices() const
auto max(const L &left, const R &right)
Grab all the (possibly semi)local dof indices for the variables passed in, in the system passed in...
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep...
virtual void takeStep(Real input_dt=-1.0)
Do whatever is necessary to advance one step.
Definition: Transient.C:398
bool _keep_solution_during_restore
Flag indicates if or not restart from the latest solution.
Definition: MultiApp.h:595
void min(const T &r, T &o, Request &req) const
virtual bool lastSolveConverged() const override
Whether or not the last solve converged.
Definition: Transient.C:622
const ExecFlagType EXEC_TIMESTEP_BEGIN
Definition: Moose.C:33
TransientMultiApp(const InputParameters &parameters)
virtual bool needsRestoration() override
Whether or not this MultiApp should be restored at the beginning of each Picard iteration.
std::set< dof_id_type > _transferred_dofs
The DoFs associated with all of the currently transferred variables.
FEProblemBase & appProblemBase(unsigned int app)
Get the FEProblemBase for the global app desired.
Definition: MultiApp.C:936
void forceOutput()
Indicates that the next call to outputStep should be forced.
bool & _first
Is it our first time through the execution loop?
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:69
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 ...
virtual void incrementStepOrReject()
This is where the solve step is actually incremented.
Definition: Transient.C:341
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:1007
std::vector< std::string > _transferred_vars
The variables that have been transferred to. Used when doing transfer interpolation. This will be cleared after each solve.
AuxiliarySystem & getAuxiliarySystem()
virtual void close()=0
std::vector< Transient * > _transient_executioners
virtual int & timeStep() const
unsigned int _my_num_apps
The number of apps this object is involved in simulating.
Definition: MultiApp.h:511
bool _has_an_app
Whether or not this processor as an App at all
Definition: MultiApp.h:586
Real computeDT()
Finds the smallest dt from among any of the apps.
virtual void preExecute() override
Override this for actions that should take place before execution.
Definition: Transient.C:242
unsigned int _first_local_app
The number of the first app on this processor.
Definition: MultiApp.h:514
Real & endTime()
Get a modifiable reference to the end time.
Definition: Transient.h:183
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void initialSetup() override
Method to be called in main-app initial setup for create sub-apps if using positions is false...
Definition: MultiApp.C:413
virtual Real getTime() const
Get the current time.
Definition: Transient.h:95
Real & timestepTol()
Get the timestep tolerance.
Definition: Transient.h:189
unsigned int _failures
virtual System & system() override
Get the reference to the libMesh system.
virtual MooseMesh & mesh() override
virtual void preStep()
Definition: Transient.C:269
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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...
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...
virtual void set(const numeric_index_type i, const Number value)=0
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
static InputParameters validParams()
Definition: MultiApp.C:50
virtual void postStep()
Definition: Transient.C:275
A MultiApp represents one or more MOOSE applications that are running simultaneously.
Definition: MultiApp.h:112
registerMooseObject("MooseApp", TransientMultiApp)
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition: MooseApp.C:1167
auto min(const L &left, const R &right)
Real getGlobalTimeOffset() const
Each App has it&#39;s own local time.
Definition: MooseApp.h:307
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...
MPI_Comm & _my_comm
The MPI communicator this object is going to use.
Definition: MultiApp.h:523
A system that holds auxiliary variables.
void ErrorVector unsigned int
virtual void incrementTStep(Real target_time) override
Advances the multi-apps time step which is important for dt selection.
void allowOutput(bool state)
Ability to enable/disable all output calls.
virtual void outputStep(ExecFlagType type)
Output the current step.
Real getSolutionChangeNorm()
Get the Relative L2 norm of the change in the solution.
Definition: Transient.C:640
virtual bool solveStep(Real dt, Real target_time, bool auto_advance=true) override
Re-solve all of the Apps.
unsigned int globalAppToLocal(unsigned int global_app)
Map a global App number to the local number.
Definition: MultiApp.C:1330
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...
std::vector< bool > _reset_happened
Whether or not apps have been reset at each time.
Definition: MultiApp.h:571
virtual void finishStep(bool recurse_through_multiapp_levels=false) override
Calls multi-apps executioners&#39; endStep and postStep methods which creates output and advances time (n...