www.mooseframework.org
TransientMultiApp.h
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 #ifndef TRANSIENTMULTIAPP_H
15 #define TRANSIENTMULTIAPP_H
16 
17 #include "MultiApp.h"
18 
19 // Forward declarations
20 class TransientMultiApp;
21 class Transient;
22 
23 template <>
25 
32 {
33 public:
35 
36  virtual NumericVector<Number> & appTransferVector(unsigned int app,
37  std::string var_name) override;
38 
39  virtual void initialSetup() override;
40 
41  virtual bool solveStep(Real dt, Real target_time, bool auto_advance = true) override;
42 
43  virtual void advanceStep() override;
44 
45  virtual bool needsRestoration() override;
46 
47  virtual void resetApp(unsigned int global_app, Real time) override;
48 
52  Real computeDT();
53 
54 private:
61  void setupApp(unsigned int i, Real time = 0.0);
62 
63  std::vector<Transient *> _transient_executioners;
64 
70 
71  unsigned int _max_failures;
73 
74  unsigned int _failures;
75 
76  bool _catch_up;
78 
80  bool & _first;
81 
83  std::vector<std::string> _transferred_vars;
84 
86  std::set<dof_id_type> _transferred_dofs;
87 
88  std::vector<std::map<std::string, unsigned int>> _output_file_numbers;
89 
91 
92  std::set<unsigned int> _reset;
93 
96 };
97 
102 class MultiAppSolveFailure : public std::runtime_error
103 {
104 public:
105  MultiAppSolveFailure(const std::string & error) throw() : runtime_error(error) {}
106 
107  MultiAppSolveFailure(const MultiAppSolveFailure & e) throw() : runtime_error(e) {}
108 
110 };
111 
112 #endif // TRANSIENTMULTIAPP_H
virtual NumericVector< Number > & appTransferVector(unsigned int app, std::string var_name) override
Get the vector to transfer to for this MultiApp.
Utility class for catching solve failure errors so that MOOSE can recover state before continuing...
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:36
bool _print_sub_cycles
Flag for toggling console output on sub cycles.
virtual void advanceStep() override
Actually advances time and causes output.
unsigned int _max_failures
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
void setupApp(unsigned int i, Real time=0.0)
Setup the executioner for the local app.
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.
MultiAppSolveFailure(const std::string &error)
TransientMultiApp(const InputParameters &parameters)
std::set< unsigned int > _reset
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.
MultiAppSolveFailure(const MultiAppSolveFailure &e)
bool & _first
Is it our first time through the execution loop?
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.
std::vector< Transient * > _transient_executioners
Real computeDT()
Finds the smallest dt from among any of the apps.
unsigned int _failures
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
std::vector< std::map< std::string, unsigned int > > _output_file_numbers
A MultiApp represents one or more MOOSE applications that are running simultaneously.
Definition: MultiApp.h:59
virtual bool solveStep(Real dt, Real target_time, bool auto_advance=true) override
Re-solve all of the Apps.
InputParameters validParams< TransientMultiApp >()