Peano 4
Loading...
Searching...
No Matches
exahype2::fd Namespace Reference

Namespaces

namespace  fd4
 
namespace  internal
 
namespace  tests
 

Typedefs

typedef std::function< void(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &gridCellX, const tarch::la::Vector< Dimensions, double > &gridCellH, double t, double dt, double *__restrict__ AlgeSrc) Source)
 
typedef std::function< void(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &gridCellH, double t, double dt, int normal, double *__restrict__ F) Flux)
 
typedef std::function< void(const double *__restrict__ Q, const double *__restrict__ deltaQ, const tarch::la::Vector< Dimensions, double > &gridCellX, const tarch::la::Vector< Dimensions, double > &gridCellH, double t, double dt, int normal, double *__restrict__ DiffSrc) NonconservativeProduct)
 
typedef std::function< double(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &gridCellX, const tarch::la::Vector< Dimensions, double > &gridCellH, double t, double dt, int normal) MaxEigenvalue)
 The max eigenvalue is used if and only if you have adaptive time stepping.
 

Functions

void applyBoundaryConditions (std::function< void(const double *__restrict__ Qinside, double *__restrict__ Qoutside, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &volumeH, double t, double dt, int normal) > boundaryCondition, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &patchSize, double t, double dt, int numberOfGridCellsPerPatchPerAxis, int overlap, int unknownsPlusAuxiliaryVariables, int faceNumber, double *__restrict__ Q)
 Apply (generic) boundary conditions.
 
void applySommerfeldConditions (std::function< double(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &gridCellH, double t, double dt, int normal) > maxEigenvalue, std::function< void(double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &gridCellH) > farFieldSolution, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &patchSize, double t, double dt, int numberOfGridCellsPerPatchPerAxis, int overlap, int numberOfUnknowns, int numberOfAuxiliaryVariables, int faceNumber, const tarch::la::Vector< Dimensions, double > &systemOrigin, double *__restrict__ Qold, double *__restrict__ Qnew)
 
void applySommerfeldConditions (std::function< double(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &gridCellH, double t, double dt, int normal) > maxEigenvalue, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &patchSize, double t, double dt, int numberOfGridCellsPerPatchPerAxis, int overlap, int numberOfUnknowns, int numberOfAuxiliaryVariables, int faceNumber, const tarch::la::Vector< Dimensions, double > &systemOrigin, double *__restrict__ Qold, double *__restrict__ Qnew)
 Wrapper around the other applySommerfeldConditions() function.
 
void reduceMaxEigenvalue_patchwise_functors (::exahype2::CellData &patchData, int numberOfGridCellsPerPatchPerAxis, int overlap, int unknowns, int auxiliaryVariables, MaxEigenvalue maxEigenvalue)
 
static tarch::la::Vector< 2, double > getGridCellSize (const tarch::la::Vector< 2, double > &h, int numberOfGridCellsPerPatchPerAxis)
 
static tarch::la::Vector< 3, double > getGridCellSize (const tarch::la::Vector< 3, double > &h, int numberOfGridCellsPerPatchPerAxis)
 
static tarch::la::Vector< 2, double > getGridFaceSize (const tarch::la::Vector< 2, double > &h, int numberOfGridCellsPerPatchPerAxis)
 
static tarch::la::Vector< 3, double > getGridFaceSize (const tarch::la::Vector< 3, double > &h, int numberOfGridCellsPerPatchPerAxis)
 
static tarch::la::Vector< 2, double > getGridCellCentre (const tarch::la::Vector< 2, double > &x, const tarch::la::Vector< 2, double > &h, int numberOfGridCellsPerPatchPerAxis, const tarch::la::Vector< 2, int > &index)
 In ExaHyPE's Finite Volume setup, a cell hosts a patch of Finite Volumes.
 
static tarch::la::Vector< 3, double > getGridCellCentre (const tarch::la::Vector< 3, double > &x, const tarch::la::Vector< 3, double > &h, int numberOfGridCellsPerPatchPerAxis, const tarch::la::Vector< 3, int > &index)
 
static tarch::la::Vector< 2, double > getGridFaceCentre (const tarch::la::Vector< 2, double > &x, const tarch::la::Vector< 2, double > &h, int numberOfGridCellsPerPatchPerAxis, int overlap, int normal, const tarch::la::Vector< 2, int > &index)
 
static tarch::la::Vector< 3, double > getGridFaceCentre (const tarch::la::Vector< 3, double > &x, const tarch::la::Vector< 3, double > &h, int numberOfGridCellsPerPatchPerAxis, int overlap, int normal, const tarch::la::Vector< 3, int > &index)
 
