Skip to content

Commit 3744382

Browse files
committed
docs: add case-optimization namelist and conserved-variable eqn_idx gotchas
1 parent 890bc9d commit 3744382

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.claude/rules/parameter-system.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ at CMake configure time — no manual Fortran edits needed for simple scalar par
3737
**Exceptions — still require manual Fortran edits:**
3838
- Array variables (e.g. `logical, dimension(num_fluids_max)`) → declare in `src/*/m_global_parameters.fpp`
3939
- Derived-type members (`fluid_pp%attr`, `patch_icpp(i)%attr`) → declare in the relevant derived type
40-
- Case-optimization parameters → add to `CASE_OPT_PARAMS` and the `#:else` block in `src/simulation/m_global_parameters.fpp`
40+
- Case-optimization parameters → add to `CASE_OPT_PARAMS` and the `#:else` block in `src/simulation/m_global_parameters.fpp`.
41+
Gotcha: under `--case-optimization` these are baked into the binary and dropped from the simulation namelist
42+
(`case_dicts.py` filters them), so changing one needs a *rebuild*, not just a case edit — and building without
43+
the flag makes them read from `.inp` again.
4144

4245
## Case Files
4346
- Case files are Python scripts (`.py`) that define a dict of parameters
@@ -60,6 +63,11 @@ Add Fortran-side checks in addition to `case_validator.py`.
6063
String expressions in parameters become Fortran code via `case.py.__get_analytic_ic_fpp()`.
6164
These are compiled into the binary, so syntax errors cause build failures, not runtime errors.
6265

66+
Gotcha: each IC variable (`alpha_rho`, `vel`, `pres`, `alpha`, `Y`, `Bx`...) maps to an `eqn_idx%…`
67+
expression in `QPVF_IDX_VARS` (`case.py`). Adding a conserved variable that patches can set means
68+
updating that map *and* the Fortran `eqn_idx` builder to agree — a mismatch is a silent wrong-index, not
69+
an error. (This is also why `Bx`/`By`/`Bz` use `eqn_idx%B%end-1/%end`, to stay valid in 1D/2D.)
70+
6371
Available variables in analytical IC expressions:
6472
- `x`, `y`, `z` — cell-center coordinates (mapped to `x_cc(i)`, `y_cc(j)`, `z_cc(k)`)
6573
- `xc`, `yc`, `zc` — patch centroid coordinates

0 commit comments

Comments
 (0)