4#include "exahype2/RefinementControl.h"
6tarch::logging::Log exahype::limiting::swe::fvSWE::_log(
"exahype::limiting::swe::fvSWE" );
9double exahype::limiting::swe::fvSWE::maxEigenvalue(
10 [[maybe_unused]]
const double*
const NOALIAS Q,
11 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& x,
12 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& h,
13 [[maybe_unused]]
const double t,
14 [[maybe_unused]]
const double dt,
15 [[maybe_unused]]
const int normal
17 static constexpr double g = 9.81;
18 const double u = Q[0] > 1e-5 ? Q[1 + normal] / Q[0] : 0.0;
19 const double c = Q[0] > 1e-5 ? sqrt(g * Q[0]) : 0.0;
20 return std::max(std::abs(u - c), std::abs(u + c));
23void exahype::limiting::swe::fvSWE::flux(
24 [[maybe_unused]]
const double*
const NOALIAS Q,
25 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& x,
26 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& h_,
27 [[maybe_unused]]
const double t,
28 [[maybe_unused]]
const double dt,
29 [[maybe_unused]]
const int normal,
30 [[maybe_unused]]
double*
const NOALIAS F
32 static constexpr double g = 9.81;
34 const double ih = Q[0] > 1e-5 ? 1.0 / Q[0] : 0.0;
36 F[1 + 0] = ih * Q[1 + normal] * Q[1 + 0];
37 F[1 + 1] = ih * Q[1 + normal] * Q[1 + 1];
38 F[1 + normal] += 0.5 *
g * Q[0] * Q[0];
44 const double* NOALIAS ql,
45 const double* NOALIAS qr,
47 double* NOALIAS apdq,
const int* normal);
50double exahype::limiting::swe::fvSWE::solveRiemannProblem(
51 [[maybe_unused]]
const double*
const NOALIAS QL,
52 [[maybe_unused]]
const double*
const NOALIAS QR,
53 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& x,
54 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& h,
55 [[maybe_unused]]
const double t,
56 [[maybe_unused]]
const double dt,
57 [[maybe_unused]]
const int normal,
58 [[maybe_unused]]
double*
const NOALIAS FL,
59 [[maybe_unused]]
double*
const NOALIAS FR
64 const double cL = std::sqrt(9.81 * QL[0]);
65 double uL = QL[normal + 1] * QL[0] * std::sqrt(2)/std::sqrt(std::pow(QL[0], 4) + std::pow(std::max(QL[0], 1e-5), 4));
67 double smaxL = std::max(std::abs(uL - cL), std::abs(uL + cL));
69 const double cR = std::sqrt(9.81 * QR[0]);
70 double uR = QR[normal + 1] * QR[0] * std::sqrt(2)/std::sqrt(std::pow(QR[0], 4) + std::pow(std::max(QR[0], 1e-5), 4));
72 double smaxR = std::max(std::abs(uR - cR), std::abs(uR + cR));
74 double smax = std::max(smaxL, smaxR);
79 flux(QL, x, h, t, dt, normal, FL);
80 flux(QR, x, h, t, dt, normal, FR);
83 FL[0] = 0.5*(FL[0]+FR[0] + smax*(QL[0]+QL[3]-QR[0]-QR[3]) );
84 FL[1] = 0.5*(FL[1]+FR[1] + smax*(QL[1]-QR[1]) );
85 FL[2] = 0.5*(FL[2]+FR[2] + smax*(QL[2]-QR[2]) );
94 FL[normal+1] += 0.5*9.81*0.5*(QL[0]+QR[0])*(QR[3]-QL[3]);
95 FR[normal+1] -= 0.5*9.81*0.5*(QL[0]+QR[0])*(QR[3]-QL[3]);
double rpn2_augmented_wrapper(const double *NOALIAS ql, const double *NOALIAS qr, double *NOALIAS amdq, double *NOALIAS apdq, const int *normal)