Peano 4
Loading...
Searching...
No Matches
LoopBody.cpp
Go to the documentation of this file.
1#include "LoopBody.h"
3#include "peano4/utils/Loop.h"
4
6 ::exahype2::CellData& patchData,
7 int numberOfGridCellsPerPatchPerAxis,
8 int overlap,
9 int unknowns,
10 int auxiliaryVariables,
11 MaxEigenvalue maxEigenvalue
12) {
13 exahype2::enumerator::AoSLexicographicEnumerator QOutEnumerator(1, numberOfGridCellsPerPatchPerAxis, overlap, unknowns, auxiliaryVariables);
14
15 for (int patchIndex=0; patchIndex<patchData.numberOfCells; patchIndex++) {
16 double newMaxEigenvalue = 0.0;
17 dfor(cell,numberOfGridCellsPerPatchPerAxis) {
18 newMaxEigenvalue = std::max(
19 newMaxEigenvalue,
21 *(patchData.QOut + patchIndex),
22 QOutEnumerator,
23 maxEigenvalue,
24 patchData.cellCentre[patchIndex],
25 patchData.cellSize[patchIndex],
26 patchIndex,
27 cell,
28 patchData.t[patchIndex],
29 patchData.dt[patchIndex]
30 )
31 );
32 }
33 patchData.maxEigenvalue[patchIndex] = newMaxEigenvalue;
34 }
35}
36
37template <>
39 const double* __restrict__ QOut,
41 exahype2::fd::MaxEigenvalue maxEigenvalue,
42 const tarch::la::Vector<Dimensions,double>& patchCentre,
44 int patchIndex,
45 const tarch::la::Vector<Dimensions,int>& volumeIndex,
46 double t,
47 double dt
48) {
49 double result = 0.0;
50 for (int normal=0; normal<Dimensions; normal++) {
51 result = std::max(
52 result,
53 maxEigenvalue(
54 & (QOut[ QOutEnumerator(patchIndex,volumeIndex,0) ]),
55 ::exahype2::fd::getGridCellCentre( patchCentre, patchSize, QOutEnumerator._numberOfDoFsPerAxisInCell, volumeIndex ),
57 t,
58 dt,
59 normal
60 )
61 );
62 }
63
64 return result;
65}
<!-- WE COMMENT THIS OUT. I DON 'T THINK IT 'S READY YET Now we are working on a cell-by-cell basis, let us examine the @f$ 1^{st} @f$ cell. We note that only @f$ \phi_0 @f$ and @f$ \phi_1 @f$ are non-zero here, so our original equation reduces to:\f{eqnarray *}{ u_1 \ \sum_{k=1, 2} \int_{c_k}(\nabla \phi_0, \ \phi_0) \+dx \=\ \int_{c_0}(f, \ \phi_0) dx \f} and we drop the @f$ \forall \phi @f$ requirement since only @f$ \phi_0 @f$ is non-zero here. In effect, this @f$ \int_{c_0}(\nabla \phi_0, \ \phi_0) dx \=\ \int_{c_0}(f, \ \phi_0) dx @f$ will become our matrix element, as we shall see shortly. --> The basis of functions that we use in this example are piecewise linear defined in each cell(which is an interval of width @f$ h @f$)
#define dfor(counter, max)
d-dimensional Loop
Definition Loop.h:308
static double reduceMaxEigenvalue_LoopBody(const double *__restrict__ QOut, const QOutEnumeratorType &QOutEnumerator, exahype2::fd::MaxEigenvalue maxEigenvalue, const tarch::la::Vector< Dimensions, double > &patchCentre, const tarch::la::Vector< Dimensions, double > &patchSize, int patchIndex, const tarch::la::Vector< Dimensions, int > &volumeIndex, double t, double dt) InlineMethod
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.
Definition PatchUtils.h:77
void reduceMaxEigenvalue_patchwise_functors(::exahype2::CellData &patchData, int numberOfGridCellsPerPatchPerAxis, int overlap, int unknowns, int auxiliaryVariables, MaxEigenvalue maxEigenvalue)
Definition LoopBody.cpp:5
static tarch::la::Vector< 2, double > getGridCellSize(const tarch::la::Vector< 2, double > &h, int numberOfGridCellsPerPatchPerAxis)
Definition PatchUtils.h:22
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.
Definition Functors.h:53
auto volumeIndex(Args... args)
Definition VolumeIndex.h:54
Representation of a number of cells which contains all information that's required to process the sto...
Definition CellData.h:79
double * maxEigenvalue
Out values.
Definition CellData.h:111
double ** QOut
Out values.
Definition CellData.h:106
const int numberOfCells
As we store data as SoA, we have to know how big the actual arrays are.
Definition CellData.h:101
tarch::la::Vector< Dimensions, double > * cellSize
Definition CellData.h:86
tarch::la::Vector< Dimensions, double > * cellCentre
Definition CellData.h:85
Simple vector class.
Definition Vector.h:134