4#include "exahype2/RefinementControl.h"
6tarch::logging::Log exahype::limiting::swe::aderSWE::_log(
"exahype::limiting::swe::aderSWE" );
9double exahype::limiting::swe::aderSWE::maxEigenvalue(
10 [[maybe_unused]]
const double* 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]]
double t,
14 [[maybe_unused]]
double dt,
15 [[maybe_unused]]
int normal
18 static constexpr double g = 9.81;
19 static constexpr double zeroFlux = 1e-3;
26 double u = Q[normal+1] / Q[0];
27 double c = std::sqrt(g * Q[0]);
29 return std::max(std::abs(u - c), std::abs(u + c));
33void exahype::limiting::swe::aderSWE::flux(
34 [[maybe_unused]]
const double* NOALIAS Q,
35 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& x,
36 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& h_,
37 [[maybe_unused]]
double t,
38 [[maybe_unused]]
double dt,
39 [[maybe_unused]]
int normal,
40 [[maybe_unused]]
double* NOALIAS F
43 static constexpr double g = 9.81;
44 static constexpr double zeroFlux = 1e-3;
64 F[1] =
h *
u *
u + 0.5 *
g *
h *
h;
70 F[2] =
h *
v *
v + 0.5 *
g *
h *
h;
76void exahype::limiting::swe::aderSWE::nonconservativeProduct(
77 [[maybe_unused]]
const double* NOALIAS Q,
78 [[maybe_unused]]
const double* NOALIAS deltaQ,
79 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& x,
80 [[maybe_unused]]
const tarch::la::Vector<DIMENSIONS, double>& h,
81 [[maybe_unused]]
double t,
82 [[maybe_unused]]
double dt,
83 [[maybe_unused]]
int normal,
84 [[maybe_unused]]
double* NOALIAS BTimesDeltaQ
87 static constexpr double g = 9.81;
88 static constexpr double zeroFlux = 1e-3;
92 BTimesDeltaQ[0] = 0.0;
93 BTimesDeltaQ[1] = 0.0;
94 BTimesDeltaQ[2] = 0.0;
95 BTimesDeltaQ[3] = 0.0;
101 BTimesDeltaQ[0] = 0.0;
102 BTimesDeltaQ[1] =
g * Q[0] * (deltaQ[3]);
103 BTimesDeltaQ[2] = 0.0;
104 BTimesDeltaQ[3] = 0.0;
107 BTimesDeltaQ[0] = 0.0;
108 BTimesDeltaQ[1] = 0.0;
109 BTimesDeltaQ[2] =
g * Q[0] * (deltaQ[3]);
110 BTimesDeltaQ[3] = 0.0;
116void exahype::limiting::swe::aderSWE::riemannSolver(
119 const double*
const QL,
120 const double*
const QR,
123 const tarch::la::Vector<DIMENSIONS, double>& x,
124 const tarch::la::Vector<DIMENSIONS, double>& h,
132 for(
int xy=0; xy<Order+1; xy++){
133 smax = std::max(smax, maxEigenvalue(&QL[xy*4], x, h, t, dt, direction));
134 smax = std::max(smax, maxEigenvalue(&QR[xy*4], x, h, t, dt, direction));
138 for(
int xy=0; xy<Order+1; xy++){
141 FL[xy*4+0] = 0.5*(FL[xy*4+0]+FR[xy*4+0] + smax*(QL[xy*4+0]+QL[xy*4+3]-QR[xy*4+0]-QR[xy*4+3]) );
142 FL[xy*4+1] = 0.5*(FL[xy*4+1]+FR[xy*4+1] + smax*(QL[xy*4+1]-QR[xy*4+1]) );
143 FL[xy*4+2] = 0.5*(FL[xy*4+2]+FR[xy*4+2] + smax*(QL[xy*4+2]-QR[xy*4+2]) );
146 FR[xy*4+0] = FL[xy*4+0];
147 FR[xy*4+1] = FL[xy*4+1];
148 FR[xy*4+2] = FL[xy*4+2];
152 FL[xy*4+direction+1] += 0.5*9.81*0.5*(QL[xy*4+0]+QR[xy*4+0])*(QR[xy*4+3]-QL[xy*4+3]);
153 FR[xy*4+direction+1] -= 0.5*9.81*0.5*(QL[xy*4+0]+QR[xy*4+0])*(QR[xy*4+3]-QL[xy*4+3]);