Nektar++
|
A class to assist in the construction of nodal simplex and hybrid elements in two and three dimensions. More...
#include <NodalUtil.h>
Public Member Functions | |
virtual | ~NodalUtil ()=default |
NekVector< NekDouble > | GetWeights () |
Obtain the integration weights for the given nodal distribution. More... | |
SharedMatrix | GetVandermonde () |
Return the Vandermonde matrix for the nodal distribution. More... | |
SharedMatrix | GetVandermondeForDeriv (size_t dir) |
Return the Vandermonde matrix of the derivative of the basis functions for the nodal distribution. More... | |
SharedMatrix | GetDerivMatrix (size_t dir) |
Return the derivative matrix for the nodal distribution. More... | |
SharedMatrix | GetInterpolationMatrix (Array< OneD, Array< OneD, NekDouble > > &xi) |
Construct the interpolation matrix used to evaluate the basis at the points xi inside the element. More... | |
Protected Member Functions | |
NodalUtil (size_t degree, size_t dim) | |
Set up the NodalUtil object. More... | |
virtual NekVector< NekDouble > | v_OrthoBasis (const size_t mode)=0 |
Return the values of the orthogonal basis at the nodal points for a given mode. More... | |
virtual NekVector< NekDouble > | v_OrthoBasisDeriv (const size_t dir, const size_t mode)=0 |
Return the values of the derivative of the orthogonal basis at the nodal points for a given mode. More... | |
virtual std::shared_ptr< NodalUtil > | v_CreateUtil (Array< OneD, Array< OneD, NekDouble > > &xi)=0 |
Construct a NodalUtil object of the appropriate element type for a given set of points. More... | |
virtual NekDouble | v_ModeZeroIntegral ()=0 |
Return the value of the integral of the zero-th mode for this element. More... | |
virtual size_t | v_NumModes ()=0 |
Calculate the number of degrees of freedom for this element. More... | |
Protected Attributes | |
size_t | m_dim |
Dimension of the nodal element. More... | |
size_t | m_degree |
Degree of the nodal element. More... | |
size_t | m_numPoints |
Total number of nodal points. More... | |
Array< OneD, Array< OneD, NekDouble > > | m_xi |
Coordinates of the nodal points defining the basis. More... | |
A class to assist in the construction of nodal simplex and hybrid elements in two and three dimensions.
The NodalUtil class and its subclasses are designed to take care of some common issues that arise when considering triangles, tetrahedra and prismatic elements that are equipped with a nodal Lagrangian basis, defined using a set of nodal points \( \xi_i \) that we store in the array NodalUtil::m_xi. Since one cannot write this basis analytically, we instead construct the Vandermonde matrix
\[ \mathbf{V}_{ij} = \psi_j(\xi_i) \]
where \( \psi_j \) is a basis that spans the polynomial space of the element. The Vandermonde matrix can then be used to construct the integration weights, derivative and interpolation matrices. Although this can be any basis, such as the monomial basis \( x^i y^j z^k \), in practice this is numerically unstable at high polynomial orders. Elements are therefore expected to use the 'traditional' modal orthogonal basis. See Sherwin & Karniadakis or Hesthaven & Warburton for further details of this basis and the surrounding numerical issues.
This class therefore contains the generic logic needed to construct various matrices, and subclasses override virtual functions that define the orthogonal basis and its derivatives for a particular element type.
Definition at line 77 of file NodalUtil.h.
|
virtualdefault |
|
inlineprotected |
Set up the NodalUtil object.
dim | Dimension of the element. |
degree | Polynomial degree of the element. |
Definition at line 95 of file NodalUtil.h.
SharedMatrix Nektar::LibUtilities::NodalUtil::GetDerivMatrix | ( | size_t | dir | ) |
Return the derivative matrix for the nodal distribution.
This routine constructs and returns the derivative matrices \(\mathbf{D}_d\) for coordinate directions \( 0 \leq d \leq 2 \), which can be used to evaluate the derivative of a nodal expansion at the points defined by NodalUtil::m_xi. These are calculated as \( \mathbf{D}_d = \mathbf{V}_d \mathbf{V}^{-1} \), where \( \mathbf{V}_d \) is the derivative Vandermonde matrix and \( \mathbf{V} \) is the Vandermonde matrix.
dir | Coordinate direction in which to evaluate the derivative. |
dir
. Definition at line 163 of file NodalUtil.cpp.
References GetVandermonde(), and GetVandermondeForDeriv().
SharedMatrix Nektar::LibUtilities::NodalUtil::GetInterpolationMatrix | ( | Array< OneD, Array< OneD, NekDouble > > & | xi | ) |
Construct the interpolation matrix used to evaluate the basis at the points xi
inside the element.
This routine returns a matrix \( \mathbf{I}(\mathbf{a}) \) that can be used to evaluate the nodal basis at the points defined by the parameter xi
, which is denoted by \( \mathbf{a} = (a_1, \dots, a_N) \) and \( N \) is the number of points in xi
.
In particular, if the array \( \mathbf{u} \) with components \( \mathbf{u}_i = u^\delta(\xi_i) \) represents the polynomial approximation of a function \( u \) evaluated at the nodal points NodalUtil::m_xi, then the evaluation of \( u^\delta \) evaluated at the input points \( \mathbf{a} \) is given by \( \mathbf{I}(\mathbf{a})\mathbf{u} \).
xi | An array of first size number of spatial dimensions \( d \) and secondary size the number of points to interpolate. |
xi
. Definition at line 197 of file NodalUtil.cpp.
References GetVandermonde(), and v_CreateUtil().
SharedMatrix Nektar::LibUtilities::NodalUtil::GetVandermonde | ( | ) |
Return the Vandermonde matrix for the nodal distribution.
This routine constructs and returns the Vandermonde matrix \(\mathbf{V}\), with each entry as \(\mathbf{V}_{ij} = (\psi_i(\xi_j))\) where \( \psi_i \) is the orthogonal basis obtained through the abstract function NodalUtil::v_OrthoBasis.
Definition at line 97 of file NodalUtil.cpp.
References m_numPoints, v_NumModes(), and v_OrthoBasis().
Referenced by GetDerivMatrix(), GetInterpolationMatrix(), and GetWeights().
SharedMatrix Nektar::LibUtilities::NodalUtil::GetVandermondeForDeriv | ( | size_t | dir | ) |
Return the Vandermonde matrix of the derivative of the basis functions for the nodal distribution.
This routine constructs and returns the Vandermonde matrix for the derivative of the basis functions \(\mathbf{V}_d\) for coordinate directions \( 0 \leq d \leq 2 \), with each entry as \(\mathbf{V}_{ij} = (\partial_d \psi_i(\xi_j))\) where \( \partial_d\psi_i \) is the derivative of the orthogonal basis obtained through the abstract function NodalUtil::v_OrthoBasisDeriv.
dir | Direction of derivative in the standard element. |
dir
. Definition at line 130 of file NodalUtil.cpp.
References m_numPoints, v_NumModes(), and v_OrthoBasisDeriv().
Referenced by GetDerivMatrix().
Obtain the integration weights for the given nodal distribution.
This routine constructs the integration weights for the given nodal distribution inside NodalUtil::m_xi. To do this we solve the linear system \( \mathbf{V}^\top \mathbf{w} = \mathbf{g} \) where \( \mathbf{g}_i = \int_\Omega \psi_i(x)\, dx \), and we use the fact that under the definition of the orthogonal basis for each element type, \( \mathbf{g}_i = 0 \) for \( i > 0 \). We use NodalUtil::v_ModeZeroIntegral to return the analytic value of \( \mathbf{g}_0 \).
Definition at line 61 of file NodalUtil.cpp.
References GetVandermonde(), m_numPoints, Nektar::LinearSystem::SolveTranspose(), v_ModeZeroIntegral(), and v_NumModes().
|
protectedpure virtual |
Construct a NodalUtil object of the appropriate element type for a given set of points.
This function is used inside NodalUtil::GetInterpolationMatrix so that the (potentially non-square) Vandermonde matrix can be constructed to create the interpolation matrix at an arbitrary set of points in the domain.
xi | Distribution of nodal points to create utility with. |
Implemented in Nektar::LibUtilities::NodalUtilTriangle, Nektar::LibUtilities::NodalUtilTetrahedron, Nektar::LibUtilities::NodalUtilPrism, Nektar::LibUtilities::NodalUtilQuad, and Nektar::LibUtilities::NodalUtilHex.
Referenced by GetInterpolationMatrix().
|
protectedpure virtual |
Return the value of the integral of the zero-th mode for this element.
Note that for the orthogonal basis under consideration, all modes integrate to zero asides from the zero-th mode. This function is used in NodalUtil::GetWeights to determine integration weights.
Implemented in Nektar::LibUtilities::NodalUtilTriangle, Nektar::LibUtilities::NodalUtilTetrahedron, Nektar::LibUtilities::NodalUtilPrism, Nektar::LibUtilities::NodalUtilQuad, and Nektar::LibUtilities::NodalUtilHex.
Referenced by GetWeights().
|
protectedpure virtual |
Calculate the number of degrees of freedom for this element.
Implemented in Nektar::LibUtilities::NodalUtilTriangle, Nektar::LibUtilities::NodalUtilTetrahedron, Nektar::LibUtilities::NodalUtilPrism, Nektar::LibUtilities::NodalUtilQuad, and Nektar::LibUtilities::NodalUtilHex.
Referenced by GetVandermonde(), GetVandermondeForDeriv(), and GetWeights().
|
protectedpure virtual |
Return the values of the orthogonal basis at the nodal points for a given mode.
mode | Mode number, which is between 0 and NodalUtil::v_NumModes()
|
mode
evaluated at the nodal points. Implemented in Nektar::LibUtilities::NodalUtilTriangle, Nektar::LibUtilities::NodalUtilTetrahedron, Nektar::LibUtilities::NodalUtilPrism, Nektar::LibUtilities::NodalUtilQuad, and Nektar::LibUtilities::NodalUtilHex.
Referenced by GetVandermonde().
|
protectedpure virtual |
Return the values of the derivative of the orthogonal basis at the nodal points for a given mode.
dir | Coordinate direction of derivative. |
mode | Mode number, which is between 0 and NodalUtil::v_NumModes()
|
Implemented in Nektar::LibUtilities::NodalUtilTriangle, Nektar::LibUtilities::NodalUtilTetrahedron, Nektar::LibUtilities::NodalUtilPrism, Nektar::LibUtilities::NodalUtilQuad, and Nektar::LibUtilities::NodalUtilHex.
Referenced by GetVandermondeForDeriv().
|
protected |
Degree of the nodal element.
Definition at line 103 of file NodalUtil.h.
Referenced by Nektar::LibUtilities::NodalUtilHex::NodalUtilHex(), Nektar::LibUtilities::NodalUtilPrism::NodalUtilPrism(), Nektar::LibUtilities::NodalUtilQuad::NodalUtilQuad(), Nektar::LibUtilities::NodalUtilTetrahedron::NodalUtilTetrahedron(), Nektar::LibUtilities::NodalUtilTriangle::NodalUtilTriangle(), Nektar::LibUtilities::NodalUtilTriangle::v_CreateUtil(), Nektar::LibUtilities::NodalUtilTetrahedron::v_CreateUtil(), Nektar::LibUtilities::NodalUtilPrism::v_CreateUtil(), Nektar::LibUtilities::NodalUtilQuad::v_CreateUtil(), Nektar::LibUtilities::NodalUtilHex::v_CreateUtil(), Nektar::LibUtilities::NodalUtilTriangle::v_NumModes(), Nektar::LibUtilities::NodalUtilTetrahedron::v_NumModes(), Nektar::LibUtilities::NodalUtilPrism::v_NumModes(), Nektar::LibUtilities::NodalUtilQuad::v_NumModes(), and Nektar::LibUtilities::NodalUtilHex::v_NumModes().
|
protected |
Dimension of the nodal element.
Definition at line 101 of file NodalUtil.h.
|
protected |
Total number of nodal points.
Definition at line 105 of file NodalUtil.h.
Referenced by GetVandermonde(), GetVandermondeForDeriv(), GetWeights(), Nektar::LibUtilities::NodalUtilHex::NodalUtilHex(), Nektar::LibUtilities::NodalUtilPrism::NodalUtilPrism(), Nektar::LibUtilities::NodalUtilQuad::NodalUtilQuad(), Nektar::LibUtilities::NodalUtilTetrahedron::NodalUtilTetrahedron(), Nektar::LibUtilities::NodalUtilTriangle::NodalUtilTriangle(), Nektar::LibUtilities::NodalUtilTriangle::v_OrthoBasis(), Nektar::LibUtilities::NodalUtilTetrahedron::v_OrthoBasis(), Nektar::LibUtilities::NodalUtilPrism::v_OrthoBasis(), Nektar::LibUtilities::NodalUtilQuad::v_OrthoBasis(), Nektar::LibUtilities::NodalUtilHex::v_OrthoBasis(), Nektar::LibUtilities::NodalUtilTriangle::v_OrthoBasisDeriv(), Nektar::LibUtilities::NodalUtilTetrahedron::v_OrthoBasisDeriv(), Nektar::LibUtilities::NodalUtilPrism::v_OrthoBasisDeriv(), Nektar::LibUtilities::NodalUtilQuad::v_OrthoBasisDeriv(), and Nektar::LibUtilities::NodalUtilHex::v_OrthoBasisDeriv().
Coordinates of the nodal points defining the basis.
Definition at line 107 of file NodalUtil.h.
Referenced by Nektar::LibUtilities::NodalUtilHex::NodalUtilHex(), Nektar::LibUtilities::NodalUtilPrism::NodalUtilPrism(), Nektar::LibUtilities::NodalUtilQuad::NodalUtilQuad(), Nektar::LibUtilities::NodalUtilTetrahedron::NodalUtilTetrahedron(), Nektar::LibUtilities::NodalUtilTriangle::NodalUtilTriangle(), Nektar::LibUtilities::NodalUtilQuad::v_OrthoBasis(), Nektar::LibUtilities::NodalUtilHex::v_OrthoBasis(), Nektar::LibUtilities::NodalUtilQuad::v_OrthoBasisDeriv(), and Nektar::LibUtilities::NodalUtilHex::v_OrthoBasisDeriv().