Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
InitialConditionTempl.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 "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 class FEProblemBase;
21 class Assembly;
22 
29 template <typename T>
31 {
32 public:
38 
45 
46  virtual ~InitialConditionTempl();
47 
49 
50  virtual MooseVariableFEBase & variable() override { return _var; }
51 
52  virtual void compute() override;
53 
54  virtual void computeNodal(const Point & p) override;
55 
61  virtual T value(const Point & p) = 0;
62 
69  virtual GradientType gradient(const Point & /*p*/) { return GradientType(); };
70 
71  T gradientComponent(GradientType grad, unsigned int i);
72 
76  void setCZeroVertices();
80  void setHermiteVertices();
84  void setOtherCOneVertices();
85 
91  {
92  return op1 * op2;
93  }
94  Real dotHelper(const RealTensor & op1, const RealTensor & op2) { return op1.contract(op2); }
96  {
97  RealEigenVector v = op1.col(0) * op2(0);
98  for (const auto i : make_range(Moose::dim))
99  v += op1.col(i) * op2(i);
100  return v;
101  }
102 
106  void choleskySolve(bool is_volume);
107 
111  void choleskyAssembly(bool is_volume);
112 
113 protected:
116 
118  Real & _t;
119 
123 
126 
129 
132  const Elem * const & _current_elem;
133 
136 
139  const Node * _current_node;
140 
142  unsigned int _qp;
143 
147  DenseVector<DataType> _Fe;
149  DenseVector<DataType> _Ue;
150 
155 
157  std::vector<dof_id_type> _dof_indices;
159  std::vector<unsigned int> _side_dofs;
160 
162  unsigned int _n_qp;
164  unsigned int _n_nodes;
165 
167  std::vector<char> _dof_is_fixed;
169  std::vector<int> _free_dof;
170 
177 
179  const std::vector<std::vector<ValueType>> * _phi;
181  const std::vector<std::vector<GradientShapeType>> * _dphi;
183  const std::vector<Real> * _JxW;
185  const std::vector<Point> * _xyz_values;
186 
188  unsigned int _n;
190  unsigned int _dim;
191 };
192 
193 template <typename T>
196 {
198 }
199 
203 
204 // Declare all the specializations, as the template specialization declaration below must know
205 template <>
207 template <>
209  unsigned int i);
210 template <>
212  unsigned int i);
213 template <>
215 template <>
217 template <>
219 
220 // Prevent implicit instantiation in other translation units where these classes are used
221 extern template class InitialConditionTempl<Real>;
222 extern template class InitialConditionTempl<RealVectorValue>;
223 extern template class InitialConditionTempl<RealEigenVector>;
Real dotHelper(const libMesh::RealGradient &op1, const libMesh::RealGradient &op2)
Helps perform multiplication of GradientTypes: a normal dot product for vectors and a contraction for...
DenseVector< DataType > _Fe
Linear b vector.
const Moose::CoordinateSystemType & _coord_sys
The coordinate system type for this problem, references the value in Assembly.
OutputTools< T >::OutputData DataType
std::vector< unsigned int > _side_dofs
Side/edge DOF indices.
const std::vector< std::vector< ValueType > > * _phi
pointers to shape functions
Keeps track of stuff related to assembling.
Definition: Assembly.h:100
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.
void choleskyAssembly(bool is_volume)
Assemble a small local system for cholesky solve.
std::vector< char > _dof_is_fixed
Whether the degree of freedom is fixed (true/false)
const Real & _current_elem_volume
the volume of the current element
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.
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:148
RealTensorValue RealTensor
const std::vector< Real > * _JxW
pointers to the Jacobian * quadrature weights for current element
static InputParameters validParams()
InitialConditionTempl< RealEigenVector > ArrayInitialCondition
Real dotHelper(const RealTensor &op1, const RealTensor &op2)
This class provides an interface for common operations on field variables of both FE and FV types wit...
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.
MooseVariableField< T > & _var
The variable that this initial condition is acting upon.
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.
const std::vector< std::vector< GradientShapeType > > * _dphi
pointers to shape function gradients
OutputTools< T >::OutputShape ValueType
static InputParameters validParams()
InitialConditionTempl< Real > InitialCondition
void setCZeroVertices()
set the temporary solution vector for node projections of C0 variables
virtual T value(const Point &p)=0
The value of the variable at a point.
unsigned int _n
node counter
OutputTools< T >::OutputShapeGradient GradientShapeType
void setHermiteVertices()
set the temporary solution vector for node projections of Hermite variables
unsigned int _dim
the mesh dimension
dof_id_type _current_dof
The current dof being operated on.
InitialConditionTempl(const InputParameters &parameters)
Constructor.
dof_id_type _free_dofs
The number of free dofs.
InitialConditionTempl< RealVectorValue > VectorInitialCondition
virtual void compute() override
Workhorse method for projecting the initial conditions for block initial conditions.
Eigen::Matrix< Real, Eigen::Dynamic, Moose::dim > RealVectorArrayValue
Definition: MooseTypes.h:143
DenseVector< DataType > _Ue
Linear solution vector.
dof_id_type _nc
number of dofs per node per variable
MooseVariableFE< T > * _fe_var
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
RealEigenVector dotHelper(const RealVectorArrayValue &op1, const libMesh::RealGradient &op2)
libMesh::FEContinuity _cont
The type of continuity, e.g. C0, C1.
CoordinateSystemType
Definition: MooseTypes.h:803
void choleskySolve(bool is_volume)
Perform the cholesky solves for edge, side, and interior projections.
virtual MooseVariableFEBase & variable() override
retrieves the MOOSE variable that this initial condition acts upon
IntRange< T > make_range(T beg, T end)
const InputParameters & parameters() const
Get the parameters of the object.
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.
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealEigenVector
Definition: MooseTypes.h:142
libMesh::FEGenericBase< ValueType > FEBaseType
T gradientComponent(GradientType grad, unsigned int i)
virtual GradientType gradient(const Point &)
The gradient of the variable at a point.
unsigned int _n_nodes
The number of nodes for a given element.
const libMesh::FEType & _fe_type
The finite element type for the IC variable.
unsigned int THREAD_ID
Definition: MooseTypes.h:205
uint8_t dof_id_type
Assembly & _assembly
the finite element/volume assembly object