|
Nektar++
|
Calculation and storage of geometric factors associated with the mapping from StdRegions reference elements to a given LocalRegions physical element in the mesh. More...
#include <GeomFactors.h>
Public Member Functions | |
| GeomFactors (const GeomType gtype, const int coordim, const StdRegions::StdExpansionSharedPtr &xmap, const std::vector< Array< OneD, NekDouble > > &coords, const LibUtilities::PointsKeyVector &keyTgt) | |
| Constructor for GeomFactors class. | |
| GeomFactors (const GeomFactors &S) | |
| Copy constructor. | |
| ~GeomFactors ()=default | |
| Destructor. | |
| DerivStorage | GetDeriv (const LibUtilities::PointsKeyVector &keyTgt) |
| Return the derivative of the mapping with respect to the reference coordinates, \(\frac{\partial \chi_i}{\partial \xi_j}\). | |
| const Array< OneD, const NekDouble > | GetJac () |
| Return the Jacobian of the mapping. | |
| Array< OneD, NekDouble > | ComputeJac (const LibUtilities::PointsKeyVector &keyTgt) const |
| Compute the Jacobian of the mapping. | |
| const Array< TwoD, const NekDouble > | GetGmat (const LibUtilities::PointsKeyVector &keyTgt) |
| Return the Laplacian coefficients \(g_{ij}\). | |
| const Array< TwoD, const NekDouble > | GetDerivFactors () |
| Return the derivative of the reference coordinates with respect to the mapping, \(\frac{\partial \xi_i}{\partial \chi_j}\). | |
| Array< TwoD, NekDouble > | ComputeDerivFactors (const LibUtilities::PointsKeyVector &keyTgt) const |
| Compute the derivative of the reference coordinates with respect to the mapping, \(\frac{\partial \xi_i}{\partial \chi_j}\). | |
| void | GetMovingFrames (const LibUtilities::PointsKeyVector &keyTgt, const SpatialDomains::GeomMMF MMFdir, const Array< OneD, const NekDouble > &CircCentre, Array< OneD, Array< OneD, NekDouble > > &outarray) |
| Returns moving frames. | |
| GeomType | GetGtype () |
| Returns whether the geometry is regular or deformed. | |
| bool | IsValid () const |
| Determine if element is valid and not self-intersecting. | |
| int | GetCoordim () const |
| Return the number of dimensions of the coordinate system. | |
| size_t | GetHash () |
| Computes a hash of this GeomFactors element. | |
Protected Member Functions | |
| StdRegions::StdExpansionSharedPtr & | GetXmap () |
| Return the Xmap;. | |
Protected Attributes | |
| GeomType | m_type |
| Type of geometry (e.g. eRegular, eDeformed, eMovingRegular). | |
| int | m_expDim |
| Dimension of expansion. | |
| int | m_coordDim |
| Dimension of coordinate system. | |
| bool | m_valid |
| Validity of element (Jacobian positive) | |
| LibUtilities::PointsKeyVector | m_keyTgt |
| Default points at which to compute jacobian and derivative factors. | |
| enum GeomMMF | m_MMFDir |
| Principle tangent direction for MMF. | |
| StdRegions::StdExpansionSharedPtr | m_xmap |
| Stores information about the expansion. | |
| std::vector< Array< OneD, NekDouble > > | m_coords |
| Stores coordinates of the geometry. | |
| Array< OneD, NekDouble > | m_jac |
| Jacobian vector. | |
| Array< TwoD, NekDouble > | m_derivFactor |
| DerivFactors vector. | |
| bool | m_jacComputed = false |
| Indicates whether stored jacobian has been populated. | |
| bool | m_derivFacComputed = false |
| Indicates whether stored derivative factors have been populated. | |
Private Member Functions | |
| void | CheckIfValid () |
| Tests if the element is valid and not self-intersecting. | |
| DerivStorage | ComputeDeriv (const LibUtilities::PointsKeyVector &keyTgt) const |
| Array< TwoD, NekDouble > | ComputeGmat (const LibUtilities::PointsKeyVector &keyTgt) const |
| Computes the Laplacian coefficients \(g_{ij}\). | |
| void | ComputeMovingFrames (const LibUtilities::PointsKeyVector &keyTgt, const SpatialDomains::GeomMMF MMFdir, const Array< OneD, const NekDouble > &CircCentre, Array< OneD, Array< OneD, NekDouble > > &movingframes) |
| void | Interp (const LibUtilities::PointsKeyVector &src_points, const Array< OneD, const NekDouble > &src, const LibUtilities::PointsKeyVector &tgt_points, Array< OneD, NekDouble > &tgt) const |
| Perform interpolation of data between two point distributions. | |
| void | Adjoint (const Array< TwoD, const NekDouble > &src, Array< TwoD, NekDouble > &tgt) const |
| Compute the transpose of the cofactors matrix. | |
| void | ComputePrincipleDirection (const LibUtilities::PointsKeyVector &keyTgt, const SpatialDomains::GeomMMF MMFdir, const Array< OneD, const NekDouble > &CircCentre, Array< OneD, Array< OneD, NekDouble > > &output) |
| void | VectorNormalise (Array< OneD, Array< OneD, NekDouble > > &array) |
| void | VectorCrossProd (const Array< OneD, const Array< OneD, NekDouble > > &v1, const Array< OneD, const Array< OneD, NekDouble > > &v2, Array< OneD, Array< OneD, NekDouble > > &v3) |
| Computes the vector cross-product in 3D of v1 and v2, storing the result in v3. | |
Friends | |
| bool | operator== (const GeomFactors &lhs, const GeomFactors &rhs) |
| Tests if two GeomFactors classes are equal. | |
Calculation and storage of geometric factors associated with the mapping from StdRegions reference elements to a given LocalRegions physical element in the mesh.
This class stores the various geometric factors associated with a specific element, necessary for fundamental integration and differentiation operations as well as edge and surface normals.
Initially, these algorithms are provided with a mapping from the reference region element to the physical element. Practically, this is represented using a corresponding reference region element for each coordinate component. Note that for straight-sided elements, these elements will be of linear order. Curved elements are represented using higher-order coordinate mappings. This geometric order is in contrast to the order of the spectral/hp expansion order on the element.
For application of the chain rule during differentiation we require the partial derivatives
\[\frac{\partial \xi_i}{\partial \chi_j}\]
evaluated at the physical points of the expansion basis. We also construct the inverse metric tensor \(g^{ij}\) which, in the case of a domain embedded in a higher-dimensional space, supports the conversion of covariant quantities to contravariant quantities. When the expansion dimension is equal to the coordinate dimension the Jacobian of the mapping \(\chi_j\) is a square matrix and consequently the required terms are the entries of the inverse of the Jacobian. However, in general this is not the case, so we therefore implement the construction of these terms following the derivation in Cantwell, et. al. [CaYaKiPeSh13]. Given the coordinate maps \(\chi_i\), this comprises of five steps
Definition at line 67 of file GeomFactors.h.
| Nektar::SpatialDomains::GeomFactors::GeomFactors | ( | const GeomType | gtype, |
| const int | coordim, | ||
| const StdRegions::StdExpansionSharedPtr & | xmap, | ||
| const std::vector< Array< OneD, NekDouble > > & | coords, | ||
| const LibUtilities::PointsKeyVector & | keyTgt | ||
| ) |
Constructor for GeomFactors class.
| gtype | Specified whether the geometry is regular or deformed. |
| coordim | Specifies the dimension of the coordinate system. |
| Coords | Coordinate maps of the element. |
| keyTgt | Points at which to compute stored Jacobian and derivative factors |
Definition at line 88 of file GeomFactors.cpp.
References CheckIfValid().
| Nektar::SpatialDomains::GeomFactors::GeomFactors | ( | const GeomFactors & | S | ) |
Copy constructor.
| S | An instance of a GeomFactors class from which to construct a new instance. |
Definition at line 102 of file GeomFactors.cpp.
|
default |
Destructor.
|
private |
Compute the transpose of the cofactors matrix.
Input and output arrays are of dimension (m_expDim*m_expDim) x num_points. The first index of the input and output arrays are ordered row-by-row.
| src | Input data array. |
| tgt | Storage for adjoint matrix data. |
Definition at line 709 of file GeomFactors.cpp.
References Nektar::ErrorUtil::ewarning, Vmath::Fill(), m_expDim, NEKERROR, Vmath::Smul(), Vmath::Vcopy(), and Vmath::Vvtvvtm().
Referenced by ComputeDerivFactors(), ComputeGmat(), and ComputeJac().
|
private |
Tests if the element is valid and not self-intersecting.
Constructs the Jacobian as per Spencer's book p158 and tests if negative.
Definition at line 608 of file GeomFactors.cpp.
References Nektar::SpatialDomains::eMovingRegular, Nektar::SpatialDomains::eRegular, GetDeriv(), m_coordDim, m_expDim, m_type, m_valid, m_xmap, Vmath::Vmin(), Vmath::Vvtvp(), and Vmath::Vvtvvtm().
Referenced by GeomFactors().
|
private |
Derivatives are computed at the geometry point distributions and interpolated to the target point distributions.
| tpoints | Target point distributions. |
Definition at line 150 of file GeomFactors.cpp.
References Nektar::ErrorUtil::ewarning, Interp(), m_coordDim, m_coords, m_expDim, m_xmap, and NEKERROR.
Referenced by ComputeDerivFactors(), ComputeGmat(), ComputeJac(), ComputeMovingFrames(), and GetDeriv().
| Array< TwoD, NekDouble > Nektar::SpatialDomains::GeomFactors::ComputeDerivFactors | ( | const LibUtilities::PointsKeyVector & | keyTgt | ) | const |
Compute the derivative of the reference coordinates with respect to the mapping, \(\frac{\partial \xi_i}{\partial \chi_j}\).
| keyTgt | Target point distributions. |
Definition at line 401 of file GeomFactors.cpp.
References Adjoint(), ComputeDeriv(), Nektar::SpatialDomains::eDeformed, Nektar::ErrorUtil::ewarning, m_coordDim, m_expDim, m_type, NEKERROR, Vmath::Vdiv(), Vmath::Vsqrt(), and Vmath::Vvtvp().
Referenced by GetDerivFactors().
|
private |
Computes the Laplacian coefficients \(g_{ij}\).
This routine returns a two-dimensional array of values specifying the inverse metric terms associated with the coordinate mapping of the corresponding reference region to the physical element. These terms correspond to the \(g^{ij}\) terms in [CaYaKiPeSh13] and, in the case of an embedded manifold, map covariant quantities to contravariant quantities. The leading index of the array is the index of the term in the tensor numbered as
\[\left(\begin{array}{ccc} 0 & 1 & 2 \\ 1 & 3 & 4 \\ 2 & 4 & 5 \end{array}\right)\]
. The second dimension is either of size 1 in the case of elements having GeomType eRegular, or of size equal to the number of quadrature points for eDeformed elements.
Definition at line 334 of file GeomFactors.cpp.
References Adjoint(), ComputeDeriv(), Nektar::SpatialDomains::eDeformed, Nektar::ErrorUtil::ewarning, m_coordDim, m_expDim, m_type, NEKERROR, Vmath::Vdiv(), and Vmath::Vvtvp().
Referenced by GetGmat().
| Array< OneD, NekDouble > Nektar::SpatialDomains::GeomFactors::ComputeJac | ( | const LibUtilities::PointsKeyVector & | keyTgt | ) | const |
Compute the Jacobian of the mapping.
This routine returns an array of values specifying the Jacobian of the mapping at quadrature points in the element. The array is either of size 1 in the case of elements having GeomType eRegular, or of size equal to the number of quadrature points for eDeformed elements.
Definition at line 248 of file GeomFactors.cpp.
References Adjoint(), ComputeDeriv(), Nektar::SpatialDomains::eDeformed, Nektar::ErrorUtil::ewarning, m_coordDim, m_expDim, m_type, NEKERROR, Vmath::Vsqrt(), and Vmath::Vvtvp().
|
private |
Definition at line 479 of file GeomFactors.cpp.
References ComputeDeriv(), ComputePrincipleDirection(), Nektar::SpatialDomains::eDeformed, Nektar::SpatialDomains::eLOCAL, Nektar::ErrorUtil::ewarning, Vmath::Fill(), m_coordDim, m_expDim, m_type, Vmath::Neg(), NEKERROR, Vmath::Vcopy(), VectorCrossProd(), VectorNormalise(), and Vmath::Vvtvp().
Referenced by GetMovingFrames().
|
private |
Definition at line 757 of file GeomFactors.cpp.
References Nektar::SpatialDomains::eTangentCircular, Nektar::SpatialDomains::eTangentIrregular, Nektar::SpatialDomains::eTangentNonconvex, Nektar::SpatialDomains::eTangentX, Nektar::SpatialDomains::eTangentXY, Nektar::SpatialDomains::eTangentY, Nektar::SpatialDomains::eTangentZ, Nektar::ErrorUtil::ewarning, Vmath::Fill(), Interp(), m_coordDim, m_coords, m_expDim, m_xmap, NEKERROR, and tinysimd::sqrt().
Referenced by ComputeMovingFrames().
|
inline |
Return the number of dimensions of the coordinate system.
This is greater than or equal to the expansion dimension.
Definition at line 292 of file GeomFactors.h.
References m_coordDim.
|
inline |
Return the derivative of the mapping with respect to the reference coordinates, \(\frac{\partial \chi_i}{\partial \xi_j}\).
| tpoints | Target point distributions. |
Definition at line 215 of file GeomFactors.h.
References ComputeDeriv().
Referenced by CheckIfValid(), and Nektar::FieldUtils::ProcessQualityMetric::GetQ().
|
inline |
Return the derivative of the reference coordinates with respect to the mapping, \(\frac{\partial \xi_i}{\partial \chi_j}\).
Returns derivative factors.
Definition at line 257 of file GeomFactors.h.
References ComputeDerivFactors(), m_derivFacComputed, m_derivFactor, and m_keyTgt.
Referenced by Nektar::AcousticSystem::v_GetMaxStdVelocity(), and Nektar::CompressibleFlowSystem::v_GetMaxStdVelocity().
|
inline |
Return the Laplacian coefficients \(g_{ij}\).
| keyTgt | Target point distributions. |
Definition at line 244 of file GeomFactors.h.
References ComputeGmat().
|
inline |
Returns whether the geometry is regular or deformed.
A geometric shape is considered regular if it has constant geometric information, and deformed if this information changes throughout the shape.
Definition at line 283 of file GeomFactors.h.
References m_type.
Referenced by Nektar::AcousticSystem::v_GetMaxStdVelocity(), Nektar::CompressibleFlowSystem::v_GetMaxStdVelocity(), Nektar::FieldUtils::ProcessJacobianEnergy::v_Process(), and Nektar::FieldUtils::ProcessScalGrad::v_Process().
|
inline |
Computes a hash of this GeomFactors element.
The hash is computed from the geometry type, expansion dimension, coordinate dimension and Jacobian.
Definition at line 312 of file GeomFactors.h.
References ComputeJac(), Nektar::SpatialDomains::eDeformed, Nektar::hash_combine(), Nektar::hash_range(), m_coordDim, m_expDim, m_type, and m_xmap.
Return the Jacobian of the mapping.
Returns Jacobian.
Definition at line 228 of file GeomFactors.h.
References ComputeJac(), m_jac, m_jacComputed, and m_keyTgt.
Referenced by Nektar::FieldUtils::ProcessJacobianEnergy::v_Process().
|
inline |
Returns moving frames.
Definition at line 267 of file GeomFactors.h.
References ComputeMovingFrames().
|
inlineprotected |
|
private |
Perform interpolation of data between two point distributions.
| map_points | Source data point distribution. |
| src | Source data to be interpolated. |
| tpoints | Target data point distribution. |
| tgt | Target data storage. |
Definition at line 673 of file GeomFactors.cpp.
References Nektar::ErrorUtil::ewarning, Nektar::LibUtilities::Interp1D(), Nektar::LibUtilities::Interp2D(), Nektar::LibUtilities::Interp3D(), m_expDim, and NEKERROR.
Referenced by ComputeDeriv(), and ComputePrincipleDirection().
|
inline |
Determine if element is valid and not self-intersecting.
The validity test is performed by testing if the Jacobian is negative at any point in the shape.
Definition at line 302 of file GeomFactors.h.
References m_valid.
Referenced by Nektar::IterativeElasticSystem::v_DoSolve().
|
private |
Computes the vector cross-product in 3D of v1 and v2, storing the result in v3.
| v1 | First input vector. |
| v2 | Second input vector. |
| v3 | Output vector computed to be orthogonal to both v1 and v2. |
Definition at line 970 of file GeomFactors.cpp.
References Nektar::ErrorUtil::efatal, NEKERROR, Vmath::Vmul(), and Vmath::Vvtvm().
Referenced by ComputeMovingFrames().
|
private |
Definition at line 928 of file GeomFactors.cpp.
References Nektar::ErrorUtil::efatal, NEKERROR, Vmath::Vdiv(), Vmath::Vsqrt(), and Vmath::Vvtvp().
Referenced by ComputeMovingFrames().
|
friend |
Tests if two GeomFactors classes are equal.
Member data equivalence is tested in the following order: shape type, expansion dimension, coordinate dimension and coordinates.
Definition at line 113 of file GeomFactors.cpp.
|
protected |
Dimension of coordinate system.
Definition at line 134 of file GeomFactors.h.
Referenced by CheckIfValid(), ComputeDeriv(), ComputeDerivFactors(), ComputeGmat(), ComputeJac(), ComputeMovingFrames(), ComputePrincipleDirection(), GetCoordim(), and GetHash().
Stores coordinates of the geometry.
Definition at line 146 of file GeomFactors.h.
Referenced by ComputeDeriv(), and ComputePrincipleDirection().
|
protected |
Indicates whether stored derivative factors have been populated.
Definition at line 154 of file GeomFactors.h.
Referenced by GetDerivFactors().
|
protected |
Dimension of expansion.
Definition at line 132 of file GeomFactors.h.
Referenced by Adjoint(), CheckIfValid(), ComputeDeriv(), ComputeDerivFactors(), ComputeGmat(), ComputeJac(), ComputeMovingFrames(), ComputePrincipleDirection(), GetHash(), and Interp().
|
protected |
Indicates whether stored jacobian has been populated.
Definition at line 152 of file GeomFactors.h.
Referenced by GetJac().
|
protected |
Default points at which to compute jacobian and derivative factors.
Definition at line 138 of file GeomFactors.h.
Referenced by GetDerivFactors(), and GetJac().
|
protected |
Principle tangent direction for MMF.
Definition at line 141 of file GeomFactors.h.
|
protected |
Type of geometry (e.g. eRegular, eDeformed, eMovingRegular).
Definition at line 130 of file GeomFactors.h.
Referenced by CheckIfValid(), ComputeDerivFactors(), ComputeGmat(), ComputeJac(), ComputeMovingFrames(), GetGtype(), and GetHash().
|
protected |
Validity of element (Jacobian positive)
Definition at line 136 of file GeomFactors.h.
Referenced by CheckIfValid(), and IsValid().
|
protected |
Stores information about the expansion.
Definition at line 144 of file GeomFactors.h.
Referenced by CheckIfValid(), ComputeDeriv(), ComputePrincipleDirection(), GetHash(), and GetXmap().