You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: simulation probe sound speed omits qv from enthalpy, disagreeing with post-process #1707
Three s_compute_speed_of_sound call sites in src/simulation/m_data_output.fpp build the specific total enthalpy H without the qv term while still passing the real qv as the final argument. Because the routine subtracts qv/rho internally, the sound speed comes out too low whenever qv /= 0. The equivalent post-process path builds H correctly, so simulation and post-process report different sound speeds for identical state.
The contract
s_compute_speed_of_sound (src/common/m_variables_conversion.fpp:1180) computes, in the default stiffened-gas branch (line 1227):
c = (H - 5.e-1*vel_sum - qv/rho)/gamma
Since E = gamma*p + pi_inf + qv + rho*KE, the specific total enthalpy H = (E + p)/rho includes qv. The internal - qv/rho then cancels it, leaving the correct stiffened-gas result c^2 = ((gamma+1)*p + pi_inf)/(rho*gamma). H must therefore include qv.
Every solver call site satisfies this implicitly by deriving H from the conserved energy, e.g. src/simulation/m_riemann_solver_hll.fpp:255:
H is open-coded as ((gamma + 1)*pres + pi_inf)/rho — no qv — but the real qv is still passed. The internal subtraction then has nothing to cancel against:
Diagnostics only — these sites feed probe output and Ma = maxvel/c. Reported Mach number is too high when qv /= 0, and disagrees with what post-process reports for the same field data. If qv > ((gamma+1)*p + pi_inf) the argument goes negative and the mixture_err floor clamps c to 100*sgm_eps, which would make the reported Mach number meaningless rather than merely wrong.
Dormant when qv = 0 (the default). Triggers for the phase-change and reactive-burn examples that set fluid_pp(i)%qv.
Suggested fix
Either add the + qv term at the three sites, or better, stop open-coding H at call sites entirely — the solver convention H = (E + pres)/rho is both correct and drift-proof. See the tracking issue for deduplication.
Activity
Pass an eos_state to s_compute_speed_of_sound
Derive the speed of sound from the state, not a supplied enthalpy