www.mooseframework.org
InitialCondition.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 INITIALCONDITION_H
16 #define INITIALCONDITION_H
17 
18 #include "MooseObject.h"
19 #include "Coupleable.h"
20 #include "FunctionInterface.h"
21 #include "UserObjectInterface.h"
22 #include "Restartable.h"
23 #include "BlockRestrictable.h"
25 #include "BoundaryRestrictable.h"
26 #include "ZeroInterface.h"
27 #include "MooseTypes.h"
28 
29 // libMesh
30 #include "libmesh/point.h"
31 #include "libmesh/vector_value.h"
32 #include "libmesh/elem.h"
33 
34 // forward declarations
35 class InitialCondition;
36 class FEProblemBase;
37 class SystemBase;
38 class Assembly;
39 class MooseVariable;
40 
41 template <>
43 
48  public BlockRestrictable,
49  public Coupleable,
50  public FunctionInterface,
51  public UserObjectInterface,
52  public BoundaryRestrictable,
54  public Restartable,
55  public ZeroInterface
56 {
57 public:
64 
65  virtual ~InitialCondition();
66 
67  MooseVariable & variable() { return _var; }
68 
69  const std::set<std::string> & getDependObjects() const { return _depend_uo; }
70 
71  virtual void compute();
72 
78  virtual Real value(const Point & p) = 0;
79 
86  virtual RealGradient gradient(const Point & /*p*/) { return RealGradient(); };
87 
94  virtual void initialSetup() {}
95 
96  virtual const std::set<std::string> & getRequestedItems() override;
97 
98  virtual const std::set<std::string> & getSuppliedItems() override;
99 
100  template <typename T>
101  const T & getUserObject(const std::string & name);
102  template <typename T>
103  const T & getUserObjectByName(const UserObjectName & name);
104 
105  const UserObject & getUserObjectBase(const std::string & name);
106 
107 protected:
111 
113 
115  Real & _t;
116 
119 
122 
128  const Elem *& _current_elem;
129 
134  const Node * _current_node;
135 
137  unsigned int _qp;
138 
139  std::set<std::string> _depend_vars;
140  std::set<std::string> _supplied_vars;
141 
143  std::set<std::string> _depend_uo;
144 
147 };
148 
149 template <typename T>
150 const T &
152 {
154  _depend_uo.insert(_pars.get<UserObjectName>(name));
155  return UserObjectInterface::getUserObject<T>(name);
156 }
157 
158 template <typename T>
159 const T &
161 {
163  _depend_uo.insert(name);
164  return UserObjectInterface::getUserObjectByName<T>(name);
165 }
166 
167 #endif // INITIALCONDITION_H
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:47
const std::set< std::string > & getDependObjects() const
RealVectorValue RealGradient
Definition: Assembly.h:43
const T & getUserObject(const std::string &name)
A class for creating restricted objects.
Definition: Restartable.h:31
Keeps track of stuff related to assembling.
Definition: Assembly.h:63
Class for stuff related to variables.
Definition: MooseVariable.h:43
virtual ~InitialCondition()
FEProblemBase & _fe_problem
const Moose::CoordinateSystemType & _coord_sys
The coordinate system type for this problem, references the value in Assembly.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
Base class for a system (of equations)
Definition: SystemBase.h:91
std::set< std::string > _depend_uo
Depend UserObjects.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const T & getUserObjectByName(const UserObjectName &name)
const Elem *& _current_elem
The current element we are on will retrieving values at specific points in the domain.
InitialConditions are objects that set the initial value of variables.
MooseVariable & variable()
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:36
virtual const std::set< std::string > & getRequestedItems() override
Return a set containing the names of items requested by the object.
unsigned int _qp
The current quadrature point, contains the "nth" node number when visiting nodes. ...
MooseVariable & _var
The variable that this initial condition is acting upon.
Interface for objects that need to use UserObjects.
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
Definition: MooseObject.h:111
CoordinateSystemType
Definition: MooseTypes.h:212
virtual const std::set< std::string > & getSuppliedItems() override
Return a set containing the names of items owned by the object.
const UserObject & getUserObjectBase(const std::string &name)
Interface for objects that needs coupling capabilities.
Definition: Coupleable.h:35
std::set< std::string > _supplied_vars
const bool _ignore_uo_dependency
If set, UOs retrieved by this IC will not be executed before this IC.
Interface to bring zero values inside objects.
Definition: ZeroInterface.h:35
const Node * _current_node
The current node if the point we are evaluating at also happens to be a node.
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
Interface for sorting dependent vectors of objects.
virtual void compute()
virtual Real value(const Point &p)=0
The value of the variable at a point.
InputParameters validParams< InitialCondition >()
std::set< std::string > _depend_vars
InitialCondition(const InputParameters &parameters)
Constructor.
Interface for objects that need to use functions.
Base class for user-specific data.
Definition: UserObject.h:42
virtual RealGradient gradient(const Point &)
The gradient of the variable at a point.
unsigned int THREAD_ID
Definition: MooseTypes.h:79
virtual void initialSetup()
Gets called at the beginning of the simulation before this object is asked to do its job...