std::string plotGridCell (const double *__restrict__ Q, int unknowns)
 Helper routine that I need in the log statements.
 
void validatePatch (const double *__restrict__ Q, int unknowns, int auxiliaryVariables, int numberOfGridCellsPerPatchPerAxis, int haloSize, const std::string &location="", bool triggerNonCriticalAssertion=true, double *minValues=nullptr, double *maxValues=nullptr)
 Just runs over the patch and ensures that no entry is non or infinite.
 
std::string plotPatch (const double *__restrict__ Q, int unknowns, int auxiliaryVariables, int numberOfGridCellsPerPatchPerAxis, int haloSize, bool prettyPrint=false)
 Plot patch.
 
std::string plotPatchOverlap (const double *__restrict__ Q, int unknowns, int auxiliaryVariables, int numberOfGridCellsPerPatchPerAxis, int haloSize, int normal, bool prettyPrint=false)
 

Variables

constexpr int PickAllEntriesFromOutputVector = -1
 

Typedef Documentation

◆ Flux

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

Definition at line 30 of file Functors.h.

◆ MaxEigenvalue

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

The max eigenvalue is used if and only if you have adaptive time stepping.

Definition at line 53 of file Functors.h.

◆ NonconservativeProduct

typedef std::function< void( const double * __restrict__ Q, const double * __restrict__ deltaQ, const tarch::la::Vector<Dimensions,double>& gridCellX, const tarch::la::Vector<Dimensions,double>& gridCellH, double t, double dt, int normal, double * __restrict__ DiffSrc ) exahype2::fd::NonconservativeProduct)

Definition at line 41 of file Functors.h.

◆ Source

typedef std::function< void( const double * __restrict__ Q, const tarch::la::Vector<Dimensions,double>& gridCellX, const tarch::la::Vector<Dimensions,double>& gridCellH, double t, double dt, double * __restrict__ AlgeSrc ) exahype2::fd::Source)

Definition at line 20 of file Functors.h.

Function Documentation

◆ applyBoundaryConditions()

void exahype2::fd::applyBoundaryConditions ( std::function< void(const double *__restrict__ Qinside, double *__restrict__ Qoutside, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &volumeH, double t, double dt, int normal) > boundaryCondition,
const tarch::la::Vector< Dimensions, double > & faceCentre,
const tarch::la::Vector< Dimensions, double > & patchSize,
double t,
double dt,
int numberOfGridCellsPerPatchPerAxis,
int overlap,
int unknownsPlusAuxiliaryVariables,
int faceNumber,
double *__restrict__ Q )

Apply (generic) boundary conditions.

This implementation runs over the boundary and applies the generic (point-wise) boundary conditions via a call-back to the user implementation.

Parameters
unknownsPlusAuxiliaryVariablesNumber of unknowns plus the number of auxiliary variables. The boundary treatment routine does not distinguish how the two types of quantities are handled, so it is reasonable to only pass in the sum.
faceNumberIs usually taken from marker.getSelectedFaceNumber() and is thus a number between 0 and 2d-1.

Definition at line 13 of file BoundaryConditions.cpp.

References _log, dfore, getGridCellSize(), logDebug, logTraceInWith4Arguments, logTraceOut, and tarch::la::multiplyComponents().

Here is the call graph for this function:

◆ applySommerfeldConditions() [1/2]

void exahype2::fd::applySommerfeldConditions ( std::function< double(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &gridCellH, double t, double dt, int normal) > maxEigenvalue,
const tarch::la::Vector< Dimensions, double > & faceCentre,
const tarch::la::Vector< Dimensions, double > & patchSize,
double t,
double dt,
int numberOfGridCellsPerPatchPerAxis,
int overlap,
int numberOfUnknowns,
int numberOfAuxiliaryVariables,
int faceNumber,
const tarch::la::Vector< Dimensions, double > & systemOrigin,
double *__restrict__ Qold,
double *__restrict__ Qnew )

Wrapper around the other applySommerfeldConditions() function.

In this variant, the far-field solution is zero, so the solution is kind of trivialised there.

Definition at line 197 of file BoundaryConditions.cpp.

References applySommerfeldConditions().

Here is the call graph for this function:

◆ applySommerfeldConditions() [2/2]

