Fill ptil so probe output stops writing undefined ptilde and ptot - #1742
Conversation
ptil was allocated in m_global_parameters and pushed to the device, but nothing ever assigned it. The probe path read it at m_data_output.fpp:1300, reduced the result across ranks, and wrote it as the ptilde and ptot columns, so 1D Euler-Euler bubble runs with probe_wrt and num_fluids = 3 emitted undefined values in those two columns. Add s_compute_ptilde, which evaluates the pressure correction at cell centers the same way the HLLC solver applies it to reconstructed face states, including the small_alf degenerate branch and the qbmm moment path. Call it from s_compute_rhs rather than from s_compute_bubble_EE_source, since the latter is skipped when qbmm or adap_dt is on and would leave ptil unfilled in exactly those cases. Copy ptil back to the host alongside q_cons before probes are written, which was also missing. ptil is diagnostic only and never feeds the solution, so no golden values move. The computation runs only when probe_wrt is set.
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Fixes undefined ptilde/ptot probe outputs in Euler–Euler bubble runs by computing and syncing the ptil diagnostic field before probe writes.
Changes:
- Compute
ptilin the RHS path (gated onbubbles_euler+probe_wrt) via news_compute_ptilde. - Add GPU host sync for
ptilin the probe-related startup sync block. - Implement cell-centered
ptilevaluation mirroring the HLLC solver’s pressure-correction logic (including QBMM and degenerate branches).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/simulation/m_start_up.fpp | Adds host synchronization of ptil for GPU builds when probes are enabled. |
| src/simulation/m_rhs.fpp | Calls s_compute_ptilde during RHS evaluation when probe output is enabled. |
| src/simulation/m_bubbles_EE.fpp | Introduces s_compute_ptilde to fill the probe diagnostic ptil consistently with solver logic. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| !> Evaluate the Euler-Euler pressure correction at cell centers and store it in ptil. This mirrors the modified mixture pressure | ||
| !! that the HLLC solver applies to the reconstructed face states in m_riemann_solver_hllc.fpp, following Ando (2010), Eq. (2.5). | ||
| !! It is a diagnostic: ptil is read only by the probe output path and never feeds back into the solution. | ||
| impure subroutine s_compute_ptilde(q_cons_vf, q_prim_vf) |
| R3bar = R3bar + weight(q)*(myR**3._wp) | ||
| R3V2bar = R3V2bar + weight(q)*(myR**3._wp)*(myV**2._wp) | ||
| PbwR3bar = PbwR3bar + weight(q)*f_cpbw_KM(R0(q), myR, myV, myPb)*(myR**3._wp) |
| if (bubbles_euler) then | ||
| $:GPU_UPDATE(host='[ptil]') | ||
| end if |
|
Claude Code Review Head SHA: 962130b Files changed:
Findings:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1742 +/- ##
==========================================
+ Coverage 61.59% 61.61% +0.01%
==========================================
Files 84 84
Lines 21493 21520 +27
Branches 3176 3180 +4
==========================================
+ Hits 13239 13259 +20
- Misses 6078 6082 +4
- Partials 2176 2179 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
ptilis allocated inm_global_parameters.fpp:929and pushed to the device, but nothing in the codebase ever assigns it. The probe path reads it anyway:m_data_output.fpp:1300ptilde = ptil(j - 2, k, l)m_data_output.fpp:1301ptot = pres - ptildem_data_output.fpp:1471both are passed throughs_mpi_allreduce_summ_data_output.fpp:1509both are written to the probe fileSo 1D Euler-Euler bubble runs with
probe_wrt = Tandnum_fluids = 3have been writing undefined values in theptildeandptotcolumns. Because the values are MPI-reduced first, they are not reproducible across runs or rank counts. Fixes #1741.Changes
s_compute_ptildeinm_bubbles_EE.fppevaluates the correction at cell centers, mirroring what the HLLC solver applies to reconstructed face states inm_riemann_solver_hllc.fpp:736-746:which is Eq. (2.5) of Ando (Caltech thesis, 2010). The
small_alfdegenerate branch and the QBMM moment path (mom_sp1, 3, 4) are both mirrored so the diagnostic cannot drift from the solver.It is called from
s_compute_rhsrather than froms_compute_bubble_EE_source. The latter is guarded by(.not. adap_dt) .and. (.not. qbmm)atm_rhs.fpp:839, so hanging the fix off it would have leftptilunfilled in exactly the QBMM and adaptive-timestep cases.m_start_up.fppalso gains aGPU_UPDATE(host='[ptil]')next to the existingq_conssync in theprobe_wrtblock. Without it the array stayed device-resident and the host-side probe read would still have been invalid on GPU builds.Type of change
Scope
Testing
Built
simulationlocally and ranexamples/1D_bubblescreen(bubbles_euler,probe_wrt) with temporary instrumentation onptil. Values are finite and evolve smoothly. The magnitudes check out against the case setup: the background patch hasalpha = 1e-12, belowsmall_alf = 1e-11, so it takes the degenerate branch and givesptil = alpha * pof about1e-12, which matches the observed maximum. The bubble screen atvf0 = 4e-5contributes near zero because the bubbles start in equilibrium, sop_l - p_bwandRdotboth vanish. The instrumentation was removed before commit../mfc.sh precheckpasses.ptilis diagnostic only and never feeds back into the solution, and the new computation is gated onprobe_wrt, so no golden values move.Note on coverage
No example or test case combines 1D,
bubbles_euler,probe_wrt, andnum_fluids = 3, which is why this went unnoticed. Adding one would be a reasonable follow-up.