Skip to content

Commit 1a61c23

Browse files
committed
fix: use num_ib_patches_max_namelist in Python toolchain for patch_ib limit
NIB and the case_validator both now reference num_ib_patches_max_namelist (50000) instead of num_ib_patches_max (2050000). This constant is the actual namelist limit; particle beds grow patch_ib beyond it at runtime but those entries are never specified in the namelist. The fallback values match the constant, ensuring Homebrew installs (which lack m_constants.fpp) use the correct limit.
1 parent 1bbe86e commit 1a61c23

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

toolchain/mfc/case_validator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,10 @@ def check_ibm(self):
601601
ib and num_ibs <= 0 and not has_particle_beds,
602602
"num_ibs must be >= 1 when ib is enabled (or specify at least one particle_bed with num_particles > 0)",
603603
)
604-
num_ib_patches_max = get_fortran_constants().get("num_ib_patches_max", 100000)
604+
num_ib_patches_max = get_fortran_constants().get("num_ib_patches_max_namelist", 50000)
605605
self.prohibit(
606606
ib and num_ibs > num_ib_patches_max,
607-
f"num_ibs must be <= {num_ib_patches_max} (num_ib_patches_max in m_constants.fpp)",
607+
f"num_ibs must be <= {num_ib_patches_max} (num_ib_patches_max_namelist in m_constants.fpp)",
608608
)
609609
self.prohibit(not ib and num_ibs > 0, "num_ibs is set, but ib is not enabled")
610610
self.prohibit(ib_state_wrt and not ib, "ib_state_wrt requires ib to be enabled")

toolchain/mfc/params/definitions.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def _fc(name: str, default: int) -> int:
3131
NPR = _fc("num_probes_max", 10) # probe, acoustic, integral
3232
NB = _fc("num_bc_patches_max", 10) # patch_bc
3333
NUM_PATCHES_MAX = _fc("num_patches_max", 10) # patch_icpp (Fortran array bound)
34-
NIB = _fc("num_ib_patches_max", 50000) # patch_ib (Fortran array bound)
34+
NIB = _fc("num_ib_patches_max_namelist", 50000) # patch_ib namelist limit (patch_ib grows beyond this for particle beds)
3535
NPB = _fc("num_particle_beds_max", 10) # particle_bed (Fortran array bound)
3636
# Enumeration limits for families not yet converted to IndexedFamily.
3737
# These are smaller than the Fortran array bounds to keep the registry compact.
@@ -1184,9 +1184,8 @@ def _load():
11841184
_r(f"bub_pp%{a}", REAL, {"bubbles"}, math=sym)
11851185

11861186
# patch_ib (immersed boundaries) — registered as indexed family for O(1) lookup.
1187-
# max_index is None so the parameter registry stays compact (no enumeration).
1188-
# The Fortran-side upper bound (num_ib_patches_max in m_constants.fpp) is parsed
1189-
# and enforced by the case_validator, not by max_index here.
1187+
# max_index=NIB enforces the namelist limit (num_ib_patches_max_namelist); particle beds can
1188+
# grow patch_ib beyond this at runtime, but those entries are never in the namelist.
11901189
_ib_tags = {"ib"}
11911190
_ib_attrs: Dict[str, tuple] = {}
11921191
for a in ["geometry", "moving_ibm"]:

0 commit comments

Comments
 (0)