Skip to content

CCE OpenACC faults when the acoustic loop calls s_compute_speed_of_sound #1794

Description

@sbryngelson

Summary

m_acoustic_src computes its own sound speed instead of calling s_compute_speed_of_sound. It is the
only site in the solver that does so. Under bubbles_euler the two disagree, which means the acoustic
source injects a wave at a different speed than the wave speeds the Riemann solver computes on the same
cells.

Attempting to unify them destabilizes the solver on Frontier CCE OpenACC, so the disagreement needs a
physics ruling before either form can be called correct. This issue records the derivation and the
measurements so none of it has to be rediscovered.

The two expressions are the same EOS

m_acoustic_src (src/simulation/m_acoustic_src.fpp) forms the mixture coefficients and then writes the
Tait form by hand:

call s_compute_mixture_coefficients(myalpha_rho, myalpha, myRho, small_gamma, B_tait, qv_dummy)
small_gamma = 1._wp/small_gamma + 1._wp
c = sqrt(small_gamma*(pres + ((small_gamma - 1._wp)/small_gamma)*B_tait)/myRho)

With n = 1/Gamma + 1, (n - 1)/n = 1/(1 + Gamma), so this is exactly
sqrt(((Gamma + 1)p + Pi)/(Gamma rho)) - i.e. f_bulk_modulus(p, Gamma, Pi)/rho, the plain branch of
s_compute_speed_of_sound. The downstream c/(small_gamma - 1) is likewise a pure rename: n - 1 = 1/Gamma,
so it equals c*Gamma.

So there is no EOS disagreement. The entire behavioural delta is what s_compute_speed_of_sound adds
on top of the plain branch and the hand-rolled code never applied:

  • the bubble dilution c = c/(1 - adv(num_fluids)) under model_eqns_5eq .and. bubbles_euler
  • the alt_soundspeed Wood's-law harmonic mean
  • the model_eqns_6eq arithmetic mean

The open question is therefore specifically whether the dilution closure belongs in the acoustic source
term
, not which EOS is right.

Evidence

Switching m_acoustic_src to s_compute_speed_of_sound:

  • moved the bubbly QBMM golden CE9DBA3F by 1.7% on AMD MI210 / amdflang OpenMP offload, which is the
    1/(1 - alpha) dilution to within rounding (alpha = 4e-2 predicts ~2.1%). Non-bubbly acoustic goldens
    were unaffected.
  • NaN'd at step 50 on Frontier CCE OpenACC in all three suites that combine an acoustic source with a
    bubbly medium: B9553426 and 4A1BD9B8 (2D Lagrange bubbles, acoustic_source = T, mag = 2e04) and
    CE9DBA3F (1D QBMM bubbles). Reverting the change returns all three to green - 41 tests pass, 0 fail,
    including the full Lagrange suite and a 28-case CCE-critical sweep.

The NaN mechanism is still open

An earlier version of this report attributed the NaN to the 1/(1 - alpha) dilution. That was wrong.
In MFC a 1/(1 - alpha) always denotes the dilute bubbly void fraction, and in these cases it is small:
the two Lagrange suites run bubbles_lagrange with bubbles_euler = F and so never enter that branch,
and the QBMM case has alpha = 4e-2, giving 1/0.96. That accounts for the 1.7% answer shift and nothing
more - it cannot produce Inf or NaN.

With model_eqns = 2, alt_soundspeed = F and mixture_err = F (the test base config), the new call
reduces for the Lagrange cases to the identical plain branch, f_bulk_modulus(p, Gamma, Pi)/rho. So the
arithmetic delta there is only floating-point re-association, which should not destabilize anything.

The remaining common factor across all three failures is structural rather than numerical: the change
passes myalpha - an array whose bound num_fluids is a device global - into s_compute_speed_of_sound,
a GPU_ROUTINE(parallelism='[seq]'), from inside the acoustic parallel loop. That is the same construct
class that has twice caused CCE-only failures in this codebase, once as a compile error
(ftn-7066 ... Global in accelerator routine without declare) and once as a runtime GPU memory fault
with a clean build (the m_thermochem case). Clean build plus runtime NaN on CCE only, with amdflang
OpenMP offload green on the same tree, fits that pattern.

This is a hypothesis, not a measurement. Discriminating it needs a variant that computes the mixture sound
speed without passing an array into a device routine from that loop.

What a fix needs

  1. A ruling on whether an acoustic source in a bubbly medium should inject at the diluted mixture speed or
    at the carrier-liquid speed. Note m_qbmm.fpp:775 deliberately goes the other way - it multiplies by
    (1 - alf) to recover the pure liquid speed from the partial density, which is correct for
    Keller-Miksis. These are different physical quantities and neither should be folded into the other.
  2. If the dilution does belong, Bubble sound speed: alpha -> 1 should assert, not silently produce Inf #1793 has to be fixed first or the source term is unstable wherever the
    void fraction approaches one.
  3. Frontier CCE OpenACC validation of the bubbly acoustic cases before merge, not after.

Reverted in #1762 as e07ee640; the rest of that PR stands and is CCE-validated without it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions