www.mooseframework.org
AuxiliarySystem.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 
15 #ifndef AUXILIARYSYSTEM_H
16 #define AUXILIARYSYSTEM_H
17 
18 // MOOSE includes
19 #include "SystemBase.h"
21 
22 #include "libmesh/explicit_system.h"
23 #include "libmesh/transient_system.h"
24 
25 // Forward declarations
26 class AuxKernel;
27 class FEProblemBase;
28 class TimeIntegrator;
29 class AuxScalarKernel;
30 class AuxKernel;
31 
32 // libMesh forward declarations
33 namespace libMesh
34 {
35 template <typename T>
36 class NumericVector;
37 }
38 
44 {
45 public:
46  AuxiliarySystem(FEProblemBase & subproblem, const std::string & name);
47  virtual ~AuxiliarySystem();
48 
49  virtual void init() override;
50  virtual void addExtraVectors() override;
51 
52  virtual void initialSetup();
53  virtual void timestepSetup();
54  virtual void subdomainSetup();
55  virtual void residualSetup();
56  virtual void jacobianSetup();
57  virtual void updateActive(THREAD_ID tid);
58 
59  virtual void addVariable(const std::string & var_name,
60  const FEType & type,
61  Real scale_factor,
62  const std::set<SubdomainID> * const active_subdomains = NULL) override;
63 
70  void
71  addTimeIntegrator(const std::string & type, const std::string & name, InputParameters parameters);
72 
79  void
80  addKernel(const std::string & kernel_name, const std::string & name, InputParameters parameters);
81 
88  void addScalarKernel(const std::string & kernel_name,
89  const std::string & name,
90  InputParameters parameters);
91 
92  virtual void reinitElem(const Elem * elem, THREAD_ID tid) override;
93  virtual void
94  reinitElemFace(const Elem * elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid) override;
95 
96  virtual const NumericVector<Number> *& currentSolution() override
97  {
98  _current_solution = _sys.current_local_solution.get();
99  return _current_solution;
100  }
101 
102  virtual NumericVector<Number> & solutionUDot() override;
103 
104  virtual void serializeSolution();
105  virtual NumericVector<Number> & serializedSolution() override;
106 
107  // This is an empty function since the Aux system doesn't have a matrix!
108  virtual void augmentSparsity(SparsityPattern::Graph & /*sparsity*/,
109  std::vector<dof_id_type> & /*n_nz*/,
110  std::vector<dof_id_type> & /*n_oz*/) override;
111 
116  virtual void compute(ExecFlagType type);
117 
123  std::set<std::string> getDependObjects(ExecFlagType type);
124  std::set<std::string> getDependObjects();
136  NumericVector<Number> &
137  addVector(const std::string & vector_name, const bool project, const ParallelType type) override;
138 
142  virtual Order getMinQuadratureOrder() override;
143 
148  bool needMaterialOnSide(BoundaryID bnd_id);
149 
150  virtual NumericVector<Number> & solution() override { return *_sys.solution; }
151 
152  virtual NumericVector<Number> & solutionOld() override { return *_sys.old_local_solution; }
153 
154  virtual NumericVector<Number> & solutionOlder() override { return *_sys.older_local_solution; }
155 
156  virtual TransientExplicitSystem & sys() { return _sys; }
157 
158  virtual System & system() override { return _sys; }
159  virtual const System & system() const override { return _sys; }
160 
161  virtual NumericVector<Number> * solutionPreviousNewton() override
162  {
163  return _solution_previous_nl;
164  }
165 
166  virtual void setPreviousNewtonSolution();
167 
168 protected:
169  void computeScalarVars(ExecFlagType type);
170  void computeNodalVars(ExecFlagType type);
171  void computeElementalVars(ExecFlagType type);
172 
174 
175  TransientExplicitSystem & _sys;
176 
178  const NumericVector<Number> * _current_solution;
180  NumericVector<Number> & _serialized_solution;
182  NumericVector<Number> * _solution_previous_nl;
184  std::shared_ptr<TimeIntegrator> _time_integrator;
186  NumericVector<Number> & _u_dot;
187 
190 
191  // Variables
192  std::vector<std::map<std::string, MooseVariable *>> _nodal_vars;
193  std::vector<std::map<std::string, MooseVariable *>> _elem_vars;
194 
195  // Storage for AuxScalarKernel objects
197 
198  // Storage for AuxKernel objects
200 
201  // Storage for AuxKernel objects
203 
204  friend class AuxKernel;
210  friend class ComputeMarkerThread;
211  friend class FlagElementsThread;
216 };
217 
218 #endif /* EXPLICITSYSTEM_H */
virtual const System & system() const override
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
NumericVector< Number > & _serialized_solution
Serialized version of the solution vector.
std::vector< std::map< std::string, MooseVariable * > > _nodal_vars
NumericVector< Number > & _u_dot
solution vector for u^dot
virtual TransientExplicitSystem & sys()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual NumericVector< Number > & solutionOld() override
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const NumericVector< Number > * _current_solution
solution vector from nonlinear solver
Base class for a system (of equations)
Definition: SystemBase.h:91
ExecuteMooseObjectWarehouse< AuxScalarKernel > _aux_scalar_storage
virtual const NumericVector< Number > *& currentSolution() override
The solution vector that is currently being operated on.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual NumericVector< Number > * solutionPreviousNewton() override
std::vector< std::map< std::string, MooseVariable * > > _elem_vars
Base class for making kernels that work on auxiliary scalar variables.
FEProblemBase & _fe_problem
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:51
TransientExplicitSystem & _sys
bool _need_serialized_solution
Whether or not a copy of the residual needs to be made.
virtual NumericVector< Number > & solution() override
MatType type
Base class for time integrators.
virtual System & system() override
Get the reference to the libMesh system.
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
ExecFlagType
Execution flags - when is the object executed/evaluated.
Definition: MooseTypes.h:90
NumericVector< Number > * _solution_previous_nl
Solution vector of the previous nonlinear iterate.
A system that holds auxiliary variables.
virtual NumericVector< Number > & solutionOlder() override
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
boundary_id_type BoundaryID
Definition: MooseTypes.h:75
unsigned int THREAD_ID
Definition: MooseTypes.h:79