Skip to content

Commit 05270ff

Browse files
committedFeb 19, 2025
Moved ComputeFlux as a Riemann Solver lambda
1 parent 1c95cf2 commit 05270ff

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed
 

‎RiemannSolvers.h

+15
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ void hll(State &qL, State &qR, State& flux, real_t &pout, const Params &params)
1616
const real_t SL = fmin(sminL, sminR);
1717
const real_t SR = fmax(smaxL, smaxR);
1818

19+
20+
auto computeFlux = [&](State &q, const Params &params) {
21+
const real_t Ek = 0.5 * q[IR] * (q[IU] * q[IU] + q[IV] * q[IV]);
22+
const real_t E = (q[IP] / (params.gamma0-1.0) + Ek);
23+
24+
State fout {
25+
q[IR]*q[IU],
26+
q[IR]*q[IU]*q[IU] + q[IP],
27+
q[IR]*q[IU]*q[IV],
28+
(q[IP] + E) * q[IU]
29+
};
30+
31+
return fout;
32+
};
33+
1934
State FL = computeFlux(qL, params);
2035
State FR = computeFlux(qR, params);
2136

‎States.h

-14
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,5 @@ State swap_component(State &q, IDir dir) {
105105
return {q[IR], q[IV], q[IU], q[IP]};
106106
}
107107

108-
KOKKOS_INLINE_FUNCTION
109-
State computeFlux(State &q, const Params &params) {
110-
const real_t Ek = 0.5 * q[IR] * (q[IU] * q[IU] + q[IV] * q[IV]);
111-
const real_t E = (q[IP] / (params.gamma0-1.0) + Ek);
112-
113-
State fout {
114-
q[IR]*q[IU],
115-
q[IR]*q[IU]*q[IU] + q[IP],
116-
q[IR]*q[IU]*q[IV],
117-
(q[IP] + E) * q[IU]
118-
};
119-
120-
return fout;
121-
}
122108

123109
}

0 commit comments

Comments
 (0)
Please sign in to comment.