Peano
Loading...
Searching...
No Matches
exahype2::dg Namespace Reference

Namespaces

namespace  average
 
namespace  fluxaverage
 
namespace  internal
 
namespace  laxfriedrichs
 
namespace  rusanov
 
namespace  tests
 

Data Structures

struct  PointSource
 

Typedefs

typedef std::function< void(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &x, double t, double dt, int normal, double *__restrict__ F) Flux)
 Flux functor.
 
typedef std::function< void(const double *__restrict__ Q, const double *__restrict__ dQdx, const tarch::la::Vector< Dimensions, double > &x, double t, double dt, int normal, double *__restrict__ F) NonConservativeProduct)
 
typedef std::function< void(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &x, double t, double dt, double *__restrict__ S) Source)
 Source functor.
 
typedef std::function< std::vector< PointSource >(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &cellCentre, const tarch::la::Vector< Dimensions, double > &h, double t, double dt) PointSources)
 This is the only routine within the DG framework which accepts the dimensions of the underlying cell rather than only a point.
 
typedef std::function< double(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &x, double t, double dt, int normal) MaxEigenvalue)
 
typedef std::function< void(const double *__restrict__ Qinside, double *__restrict__ Qoutside, const tarch::la::Vector< Dimensions, double > &x, double t, int normal) BoundaryConditions)
 

Functions

void applyBoundaryConditions (std::function< void(const double *__restrict__ Qinside, double *__restrict__ Qoutside, const tarch::la::Vector< Dimensions, double > &x, double t, double dt, int normal) > boundaryCondition, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &cellSize, double t, double dt, int order, int unknowns, int auxiliaryVariables, int faceNumber, const double *__restrict__ quadraturePoints, double *__restrict__ Q)
 Apply boundary conditions.
 
void cellIntegral_patchwise_in_situ_GaussLegendre_functors (::exahype2::CellData< double, double > &cellData, const int order, const int unknowns, const int auxiliaryVariables, Flux flux, NonConservativeProduct nonconservativeProduct, Source source, PointSources pointSources, const double *__restrict__ QuadratureNodes1d, const double *__restrict__ MassMatrixDiagonal1d, const double *__restrict__ StiffnessMatrix1d, const double *__restrict__ DerivativeOperator1d, bool evaluateFlux, bool evaluateNonconservativeProduct, bool evaluateSource, bool evaluatePointSources)
 
template<typename Solver , int order, int unknowns, int auxiliaryVariables>
void cellIntegral_patchwise_in_situ_GaussLegendre (::exahype2::CellData< double, double > &cellData, bool evaluateFlux, bool evaluateNonconservativeProduct, bool evaluateSource, bool evaluatePointSources)
 
void multiplyWithInvertedMassMatrix_GaussLegendre (::exahype2::CellData< double, double > &cellData, const int order, const int unknowns, const int auxiliaryVariables, const double *__restrict__ MassMatrixDiagonal1d)
 Final step of DG algorithm.
 
void reduceMaxEigenvalue_patchwise_functors (::exahype2::CellData< double, double > &cellData, const int order, const int unknowns, const int auxiliaryVariables, MaxEigenvalue maxEigenvalue, const double *__restrict__ QuadratureNodes1d)
 Compute the maximum eigenvalues over a sequence of cells and store the result in the respective CellData entry.
 
template<typename T >
tarch::la::Vector< Dimensions, doublegetQuadraturePoint (const tarch::la::Vector< Dimensions, double > &cellCentre, const tarch::la::Vector< Dimensions, double > &cellSize, const tarch::la::Vector< Dimensions, int > &index, int polynomialOrder, const T *__restrict__ quadraturePoints)
 Construct location of a quadrature point.
 
double getQuadratureWeight (const tarch::la::Vector< 3, double > &cellSize, const tarch::la::Vector< 3, int > &index, const double *__restrict__ quadratureWeights)
 Compute integral over shape function over cell defined by index.
 
int getNodesPerCell (int nodesPerAxis)
 The number of nodes in a cell is basically the input to the power of d.
 
tarch::la::Vector< Dimensions, intgetStrides (int nodesPerAxis)
 
tarch::la::Vector< Dimensions, intgetIndex (int node, tarch::la::Vector< Dimensions, int > strides)
 
int cellIndexToHullIndex (const tarch::la::Vector< Dimensions, int > &indexCell, const int direction, const int orientation, const int nodesPerAxis)
 
void computeGradient (const double *__restrict__ const QCell, const double *__restrict__ const derivativeOperator, const double invDx, const int nodesPerAxis, const int strideQ, const int scalarIndex, double *__restrict__ gradQ)
 
void subtractCell (double *__restrict__ QOut, const double *__restrict__ Qsubstract, const int order, const int unknowns, const int auxiliaryVariables)
 
std::string plotCell (const double *__restrict__ Q, const int order, const int unknowns, const int auxiliaryVariables)
 
std::string plotFace (const double *__restrict__ Q, const int order, const int unknowns, const int auxiliaryVariables, int normal, int numberOfQuantitiesProjectedOntoFace)
 
