 |
Peano
|
Go to the documentation of this file.
5 // Compute average left and right states
6 const auto N{NumberOfUnknowns + NumberOfAuxiliaryVariables};
9 for (auto xy = 0; xy < Order + 1; ++xy) {
10 for (auto i = 0; i < N; ++i) {
11 QavgL[i] += kernels::{{SOLVER_NAME}}::Quadrature<double>::weights2[xy] * QL[xy * N + i];
12 QavgR[i] += kernels::{{SOLVER_NAME}}::Quadrature<double>::weights2[xy] * QR[xy * N + i];
16 // Wave speed estimation based on the flux Jacobian
18 if (QavgL[Shortcuts::h] > hThreshold) {
19 const auto VnL{QavgL[Shortcuts::hu + direction] / QavgL[Shortcuts::h]};
20 const auto cL{std::sqrt(g * QavgL[Shortcuts::h])};
21 sL = std::fmax(std::fabs(VnL - cL), std::fabs(VnL + cL));
24 if (QavgR[Shortcuts::h] > hThreshold) {
25 const auto VnR{QavgR[Shortcuts::hu + direction] / QavgR[Shortcuts::h]};
26 const auto cR{std::sqrt(g * QavgR[Shortcuts::h])};
27 sR = std::fmax(std::fabs(VnR - cR), std::fabs(VnR + cR));
29 const auto smax{std::fmax(sR, sL)};
32 auto rusanovFlux{0.0};
33 for (auto xy = 0; xy < Order + 1; ++xy) {
34 for (auto i = 0; i < N; ++i) {
36 rusanovFlux = 0.5 * (FL[j] + FR[j] + smax * (QL[j] - QR[j]));
40 // Ignore flux for flow topography
41 j = xy * N + Shortcuts::z;
48 flux(QL, x, h, t, dt, normal, FL);
49 flux(QR, x, h, t, dt, normal, FR);
51 const auto smax{std::fmax(maxEigenvalue(QL, x, h, t, dt, normal), maxEigenvalue(QR, x, h, t, dt, normal))};
52 const auto N{NumberOfAuxiliaryVariables + NumberOfUnknowns};
55 double DeltaQ[N] = {};
56 for (int i = 0; i < NumberOfUnknowns; ++i) {
57 Qavg[i] = 0.5 * (QL[i] + QR[i]);
58 DeltaQ[i] = QR[i] - QL[i];
59 FL[i] = 0.5 * (FL[i] + FR[i] - smax * DeltaQ[i]);
63 for (int i = NumberOfUnknowns; i < N; ++i) {
64 Qavg[i] = 0.5 * (QL[i] + QR[i]);
65 DeltaQ[i] = QR[i] - QL[i];
68 double ncp[NumberOfUnknowns] = {};
69 nonconservativeProduct(Qavg, DeltaQ, x, h, t, dt, normal, ncp);
70 for (int i = 0; i < NumberOfUnknowns; ++i) {
71 FL[i] += 0.5 * ncp[i];
72 FR[i] -= 0.5 * ncp[i];
76 if (QL[Shortcuts::h] > hThreshold) {
77 const auto hL{QL[Shortcuts::h] > hThreshold ? QL[Shortcuts::h] : hThreshold};
78 const auto momentumL{std::sqrt(QL[Shortcuts::hu] * QL[Shortcuts::hu] + QL[Shortcuts::hv] * QL[Shortcuts::hv])};
79 sL = 2.0 * g * momentumL * invXi / (hL * hL);
83 if (QL[Shortcuts::h] > hThreshold) {
84 const auto hR{QR[Shortcuts::h] > hThreshold ? QR[Shortcuts::h] : hThreshold};
85 const auto momentumR{std::sqrt(QR[Shortcuts::hu] * QR[Shortcuts::hu] + QR[Shortcuts::hv] * QR[Shortcuts::hv])};
86 sR = 2.0 * g * momentumR * invXi / (hR * hR);
89 return std::fmax(smax, h[normal] * std::fmax(sL, sR));