void exahype2::fd::applySommerfeldConditions ( std::function< double(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &gridCellH, double t, double dt, int normal) > maxEigenvalue,
std::function< void(double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &faceCentre, const tarch::la::Vector< Dimensions, double > &gridCellH) > farFieldSolution,
const tarch::la::Vector< Dimensions, double > & faceCentre,
const tarch::la::Vector< Dimensions, double > & patchSize,
double t,
double dt,
int numberOfGridCellsPerPatchPerAxis,
int overlap,
int numberOfUnknowns,
int numberOfAuxiliaryVariables,
int faceNumber,
const tarch::la::Vector< Dimensions, double > & systemOrigin,
double *__restrict__ Qold,
double *__restrict__ Qnew )
   Apply Sommerfeld boundary conditions

   Sommerfeld boundary conditions don't need a callback for the actual
   boundary data, but they need the max flux. If you employ Sommerfeld
   conditions, you can ignore the generic boundary condition function
   of your solver. It will still remain there, but you can leave it
   empty (or add an assertion in there, as it should never be called).



   ## Usage

   The typical user switches to Sommerfeld conditions by exchanging the
   boundary kernel call:

   <pre>

self._action_set_handle_boundary.TemplateHandleBoundary_KernelCalls = """ ::exahype2::fd::applySommerfeldConditions( [&]( const double * <strong>restrict</strong> Q, const tarch::la::Vector<Dimensions,double>& faceCentre, const tarch::la::Vector<Dimensions,double>& gridCellH, double t, double dt, int normal ) -> double { return repositories::{{SOLVER_INSTANCE}}.maxEigenvalue( Q, faceCentre, gridCellH, t, dt, normal ); }, [&]( double * <strong>restrict</strong> Q, const tarch::la::Vector<Dimensions,double>& faceCentre, const tarch::la::Vector<Dimensions,double>& gridCellH ) -> void { repositories::{{SOLVER_INSTANCE}}.initialCondition( Q, faceCentre, gridCellH, true ); }, marker.x(), marker.h(), {{FACE_METADATA_ACCESSOR}}.getOldTimeStamp(marker.getSelectedFaceNumber()<Dimensions ? 1 : 0), repositories::{{SOLVER_INSTANCE}}.getMinTimeStepSize(), {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}}, {{OVERLAP}}, {{NUMBER_OF_UNKNOWNS}}, {{NUMBER_OF_AUXILIARY_VARIABLES}}, marker.getSelectedFaceNumber(), {0.0, 0.0, 0.0}, fineGridFace{{UNKNOWN_IDENTIFIER}}Old.value, fineGridFace{{UNKNOWN_IDENTIFIER}}New.value, {...} //approximate background solution at infinity ); </pre> """

Parameters
farFieldSolution

Definition at line 84 of file BoundaryConditions.cpp.

References _log, dfore, tarch::la::equals(), tarch::freeMemory(), getGridCellSize(), tarch::Heap, logDebug, logTraceInWith4Arguments, logTraceOut, tarch::la::multiplyComponents(), and tarch::la::norm2().

Referenced by applySommerfeldConditions(), and exahype2::fd::tests::SommerfeldBCTest::flatsolutiontest().

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

◆ getGridCellCentre() [1/2]

static tarch::la::Vector< 2, double > exahype2::fd::getGridCellCentre ( const tarch::la::Vector< 2, double > & x,
const tarch::la::Vector< 2, double > & h,
int numberOfGridCellsPerPatchPerAxis,
const tarch::la::Vector< 2, int > & index )
static

In ExaHyPE's Finite Volume setup, a cell hosts a patch of Finite Volumes.

When we iterate over these volumes, we typically have to know the centre of the volume.

I use this routine in a lot of the loops that have to be vectorised. Therefore, it is absolutely essential that the compiler can inline them. Inlining works properly with most compilers if and only if the definition is available in the header. This is the reason why this implementation ended up here and not in the cpp file.

Parameters
xCentre of the cell
hSize of the cell
indexIndex of Finite Volume (in lexicographic ordering)

Definition at line 77 of file PatchUtils.h.

References h.

Referenced by exahype2::fd::internal::reduceMaxEigenvalue_LoopBody().

Here is the caller graph for this function:

◆ getGridCellCentre() [2/2]

static tarch::la::Vector< 3, double > exahype2::fd::getGridCellCentre ( const tarch::la::Vector< 3, double > & x,
const tarch::la::Vector< 3, double > & h,
int numberOfGridCellsPerPatchPerAxis,
const tarch::la::Vector< 3, int > & index )
static

Definition at line 89 of file PatchUtils.h.

References h.

◆ getGridCellSize() [1/2]

static tarch::la::Vector< 2, double > exahype2::fd::getGridCellSize ( const tarch::la::Vector< 2, double > & h,
int numberOfGridCellsPerPatchPerAxis )
static
See also
exahype2::fv::getVolumeSize()

Definition at line 22 of file PatchUtils.h.

References h.

