10 #include <athena/athena.hpp>
11 #include <athena/athena_arrays.hpp>
12 #include <athena/hydro/hydro.hpp>
14 void Hydro::RiemannSolver(
int const k,
int const j,
int const il,
int const iu,
18 int ivy = ivx == IVX ? IVY : IVX;
20 Real wli[NHYDRO], wri[NHYDRO], wave[3][3], speed[3];
22 Real ubar, vbar, cbar, delh, delu, delv, hbar, a1, a2, a3;
24 for (
int i = il; i <= iu; ++i) {
25 for (
int n = 0; n < NHYDRO; ++n) {
30 ubar = (wli[ivx] * sqrt(wli[IDN]) + wri[ivx] * sqrt(wri[IDN])) /
31 (sqrt(wli[IDN]) + sqrt(wri[IDN]));
32 vbar = (wli[ivy] * sqrt(wli[IDN]) + wri[ivy] * sqrt(wri[IDN])) /
33 (sqrt(wli[IDN]) + sqrt(wri[IDN]));
34 cbar = sqrt(0.5 * (wli[IDN] + wri[IDN]));
36 delh = wri[IDN] - wli[IDN];
37 delu = wri[ivx] - wli[ivx];
38 delv = wri[ivy] - wli[ivy];
39 hbar = sqrt(wli[IDN] * wri[IDN]);
41 a1 = 0.5 * (cbar * delh - hbar * delu) / cbar;
43 a3 = 0.5 * (cbar * delh + hbar * delu) / cbar;
46 wave[0][1] = a1 * (ubar - cbar);
47 wave[0][2] = a1 * vbar;
52 wave[2][1] = a3 * (ubar + cbar);
53 wave[2][2] = a3 * vbar;
55 speed[0] = fabs(ubar - cbar);
56 speed[1] = fabs(ubar);
57 speed[2] = fabs(ubar + cbar);
59 flx(IDN, k,
j, i) = 0.5 * (wli[IDN] * wli[ivx] + wri[IDN] * wri[ivx]);
61 0.5 * (wli[IDN] * wli[ivx] * wli[ivx] + 0.5 * wli[IDN] * wli[IDN] +
62 wri[IDN] * wri[ivx] * wri[ivx] + 0.5 * wri[IDN] * wri[IDN]);
64 0.5 * (wli[IDN] * wli[ivx] * wli[ivy] + wri[IDN] * wri[ivx] * wri[ivy]);
65 flx(IVZ, k,
j, i) = 0.;
67 for (
int r = 0;
r < 3; ++
r) {
68 flx(IDN, k,
j, i) -= 0.5 * speed[
r] * wave[
r][0];
69 flx(ivx, k,
j, i) -= 0.5 * speed[
r] * wave[
r][1];
70 flx(ivy, k,
j, i) -= 0.5 * speed[
r] * wave[
r][2];