10 #include <athena/athena.hpp>
11 #include <athena/coordinates/coordinates.hpp>
12 #include <athena/hydro/hydro.hpp>
13 #include <athena/mesh/mesh.hpp>
16 #include <configure.hpp>
18 void Hydro::RiemannSolver(
int const k,
int const j,
int const il,
int const iu,
22 int ivy = ivx == IVY ? IVZ : IVY;
24 Real wli[NHYDRO], wri[NHYDRO], wave[3][3], speed[3];
26 Real ubar, vbar, cbar, delh, delu, delv, hbar, a1, a2, a3;
33 pmy_block->pcoord->PrimToLocal2(k,
j, il, iu, empty, wl, wr, empty);
36 pmy_block->pcoord->PrimToLocal3(k,
j, il, iu, empty, wl, wr, empty);
42 for (
int i = il; i <= iu; ++i) {
43 for (
int n = 0; n < NHYDRO; ++n) {
48 ubar = (wli[ivx] * sqrt(wli[IDN]) + wri[ivx] * sqrt(wri[IDN])) /
49 (sqrt(wli[IDN]) + sqrt(wri[IDN]));
50 vbar = (wli[ivy] * sqrt(wli[IDN]) + wri[ivy] * sqrt(wri[IDN])) /
51 (sqrt(wli[IDN]) + sqrt(wri[IDN]));
52 cbar = sqrt(0.5 * (wli[IDN] + wri[IDN]));
54 delh = wri[IDN] - wli[IDN];
55 delu = wri[ivx] - wli[ivx];
56 delv = wri[ivy] - wli[ivy];
57 hbar = sqrt(wli[IDN] * wri[IDN]);
59 a1 = 0.5 * (cbar * delh - hbar * delu) / cbar;
61 a3 = 0.5 * (cbar * delh + hbar * delu) / cbar;
64 wave[0][1] = a1 * (ubar - cbar);
65 wave[0][2] = a1 * vbar;
70 wave[2][1] = a3 * (ubar + cbar);
71 wave[2][2] = a3 * vbar;
73 speed[0] = fabs(ubar - cbar);
74 speed[1] = fabs(ubar);
75 speed[2] = fabs(ubar + cbar);
77 flx(IDN, k,
j, i) = 0.5 * (wli[IDN] * wli[ivx] + wri[IDN] * wri[ivx]);
79 0.5 * (wli[IDN] * wli[ivx] * wli[ivx] + 0.5 * wli[IDN] * wli[IDN] +
80 wri[IDN] * wri[ivx] * wri[ivx] + 0.5 * wri[IDN] * wri[IDN]);
82 0.5 * (wli[IDN] * wli[ivx] * wli[ivy] + wri[IDN] * wri[ivx] * wri[ivy]);
83 flx(IVX, k,
j, i) = 0.;
85 for (
int r = 0;
r < 3; ++
r) {
86 flx(IDN, k,
j, i) -= 0.5 * speed[
r] * wave[
r][0];
87 flx(ivx, k,
j, i) -= 0.5 * speed[
r] * wave[
r][1];
88 flx(ivy, k,
j, i) -= 0.5 * speed[
r] * wave[
r][2];
97 pmy_block->pcoord->FluxToGlobal2(k,
j, il, iu, empty, empty, flx, empty,
101 pmy_block->pcoord->FluxToGlobal3(k,
j, il, iu, empty, empty, flx, empty,