From 5f6e59370c876db80993dde3ab18dbf974ad2b88 Mon Sep 17 00:00:00 2001 From: Zhi Date: Thu, 29 Aug 2024 16:11:34 -0400 Subject: [PATCH] update riemann_flux --- pyro/compressible/riemann.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/pyro/compressible/riemann.py b/pyro/compressible/riemann.py index 47d07beec..bf46c26ff 100644 --- a/pyro/compressible/riemann.py +++ b/pyro/compressible/riemann.py @@ -594,7 +594,7 @@ def riemann_prim(idir, ng, @njit(cache=True) -def riemann_hllc(idir, ng, coord_type, +def riemann_hllc(idir, ng, idens, ixmom, iymom, iener, irhoX, nspec, lower_solid, upper_solid, # pylint: disable=unused-argument gamma, U_l, U_r): @@ -627,6 +627,9 @@ def riemann_hllc(idir, ng, coord_type, Conserved flux """ + # Only Cartesian2d is supported in HLLC + coord_type = 0 + qx, qy, nvar = U_l.shape F = np.zeros((qx, qy, nvar)) @@ -898,19 +901,18 @@ def riemann_flux(idir, U_l, U_r, my_data, rp, ivars, riemann_method = rp.get_param("compressible.riemann") gamma = rp.get_param("eos.gamma") - riemannFunc = None - if riemann_method == "HLLC": - riemannFunc = riemann_hllc - elif riemann_method == "CGF": - riemannFunc = riemann_cgf - else: + riemann_solvers = {"HLLC": riemann_hllc, "CGF": riemann_cgf} + + if riemann_method not in riemann_solvers: msg.fail("ERROR: Riemann solver undefined") - _f = riemannFunc(idir, myg.ng, myg.coord_type, - ivars.idens, ivars.ixmom, ivars.iymom, - ivars.iener, ivars.irhox, ivars.naux, - lower_solid, upper_solid, - gamma, U_l, U_r) + riemannFunc = riemann_solvers[riemann_method] + + _f = riemann_hllc(idir, myg.ng, + ivars.idens, ivars.ixmom, ivars.iymom, + ivars.iener, ivars.irhox, ivars.naux, + lower_solid, upper_solid, + gamma, U_l, U_r) # If riemann_method is not HLLC, then it outputs interface conserved states if riemann_method != "HLLC":