www.mooseframework.org
Classes | Namespaces | Functions
MultiApp.h File Reference

Go to the source code of this file.

Classes

class  libMesh::NumericVector< T >
 
class  SubAppBackups
 Helper class for holding Sub-app backups. More...
 
class  MultiApp
 A MultiApp represents one or more MOOSE applications that are running simultaneously. More...
 

Namespaces

 libMesh
 The following methods are specializations for using the libMesh::Parallel::packed_range_* routines for std::strings.
 
 libMesh::MeshTools
 

Functions

template<>
InputParameters validParams< MultiApp > ()
 
template<>
void dataStore (std::ostream &stream, SubAppBackups &backups, void *context)
 
template<>
void dataLoad (std::istream &stream, SubAppBackups &backups, void *context)
 

Function Documentation

template<>
void dataLoad ( std::istream &  stream,
SubAppBackups backups,
void *  context 
)
inline

Definition at line 406 of file MultiApp.h.

407 {
408  MultiApp * multi_app = static_cast<MultiApp *>(context);
409 
410  if (!multi_app)
411  mooseError("Error loading std::vector<Backup*>");
412 
413  for (unsigned int i = 0; i < backups.size(); i++)
414  dataLoad(stream, backups[i], context);
415 
416  multi_app->restore();
417 }
virtual void restore()
Restore the state of every Sub App.
Definition: MultiApp.C:346
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
void dataLoad(std::istream &stream, SubAppBackups &backups, void *context)
Definition: MultiApp.h:406
A MultiApp represents one or more MOOSE applications that are running simultaneously.
Definition: MultiApp.h:59
template<>
void dataStore ( std::ostream &  stream,
SubAppBackups backups,
void *  context 
)
inline

Definition at line 391 of file MultiApp.h.

392 {
393  MultiApp * multi_app = static_cast<MultiApp *>(context);
394 
395  multi_app->backup();
396 
397  if (!multi_app)
398  mooseError("Error storing std::vector<Backup*>");
399 
400  for (unsigned int i = 0; i < backups.size(); i++)
401  dataStore(stream, backups[i], context);
402 }
virtual void backup()
Save off the state of every Sub App.
Definition: MultiApp.C:339
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
A MultiApp represents one or more MOOSE applications that are running simultaneously.
Definition: MultiApp.h:59
void dataStore(std::ostream &stream, SubAppBackups &backups, void *context)
Definition: MultiApp.h:391

Definition at line 46 of file MultiApp.C.

Referenced by validParams< FullSolveMultiApp >(), and validParams< TransientMultiApp >().

47 {
49  params += validParams<SetupInterface>();
50 
51  params.addParam<bool>("use_displaced_mesh",
52  false,
53  "Whether or not this object should use the "
54  "displaced mesh for computation. Note that "
55  "in the case this is true but no "
56  "displacements are provided in the Mesh block "
57  "the undisplaced mesh will still be used.");
58  params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
59 
60  std::ostringstream app_types_strings;
62  for (; it != AppFactory::instance().registeredObjectsEnd(); ++it)
63  app_types_strings << it->first << " ";
64  MooseEnum app_types_options(app_types_strings.str(), "", true);
65 
66  params.addParam<MooseEnum>("app_type",
67  app_types_options,
68  "The type of application to build (applications not "
69  "registered can be loaded with dynamic libraries. Master "
70  "application type will be used if not provided.");
71  params.addParam<std::string>("library_path",
72  "",
73  "Path to search for dynamic libraries (please "
74  "avoid committing absolute paths in addition to "
75  "MOOSE_LIBRARY_PATH)");
76  params.addParam<std::vector<Point>>(
77  "positions",
78  "The positions of the App locations. Each set of 3 values will represent a "
79  "Point. This and 'positions_file' cannot be both supplied. If this and "
80  "'positions_file' are not supplied, a single position (0,0,0) will be used");
81  params.addParam<std::vector<FileName>>("positions_file",
82  "A filename that should be looked in for positions. Each "
83  "set of 3 values in that file will represent a Point. "
84  "This and 'positions' cannot be both supplied");
85 
86  params.addRequiredParam<std::vector<FileName>>(
87  "input_files",
88  "The input file for each App. If this parameter only contains one input file "
89  "it will be used for all of the Apps. When using 'positions_from_file' it is "
90  "also admissable to provide one input_file per file.");
91  params.addParam<Real>("bounding_box_inflation",
92  0.01,
93  "Relative amount to 'inflate' the bounding box of this MultiApp.");
94 
95  params.addPrivateParam<MPI_Comm>("_mpi_comm");
96 
97  // Set the default execution time
98  params.set<MultiMooseEnum>("execute_on") = "timestep_begin";
99 
100  params.addParam<unsigned int>("max_procs_per_app",
101  std::numeric_limits<unsigned int>::max(),
102  "Maximum number of processors to give to each App in this "
103  "MultiApp. Useful for restricting small solves to just a few "
104  "procs so they don't get spread out");
105 
106  params.addParam<bool>(
107  "output_in_position",
108  false,
109  "If true this will cause the output from the MultiApp to be 'moved' by its position vector");
110 
111  params.addParam<Real>("reset_time",
112  std::numeric_limits<Real>::max(),
113  "The time at which to reset Apps given by the 'reset_apps' parameter. "
114  "Resetting an App means that it is destroyed and recreated, possibly "
115  "modeling the insertion of 'new' material for that app.");
116 
117  params.addParam<std::vector<unsigned int>>(
118  "reset_apps",
119  "The Apps that will be reset when 'reset_time' is hit. These are the App "
120  "'numbers' starting with 0 corresponding to the order of the App positions. "
121  "Resetting an App means that it is destroyed and recreated, possibly modeling "
122  "the insertion of 'new' material for that app.");
123 
124  params.addParam<Real>(
125  "move_time",
126  std::numeric_limits<Real>::max(),
127  "The time at which Apps designated by move_apps are moved to move_positions.");
128 
129  params.addParam<std::vector<unsigned int>>(
130  "move_apps",
131  "Apps, designated by their 'numbers' starting with 0 corresponding to the order "
132  "of the App positions, to be moved at move_time to move_positions");
133 
134  params.addParam<std::vector<Point>>("move_positions",
135  "The positions corresponding to each move_app.");
136 
137  params.addPrivateParam<bool>("use_positions", true);
138  params.declareControllable("enable");
139  params.registerBase("MultiApp");
140 
141  return params;
142 }
registeredMooseAppIterator registeredObjectsBegin()
Returns iterators to the begin/end of the registered objects data structure: a name -> validParams fu...
Definition: AppFactory.h:129
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< SetupInterface >()
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< MooseObject >()
Definition: MooseObject.C:22
static AppFactory & instance()
Get the instance of the AppFactory.
Definition: AppFactory.C:22
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...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
registeredMooseAppIterator registeredObjectsEnd()
Definition: AppFactory.h:130
std::map< std::string, paramsPtr >::iterator registeredMooseAppIterator
alias for registered Object iterator
Definition: AppFactory.h:50