www.mooseframework.org
InitialConditionTempl.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "InitialConditionBase.h"
13 
14 // libMesh
15 #include "libmesh/point.h"
16 #include "libmesh/vector_value.h"
17 #include "libmesh/elem.h"
18 
19 // forward declarations
20 template <typename>
22 class FEProblemBase;
23 class Assembly;
24 
25 template <>
26 InputParameters validParams<InitialConditionTempl<Real>>();
27 template <>
28 InputParameters validParams<InitialConditionTempl<RealVectorValue>>();
29 
36 template <typename T>
38 {
39 public:
40  typedef FEGenericBase<T> FEBaseType;
43 
50 
51  virtual ~InitialConditionTempl();
52 
53  virtual MooseVariableFEBase & variable() override { return _var; }
54 
55  virtual void compute() override;
56  virtual void computeNodal(const Point & p) override;
57 
63  virtual ValueType value(const Point & p) = 0;
64 
71  virtual GradientType gradient(const Point & /*p*/) { return GradientType(); };
72 
76  void setCZeroVertices();
80  void setHermiteVertices();
84  void setOtherCOneVertices();
85 
90  Real dotHelper(const GradientType & op1, const GradientType & op2);
91 
95  void choleskySolve(bool is_volume);
96 
97 protected:
100 
102 
104  Real & _t;
105 
108 
111 
114  const Elem * const & _current_elem;
115 
118  const Node * _current_node;
119 
121  unsigned int _qp;
122 
124  DenseMatrix<Real> _Ke;
126  DenseVector<Number> _Fe;
128  DenseVector<Number> _Ue;
129 
131  const FEType & _fe_type;
133  FEContinuity _cont;
134 
136  std::vector<dof_id_type> _dof_indices;
138  std::vector<unsigned int> _side_dofs;
139 
141  unsigned int _n_qp;
143  unsigned int _n_nodes;
144 
146  std::vector<char> _dof_is_fixed;
148  std::vector<int> _free_dof;
149 
151  dof_id_type _free_dofs;
153  dof_id_type _current_dof;
155  dof_id_type _nc;
156 
158  const std::vector<std::vector<ValueType>> * _phi;
160  const std::vector<std::vector<GradientType>> * _dphi;
162  const std::vector<Real> * _JxW;
164  const std::vector<Point> * _xyz_values;
165 
167  unsigned int _n;
169  unsigned int _dim;
170 };
171 
const Moose::CoordinateSystemType & _coord_sys
The coordinate system type for this problem, references the value in Assembly.
std::vector< unsigned int > _side_dofs
Side/edge DOF indices.
MooseVariableFE< T > & _var
The variable that this initial condition is acting upon.
const std::vector< std::vector< ValueType > > * _phi
pointers to shape functions
Keeps track of stuff related to assembling.
Definition: Assembly.h:62
OutputTools< T >::OutputGradient GradientType
void setOtherCOneVertices()
set the temporary solution vector for node projections of non-Hermitian C1 variables ...
DenseMatrix< Real > _Ke
Matrix storage member.
This is a template class that implements the workhorse compute and computeNodal methods.
std::vector< char > _dof_is_fixed
Whether the degree of freedom is fixed (true/false)
virtual void computeNodal(const Point &p) override
Workhorse method for projecting the initial conditions for boundary restricted initial conditions...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::vector< int > _free_dof
Stores the ids of the free dofs.
const std::vector< Real > * _JxW
pointers to the Jacobian * quadrature weights for current element
const FEType & _fe_type
The finite element type for the IC variable.
InitialConditionBase serves as the abstract base class for InitialConditions and VectorInitialConditi...
unsigned int _qp
The current quadrature point, contains the "nth" node number when visiting nodes. ...
unsigned int _n_qp
The number of quadrature points for a given element.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const std::vector< Point > * _xyz_values
pointers to the xyz coordinates of the quadrature points for the current element
const Node * _current_node
The current node if the point we are evaluating at also happens to be a node.
FEGenericBase< T > FEBaseType
OutputTools< T >::OutputShape ValueType
virtual ValueType value(const Point &p)=0
The value of the variable at a point.
InitialConditionTempl< Real > InitialCondition
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
DenseVector< Number > _Fe
Linear b vector.
void setCZeroVertices()
set the temporary solution vector for node projections of C0 variables
unsigned int _n
node counter
OutputType OutputShape
Definition: MooseTypes.h:171
void setHermiteVertices()
set the temporary solution vector for node projections of Hermite variables
DenseVector< Number > _Ue
Linear solution vector.
unsigned int _dim
the mesh dimension
dof_id_type _current_dof
The current dof being operated on.
InitialConditionTempl(const InputParameters &parameters)
Constructor.
FEContinuity _cont
The type of continuity, e.g. C0, C1.
dof_id_type _free_dofs
The number of free dofs.
CoordinateSystemType
Definition: MooseTypes.h:556
InitialConditionTempl< RealVectorValue > VectorInitialCondition
virtual void compute() override
Workhorse method for projecting the initial conditions for block initial conditions.
dof_id_type _nc
number of dofs per node per variable
void choleskySolve(bool is_volume)
Perform the cholesky solves for edge, side, and interior projections.
Real dotHelper(const GradientType &op1, const GradientType &op2)
Helps perform multiplication of GradientTypes: a normal dot product for vectors and a contraction for...
virtual MooseVariableFEBase & variable() override
retrieves the MOOSE variable that this initial condition acts upon
std::vector< dof_id_type > _dof_indices
The global DOF indices.
const Elem *const & _current_elem
The current element we are on will retrieving values at specific points in the domain.
const std::vector< std::vector< GradientType > > * _dphi
pointers to shape function gradients
virtual GradientType gradient(const Point &)
The gradient of the variable at a point.
TensorTools::IncrementRank< OutputShape >::type OutputGradient
Definition: MooseTypes.h:173
unsigned int _n_nodes
The number of nodes for a given element.
unsigned int THREAD_ID
Definition: MooseTypes.h:161