4template <
class T,
class Shortcuts,
class Quadrature,
int NumberOfUnknowns,
int NumberOfAuxiliaryVariables,
int Order>
6 const T*
const NOALIAS QL,
7 const T*
const NOALIAS QR,
8 const tarch::la::Vector<DIMENSIONS, double>& x,
9 const tarch::la::Vector<DIMENSIONS, double>& h,
17 constexpr auto N{NumberOfUnknowns + NumberOfAuxiliaryVariables};
20 for (
auto xy = 0; xy < Order + 1; ++xy) {
21 for (
auto i = 0; i < N; ++i) {
22 QavgL[i] += Quadrature::weights2[xy] * QL[xy * N + i];
23 QavgR[i] += Quadrature::weights2[xy] * QR[xy * N + i];
29 if (QavgL[Shortcuts::h] > hThreshold) {
30 const auto VnL{QavgL[Shortcuts::hu + normal] / QavgL[Shortcuts::h]};
31 const auto cL{std::sqrt(g * QavgL[Shortcuts::h])};
32 sL = std::fmax(std::fabs(VnL - cL), std::fabs(VnL + cL));
35 if (QavgR[Shortcuts::h] > hThreshold) {
36 const auto VnR{QavgR[Shortcuts::hu + normal] / QavgR[Shortcuts::h]};
37 const auto cR{std::sqrt(g * QavgR[Shortcuts::h])};
38 sR = std::fmax(std::fabs(VnR - cR), std::fabs(VnR + cR));
40 const auto smax{std::fmax(sR, sL)};
43 auto rusanovFlux{0.0};
44 for (
auto xy = 0; xy < Order + 1; ++xy) {
45 for (
auto i = 0; i < N; ++i) {
47 rusanovFlux = 0.5 * (FL[j] + FR[j] + smax * (QL[j] - QR[j]));
52 j = xy * N + Shortcuts::z;
58template <
class T,
class Shortcuts,
int NumberOfUnknowns,
int NumberOfAuxiliaryVariables>
60 const T*
const NOALIAS QL,
61 const T*
const NOALIAS QR,
62 const tarch::la::Vector<DIMENSIONS, double>& x,
63 const tarch::la::Vector<DIMENSIONS, double>& h,
70 flux<T, Shortcuts, NumberOfUnknowns>(QL, x, h, t, dt, normal, FL);
71 flux<T, Shortcuts, NumberOfUnknowns>(QR, x, h, t, dt, normal, FR);
73 const auto smax{std::fmax(
74 maxEigenvalue<T, Shortcuts>(QL, x, h, t, dt, normal),
75 maxEigenvalue<T, Shortcuts>(QR, x, h, t, dt, normal)
77 constexpr auto N{NumberOfAuxiliaryVariables + NumberOfUnknowns};
81 for (
int i = 0; i < NumberOfUnknowns; ++i) {
82 Qavg[i] = 0.5 * (QL[i] + QR[i]);
83 DeltaQ[i] = QR[i] - QL[i];
84 FL[i] = 0.5 * (FL[i] + FR[i] - smax * DeltaQ[i]);
88 for (
int i = NumberOfUnknowns; i < N; ++i) {
89 Qavg[i] = 0.5 * (QL[i] + QR[i]);
90 DeltaQ[i] = QR[i] - QL[i];
93 T ncp[NumberOfUnknowns] = {};
94 FrictionLaws::nonconservativeProduct<T, Shortcuts, NumberOfUnknowns>(Qavg, DeltaQ, x, h, t, dt, normal, ncp);
95 for (
int i = 0; i < NumberOfUnknowns; ++i) {
96 FL[i] += 0.5 * ncp[i];
97 FR[i] -= 0.5 * ncp[i];
101 if (QL[Shortcuts::h] > hThreshold) {
103 const auto momentumL{std::sqrt(QL[Shortcuts::hu] * QL[Shortcuts::hu] + QL[Shortcuts::hv] * QL[Shortcuts::hv])};
104 sL = 2.0 *
g * momentumL * invXi / (hL * hL);
108 if (QL[Shortcuts::h] > hThreshold) {
110 const auto momentumR{std::sqrt(QR[Shortcuts::hu] * QR[Shortcuts::hu] + QR[Shortcuts::hv] * QR[Shortcuts::hv])};
111 sR = 2.0 *
g * momentumR * invXi / (hR * hR);
114 return std::fmax(smax, h[normal] * std::fmax(sL, sR));
static GPU_CALLABLE_METHOD void rusanovRiemannSolverADERDG(const T *const NOALIAS QL, const T *const NOALIAS QR, const tarch::la::Vector< DIMENSIONS, double > &x, const tarch::la::Vector< DIMENSIONS, double > &h, const double t, const double dt, const int normal, T *const NOALIAS FL, T *const NOALIAS FR)
static GPU_CALLABLE_METHOD double rusanovRiemannSolverFV(const T *const NOALIAS QL, const T *const NOALIAS QR, const tarch::la::Vector< DIMENSIONS, double > &x, const tarch::la::Vector< DIMENSIONS, double > &h, const double t, const double dt, const int normal, T *const NOALIAS FL, T *const NOALIAS FR)