template<typename QStoreType >
QStoreType evaluatePolynomial (const peano4::datamanagement::CellMarker &marker, int order, const double *__restrict__ QuadratureNodes1d, int unknownsPerDoF, const QStoreType *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &x, int unknown)
 Evaluate the DG polynomial.
 
void copyOneSideOfFaceProjection (int unknownsPlusAuxiliaryVariables, int order, int numberOfProjectedQuantities, int normal, int isRightFaceHalf, const double *__restrict__ srcQ, double *__restrict__ destQ)
 Delegate to PatchUtils of the Finite Volume scheme.
 
void interpolateRiemannSolution (const peano4::datamanagement::FaceMarker &marker, int order, int unknowns, const double *__restrict__ InterpolationMatrix1d, const double *__restrict__ coarseGridFaceQ, double *__restrict__ fineGridFaceQ)
 
void restrictAndAccumulateProjectedFacePolynomial (const peano4::datamanagement::FaceMarker &marker, int order, int numberOfProjectedQuantities, int unknowns, int auxiliaryVariables, const double *__restrict__ RestrictionMatrix1d, const double *__restrict__ fineGridFaceQ, double *__restrict__ coarseGridFaceQ)
 Counterpart of interpolateRiemannSolution().
 
void projectVolumetricDataOntoFaces (const double *__restrict__ cellQ, int order, int unknowns, int auxiliaryVariables, const double *const __restrict__ BasisFunctionValuesLeft, double *const __restrict__ faceQLeft, double *const __restrict__ faceQRight, double *const __restrict__ faceQBottom, double *const __restrict__ faceQUp)
 Take polynomial within cell and project it onto the faces.
 
void clearSolutionProjection (int order, int unknowns, int auxiliaryVariables, int numberOfProjectedQuantities, double *__restrict__ faceQ)
 Set the whole solution projection on the face from left and right to zero.
 
void clearRiemannResult (int order, int unknowns, double *__restrict__ faceQ)
 
void projectVolumetricDataOntoFaces (const double *__restrict__ cellQ, int order, int unknowns, int auxiliaryVariables, const double *const __restrict__ BasisFunctionValuesLeft, double *const __restrict__ faceQLeft, double *const __restrict__ faceQRight, double *const __restrict__ faceQBottom, double *const __restrict__ faceQUp, double *const __restrict__ faceQFront, double *const __restrict__ faceQBack)
 3d counterpart to other projectVolumetricDataOntoFaces() variant.
 
void projectVolumetricDataAndGradientOntoFaces (const double *__restrict__ cellQ, int order, int unknowns, int auxiliaryVariables, const double *const __restrict__ BasisFunctionValuesLeft, double *const __restrict__ faceQLeft, double *const __restrict__ faceQRight, double *const __restrict__ faceQBottom, double *const __restrict__ faceQUp)
 
void projectVolumetricDataAndGradientOntoFaces (const double *__restrict__ cellQ, int order, int unknowns, int auxiliaryVariables, const double *const __restrict__ BasisFunctionValuesLeft, double *const __restrict__ faceQLeft, double *const __restrict__ faceQRight, double *const __restrict__ faceQBottom, double *const __restrict__ faceQUp, double *const __restrict__ faceQFront, double *const __restrict__ faceQBack)
 3d counterpart to other projectVolumetricDataOntoFaces() variant.
 
void integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre (const double *const __restrict__ faceQLeft, const double *const __restrict__ faceQRight, const double *const __restrict__ faceQBottom, const double *const __restrict__ faceQUp, int order, int unknowns, const int auxiliaryVariables, const tarch::la::Vector< 2, double > &cellSize, const double *const __restrict__ BasisFunctionValuesLeft, const double *__restrict__ MassMatrixDiagonal1d, double *__restrict__ cellQ)
 Given a numerical flux at the various faces, this computes and adds the Riemann integral of this flux to the nodes of the cell.
 
void integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre (const double *const __restrict__ faceQLeft, const double *const __restrict__ faceQRight, const double *const __restrict__ faceQBottom, const double *const __restrict__ faceQUp, const double *const __restrict__ faceQFront, const double *const __restrict__ faceQBack, int order, int unknowns, const int auxiliaryVariables, const tarch::la::Vector< 3, double > &cellSize, const double *const __restrict__ BasisFunctionValuesLeft, const double *__restrict__ MassMatrixDiagonal1d, double *__restrict__ cellQ)
 3D counterpart of integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre()
 
template<typename Particle , int SourceIndex, int DestIndex>
void projectValueOntoParticle (const peano4::datamanagement::CellMarker &marker, int order, const double *__restrict__ QuadratureNodes1d, int unknownsPerDoF, const double *__restrict__ Q, Particle &particle)
 Project one quantity from the patch data onto the particle.
 
template<typename Particle , typename QStoreType >
void projectAllValuesOntoParticle (const peano4::datamanagement::CellMarker &marker, int order, const double *__restrict__ QuadratureNodes1d, int unknownsPerDoF, const QStoreType *__restrict__ Q, Particle &particle)
 Take all values of the unknown field Q and project them onto the particle.
 