Referenced by applyBoundaryConditions(), applySommerfeldConditions(), and exahype2::fd::internal::reduceMaxEigenvalue_LoopBody().

Here is the caller graph for this function:

◆ getGridCellSize() [2/2]

static tarch::la::Vector< 3, double > exahype2::fd::getGridCellSize ( const tarch::la::Vector< 3, double > & h,
int numberOfGridCellsPerPatchPerAxis )
static

Definition at line 32 of file PatchUtils.h.

References h.

◆ getGridFaceCentre() [1/2]

static tarch::la::Vector< 2, double > exahype2::fd::getGridFaceCentre ( const tarch::la::Vector< 2, double > & x,
const tarch::la::Vector< 2, double > & h,
int numberOfGridCellsPerPatchPerAxis,
int overlap,
int normal,
const tarch::la::Vector< 2, int > & index )
static

Definition at line 101 of file PatchUtils.h.

References h.

◆ getGridFaceCentre() [2/2]

static tarch::la::Vector< 3, double > exahype2::fd::getGridFaceCentre ( const tarch::la::Vector< 3, double > & x,
const tarch::la::Vector< 3, double > & h,
int numberOfGridCellsPerPatchPerAxis,
int overlap,
int normal,
const tarch::la::Vector< 3, int > & index )
static

Definition at line 115 of file PatchUtils.h.

References h.

◆ getGridFaceSize() [1/2]

static tarch::la::Vector< 2, double > exahype2::fd::getGridFaceSize ( const tarch::la::Vector< 2, double > & h,
int numberOfGridCellsPerPatchPerAxis )
static

Definition at line 42 of file PatchUtils.h.

References h.

◆ getGridFaceSize() [2/2]

static tarch::la::Vector< 3, double > exahype2::fd::getGridFaceSize ( const tarch::la::Vector< 3, double > & h,
int numberOfGridCellsPerPatchPerAxis )
static

Definition at line 52 of file PatchUtils.h.

References h.

◆ plotGridCell()

std::string exahype2::fd::plotGridCell ( const double *__restrict__ Q,
int unknowns )

Helper routine that I need in the log statements.

Applies to AoS data only.

Returns
Data of one volume as tuple.

Definition at line 31 of file PatchUtils.cpp.

References exahype2::fv::plotVolume().

Here is the call graph for this function:

◆ plotPatch()

std::string exahype2::fd::plotPatch ( const double *__restrict__ Q,
int unknowns,
int auxiliaryVariables,
int numberOfGridCellsPerPatchPerAxis,
int haloSize,
bool prettyPrint = false )

Plot patch.

Usually used for debugging.

Assumes all data are held as AoS.

Definition at line 39 of file PatchUtils.cpp.

References exahype2::fv::plotPatch().

Here is the call graph for this function:

◆ plotPatchOverlap()

std::string exahype2::fd::plotPatchOverlap ( const double *__restrict__ Q,
int unknowns,
int auxiliaryVariables,
int numberOfGridCellsPerPatchPerAxis,
int haloSize,
int normal,
bool prettyPrint = false )

Definition at line 58 of file PatchUtils.cpp.

References exahype2::fv::plotPatchOverlap().

Here is the call graph for this function:

◆ reduceMaxEigenvalue_patchwise_functors()

void exahype2::fd::reduceMaxEigenvalue_patchwise_functors ( ::exahype2::CellData & patchData,
int numberOfGridCellsPerPatchPerAxis,
int overlap,
int unknowns,
int auxiliaryVariables,
MaxEigenvalue maxEigenvalue )

◆ validatePatch()

void exahype2::fd::validatePatch ( const double *__restrict__ Q,
int unknowns,
int auxiliaryVariables,
int numberOfGridCellsPerPatchPerAxis,
int haloSize,
const std::string & location = "",
bool triggerNonCriticalAssertion = true,
double * minValues = nullptr,
double * maxValues = nullptr )

Just runs over the patch and ensures that no entry is non or infinite.

In ExaHyPE, we primarily work with split approaches. That is, diagonal halo entries are never initialised properly: We can copy over the face-connected data, but we lack information through the diagonals. This routine takes this into account when it validates the entries.

Assumes all data are held as AoS.

Parameters
locationString that tells system from where this routine got called
minValuesIs either a nullptr or it points to a double array with exactly unknowns+auxiliaryVariables entries

Definition at line 79 of file PatchUtils.cpp.

References exahype2::fv::validatePatch().

Here is the call graph for this function:

Variable Documentation

◆ PickAllEntriesFromOutputVector

constexpr int exahype2::fd::PickAllEntriesFromOutputVector = -1
constexpr

Definition at line 17 of file LoopBody.h.