[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real > Class Template Reference

Polynomial Reconstruction Class. More...

#include <reconstruct_poly.h>

Collaboration diagram for PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >:

Public Member Functions

 ReconstructPoly (const dealii::DoFHandler< dim > &dof_handler, const dealii::hp::MappingCollection< dim > &mapping_collection, const dealii::hp::FECollection< dim > &fe_collection, const dealii::hp::QCollection< dim > &quadrature_collection, const dealii::UpdateFlags &update_flags)
 Constructor. Stores required information about the mesh and quadrature rules. More...
 
void reinit (const unsigned int n)
 Reinitialze the internal vectors. More...
 
void set_norm_type (const NormType norm_type)
 Select the Norm to be used in reconstruction. More...
 
void reconstruct_chord_derivative (const dealii::LinearAlgebra::distributed::Vector< real > &solution, const unsigned int rel_order)
 Construct directional derivatives along the chords of the cell. More...
 
void reconstruct_directional_derivative (const dealii::LinearAlgebra::distributed::Vector< real > &solution, const unsigned int rel_order)
 Construct the set of largest perpendicular directional derivatives. More...
 
void reconstruct_manufactured_derivative (const std::shared_ptr< ManufacturedSolutionFunction< dim, real >> &manufactured_solution, const unsigned int rel_order)
 Constructs directional derivates based on the manufactured solution hessian. More...
 
dealii::Vector< real > get_derivative_value_vector_dealii (const unsigned int index)
 Gets the i^th largest componet of the directional derivative vector as a dealii::Vector.
 

Public Attributes

std::vector< std::array< real, dim > > derivative_value
 Derivative values. More...
 
std::vector< std::array< dealii::Tensor< 1, dim, real >, dim > > derivative_direction
 Derivative directions. More...
 

Private Member Functions

template<typename DoFCellAccessorType >
dealii::Vector< real > reconstruct_norm (const NormType norm_type, const DoFCellAccessorType &curr_cell, const dealii::PolynomialSpace< dim > ps, const dealii::LinearAlgebra::distributed::Vector< real > &solution)
 Performs polynomial patchwise reconstruction on the current cell in the selected norm. More...
 
template<typename DoFCellAccessorType >
dealii::Vector< real > reconstruct_H1_norm (const DoFCellAccessorType &curr_cell, const dealii::PolynomialSpace< dim > ps, const dealii::LinearAlgebra::distributed::Vector< real > &solution)
 Performs polynomial patchwise reconstruction on the current cell in the H1 semi-norm. More...
 
template<typename DoFCellAccessorType >
dealii::Vector< real > reconstruct_L2_norm (const DoFCellAccessorType &curr_cell, const dealii::PolynomialSpace< dim > ps, const dealii::LinearAlgebra::distributed::Vector< real > &solution)
 Performs polynomial patchwise reconstruction on the current cell in the L2 norm. More...
 
template<typename DoFCellAccessorType >
std::vector< DoFCellAccessorType > get_patch_around_dof_cell (const DoFCellAccessorType &cell)
 Get the patch of cells surrounding the current cell of DofCellAccessorType. More...
 

Private Attributes

const dealii::DoFHandler< dim > & dof_handler
 Degree of freedom handler for iteration over mesh elements and their nodes.
 
const dealii::hp::MappingCollection< dim > & mapping_collection
 Collection of mapping rules for reference element conversion.
 
const dealii::hp::FECollection< dim > & fe_collection
 Collection of Finite elements to represent discontinuous \(hp\) solution space.
 
const dealii::hp::QCollection< dim > & quadrature_collection
 Collection of quadrature rules used to evaluate volume integrals.
 
const dealii::UpdateFlags & update_flags
 Update flags used in obtaining local cell representation.
 
NormType norm_type
 Setting controls the choice of norm used in reconstruction. Set via set_norm_type.
 

Detailed Description

template<int dim, int nstate, typename real>
class PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >

Polynomial Reconstruction Class.

This class contains functionality to approximate high-order derivative terms from the discrete solution. This is done by building a patchwise polynomial reconstruction with additional solution terms, matching the original function in the chosen error norm. The class contains functionality to perform this reconstruction either along specified element chord directions, or, by using the largest values sampled over the unit-ball of the error. This plays a key role in many mesh adaptation strategies used in the various grid refinement classes. It is especially important for the continuous methods where the additional directional derivatives provide anisotropic information to the remeshing process. After computation, the results can be extracted from the corresponding derivative_value and derivative_direction fields.

Definition at line 52 of file reconstruct_poly.h.

Constructor & Destructor Documentation

◆ ReconstructPoly()

template<int dim, int nstate, typename real >
PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::ReconstructPoly ( const dealii::DoFHandler< dim > &  dof_handler,
const dealii::hp::MappingCollection< dim > &  mapping_collection,
const dealii::hp::FECollection< dim > &  fe_collection,
const dealii::hp::QCollection< dim > &  quadrature_collection,
const dealii::UpdateFlags &  update_flags 
)

Constructor. Stores required information about the mesh and quadrature rules.

Parameters
dof_handlerdof_handler
mapping_collectionmapping collection
fe_collectionfe collection
quadrature_collectionquadrature collection
update_flagsupdate flags for for volume fe

Definition at line 20 of file reconstruct_poly.cpp.

Member Function Documentation

◆ get_patch_around_dof_cell()

template<int dim, int nstate, typename real >
template<typename DoFCellAccessorType >
std::vector< DoFCellAccessorType > PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::get_patch_around_dof_cell ( const DoFCellAccessorType &  cell)
private

Get the patch of cells surrounding the current cell of DofCellAccessorType.

Returns a list of neighbor cells sharing a face (or subface) with the current cell. Based on dealii::GridTools::get_patch_around_cell and modified to work directly on the dof_handler accesor for use with dealii::DoFHandler instead of needing to be cast back and forth.

Definition at line 766 of file reconstruct_poly.cpp.

◆ reconstruct_chord_derivative()

template<int dim, int nstate, typename real >
void PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::reconstruct_chord_derivative ( const dealii::LinearAlgebra::distributed::Vector< real > &  solution,
const unsigned int  rel_order 
)

Construct directional derivatives along the chords of the cell.

\(p+1\) (or rel_order) derivatives are constructed and extracted along the specified directions from the existing cell size. Once all polynomial terms on the surrounding patch are approximated (see reconstruct_norm for description), the derivative components are obtained by evaluating this function along a given direction:

\[ u_{\bar{\boldsymbol{x}}, p}(\boldsymbol{x}) = \sum_{|\boldsymbol{\alpha}| \leq p} { \frac{\partial^{\boldsymbol{\alpha}} u(\bar{\boldsymbol{x}})} {\boldsymbol{\alpha}!} (\boldsymbol{x}-\bar{\boldsymbol{x}})^{\boldsymbol{\alpha}} } \]

\[ D^{p+1}_{\boldsymbol{\xi}} u(\bar{\boldsymbol{x}}) h^{p+1} = u_{\bar{\boldsymbol{x}}, p+1}(\boldsymbol{x}+h\boldsymbol{\xi}) - u_{\bar{\boldsymbol{x}}, p}(\boldsymbol{x}+h\boldsymbol{\xi}) = \sum_{i=0}^{p+1}{ \frac{1} {i! (p+1-i)!} \frac{\partial^{p+1} u(\bar{\boldsymbol{x}})} {\partial x^i \partial y^{p+1-i}} (x-\bar{x})^i (y-\bar{y})^{p+1-i}} \]

Ordering is based on the internal dealii numbering. Used in cases where the orientation of the element is not controlled by the refinement procedure (e.g. fixed fraction cases). Gives direct prediction of how error will change with modifying the length of these axes.

Parameters
solutionSolution approximation to be reconstructed
rel_orderRelative order of the approximation

Definition at line 51 of file reconstruct_poly.cpp.

◆ reconstruct_directional_derivative()

template<int dim, int nstate, typename real >
void PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::reconstruct_directional_derivative ( const dealii::LinearAlgebra::distributed::Vector< real > &  solution,
const unsigned int  rel_order 
)

Construct the set of largest perpendicular directional derivatives.

\(p+1\) (or rel_order) derivatives are constructed and the largest values are extracted. In order to approximate the "worst case" unit-ball of the error in the high-order case, the method of Dolejsi is used where values are extracted from the maximum direction in the next perpendicular hyperplane to existing directions. In this way, a set of orthogonal directions is chosen with descending largest derivative orders. In 2D, this process can be written as solving the collection of functions to find maximums based on the patchwise reconstruction of the polynomial (obtained from reconstruction):

\[ A_1(\bar{\boldsymbol{x}}, p) &= \max_{\left\lVert{\boldsymbol{\xi}}\right\rVert_2=1}{|D^p_{\boldsymbol{\xi}} u(\bar{\boldsymbol{x}})|} \]

\[ \boldsymbol{\xi}_1(\bar{\boldsymbol{x}}, p) &= \mathrm{argmax}_{\left\lVert{\boldsymbol{\xi}}\right\rVert_2=1}{|D^p_{\boldsymbol{\xi}} u(\bar{\boldsymbol{x}})|} \]

\[ \varphi(\bar{\boldsymbol{x}}, p) & \in \left[ 0, 2\pi\right) \quad s.t. \text{ } \boldsymbol{\xi}_1 = (cos(\varphi), sin(\varphi)) \]

\[ A_2(\bar{\boldsymbol{x}}, p) &= |D^p_{\boldsymbol{\xi}_2} u(\bar{\boldsymbol{x}})|, \quad \text{where } \boldsymbol{\xi}_1 \cdot \boldsymbol{\xi}_2 = 0. \]

In the linear case where \(p=2\), these directions and values can be directly extracted from the local hessian reconstruction. Otherewise, for the high-order case, this is performed by sampling an approximately equidistributed set of points to give a "good enough" approximation. In 2D, 180 points are distributed radially on \([0,\pi]\) to give a \(1^\circ\) accuracy (second half of angles will be equal or negative depending on even/odd polynomial order). In 3D, the initial sampling is done using a fibbonaci spiral mapped to the unit sphere (a fibbonaci sphere, see https://stackoverflow.com/questions/9600801/evenly-distributing-n-points-on-a-sphere/26127012#26127012). This provides a good enough apporximation to an even distrubution for this case. \(180 \times 180 / 2\) samples are used to give a similar angular resolution. The second components are extracted from a unit-circle on the perpendicular plane to the largest direction.

Parameters
solutionSolution approximation to be reconstructed
rel_orderRelative order of the approximation

Definition at line 166 of file reconstruct_poly.cpp.

◆ reconstruct_H1_norm()

template<int dim, int nstate, typename real >
template<typename DoFCellAccessorType >
dealii::Vector< real > PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::reconstruct_H1_norm ( const DoFCellAccessorType &  curr_cell,
const dealii::PolynomialSpace< dim >  ps,
const dealii::LinearAlgebra::distributed::Vector< real > &  solution 
)
private

Performs polynomial patchwise reconstruction on the current cell in the H1 semi-norm.

See general form of reconstruct_norm for basic reconstruction problem description. This function is specialized to work based on the selected H1 semi-norm leading to the patchwise norm definition:

\[ \left<f,g\right>_{H^1(D(k))} = \int_{D(k)}{\left[ f(\boldsymbol{x})g(\boldsymbol{x}) + \sum_{i=0}^{dim} {\partial_i f(\boldsymbol{x}) \partial_i g(\boldsymbol{x})} \mathrm{d} \boldsymbol{x} \right]} \]

This requires the polynomial space values and derivatives to be constructed for each pair of shape functions on the quadrature points and also integrated with the discrete solution approximation values and derivatives.

Definition at line 550 of file reconstruct_poly.cpp.

◆ reconstruct_L2_norm()

template<int dim, int nstate, typename real >
template<typename DoFCellAccessorType >
dealii::Vector< real > PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::reconstruct_L2_norm ( const DoFCellAccessorType &  curr_cell,
const dealii::PolynomialSpace< dim >  ps,
const dealii::LinearAlgebra::distributed::Vector< real > &  solution 
)
private

Performs polynomial patchwise reconstruction on the current cell in the L2 norm.

See general form of reconstruct_norm for basic reconstruction problem description. This function is specialized to work based on the selected H1 semi-norm leading to the patchwise norm definition:

\[ \left<f,g\right>_{L^2(D(k))} = \int_{D(k)}{\left[ f(\boldsymbol{x})g(\boldsymbol{x}) \mathrm{d} \boldsymbol{x} \right]} \]

This requires the polynomial space values to be constructed for each pair of shape functions on the quadrature points and also integrated with the discrete solution approximation values.

Definition at line 661 of file reconstruct_poly.cpp.

◆ reconstruct_manufactured_derivative()

template<int dim, int nstate, typename real >
void PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::reconstruct_manufactured_derivative ( const std::shared_ptr< ManufacturedSolutionFunction< dim, real >> &  manufactured_solution,
const unsigned int  rel_order 
)

Constructs directional derivates based on the manufactured solution hessian.

For \(p=2\) only, gets the exact directional derivative components using the spectral decomposition of the hessian:

\[ H = \left[\begin{matrix} u_{xx} & u_{xy} \\ u_{yx} & u_{yy} \end{matrix}\right] = \left[\begin{matrix} \boldsymbol{v}_0 & \boldsymbol{v}_1 \end{matrix}\right] \left[\begin{matrix} \lambda_0 & \\ & \lambda_1 \end{matrix}\right] \left[\begin{matrix} \boldsymbol{v}_0^T \\ \boldsymbol{v}_1^T \end{matrix}\right] \]

\[ D^{p=2}_{\boldsymbol{\xi}} u(\bar{\boldsymbol{x}}) h^{p+1} = \boldsymbol{\xi}^T H \boldsymbol{\xi} = \sum_{i=0}^{dim} {\lambda_i \left(\boldsymbol{\xi}^T \boldsymbol{v}_i\right)^2} \]

Where then \(\lambda_i\) (eigenvales) are the directional derivatives and \(v_i\) (eigenvectors) are the direction vectors.

Parameters
manufactured_solutionManufactured solution function
rel_orderRelative order of the approximation

Definition at line 432 of file reconstruct_poly.cpp.

◆ reconstruct_norm()

template<int dim, int nstate, typename real >
template<typename DoFCellAccessorType >
dealii::Vector< real > PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::reconstruct_norm ( const NormType  norm_type,
const DoFCellAccessorType &  curr_cell,
const dealii::PolynomialSpace< dim >  ps,
const dealii::LinearAlgebra::distributed::Vector< real > &  solution 
)
private

Performs polynomial patchwise reconstruction on the current cell in the selected norm.

In order to obtain the high-order derivative terms, an enriched polynomial spaced solution \(\tilde{u}\in\mathbb{P}^{p+1}\) is obtained on the set of neighboring elements, \(D(k)\) for the current element \(k\). This leads to finding an equality for the inner-product between the original discontinuous solution \(u_h\) and the new enriched continuous solution \(\tilde{u}\):

\[ \left< \tilde{u}, \phi \right>_{L \left(D(k)\right)} = \left< u_h, \phi \right>_{L \left(D(k)\right)}, \quad \forall \phi \in \mathbb{P}^{p+1}\left(D(k)\right) \]

Where \(L\) is the normed integral space chosen for the reconstruction to take place. This leads to a system of equations for each polynomial shape function on the patch of cells. This is then evaluated on the set of element quadrature points to a matrix system that can be solved for the coefficients of the enriched solution in the polynomial space:

\[ \tilde{u}(x,y) = \sum_{i=0}^{N} {a_i \phi_i(x,y)} \]

\[ \left[\begin{matrix} <\phi_0,\phi_0>_{N(D(k))} & \cdots & <\phi_0,\phi_N>_{N(D(k))} \\ \vdots & \ddots & \vdots \\ <\phi_N,\phi_0>_{N(D(k))} & \cdots & <\phi_N,\phi_N>_{N(D(k))} \end{matrix}\right] \left[\begin{matrix} a_0 \\ \vdots \\ a_N \\ \end{matrix}\right] = \left[\begin{matrix} <u_h,\phi_0>_{N(D(k))} \\ \vdots \\ <u_h,\phi_N>_{N(D(k))} \end{matrix}\right] \]

and returned as a vector for further processing of the directional derivatives. For the current class, the polynomial space is selected as the set of non-homogeneous polynomials of maximum order \(p+1\). For example, \(\phi_i(x,y) = \left[1, x, y, x^2, ...\right]\).

Definition at line 517 of file reconstruct_poly.cpp.

◆ reinit()

template<int dim, int nstate, typename real >
void PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::reinit ( const unsigned int  n)

Reinitialze the internal vectors.

These vectors are used to store the obtained derivative values and directions at each mesh element.

Definition at line 43 of file reconstruct_poly.cpp.

◆ set_norm_type()

template<int dim, int nstate, typename real >
void PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::set_norm_type ( const NormType  norm_type)

Select the Norm to be used in reconstruction.

Results in a modified local reconstruction process for the patch of neighbouring elements.

Definition at line 37 of file reconstruct_poly.cpp.

Member Data Documentation

◆ derivative_direction

template<int dim, int nstate, typename real>
std::vector<std::array<dealii::Tensor<1,dim,real>,dim> > PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::derivative_direction

Derivative directions.

For each element, array of unit vectors indicate the direction of the \((p+1)^{th}\) (or rel_order) directional derivatives that have been evaluated from the specified chord directions (in reconstruct_chord_derivative) or from the largest orthogonal set of directions (in reconstruct_directional_derivative). These correspond with the numbering of the scalar derivative values in derivative_value.

Definition at line 286 of file reconstruct_poly.h.

◆ derivative_value

template<int dim, int nstate, typename real>
std::vector<std::array<real,dim> > PHiLiP::GridRefinement::ReconstructPoly< dim, nstate, real >::derivative_value

Derivative values.

For each element, array of values indicates the scale of the \((p+1)^{th}\) (or rel_order) directional derivatives that have been evaluated from the specified chord directions (in reconstruct_chord_derivative) or from the largest orthogonal set of directions (in reconstruct_directional_derivative). These correspond with the numbering of the unit vector directions in derivative_direction.

Definition at line 278 of file reconstruct_poly.h.


The documentation for this class was generated from the following files: