Module SpatialDiscretizations
The SpatialDiscretizations
module defines the discretization on the reference element and provides the geometric data relating to the mesh and the mapping from reference to physical space.
Overview
Discretizations in StableSpectralElements.jl are constructed by first building a local approximation on a canonical reference element, denoted generically as $\hat{\Omega} \subset \mathbb{R}^d$, and using a bijective transformation $\bm{X}^{(\kappa)} : \hat{\Omega} \rightarrow \Omega^{(\kappa)}$ to construct the approximation on each physical element $\Omega^{(\kappa)} \subset \Omega$ of the mesh $\{ \Omega^{(\kappa)}\}_{\kappa \in \{1:N_e\}}$ in terms of the associated operators on the reference element. An example of such a mapping is shown below, where we also depict the collapsed coordinate transformation $\bm{\chi} : [-1,1]^d \to \hat{\Omega}$ which may be used to construct operators with a tensor-product structure on the reference simplex.
In order to define the different geometric reference elements, the subtypes Line
, Quad
, Hex
, Tri
, and Tet
of AbstractElemShape
from StartUpDG.jl are used and re-exported by StableSpectralElements.jl, representing the following reference domains:
\[\begin{aligned} \hat{\Omega}_{\mathrm{line}} &= [-1,1],\\ \hat{\Omega}_{\mathrm{quad}} &= [-1,1]^2,\\ \hat{\Omega}_{\mathrm{hex}} & = [-1,1]^3, \\ \hat{\Omega}_{\mathrm{tri}} &= \big\{ \bm{\xi} \in [-1,1]^2 : \xi_1 + \xi_2 \leq 0 \big\},\\ \hat{\Omega}_{\mathrm{tet}} &= \big\{ \bm{\xi} \in [-1,1]^3 : \xi_1 + \xi_2 + \xi_3 \leq -1 \big\}. \end{aligned}\]
These element types are used in the constructor for StableSpectralElements.jl's ReferenceApproximation
type, along with a subtype of AbstractApproximationType
(NodalTensor
, ModalTensor
, NodalMulti
, ModalMulti
, NodalMultiDiagE
, or ModalMultiDiagE
) specifying the nature of the local approximation.
All the information used to define the spatial discretization on the physical domain $\Omega$ is contained within a SpatialDiscretization
structure, which is constructed using a ReferenceApproximation
and a MeshData
from StartUpDG.jl. When the constructor for a SpatialDiscretization
is called, the grid metrics are computed and stored in a field of type GeometricFactors
.
Reference
StableSpectralElements.SpatialDiscretizations.GeometricFactors
— TypeGeometricFactors(J_q::Matrix{Float64},
Λ_q::Array{Float64, 4},
J_f::Matrix{Float64},
nJf::Array{Float64, 3},
nJq::Array{Float64, 4})
Nodal values of geometric factors used by the solver to construct discretizations on the physical element. Contains the following fields:
J_q::Matrix{Float64}
: Jacobian determinant $J$ of the mapping from reference coordinates $\bm{\xi} \in \hat{\Omega}$ to physical coordinates $\bm{x} \in \Omega^{(\kappa)}$ at volume quadrature nodes; first dimension is node index (sizeN_q
), second is element index (sizeN_e
)Λ_q::Array{Float64, 4}
: Metric terms $J \partial \xi_l / \partial x_m$ at volume quadrature nodes; first index is node index (sizeN_q
), next two are $l$ and $m$ (sized
), last is element index (sizeN_e
)J_f::Matrix{Float64}
: Facet area element at facet quadrature nodes; first index is node index (sizeN_f
), second is element index (sizeN_e
)nJf::Array{Float64, 3}
: Scaled surface normal vector at facet quadrature nodes; first index is component of normal vector (sized
), second is node index (sizeN_f
), third is element index (sizeN_e
)nJq::Array{Float64, 4}
: Scaled surface normal vector to a given facet computed using the volume metrics (used in flux differencing); first index is component of normal vector (sized
), second component is reference facet index, third is volume quadrature node index (sizeN_q
), last is element index (sizeN_e
)
When using sum-factorization algorithms in collapsed coordinates with a StandardForm
solver and a ReferenceOperator
strategy, apply_reference_mapping!
overwrites Λ_q
to contain the metrics associated with the composite mapping from $[-1,1]^d$ to $\Omega^{(\kappa)}$. See (6.2) and (6.3) in the following paper:
- T. Montoya and D. W. Zingg (2024). Efficient tensor-product spectral-element operators with the summation-by-parts property on curved triangles and tetrahedra. SIAM Journal on Scientific Computing 46(4):A2270-A2297.
StableSpectralElements.SpatialDiscretizations.ModalMulti
— TypeModalMulti(p::Int)
Approximation type for a modal formulation of polynomial degree $p$ based on multidimensional volume and facet quadrature rules (generalized Vandermonde, derivative and interpolation/extrapolation operators are all dense). Currently supports Tri
and Tet
element types.
StableSpectralElements.SpatialDiscretizations.ModalMultiDiagE
— TypeModalMultiDiagE(p::Int)
Approximation type for a modal formulation based on a multidimensional volume quadrature rule of polynomial degree $p$ including nodes collocated with those used for facet integration (generalized Vandermonde and derivative operators are dense, interpolation/ extrapolation operator picks out values at facet quadrature nodes). Currently supports only the Tri
element type.
StableSpectralElements.SpatialDiscretizations.ModalTensor
— TypeModalTensor(p::Int)
Approximation type for a modal formulation of polynomial degree $p$ based on tensor-product volume and facet quadrature rules (generalized Vandermonde matrix is not necessarily identity, derivative and interpolation/extrapolation operators have tensor-product structure). Currently supports Tri
and Tet
element types.
StableSpectralElements.SpatialDiscretizations.NodalMulti
— TypeNodalMulti(p::Int)
Approximation type for a nodal formulation based on multidimensional volume and facet quadrature rules (generalized Vandermonde matrix is identity, derivative and interpolation/extrapolation operators are dense). Currently supports Tri
and Tet
element types.
StableSpectralElements.SpatialDiscretizations.NodalMultiDiagE
— TypeNodalMultiDiagE(p::Int)
Approximation type for a nodal formulation of polynomial degree $p$ based on a multidimensional volume quadrature rule including nodes collocated with those used for facet integration (generalized Vandermonde matrix is identity, derivative operator is dense, interpolation/extrapolation operator picks out values at facet quadrature nodes). Currently supports only the Tri
element type.
StableSpectralElements.SpatialDiscretizations.NodalTensor
— TypeNodalTensor(p::Int)
Approximation type for a nodal formulation of polynomial degree $p$ based on tensor-product volume and facet quadrature rules (generalized Vandermonde matrix is identity, derivative and interpolation/extrapolation operators have tensor-product structure). Currently supports Line
, Tri
, Tet
, Quad
, and Hex
element types.
StableSpectralElements.SpatialDiscretizations.ReferenceApproximation
— TypeReferenceApproximation(approx_type::AbstractReferenceMapping,
element_type::StartUpDG.AbstractElemShape, kwargs...)
Data structure defining the discretization on the reference element, containing the following fields, which are defined according to the approximation type, element type, and other parameters passed into the outer constructor:
approx_type::AbstractApproximationType
: Type of operators used for the discretization on the reference element (NodalTensor
,ModalTensor
,NodalMulti
,ModalMulti
,NodalMultiDiagE
, orModalMultiDiagE
)reference_element::StartUpDG.RefElemData
: Data structure containing quadrature node positions and operators used for defining the mapping from reference to physical space; contains the fieldelement_type::StartUpDG.AbstractElemShape
which determines the shape of the reference element (currently, StableSpectralElements.jl supports the optionsLine
,Quad
,Hex
,Tri
, andTet
)D::NTuple{d, <:LinearMap}
: Tuple of operators of sizeN_q
byN_q
approximating each partial derivative at the volume quadrature nodesV::LinearMap
: Generalized Vandermonde matrix of sizeN_q
byN_p
mapping solution degrees of freedom to values at volume quadrature nodesVf::LinearMap
: Generalized Vandermonde matrix of sizeN_f
byN_p
mapping solution degrees of freedom to values at facet quadrature nodesR::LinearMap
: Interpolation/extrapolation operator of sizeN_f
byN_q
which maps nodal data from volume quadrature nodes to facet quadrature nodesW::Diagonal
: Volume quadrature weight matrix of sizeN_q
byN_q
B::Diagonal
: Facet quadrature weight matrix of sizeN_f
byN_f
V_plot::LinearMap
: Generalized Vandermonde matrix mapping solution degrees of freedom to plotting nodesreference_mapping::AbstractReferenceMapping
: Optional collapsed coordinate transformation (eitherReferenceMapping
orNoMapping
); if such a mapping is used (i.e. notNoMapping
), the discrete derivative operators approximate partial derivatives with respect to components of the collapsed coordinate system
Outer constructors are provided to construct the discrete operators by dispatching on each combination of subtypes of AbstractApproximationType
and StartUpDG.AbstractElemShape
.
StableSpectralElements.SpatialDiscretizations.SpatialDiscretization
— TypeSpatialDiscretization(mesh::StartUpDG.MeshData,
reference_approximation::ReferenceApproximation,
metric_type::AbstractMetrics, kwargs...)
Composite type containing data for constructing the discretization on the reference element as well as the mesh and associated metric terms.