13 #if !defined(KRATOS_ELEMENT_SIZE_CALCULATOR_H )
14 #define KRATOS_ELEMENT_SIZE_CALCULATOR_H
50 template< std::
size_t TDim, std::
size_t TNumNodes >
98 const unsigned int DerivativeNodeIndex,
99 const unsigned int DerivativeDirectionIndex,
115 const unsigned int DerivativeNodeIndex,
116 const unsigned int DerivativeDirectionIndex,
145 static inline double HsqDerivative2D(
147 const double VxDerivative,
149 const double NxDerivative,
151 const double VyDerivative,
153 const double NyDerivative)
155 return 2 * (Vx * Nx + Vy * Ny) *
156 (VxDerivative * Nx + Vx * NxDerivative + VyDerivative * Ny +
157 Vy * NyDerivative) / (Nx * Nx + Ny * Ny) -
158 std::pow((Vx * Nx + Vy * Ny) / (Nx * Nx + Ny * Ny), 2) *
159 (2 * Nx * NxDerivative + 2 * Ny * NyDerivative);
162 static inline double HsqDerivative3D(
164 const double VxDerivative,
166 const double NxDerivative,
168 const double VyDerivative,
170 const double NyDerivative,
172 const double VzDerivative,
174 const double NzDerivative)
176 return 2 * (Vx * Nx + Vy * Ny + Vz * Nz) *
177 (VxDerivative * Nx + Vx * NxDerivative + VyDerivative * Ny +
178 Vy * NyDerivative + VzDerivative * Nz + Vz * NzDerivative) / (Nx * Nx + Ny * Ny + Nz * Nz) -
179 std::pow((Vx * Nx + Vy * Ny + Vz * Nz) / (Nx * Nx + Ny * Ny + Nz * Nz), 2) *
180 (2 * Nx * NxDerivative + 2 * Ny * NyDerivative + 2 * Nz * NzDerivative);
183 static inline double NormSquareDerivative(
184 const array_1d<double, 3>& rValue,
185 const array_1d<double, 3>& rValueDerivative)
187 return 2 *
inner_prod(rValue, rValueDerivative);
190 static inline double EdgeLengthDerivative(
191 const unsigned int DerivativeNodeIndex,
192 const unsigned int DerivativeDirectionIndex,
193 const unsigned int NodeIndexA,
194 const unsigned int NodeIndexB,
195 const unsigned int EdgeDirection)
197 return ((DerivativeNodeIndex == NodeIndexA) - (DerivativeNodeIndex == NodeIndexB)) * (DerivativeDirectionIndex == EdgeDirection);
A collection of functions to compute element size, to be used as the h parameter in stabilized CFD fo...
Definition: element_size_calculator.h:51
static double MinimumElementSizeDerivative(const unsigned int DerivativeNodeIndex, const unsigned int DerivativeDirectionIndex, const Geometry< Node > &rGeometry)
Minimum element size derivative based on the geometry.
BoundedMatrix< double, TNumNodes, TDim > ShapeDerivativesType
Definition: element_size_calculator.h:59
ElementSizeCalculator()=delete
static double AverageElementSize(const Geometry< Node > &rGeometry)
Average element size based on the geometry.
static double AverageElementSizeDerivative(const unsigned int DerivativeNodeIndex, const unsigned int DerivativeDirectionIndex, const Geometry< Node > &rGeometry)
Average element size derivative based on the geometry.
static double MinimumElementSize(const Geometry< Node > &rGeometry)
Minimum element size based on the geometry.
ElementSizeCalculator & operator=(ElementSizeCalculator const &rOther)=delete
Deleted assignment operator.
KRATOS_CLASS_POINTER_DEFINITION(ElementSizeCalculator)
Pointer definition of ElementSizeCalculator.
ElementSizeCalculator(ElementSizeCalculator const &rOther)=delete
Deleted copy constructor.
static double ProjectedElementSize(const Geometry< Node > &rGeometry, const array_1d< double, 3 > &rVelocity)
Projected element size in the direction of the velocity vector.
Geometry base class.
Definition: geometry.h:71
Definition: amatrix_interface.h:41
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592