https://mooseframework.inl.gov
TransientMultiApp.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 #pragma once
11 
12 #include "MultiApp.h"
13 
14 #include "libmesh/numeric_vector.h"
15 
16 class TransientBase;
17 
24 {
25 public:
27 
29 
30  virtual NumericVector<Number> & appTransferVector(unsigned int app,
31  std::string var_name) override;
32 
33  virtual void initialSetup() override;
34 
35  virtual bool solveStep(Real dt, Real target_time, bool auto_advance = true) override;
36 
37  virtual void incrementTStep(Real target_time) override;
38 
39  virtual void finishStep(bool recurse_through_multiapp_levels = false) override;
40 
41  virtual void resetApp(unsigned int global_app, Real time) override;
42 
46  Real computeDT();
47 
48 private:
55  void setupApp(unsigned int i, Real time = 0.0);
56 
57  std::vector<TransientBase *> _transient_executioners;
58 
64 
65  unsigned int _max_failures;
67 
68  unsigned int _failures;
69 
70  bool _catch_up;
72 
74  bool & _first;
75 
77  std::vector<std::string> _transferred_vars;
78 
80  std::set<dof_id_type> _transferred_dofs;
81 
82  std::vector<std::map<std::string, unsigned int>> _output_file_numbers;
83 
85 
86  std::set<unsigned int> _reset;
87 
90 };
91 
96 class MultiAppSolveFailure : public std::runtime_error
97 {
98 public:
99  MultiAppSolveFailure(const std::string & error) throw() : runtime_error(error) {}
100 
101  MultiAppSolveFailure(const MultiAppSolveFailure & e) throw() : runtime_error(e) {}
102 
104 };
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...
bool _print_sub_cycles
Flag for toggling console output on sub cycles.
static InputParameters validParams()
unsigned int _max_failures
virtual void initialSetup() override
Method to be called in main-app initial setup for create sub-apps if using positions is false...
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
std::set< dof_id_type > _transferred_dofs
The DoFs associated with all of the currently transferred variables.
MultiAppSolveFailure(const MultiAppSolveFailure &e)
std::vector< TransientBase * > _transient_executioners
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
Definition: TransientBase.h:26
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.
Real computeDT()
Finds the smallest dt from among any of the apps.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int _failures
std::vector< std::map< std::string, unsigned int > > _output_file_numbers
const InputParameters & parameters() const
Get the parameters of the object.
A MultiApp represents one or more MOOSE applications that are running simultaneously.
Definition: MultiApp.h:112
virtual void incrementTStep(Real target_time) override
Advances the multi-apps time step which is important for dt selection.
virtual bool solveStep(Real dt, Real target_time, bool auto_advance=true) override
Re-solve all of the Apps.
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...