Skip to content

Commit f42e532

Browse files
committed
toolchain: validate patch_ib against the namelist array bound; refresh dedup docs
NIB read num_ib_patches_max (2050000) but the patch_ib namelist array is dimensioned num_ib_patches_max_namelist (54000), so validation accepted indices that overflow the array. Also refreshes three doc passages made stale by the dedup. Both flagged by review.
1 parent dac3d1f commit f42e532

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

.claude/rules/common-pitfalls.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ covered in `docs/documentation/contributing.md`.
1414
bubbles and IB. Read that routine for the current value rather than assuming one.
1515
- Riemann solvers: left state at `j`, right state at `j+1`.
1616
- All equation indices live in the `eqn_idx` struct (`eqn_idx_info` in
17-
`m_derived_types.fpp`, populated in `m_global_parameters.fpp`): `%cont`, `%mom`, `%E`,
17+
`m_derived_types.fpp`, populated by `s_initialize_eqn_idx` in `m_global_parameters_common.fpp`): `%cont`, `%mom`, `%E`,
1818
`%adv`, plus optional ranges (`%bub`, `%stress`, `%species`, `%B`, ...). The old
1919
`contxb`/`momxb` shorthands are gone. Index positions depend on `model_eqns` and
2020
enabled features — changing either moves ALL indices; never hard-code one.
@@ -66,7 +66,7 @@ covered in `docs/documentation/contributing.md`.
6666
`use m_global_parameters` continues to work for all downstream modules without change.
6767
Sim-only declarations (GPU_DECLARE, Re_idx allocation) stay in
6868
`m_global_parameters_common` behind `#ifdef MFC_SIMULATION`. Generated includes
69-
(`generated_decls.fpp`, `generated_bcast.fpp`) must exist for every target — the build
69+
(`generated_decls.fpp`, `generated_bcast.fpp`, `generated_case_opt_decls.fpp`) must exist for every target — the build
7070
emits stubs where the content is sim-only, so a common file that includes one will
7171
compile for pre/post too.
7272
- Runtime checks (`@:PROHIBIT`) go where they run: shared →

docs/documentation/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ Scalar declarations, GPU declare lines, Doxygen descriptions, and namelist bindi
319319
auto-generated at build time (ninja-tracked custom command) from the `TYPED_DECLS` and `FORTRAN_ARRAY_DIMS`
320320
tables in `toolchain/mfc/params/definitions.py`. For a plain scalar registered with
321321
`_r()` / `_nv()` above, no manual Fortran edit is needed — reconfigure (`./mfc.sh build`)
322-
and the generated include in each target's `m_global_parameters.fpp` is updated
322+
and the generated include in `m_global_parameters_common.fpp` (compiled per target) is updated
323323
automatically.
324324

325325
Still manual (not auto-generated):

toolchain/mfc/params/definitions.py

Lines changed: 1 addition & 1 deletion
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", 54000) # patch_ib (Fortran array bound)
34+
NIB = _fc("num_ib_patches_max_namelist", 54000) # patch_ib namelist array bound
3535
NAF = _fc("num_ib_airfoils_max", 5) # ib_airfoil (Fortran array bound)
3636
NSM = _fc("num_stl_models_max", 10) # stl_models (Fortran array bound)
3737
NPB = _fc("num_particle_clouds_max", 10) # particle_cloud (Fortran array bound)

0 commit comments

Comments
 (0)