Typedef Documentation

◆ BoundaryConditions

typedef std::function< void( const double * __restrict__ Qinside, double * __restrict__ Qoutside, const tarch::la::Vector<Dimensions,double>& x, double t, int normal ) exahype2::dg::BoundaryConditions)

Definition at line 109 of file Functors.h.

◆ Flux

typedef std::function< void( const double * __restrict__ Q, const tarch::la::Vector<Dimensions,double>& x, double t, double dt, int normal, double * __restrict__ F ) exahype2::dg::Flux)

Flux functor.

This functor defines the signature of the flux evaluation.

If you use a template compute kernel,

Comparison to Finite Volume flux

The finite volume flux accepts a volume size h as well. For DG, we do not pass an h, as we actually work point-wisely: the flux is evaluated in integration points and then scales an underlying shape function. So there's no need for any spatial averaging, e.g.

Definition at line 44 of file Functors.h.

◆ MaxEigenvalue

typedef std::function< double( const double * __restrict__ Q, const tarch::la::Vector<Dimensions,double>& x, double t, double dt, int normal ) exahype2::dg::MaxEigenvalue)

Definition at line 95 of file Functors.h.

◆ NonConservativeProduct

typedef std::function< void( const double * __restrict__ Q, const double * __restrict__ dQdx, const tarch::la::Vector<Dimensions,double>& x, double t, double dt, int normal, double * __restrict__ F ) exahype2::dg::NonConservativeProduct)

Definition at line 54 of file Functors.h.

◆ PointSources

typedef std::function< std::vector<PointSource>( const double * __restrict__ Q, const tarch::la::Vector<Dimensions,double>& cellCentre, const tarch::la::Vector<Dimensions,double>& h, double t, double dt ) exahype2::dg::PointSources)

This is the only routine within the DG framework which accepts the dimensions of the underlying cell rather than only a point.

Definition at line 87 of file Functors.h.

◆ Source

typedef std::function< void( const double * __restrict__ Q, const tarch::la::Vector<Dimensions,double>& x, double t, double dt, double * __restrict__ S ) exahype2::dg::Source)

Source functor.

This functor defines the signature of the source evaluation.

Comparison to Finite Volume source

The finite volume source accepts a volume size h as well. For DG, we do not pass an h, as we actually work point-wisely: the source is evaluated in integration points and then scales an underlying shape function. So there's no need for any spatial averaging, e.g.

Definition at line 75 of file Functors.h.

Function Documentation

◆ applyBoundaryConditions()

void exahype2::dg::applyBoundaryConditions ( std::function< void(const double *__restrict__ Qinside, double *__restrict__ Qoutside, const tarch::la::Vector< Dimensions, double > &x, double t, double dt, int normal) > boundaryCondition,
const tarch::la::Vector< Dimensions, double > & faceCentre,
const tarch::la::Vector< Dimensions, double > & cellSize,
double t,
double dt,
int order,
int unknowns,
int auxiliaryVariables,
int faceNumber,
const double *__restrict__ quadraturePoints,
double *__restrict__ Q )

Apply boundary conditions.

Assumes we solely have the solution projected on the face.

Arguments

Parameters
faceNumberThe number of the face relativ from the cell that recognises that its face is called for the first time. So it is a number from [0,2d-1] according to Peano's standard face enumeration scheme. See grid::datatraversal::FaceEnumerator for more details.
quadNodesquadraturePoints of the integration/quadrature points along a 1d unit interval. The array consequently has order+1 entries from (0,1). You can scale them with the actual cell width (cellSize) to fit it to a cell, and you can multiply is component-wisely with the quadrature point of interest to get a 2d or 3d coordinate. This is straightforward, as we employ Cartesian meshes, i.e. coordinates can be constructed via a tensor product approach.

Definition at line 12 of file BoundaryConditions.cpp.

References _log, dfore, logTraceInWith3Arguments, and logTraceOut.

◆ cellIndexToHullIndex()

int exahype2::dg::cellIndexToHullIndex ( const tarch::la::Vector< Dimensions, int > & indexCell,
const int direction,
const int orientation,
const int nodesPerAxis )

Definition at line 71 of file DGUtils.cpp.

◆ cellIntegral_patchwise_in_situ_GaussLegendre()

template<typename Solver , int order, int unknowns, int auxiliaryVariables>
void exahype2::dg::cellIntegral_patchwise_in_situ_GaussLegendre ( ::exahype2::CellData< double, double > & cellData,
bool evaluateFlux,
bool evaluateNonconservativeProduct,
bool evaluateSource,
bool evaluatePointSources )

◆ cellIntegral_patchwise_in_situ_GaussLegendre_functors()

