@@ -23,20 +23,22 @@ MFC has ~3,400 simulation parameters defined in Python and read by Fortran via n
2323 - Reads ` &user_inputs ` namelist
2424 - Each parameter must be declared in the namelist statement
2525
26- ## Adding a New Parameter (4 -location checklist)
26+ ## Adding a New Parameter (2 -location checklist)
2727
28- YOU MUST update the first 3 locations. Missing any causes silent failures or compile errors.
29- Location 4 is required only if the parameter has physics constraints .
28+ Fortran declarations and namelist bindings are now auto-generated from definitions.py
29+ at CMake configure time — no manual Fortran edits needed for simple scalar parameters .
3030
31- 1 . ** ` toolchain/mfc/params/definitions.py ` ** : Add parameter with type, default, constraints
32- 2 . ** ` src/*/m_global_parameters.fpp ` ** : Declare the Fortran variable in the relevant
33- target(s). If the param is used by simulation only, add it there. If shared, add to
34- all three targets' m_global_parameters.fpp.
35- 3 . ** ` src/*/m_start_up.fpp ` ** : Add to the Fortran ` namelist ` declaration in the relevant
36- target(s).
37- 4 . ** ` toolchain/mfc/case_validator.py ` ** : Add validation rules if the parameter has
31+ 1 . ** ` toolchain/mfc/params/definitions.py ` ** : Add parameter with ` _r() ` (type, default,
32+ constraints) AND add it to ` NAMELIST_VARS ` via ` _nv() ` for the relevant target(s).
33+ After editing, re-run cmake (or ` ./mfc.sh build ` ) to regenerate the Fortran includes.
34+ 2 . ** ` toolchain/mfc/case_validator.py ` ** : Add validation rules if the parameter has
3835 physics constraints. Include ` PHYSICS_DOCS ` entry with title, category, explanation.
3936
37+ ** Exceptions — still require manual Fortran edits:**
38+ - Array variables (e.g. ` logical, dimension(num_fluids_max) ` ) → declare in ` src/*/m_global_parameters.fpp `
39+ - 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 `
41+
4042## Case Files
4143- Case files are Python scripts (` .py ` ) that define a dict of parameters
4244- Validated with ` ./mfc.sh validate case.py `
0 commit comments