Peano 4
Loading...
Searching...
No Matches
loehnerScheme.cpph
Go to the documentation of this file.
1
14#include <algorithm> // fill_n
16#include "computeGradients.cpph"
17
18
19namespace kernels {
20namespace aderdg {
21namespace generic {
22namespace c {
23
24// define a smallish for loop. Only local in this file.
25#define ford(i) for(int i=0; i<Dimensions; i++)
26
41template<typename SolverType>
42inline void computeLoehner(double* Xi, const double* const u, const int PhiIndex, const tarch::la::Vector<Dimensions, double>& sizeOfPatch) {
43 constexpr int numberOfVariables = SolverType::NumberOfVariables;
44 constexpr int order = SolverType::Order;
45 constexpr int basisSize = order + 1;
46 constexpr int basisX = basisSize;
47 constexpr int basisY = basisSize;
48 constexpr int basisZ = Dimensions == 3 ? basisSize : 1;
49
50 // first derivative
51 double dPhi[Dimensions][basiSizeD(basisSize)];
52 ford(d) computeGradQi(dPhi[d], u, d, PhiIndex, sizeOfPatch, numberOfVariables, order);
53
54 // second derivative
55 double ddPhi[Dimensions][Dimensions][basisSizeD(basisSize)];
56 ford(d0) ford(d1) computeGradQi(ddPhi[d0][d1], dPhi[d0], d1, 0, sizeOfPatch, 1, order);
57
58 // compute the loehner thing pointwise
59 index idx_Xi(basisZ, basisY, basisX);
60 dfor(i) {
61 int here = idx_Xi(Dimensions==3 ? i(2) : 0,i(1),i(0));
62
63 // nominator
64 double normLaplacePhi = 0;
65 ford(k) ford(l) normLaplacePhi += ddPhi[k][l][here]*ddPhi[k][l][here];
66
67 // denominator
68 double normGradPhi = 0;
69 // what is i in this?
70 // ford(k) ford(l) normGradPhi += dPhi[l+1][here] + dPhi[l-1][here]
71 // TODO continue here.
72
73 Xi[here] = std::sqrt( normLaplacePhi / normGradPhi );
74 }
75}
76
77#undef ford
78
79} // c
80} // generic
81} // aderdg
82} // kernels
we integrate over each cell and then take the sum across each of the cells We also consider the terms that enter the f$ k
#define dfor(counter, max)
d-dimensional Loop
Definition Loop.h:308
#define ford(i)
-with-ExaHyPE2-benchmark
constexpr int basisSizeD(int basisSize)
void computeLoehner(double *Xi, const double *const u, const int PhiIndex, const tarch::la::Vector< Dimensions, double > &sizeOfPatch)
This is a hacky attemp to implement the Loehner scheme for an AMR criterion for our ADERDG kernels.
void computeGradQi(double *gradQi, const double *const u, const int requestedDirection, const int requestedVariableIndex, const tarch::la::Vector< DIMENSIONS, double > &sizeOfPatch, const int numberOfVariables, const int order)
Convenience function to compute the gradient of only a single variable in a given direction.
This file is part of the ExaHyPE project.
This is a single successor class for the idx2, idx3, idx4, idx5, idx6 classes.
Definition KernelUtils.h:62
Simple vector class.
Definition Vector.h:134