Skip to content

Commit e4bb56a

Browse files
committed
codegen: broadcast the Herschel-Bulkley fluid_pp members
The hardcoded fluid_pp emitter predated the #1545 merge and silently dropped K/nn/tau0/hb_m/mu_min/mu_max/mu_bulk and non_newtonian from the generated lists - a multi-rank regression for non-Newtonian runs relative to the manual lists it replaced. Emitted sets now verified member-identical to master's manual lists per target. Caught by automated PR review.
1 parent 525e0bd commit e4bb56a

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

toolchain/mfc/params/generators/fortran_gen.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,16 @@ def _emit_bcast_group(lines: List[str], vars_list: List[str], mpi_type: str) ->
318318
def _emit_fluid_pp(lines: List[str], target: str) -> None:
319319
"""Emit the fluid_pp(i) member-loop broadcast block.
320320
321-
Members broadcast: gamma, pi_inf, G, cv, qv, qvp (all REAL, mpi_p).
322-
Sim additionally: Re(1) with count=2.
321+
Members broadcast: the 13 REAL members (EOS core plus the Herschel-Bulkley
322+
non-Newtonian set) and the LOGICAL non_newtonian flag, matching the manual
323+
lists this generator replaces. Sim additionally: Re(1) with count=2.
323324
"""
324-
# These are the core EOS members broadcast in all three targets.
325-
# Other fluid_pp members in the registry (mu_v, pv, mul0, ss, D_v, etc.) are
326-
# physics-specific and are initialised from input on rank 0 only or derived.
327-
fp_real_members = ["gamma", "pi_inf", "G", "cv", "qv", "qvp"]
325+
fp_real_members = ["gamma", "pi_inf", "G", "cv", "qv", "qvp",
326+
"K", "nn", "tau0", "hb_m", "mu_min", "mu_max", "mu_bulk"]
328327
lines.append(" do i = 1, num_fluids_max")
329328
for mem in fp_real_members:
330329
lines.append(f" call MPI_BCAST(fluid_pp(i)%{mem}, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)")
330+
lines.append(" call MPI_BCAST(fluid_pp(i)%non_newtonian, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)")
331331
if target == "sim":
332332
lines.append(" call MPI_BCAST(fluid_pp(i)%Re(1), 2, mpi_p, 0, MPI_COMM_WORLD, ierr)")
333333
lines.append(" end do")

toolchain/mfc/params_tests/test_fortran_gen.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ def test_generate_bcast_fpp_fluid_pp_loop():
414414
assert "do i = 1, num_fluids_max" in out, f"{target}: fluid_pp loop missing"
415415
assert "call MPI_BCAST(fluid_pp(i)%gamma, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)" in out
416416
assert "call MPI_BCAST(fluid_pp(i)%cv, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)" in out
417+
# Herschel-Bulkley members (#1545) — dropping any is a multi-rank regression
418+
for hb in ("K", "nn", "tau0", "hb_m", "mu_min", "mu_max", "mu_bulk"):
419+
assert f"call MPI_BCAST(fluid_pp(i)%{hb}, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)" in out, f"missing HB member {hb}"
420+
assert "call MPI_BCAST(fluid_pp(i)%non_newtonian, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)" in out
417421

418422
sim = generate_bcast_fpp("sim")
419423
assert "call MPI_BCAST(fluid_pp(i)%Re(1), 2, mpi_p, 0, MPI_COMM_WORLD, ierr)" in sim

0 commit comments

Comments
 (0)