void exahype2::dg::cellIntegral_patchwise_in_situ_GaussLegendre_functors ( ::exahype2::CellData< double, double > & cellData,
const int order,
const int unknowns,
const int auxiliaryVariables,
Flux flux,
NonConservativeProduct nonconservativeProduct,
Source source,
PointSources pointSources,
const double *__restrict__ QuadratureNodes1d,
const double *__restrict__ MassMatrixDiagonal1d,
const double *__restrict__ StiffnessMatrix1d,
const double *__restrict__ DerivativeOperator1d,
bool evaluateFlux,
bool evaluateNonconservativeProduct,
bool evaluateSource,
bool evaluatePointSources )

◆ clearRiemannResult()

void exahype2::dg::clearRiemannResult ( int order,
int unknowns,
double *__restrict__ faceQ )
See also
clearSolutionProjection()

Definition at line 153 of file Riemann.cpp.

References clearSolutionProjection().

Here is the call graph for this function:

◆ clearSolutionProjection()

void exahype2::dg::clearSolutionProjection ( int order,
int unknowns,
int auxiliaryVariables,
int numberOfProjectedQuantities,
double *__restrict__ faceQ )

Set the whole solution projection on the face from left and right to zero.

Parameters
numberOfProjectedQUantitiesEquals one if we project only the solution to the face, it equals two if we project both the solution and the gradient or the F-extrapolation, and so forth.

Definition at line 137 of file Riemann.cpp.

Referenced by clearRiemannResult().

Here is the caller graph for this function:

◆ computeGradient()

void exahype2::dg::computeGradient ( const double *__restrict__ const QCell,
const double *__restrict__ const derivativeOperator,
const double invDx,
const int nodesPerAxis,
const int strideQ,
const int scalarIndex,
double *__restrict__ gradQ )

Definition at line 110 of file DGUtils.cpp.

References getIndex(), and getStrides().

Referenced by exahype2::dg::tests::DGUtilsTest::testComputeGradientOnConstantSolution().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyOneSideOfFaceProjection()

void exahype2::dg::copyOneSideOfFaceProjection ( int unknownsPlusAuxiliaryVariables,
int order,
int numberOfProjectedQuantities,
int normal,
int isRightFaceHalf,
const double *__restrict__ srcQ,
double *__restrict__ destQ )

Delegate to PatchUtils of the Finite Volume scheme.

Definition at line 4 of file DGUtils.cpp.

References exahype2::fv::copyHalfOfHalo().

Here is the call graph for this function:

◆ evaluatePolynomial()

template<typename QStoreType >
QStoreType exahype2::dg::evaluatePolynomial ( const peano4::datamanagement::CellMarker & marker,
int order,
const double *__restrict__ QuadratureNodes1d,
int unknownsPerDoF,
const QStoreType *__restrict__ Q,
const tarch::la::Vector< Dimensions, double > & x,
int unknown )

Evaluate the DG polynomial.

Evaluate the Lagrangian polynomial within the cell specified by marker in one point. Return the value unknown within this interpolated point.

Realisation

We loop with a d-dimensional for loop over all quadrature points within the cell. Each iteration of this loop over currentDoF evalutes the impact of the polynomial anchored at currentDoF onto the position of interest. To find out what this polynomial looks like, we have to loop over all quadrature points again, besides those guys that coincide in one coordinate with the shape function at currentDoF. This inner loop over quadraturePoint exploits the fact that the Lagrange polynomials are constructed through a product over terms, while the overall d-dimensional shape function results from a tensor product. Therefore, we can evaluate the shape function over one big loop multiplying the enumerator and denominator.

Once the shape function's value at point x is evaluated, we multiple it with the actual weight of this function. The outcome is added to the result, as we work with a standard nodal basis.

Parameters
markerMarker that specifies the cell, i.e. its size and offset.
orderOrder of the polynomial.
QuadratureNodes1dArrangement of the quadrature points on the 1d unit interval, i.e. from 0 to 1.
unknownsPerDoFTotal number of unknowns within a degree of freedom. Shoudl incorporate the number of material parameters.
QPointer to data stored as AoS. The size of this data field is \( (order+1)^d \cdot unknownsPerDoF \).
xPoint of interest where the overall polynomial solution is to be evaluated.
unknownUnknown of interest.

Definition at line 3 of file DGUtils.cpph.

References dfor, and peano4::utils::dLinearised().

Referenced by projectAllValuesOntoParticle(), projectValueOntoParticle(), exahype2::dg::tests::DGUtilsTest::testEvaluatePolynomialOrder1(), and exahype2::dg::tests::DGUtilsTest::testEvaluatePolynomialOrder2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIndex()

tarch::la::Vector< Dimensions, int > exahype2::dg::getIndex ( int node,
tarch::la::Vector< Dimensions, int > strides )

Definition at line 55 of file DGUtils.cpp.

Referenced by computeGradient(), and exahype2::dg::tests::DGUtilsTest::testGetIndex().

Here is the caller graph for this function:

◆ getNodesPerCell()

int exahype2::dg::getNodesPerCell ( int nodesPerAxis)

The number of nodes in a cell is basically the input to the power of d.

The argument nodesPerAxis is typically the order plus one.

Returns
Number of nodes in a cell

Definition at line 39 of file DGUtils.cpp.

Referenced by cellIntegral_patchwise_in_situ_GaussLegendre(), cellIntegral_patchwise_in_situ_GaussLegendre_functors(), subtractCell(), exahype2::dg::tests::DGUtilsTest::testComputeGradientOnConstantSolution(), exahype2::dg::tests::DGUtilsTest::testGetIndex(), and exahype2::dg::tests::RiemannTest::testProjectVolumetricDataOntoFacesForConstantSolutionOrder3().

Here is the caller graph for this function:

◆ getQuadraturePoint()

template<typename T >
tarch::la::Vector< Dimensions, double > exahype2::dg::getQuadraturePoint ( const tarch::la::Vector< Dimensions, double > & cellCentre,
const tarch::la::Vector< Dimensions, double > & cellSize,
const tarch::la::Vector< Dimensions, int > & index,
int polynomialOrder,
const T *__restrict__ quadraturePoints )

Construct location of a quadrature point.

Given the centre of a cell as well as the size of this cell plus the index of a quadrature point, the underlying polynomial order and the 1d spacing of the points on the reference element, this function computes the spatial position of a quadrature node.

For example if there are 2 points in each dimension, located at [0.25,0.75] in 1d, then for a 2d cell with center 0.5 and size 1 [i.e. ranging from [0,0] to [1,1], there would be four nodes specified with indexes 0 to 3 and respective positions [0.25,0.25], [0.25,0.75], [0.75,0.25] and [0.75,0.75]

Parameters
polynomialOrderorder of the underlying polynomial, this specifies the number of quadraturePoints in each direction as order+1
quadraturePoints1d quadrature points over unit interval. This array has polynomialOrder+1 entries. See the documentation of the Python class exaype2.solvers.LagrangeBasis (use search field in the webpage generated by doxygen).

Definition at line 33 of file DGUtils.cpph.

References tarch::la::multiplyComponents().

Referenced by cellIntegral_patchwise_in_situ_GaussLegendre(), cellIntegral_patchwise_in_situ_GaussLegendre_functors(), and reduceMaxEigenvalue_patchwise_functors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getQuadratureWeight()

double exahype2::dg::getQuadratureWeight ( const tarch::la::Vector< 3, double > & cellSize,
const tarch::la::Vector< 3, int > & index,
const double *__restrict__ quadratureWeights )

Compute integral over shape function over cell defined by index.

Parameters
cellSizeSize of the cell hosting the polygonials. This vector determines the scaling, i.e. the \( h^d \) factor, of the outcome.
indexDetermine the quadrature point within the cell that is to be evaluated.
quadratureWeightsArray of the weights of a 1d shape function, i.e. the outcome of the 1d integral. As we work with a tensor product approach, we can evaluate each direction independently.

Definition at line 25 of file DGUtils.cpp.

Referenced by benchmarks::exahype2::euler::sphericalaccretionupscaling::SelfSimilarInfallDG::addDensity().

Here is the caller graph for this function:

◆ getStrides()

tarch::la::Vector< Dimensions, int > exahype2::dg::getStrides ( int nodesPerAxis)

Definition at line 47 of file DGUtils.cpp.

Referenced by computeGradient(), and exahype2::dg::tests::DGUtilsTest::testGetIndex().

Here is the caller graph for this function:

◆ integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre() [1/2]

void exahype2::dg::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre ( const double *const __restrict__ faceQLeft,
const double *const __restrict__ faceQRight,
const double *const __restrict__ faceQBottom,
const double *const __restrict__ faceQUp,
const double *const __restrict__ faceQFront,
const double *const __restrict__ faceQBack,
int order,
int unknowns,
const int auxiliaryVariables,
const tarch::la::Vector< 3, double > & cellSize,
const double *const __restrict__ BasisFunctionValuesLeft,
const double *__restrict__ MassMatrixDiagonal1d,
double *__restrict__ cellQ )

3D counterpart of integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre()

The routine relies on a left-handed coordinate system. So we have a cube with a left and a right face. Those are the faxes 0 and 3 (=0+Dimensions). Their normal points along the x axis. Next, we have bottom and top face, as they have a normal along the y axis and y is the second coordinate axis. Finally, we handle the front and the back face. They are the faces 2 and 2+Dimensions=5. The front face comes first, as we work with a left-handed coordinate system, i.e. the normal points into the screen.

Definition at line 389 of file Riemann.cpp.

References dfor.

◆ integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre() [2/2]

void exahype2::dg::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre ( const double *const __restrict__ faceQLeft,
const double *const __restrict__ faceQRight,
const double *const __restrict__ faceQBottom,
const double *const __restrict__ faceQUp,
int order,
int unknowns,
const int auxiliaryVariables,
const tarch::la::Vector< 2, double > & cellSize,
const double *const __restrict__ BasisFunctionValuesLeft,
const double *__restrict__ MassMatrixDiagonal1d,
double *__restrict__ cellQ )

Given a numerical flux at the various faces, this computes and adds the Riemann integral of this flux to the nodes of the cell.

Realisation

The code is a nested for loop, i.e. a 2d Cartesian loop. Per loop body, we add the results from left, right, bottom and top.

Computes this flux for a 2-dimensional cell

Parameters
cellQthe current solution, expected to be the solution already updated with local contributions. (See Euler.h)
faceQXThis should contain a value for the numerical flux at each node along the corresponding face. This is typically computed by a Riemann solver such as a Rusanov solver.
BasisFunctionValuesLeft (respectively Right): as the name implies, this is the numerical value of the basis function value evaluated at the left node in 1 dimension. This has a part in determining how much the value at the boundary influences the value at a given node. Note that the Basis function values on the right side are symmetric to those on the left side, so the BasisFunctionValuesLeft are also used there.
quadratureWeightsquadrature weight of the given quadrature node 1 dimension
See also
projectVolumetricDataOntoFaces()

Definition at line 332 of file Riemann.cpp.

References dfor.

Referenced by exahype2::dg::average::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre(), exahype2::dg::fluxaverage::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre(), exahype2::dg::laxfriedrichs::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre(), exahype2::dg::rusanov::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre(), exahype2::dg::average::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre(), exahype2::dg::fluxaverage::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre(), exahype2::dg::laxfriedrichs::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre(), and exahype2::dg::rusanov::integrateOverRiemannSolutionsAndAddToVolume_GaussLegendre().

Here is the caller graph for this function:

◆ interpolateRiemannSolution()

void exahype2::dg::interpolateRiemannSolution ( const peano4::datamanagement::FaceMarker & marker,
int order,
int unknowns,
const double *__restrict__ InterpolationMatrix1d,
const double *__restrict__ coarseGridFaceQ,
double *__restrict__ fineGridFaceQ )

Interpolation matrix

Core ingredient to this routine is the interpolation matrix. I describes how to interpolate a 1d polynomial over the unit interval into the three subcell polynomials. Consequently, the matrix points to three matrices. One for the left, one for the middle, one for the right subcell.

Each matrix accepts the order+1 values at the quadrature points as input, i.e. each matrix has order+1 columns. Each matrix returns the the output for one quadrature point at the chosen subcell. So each matrix has order+1 rows.

In the example above, we work with polynomials of order three. We hence have four quadrature points.

In the example above, the weights in c1, c2, c3 and c4 span a polynomial (blue). InterpolationMatrix1d points to \( 3 \cdot 4^2 \) entries. If we want to know the interpolated value for f31, we have to pick the third matrix (matrix index 2 as we start counting at zero), then take the first row of this matrix, and multiply its four entries with c1, c2, c3, c4.

All entries in all faces are enumerated lexicographically, i.e. from left to right, bottom-up, and always first along the x-axis, then y, then z.

Implementation

I first construct a face enumerator. So I don't really have to care about the serialisation of the dofs anymore. This is all done by the enumerator.

Next, I compute the total number of unknowns (doubles) in the fine grid face and set them all to zero. From now on, I can accumulate the result. There is a factor of 2 in the calculation of the total number of unknowns. It results from the fact that I have a left and a right projection.

The main part of the routine is a nested loop, where I run over all combinations of input and output dofs. Again, these are three loops nested, as I always have left and right.

Per combination, I have to compute the d-1-dimensional tensor product over the interpolation matrix. For 2d, this degenerates to a simple lookup.

Evaluation of interpolation/restriction matrix

We run over the d-1-dimensional dofs of both coarse and fine grid face. For a 2d simulation, we hence run over a one-dimensional thing. The interpolation and restriction matrices in ExaHyPE are written down as 1d operators, as any dimension then results from a tensor-product approach.

So in 2d, we can only count which index in the coarse and fine grid face we are currently handling and thus effectively run through the interpolation matrix row by row and column by column. In 3d, where the face is actually a 2d object, this does not work. Here, the row and column indices are defined by the entry along one direction and d-1 entries have to be multiplied (tensor product). So effectively, we have to map the dof counter for coarse and fine first to the indices of a 1d projection operator.

Parameters
numberOfProjectedQuantitiesThis is one if we only project the solution. It is two if we project the solution and the F-value or the solution and itsgradient along the normal.

Definition at line 10 of file Riemann.cpp.

References assertion, assertion2, and dfore.

◆ multiplyWithInvertedMassMatrix_GaussLegendre()

void exahype2::dg::multiplyWithInvertedMassMatrix_GaussLegendre ( ::exahype2::CellData< double, double > & cellData,
const int order,
const int unknowns,
const int auxiliaryVariables,
const double *__restrict__ MassMatrixDiagonal1d )

Final step of DG algorithm.

This is the final step of any DG algorithm step, i.e. any Runge-Kutta step. Consult dg.h for a clearer explanation.

  • I assume that the output points to the new time step's data. This is usually
     fineGridCell{{UNKNOWN_IDENTIFIER}}RhsEstimates
    
    subject to some shifts.
  • The output already holds the flux contributions, source terms, and so forth, but these contributions are stored in the weak image space, i.e. we still have to multiply them with the inverse of a mass matrix. The output also contains the Riemann solutions, back-propagated into the volume.
  • The output shall holds the flux contributions in a Runge-Kutta sense, i.e. it shall not hold the new time step but the amount that's added.

This particular routine assumes that the mass matrix is a diagonal. Therefore, the inversion is trivial: We iterate over all degrees of freedom. This is a d-dimensional for loop (dfor). Per dof, we compute the diagonal, and every unknown then is scaled by the inverse of this diagonal.

Definition at line 258 of file CellIntegral.cpp.

References assertion, exahype2::CellData< inType, outType >::cellSize, dfor, exahype2::CellData< inType, outType >::numberOfCells, and exahype2::CellData< inType, outType >::QOut.

Referenced by exahype2::dg::average::multiplyWithInvertedMassMatrix_GaussLegendre(), exahype2::dg::fluxaverage::multiplyWithInvertedMassMatrix_GaussLegendre(), exahype2::dg::laxfriedrichs::multiplyWithInvertedMassMatrix_GaussLegendre(), and exahype2::dg::rusanov::multiplyWithInvertedMassMatrix_GaussLegendre().

Here is the caller graph for this function:

◆ plotCell()

std::string exahype2::dg::plotCell ( const double *__restrict__ Q,
const int order,
const int unknowns,
const int auxiliaryVariables )

◆ plotFace()

std::string exahype2::dg::plotFace ( const double *__restrict__ Q,
const int order,
const int unknowns,
const int auxiliaryVariables,
int normal,
int numberOfQuantitiesProjectedOntoFace )

Definition at line 176 of file DGUtils.cpp.

◆ projectAllValuesOntoParticle()

template<typename Particle , typename QStoreType >
void exahype2::dg::projectAllValuesOntoParticle ( const peano4::datamanagement::CellMarker & marker,
int order,
const double *__restrict__ QuadratureNodes1d,
int unknownsPerDoF,
const QStoreType *__restrict__ Q,
Particle & particle )

Take all values of the unknown field Q and project them onto the particle.

In this context, we assume that the tracer's number of entries and the unknowns plus the auxiliary variables have the same total count.

Definition at line 27 of file Tracer.cpph.

References assertion, and evaluatePolynomial().

Here is the call graph for this function:

◆ projectValueOntoParticle()

template<typename Particle , int SourceIndex, int DestIndex>
void exahype2::dg::projectValueOntoParticle ( const peano4::datamanagement::CellMarker & marker,
int order,
const double *__restrict__ QuadratureNodes1d,
int unknownsPerDoF,
const double *__restrict__ Q,
Particle & particle )

Project one quantity from the patch data onto the particle.

Parameters
markerCell marker describing the cell's geometric/spatial properties.
voxelsPerAxisDescribe patch. We assume that the pathch has not halo.
unknownsPerVoxel
QVoxel field, i.e. actual patch data. Has the dimensions \( voxelsPerAxis^d \cdot unknownsPerVoxel \).
particleXPosition of particle.
unknownWhich unknown from data field to pick.

Definition at line 5 of file Tracer.cpph.

References evaluatePolynomial().

Here is the call graph for this function:

◆ projectVolumetricDataAndGradientOntoFaces() [1/2]

void exahype2::dg::projectVolumetricDataAndGradientOntoFaces ( const double *__restrict__ cellQ,
int order,
int unknowns,
int auxiliaryVariables,
const double *const __restrict__ BasisFunctionValuesLeft,
double *const __restrict__ faceQLeft,
double *const __restrict__ faceQRight,
double *const __restrict__ faceQBottom,
double *const __restrict__ faceQUp )

Definition at line 302 of file Riemann.cpp.

References assertionMsg.

◆ projectVolumetricDataAndGradientOntoFaces() [2/2]

void exahype2::dg::projectVolumetricDataAndGradientOntoFaces ( const double *__restrict__ cellQ,
int order,
int unknowns,
int auxiliaryVariables,
const double *const __restrict__ BasisFunctionValuesLeft,
double *const __restrict__ faceQLeft,
double *const __restrict__ faceQRight,
double *const __restrict__ faceQBottom,
double *const __restrict__ faceQUp,
double *const __restrict__ faceQFront,
double *const __restrict__ faceQBack )

3d counterpart to other projectVolumetricDataOntoFaces() variant.

Definition at line 316 of file Riemann.cpp.

References assertionMsg.

◆ projectVolumetricDataOntoFaces() [1/2]

void exahype2::dg::projectVolumetricDataOntoFaces ( const double *__restrict__ cellQ,
int order,
int unknowns,
int auxiliaryVariables,
const double *const __restrict__ BasisFunctionValuesLeft,
double *const __restrict__ faceQLeft,
double *const __restrict__ faceQRight,
double *const __restrict__ faceQBottom,
double *const __restrict__ faceQUp )

Take polynomial within cell and project it onto the faces.

Ordering

                      2 3
                      0 1
                2 3 [ o o ] 2 3
                0 1 [ o o ] 0 1
                      2 3
                      0 1

Each individual face is ordered lexicographically. So we go from left to right, and we always start closest to the origin or the coordinate system if we interpret the cell as the unit square.

The sketch above illustrates the ordering of the four faces for a p=1 discretisation where we have two dofs per direction per face per side.

Parameters
cellQPointer to cell data. The array has the size \( unknowns \times (order+1)^d\).
orderInteger greater or equal to 0. The number of nodes in each dimension will be equal to order+1
BasisFunctionValuesLeftArray of size order+1 which clarifies (in 1d) how to project the order+1 quadrature weights onto a value on the left face. For Gauss Lobatto, this is a trivial array (you can read out the value directly from the leftmost quadrature point, but for any other basis, you need a linear combination of all the quadrature points in the cell.
faceQLeftLeft unknowns. This array hosts \( 2 \times (order+1)^(d-1) * unknowns\) values, as it holds the (projected) values from the left side of the face and those from the right. The ordering of these values is lexicographic, i.e. the first unknowns entries are those at the bottom of the vertical face from the left adjacent cell. The next unknowns entries are those at the bottom of the face from the right adjacent cell. The next are then again left, then right, then left and so on. This function will fill the right values since the current cell is to the right of its own left face.
faceQBottomBottom unknowns. See faceQLeft. Again, we order lexicographically. This time, the first half of the entries are those from the adjacent cell below. The remaining entries are the projections from above.

Definition at line 167 of file Riemann.cpp.

References exahype2::volumeIndex().

Referenced by exahype2::dg::tests::RiemannTest::testProjectVolumetricDataOntoFacesForConstantSolutionOrder0(), and exahype2::dg::tests::RiemannTest::testProjectVolumetricDataOntoFacesForConstantSolutionOrder3().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ projectVolumetricDataOntoFaces() [2/2]

void exahype2::dg::projectVolumetricDataOntoFaces ( const double *__restrict__ cellQ,
int order,
int unknowns,
int auxiliaryVariables,
const double *const __restrict__ BasisFunctionValuesLeft,
double *const __restrict__ faceQLeft,
double *const __restrict__ faceQRight,
double *const __restrict__ faceQBottom,
double *const __restrict__ faceQUp,
double *const __restrict__ faceQFront,
double *const __restrict__ faceQBack )

3d counterpart to other projectVolumetricDataOntoFaces() variant.

Definition at line 221 of file Riemann.cpp.

References exahype2::volumeIndex().

Here is the call graph for this function:

◆ reduceMaxEigenvalue_patchwise_functors()

void exahype2::dg::reduceMaxEigenvalue_patchwise_functors ( ::exahype2::CellData< double, double > & cellData,
const int order,
const int unknowns,
const int auxiliaryVariables,
MaxEigenvalue maxEigenvalue,
const double *__restrict__ QuadratureNodes1d )

◆ restrictAndAccumulateProjectedFacePolynomial()

void exahype2::dg::restrictAndAccumulateProjectedFacePolynomial ( const peano4::datamanagement::FaceMarker & marker,
int order,
int numberOfProjectedQuantities,
int unknowns,
int auxiliaryVariables,
const double *__restrict__ RestrictionMatrix1d,
const double *__restrict__ fineGridFaceQ,
double *__restrict__ coarseGridFaceQ )

Counterpart of interpolateRiemannSolution().

The restriction matrix has exactly the same form as the interpolation matrix. However, this time we multiply the corresponding row of the submatrix with a weight from the fine grid.

The image below illustrates the same example as used in interpolateRiemannSolution():

Different to the interpolation, we pick one of the three submatrices of RestrictionMatrix1d, compute the c1, c2, c3 and c4 values and then add them to the coarse representation. The interpolation can overwrite.

Different to the interpolation, we only restrict one half of the face and not both. The interpolation can set both sides, as it overwrites a hanging face (or a new one). When we restrict, we know that a persistent coarse grid face might already hold some projected solution. We are interested in the other half. If we accumulate both, we'd add the interpolated value (or any other rubbish) again to the one face part which had been valid before.

Differences to interpolateRiemannSolution()

  • In the final accummulation, we write to the coarse grid while the interpolation writes to the fine grid. Consequently, coarse grid and fine grid data are permuted in the signature.
  • The restriction works on the solution that is extrapolated to the faces. Consequently, these data hold auxiliary variables. The Riemann solution instead does not hold any auxiliary variables.
  • The restriction does not clear the target field, i.e. write zeros to it. That has to be done earlier by the mesh traversal, as multiple restriction calls accummulate in one variable, i.e. if we clear we loose all the data from previous restrictions.
  • Row and column indices are permuted in the matrix access, i.e. the coarse grid dof determines the target (image) and hence defines the row.

Definition at line 69 of file Riemann.cpp.

References assertion, assertion2, assertionEquals, and dfore.

◆ subtractCell()

void exahype2::dg::subtractCell ( double *__restrict__ QOut,
const double *__restrict__ Qsubstract,
const int order,
const int unknowns,
const int auxiliaryVariables )

Definition at line 141 of file DGUtils.cpp.

References getNodesPerCell().

Here is the call graph for this function: