31 template<
class Equation>
35 typename Equation::ConstViews& in,
36 size_t x,
size_t y,
size_t z,
37 typename Equation::Views& leftView,
38 typename Equation::Views& rightView,
39 bool xDir,
bool yDir,
bool zDir) {
40 const real BOUND = 1.9;
41 const size_t indexOut = leftView.index(x, y, z);
42 const size_t indexRight = leftView.index(x + xDir, y + yDir, z + zDir);
43 const size_t indexLeft = leftView.index(x - xDir, y - yDir, z - zDir);
44 const real i0 = eq.getWeight(in, indexOut);
45 const real b0 =
square(eq.getWeight(in, indexRight) - i0);
46 const real b1 =
square(i0 - eq.getWeight(in, indexLeft));
51 const real w0Left = a0Left / (a0Left + a1Left);
52 const real w1Left = a1Left / (a0Left + a1Left);
58 const real w0Right = a0Right / (a0Right + a1Right);
59 const real w1Right = a1Right / (a0Right + a1Right);
61 typename Equation::PrimitiveVariables inLeft =
62 eq.computePrimitiveVariables(eq.fetchConservedVariables(in, indexLeft));
64 typename Equation::PrimitiveVariables inMiddle =
65 eq.computePrimitiveVariables(eq.fetchConservedVariables(in, indexOut));
67 typename Equation::PrimitiveVariables inRight =
68 eq.computePrimitiveVariables(eq.fetchConservedVariables(in, indexRight));
70 typename Equation::PrimitiveVariables dPLeft = w1Left * (inMiddle - inLeft) +
71 w0Left * (inRight - inMiddle);
74 dPLeft.rho = fmax(-BOUND * inMiddle.rho, fmin(BOUND * inMiddle.rho,
76 dPLeft.p = fmax(-BOUND * inMiddle.p, fmin(BOUND * inMiddle.p, dPLeft.p));
78 real LLLeft = 0.125 * inMiddle.rho * (dPLeft.u.dot(dPLeft.u)) -
79 0.5 * fmin(
real(0.0), dPLeft.rho * (inMiddle.u.dot(dPLeft.u))) +
80 0.5 * dPLeft.rho * dPLeft.rho * dPLeft.u.dot(dPLeft.u) / inMiddle.rho;
83 real R = inMiddle.p / (eq.getGamma() - 1);
84 real aijkLeft = 0.5 * std::sqrt(R / fmax(R, LLLeft));
90 typename Equation::ConservedVariables left = eq.computeConserved(
91 inMiddle - aijkLeft * dPLeft);
94 typename Equation::PrimitiveVariables dPRight = w1Right * (inMiddle - inLeft) +
95 w0Right * (inRight - inMiddle);
98 dPRight.rho = fmax(-BOUND * inMiddle.rho, fmin(BOUND * inMiddle.rho,
100 dPRight.p = fmax(-BOUND * inMiddle.p, fmin(BOUND * inMiddle.p, dPRight.p));
102 real LLRight = 0.125 * inMiddle.rho * (dPRight.u.dot(dPRight.u)) -
103 0.5 * fmin(
real(0.0), dPRight.rho * (inMiddle.u.dot(dPRight.u))) +
104 0.5 * dPRight.rho * dPRight.rho * dPRight.u.dot(dPRight.u) / inMiddle.rho;
106 real aijkRight = 0.5 * std::sqrt(R / fmax(R, LLRight));
108 typename Equation::ConservedVariables right = eq.computeConserved(
109 inMiddle + aijkRight * dPRight);
110 eq.setViewAt(leftView, indexOut, left);
111 eq.setViewAt(rightView, indexOut, right);
alsfvm::shared_ptr< reconstruction::Reconstruction > & reconstruction
Definition: NumericalFluxFactory.cpp:101
#define ALSFVM_WENO_EPSILON
Definition: WENOCoefficients.hpp:21
#define __host__
Definition: types.hpp:46
__device__ static __host__ int getNumberOfGhostCells()
Definition: WENOF2.hpp:115
double real
Definition: types.hpp:65
__device__ static __host__ void reconstruct(Equation eq, typename Equation::ConstViews &in, size_t x, size_t y, size_t z, typename Equation::Views &leftView, typename Equation::Views &rightView, bool xDir, bool yDir, bool zDir)
Definition: WENOF2.hpp:34
Definition: WENOF2.hpp:32
#define __device__
Definition: types.hpp:45
Various utility functions to implement the tecno flux.
Definition: types.hpp:30
__host__ __device__ real square(const real &x)
Definition: types.hpp:159