@@ -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.
@@ -42,17 +42,40 @@ covered in `docs/documentation/contributing.md`.
4242- Adding one: ` _r() ` definition + ` _nv() ` ` NAMELIST_VARS ` registration in
4343 ` toolchain/mfc/params/definitions.py ` ; ` case_validator.py ` only if physics-constrained
4444 (with a ` PHYSICS_DOCS ` entry). Fortran declarations and namelist bindings are
45- auto-generated at CMake configure time — re-run cmake (or ` ./mfc.sh build ` ) after editing.
46- - Still manual: array variables and derived-type members (declare in
47- ` src/*/m_global_parameters.fpp ` / the relevant type), and case-optimization parameters
48- (` CASE_OPT_PARAMS ` + the ` #:else ` block in ` src/simulation/m_global_parameters.fpp ` ).
49- Gotcha: under ` --case-optimization ` those are baked into the binary and dropped from
50- the namelist, so changing one needs a * rebuild* , not a case edit.
45+ auto-generated at build time (ninja-tracked custom command) — re-run cmake (or ` ./mfc.sh build ` ) after editing.
46+ - Still manual: derived-type ` TYPE ` member definitions in ` src/common/m_derived_types.fpp ` ;
47+ default-value assignments in ` s_assign_default_values_to_user_inputs ` ; the
48+ ` CASE_OPT_EXTRA_LINES ` literal in ` toolchain/mfc/params/generators/fortran_gen.py ` (covers ` num_dims ` ,
49+ ` num_vels ` , ` weno_polyn ` , ` muscl_polyn ` , ` weno_num_stencils ` , ` wenojs ` );
50+ multi-variable declaration lines (` bc_x/y/z ` , ` x/y/z_domain ` , ` x/y/z_output ` , post's
51+ ` G ` ); and the MPI broadcast residue in ` m_mpi_proxy ` (computed variables that are not
52+ namelist-bound: ` m_glb ` /` n_glb ` /` p_glb ` , ` cfl_dt ` , ` bc_io ` , and complex struct-member
53+ array loops — these cannot be auto-generated and stay hand-listed). Everything else — scalar declarations, plain arrays (` FORTRAN_ARRAY_DIMS `
54+ table in ` definitions.py ` ), derived-type namelist declarations including ` GPU_DECLARE `
55+ lines and Doxygen descs (` TYPED_DECLS ` table in ` definitions.py ` ), the simulation
56+ case-optimization declaration block, and the per-target MPI broadcast lists for all
57+ namelist-registry scalars (` generated_bcast.fpp ` ) — is regenerated at build time by a
58+ ninja-tracked custom command (editing ` params/*.py ` triggers regeneration automatically).
59+ Gotcha: ADDING a new file under ` toolchain/mfc/params/ ` needs one reconfigure
60+ (the custom command's DEPENDS list is globbed at configure time). Under ` --case-optimization ` the baked-in constants are dropped from the
61+ namelist, so changing one needs a * rebuild* , not a case edit.
62+ - Shared-state pattern: namelist declarations (` #:include 'generated_decls.fpp' ` ), the
63+ ` eqn_idx ` /` sys_size ` /` b_size ` /` tensor_size ` state variables, and the common defaults
64+ core all live in ` src/common/m_global_parameters_common.fpp ` . Each per-target
65+ ` m_global_parameters.fpp ` does ` use m_global_parameters_common ` (default-public), so
66+ ` use m_global_parameters ` continues to work for all downstream modules without change.
67+ Sim-only declarations (GPU_DECLARE, Re_idx allocation) stay in
68+ ` m_global_parameters_common ` behind ` #ifdef MFC_SIMULATION ` . Generated includes
69+ (` generated_decls.fpp ` , ` generated_bcast.fpp ` , ` generated_case_opt_decls.fpp ` ) must exist for every target — the build
70+ emits stubs where the content is sim-only, so a common file that includes one will
71+ compile for pre/post too.
5172- Runtime checks (` @:PROHIBIT ` ) go where they run: shared →
5273 ` src/common/m_checker_common.fpp ` ; simulation-only → ` src/simulation/m_checker.fpp ` ;
5374 pre/post-only → ` src/{pre,post}_process/m_checker.fpp ` (their ` s_check_inputs ` are
5475 currently empty — that IS the right place, not m_checker_common).
55- - Analytic ICs are compiled into the binary (syntax error = build failure, not runtime).
76+ - Analytic ICs are compiled into the binary. Expressions are AST-validated at case load
77+ (syntax errors and unknown variables are immediate, named errors; bare ` e ` is not a
78+ variable — write ` exp(1.0) ` ).
5679 Each IC variable maps to an ` eqn_idx%… ` expression in ` QPVF_IDX_VARS `
5780 (` toolchain/mfc/case.py ` ); a new patch-settable conserved variable means updating that
5881 map AND the Fortran ` eqn_idx ` builder to agree — a mismatch is a silent wrong index.
0 commit comments