You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add physics constraint validation and auto-generated docs (#1149)
* Add physics warning infrastructure and auto-documenting constraints
Add warn() method to CaseValidator for non-fatal physics checks (volume
fraction sum, alpha-rho consistency, EOS parameter sanity, domain bounds,
patch bounds, velocity components). Extend AST analyzer to discover
self.warn() calls alongside self.prohibit(), with severity field on Rule
dataclass. Auto-generated Doxygen docs now include a Physics Warnings
section.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix doc reference lint for auto-generated pages
Register auto-generated page IDs (parameters, case_constraints, examples,
cli) in lint_docs.py so the pre-commit doc reference check does not flag
them as missing. These pages are created by ./mfc.sh generate and only
exist after generation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Display physics warnings in ./mfc.sh validate output
The validate command was discarding the warnings list returned by
CaseValidator.validate(). Now warnings are shown with yellow formatting
alongside the per-stage constraint results.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Validate all example cases in CI and clean up non-standard case files
- Expand CI "Validate example cases" step from 2 hardcoded examples to
all 134 examples/*/case.py files
- Rename scaling/case.py to scaling/benchmark.py since it requires
mandatory CLI args (--scaling, --memory) and is not a standard example
- Remove 2D_phasechange_bubble/casefile.py (unreferenced duplicate of
3D_phasechange_bubble/case.py)
- Fix 2D_bubbly_steady_shock/case.py missing nb in output dictionary
- Add physics_constraints.md documentation
- Update doc references to scaling/benchmark.py
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Auto-generate physics_constraints.md from PHYSICS_DOCS metadata
Replace the hand-written physics constraints page with an auto-generated
one that merges PHYSICS_DOCS entries (math, explanations, references) with
AST-extracted validation rules (stages, severity, messages). This prevents
the documentation from going stale when check methods are added or modified.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix physics docs rendering: \implies → \Rightarrow, backtick code params
- Replace \implies with \Rightarrow (Doxygen MathJax compatible)
- Add _format_message() to wrap code parameter references in backticks
in auto-generated check messages (Fortran accessors, snake_case params,
known short params like nb/dt/m/n/p)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Show all enforced checks without truncation in physics docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add parameter column to undocumented checks table in physics docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove undocumented checks section from physics constraints page
These checks are discoverable via the Case Creator Guide instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix Fortran % accessor and AST artifacts in physics docs formatting
Doxygen consumes % in %<word> even inside backtick code spans, causing
tokens like bc_y%beg to render as bc_ybeg. Escape with \% to preserve
the Fortran struct accessor in rendered output. Also clean up AST
extraction artifacts: istr/jstr → i/j, remove (got varname) noise,
and rewrite f-string value placeholders into readable prose.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix Doxygen % consumption with split <code> tag workaround
Doxygen consumes %<word> as "suppress auto-link" even inside backtick
and <code> spans, and \% leaves a visible backslash. Split Fortran %
accessor tokens into adjacent <code> tags so % is never followed by a
word character: <code>bc_y%</code><code>beg</code> renders as bc_y%beg.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Use CSS classes for seamless split <code> tags around Fortran %
The previous split <code> approach preserved % but created a visible
gap due to border/padding on each element. Add f90l/f90r CSS classes
that strip internal borders and padding so adjacent code spans render
as one seamless pill: <code class="f90l">bc_y%</code><code class="f90r">beg</code>.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address review feedback: consolidate CMake commands, robustify generators
- Consolidate case_constraints.md and physics_constraints.md into a
single CMake custom command to avoid parallel build races
- Fall back to sorted stage names instead of "all" for unknown stages
- Append extra categories not in CATEGORY_ORDER instead of dropping them
- Print error details for failing example validations in CI
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Capture validation output once instead of re-running on failure
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix cli page ID in lint_docs to match actual @page cli-reference
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix 37 broken Fortran % accessors in docs and add lint check
Doxygen silently consumes %<word> (even inside backtick code spans),
so `bc_y%beg` renders as `bc_ybeg`. Fixed all 37 instances in
hand-written docs to use %% escape. Added check_doxygen_percent()
lint check to catch this in CI going forward.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove unnecessary __future__ imports, add _is_numeric guards, fix en dash
- Remove `from __future__ import annotations` from all 4 toolchain files
(Python 3.10+ is required)
- Add `_is_numeric()` guards in physics checks to prevent TypeError when
parameters are analytical string expressions
- Fix Unicode en dash in Alpha-Rho title
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix additional review items: docs typos, _is_numeric, CI coverage
- Fix missing %% in double-backtick code spans (patch_icpp(2)smoothen,
patch_icpp(j)alpha, etc.) and stray backslashes in case.md
- Add _is_numeric guard for num_fluids in check_eos_parameter_sanity
- Include benchmark.py files in CI example validation
- Extend Doxygen % lint to catch double-backtick spans too
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add _is_numeric guards for domain bounds in check_patch_within_domain
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix CI: quote Command forward ref for Python <3.14, revert benchmark.py validation
The `from __future__ import annotations` removal broke pylint on Python
3.10-3.13 because `List[Command]` is a forward reference within the
Command dataclass. Quoting it as `List["Command"]` fixes the issue.
The scaling benchmark.py requires CLI arguments and cannot be validated
as a standalone case file.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Refactor message deduplication to explicit loop in gen_physics_docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Wire constraint doc generation into ./mfc.sh generate
Previously case_constraints.md and physics_constraints.md were only
generated via CMake (docs/gen_constraints.sh), so the contributing.md
instruction to run ./mfc.sh generate was wrong. Now ./mfc.sh generate
produces all 7 auto-generated files, and --check mode validates them.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add 4 staleness-prevention lint checks and complete PHYSICS_DOCS coverage
New lint checks in lint_docs.py:
- check_physics_docs_coverage: flags check methods missing PHYSICS_DOCS entries
- check_identifier_refs: validates Python identifiers in contributing.md
(PHYSICS_DOCS, CONSTRAINTS, DEPENDENCIES, REGISTRY) still exist in source
- check_cli_refs: validates ./mfc.sh commands in running.md match CLI schema
- Expanded DOCS list to cover all hand-written docs for file path validation
Added PHYSICS_DOCS entries for 16 previously undocumented check methods
and added 11 mechanical/structural methods to the skip set.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove shallow PHYSICS_DOCS entries, move to skip set instead
The 16 entries I added were just restating what the code checks without
real physics content (math, references, explanations). Move them to the
lint skip set so domain experts can add proper documentation later.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/documentation/case.md
+29-29Lines changed: 29 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ To run such a case, use the following format:
65
65
For example, to run the `scaling` case in "weak-scaling" mode:
66
66
67
67
```shell
68
-
./mfc.sh run examples/scaling/case.py -t pre_process -j 8 -- --scaling weak
68
+
./mfc.sh run examples/scaling/benchmark.py -t pre_process -j 8 -- --scaling weak
69
69
```
70
70
71
71
## Parameters
@@ -281,12 +281,12 @@ For instance, in a 2D simulation, when a cylindrical `patch(2)` is immersed in a
281
281
282
282
-`smoothen` activates smoothening of the boundary of the patch that alters the existing patch.
283
283
When smoothening occurs, fluids of the two patches are mixed in the region of the boundary.
284
-
For instance, in the aforementioned case of the cylindrical patch immersed in the rectangular patch, smoothening occurs when ``patch_icpp(2)smoothen = 'T'``.
284
+
For instance, in the aforementioned case of the cylindrical patch immersed in the rectangular patch, smoothening occurs when ``patch_icpp(2)%%smoothen = 'T'``.
285
285
`smooth_coeff` controls the thickness of the region of smoothening (sharpness of the mixture region).
286
286
The default value of `smooth_coeff` is unity. The region of smoothening is thickened with decreasing the value.
287
287
Optimal choice of the value of `smooth_coeff` is case-dependent and left to the user.
288
288
289
-
-`patch_icpp(j)alpha(i)`, `patch_icpp(j)alpha_rho(i)`, `patch_icpp(j)pres`, and `patch_icpp(j)vel(i)` define for $j$-th patch the void fraction of `fluid(i)`, partial density of `fluid(i)`, the pressure, and the velocity in the $i$-th coordinate direction.
289
+
-`patch_icpp(j)%%alpha(i)`, `patch_icpp(j)%%alpha_rho(i)`, `patch_icpp(j)%%pres`, and `patch_icpp(j)%%vel(i)` define for $j$-th patch the void fraction of `fluid(i)`, partial density of `fluid(i)`, the pressure, and the velocity in the $i$-th coordinate direction.
290
290
These physical parameters must be consistent with fluid material's parameters defined in the next subsection.
291
291
292
292
-`model_filepath` defines the root directory of the STL or OBJ model file.
@@ -297,7 +297,7 @@ These physical parameters must be consistent with fluid material's parameters de
297
297
298
298
#### Elliptic Smoothing
299
299
300
-
Initial conditions in which not all patches support the `patch_icpp(j)%smoothen` parameter can still be smoothed by applying iterations of the heat equation to the initial condition.
300
+
Initial conditions in which not all patches support the `patch_icpp(j)%%smoothen` parameter can still be smoothed by applying iterations of the heat equation to the initial condition.
301
301
This is enabled by adding `'elliptic_smoothing': "T",` and `'elliptic_smoothing_iters': N,` to the case dictionary, where `N` is the number of smoothing iterations to apply.
@@ -463,10 +463,10 @@ Boundary condition patches can be used with non-characteristic boundary conditio
463
463
Their use is detailed in [Boundary Condition Patches](#boundary-condition-patches).
464
464
465
465
-`bc_[x,y,z]%%vb[1,2,3]` specifies the velocity in the (x,1), (y,2), (z,3) direction applied to `bc_[x,y,z]%%beg` when using `bc_[x,y,z]%%beg = -16`.
466
-
Tangential velocities require viscosity, `weno_avg = T`, and `bc_[x,y,z]%%beg = -16` to work properly. Normal velocities require `bc_[x,y,z]%%end = -15` or `\bc_[x,y,z]%%end = -16` to work properly.
466
+
Tangential velocities require viscosity, `weno_avg = T`, and `bc_[x,y,z]%%beg = -16` to work properly. Normal velocities require `bc_[x,y,z]%%end = -15` or `bc_[x,y,z]%%end = -16` to work properly.
467
467
468
468
-`bc_[x,y,z]%%ve[1,2,3]` specifies the velocity in the (x,1), (y,2), (z,3) direction applied to `bc_[x,y,z]%%beg` when using `bc_[x,y,z]%%end = -16`.
469
-
Tangential velocities require viscosity, `weno_avg = T`, and `bc_[x,y,z]%%end = 16` to work properly. Normal velocities require `bc_[x,y,z]%%end = -15` or `\bc_[x,y,z]%%end = -16` to work properly.
469
+
Tangential velocities require viscosity, `weno_avg = T`, and `bc_[x,y,z]%%end = 16` to work properly. Normal velocities require `bc_[x,y,z]%%end = -15` or `bc_[x,y,z]%%end = -16` to work properly.
470
470
471
471
-`model_eqns` specifies the choice of the multi-component model that is used to formulate the dynamics of the flow using integers from 1 through 3.
472
472
`model_eqns = 1`, `2`, and `3` correspond to \f$\Gamma\f$-\f$\Pi_\infty\f$ model (\cite Johnsen08), 5-equation model (\cite Allaire02), and 6-equation model (\cite Saurel09), respectively.
@@ -531,7 +531,7 @@ If this option is false, velocity gradient is computed using finite difference s
531
531
-`weno_avg` it activates the arithmetic average of the left and right, WENO-reconstructed, cell-boundary values.
532
532
This option requires `weno_Re_flux` to be true because cell boundary values are only utilized when employing the scalar divergence method in the computation of velocity gradients.
533
533
534
-
-`surface_tension` activates surface tension when set to ``'T'``. Requires `sigma` to be set and `num_fluids`. The color function in each patch should be assigned such that `patch_icpp(i)%cf_val = 1` in patches where `patch_icpp(i)%alpha = 1 - eps` and `patch_icpp(i)%cf_val = 0` in patches where `patch_icpp(i)%alpha = eps`.
534
+
-`surface_tension` activates surface tension when set to ``'T'``. Requires `sigma` to be set and `num_fluids`. The color function in each patch should be assigned such that `patch_icpp(i)%%cf_val = 1` in patches where `patch_icpp(i)%%alpha = 1 - eps` and `patch_icpp(i)%%cf_val = 0` in patches where `patch_icpp(i)%%alpha = eps`.
535
535
536
536
-`viscous` activates viscosity when set to ``'T'``. Requires `Re(1)` and `Re(2)` to be set.
537
537
@@ -620,8 +620,8 @@ To restart the simulation from $k$-th time step, see @ref running "Restarting Ca
620
620
|`num_probes`| Integer | Number of probes |
621
621
|`probe(i)%[x,y,z]`| Real | Coordinates of probe $i$ |
622
622
|`output_partial_domain`| Logical | Output part of the domain |
623
-
|`[x,y,z]_output%beg`| Real | Beginning of the output domain in the [x,y,z]-direction |
624
-
|`[x,y,z]_output%end`| Real | End of the output domain in the [x,y,z]-direction |
623
+
|`[x,y,z]_output%%beg`| Real | Beginning of the output domain in the [x,y,z]-direction |
624
+
|`[x,y,z]_output%%end`| Real | End of the output domain in the [x,y,z]-direction |
625
625
|`lag_txt_wrt`| Logical | Write Lagrangian bubble data to `.dat` files |
-`chem_params%transport_model` specifies the methodology for calculating diffusion coefficients and other transport properties, `1` for mixture-average, `2` for Unity-Lewis
1017
+
-`chem_params%%transport_model` specifies the methodology for calculating diffusion coefficients and other transport properties, `1` for mixture-average, `2` for Unity-Lewis
1018
1018
1019
1019
-`cantera_file` specifies the chemical mechanism file. If the file is part of the standard Cantera library, only the filename is required. Otherwise, the file must be located in the same directory as your `case.py` file
1020
1020
@@ -1051,15 +1051,15 @@ The entries labeled "Characteristic." are characteristic boundary conditions bas
1051
1051
1052
1052
| Parameter | Type | Description |
1053
1053
| ---: | :----: | :--- |
1054
-
|`bc_[x,y,z]%grcbc_in`| Logical | Enable grcbc for subsonic inflow |
1055
-
|`bc_[x,y,z]%grcbc_out`| Logical | Enable grcbc for subsonic outflow (pressure)|
1056
-
|`bc_[x,y,z]%grcbc_vel_out`| Logical | Enable grcbc for subsonic outflow (pressure + normal velocity) |
1057
-
|`bc_[x,y,z]%vel_in`| Real Array | Inflow velocities in x, y and z directions |
1058
-
|`bc_[x,y,z]%vel_out`| Real Array | Outflow velocities in x, y and z directions |
1059
-
|`bc_[x,y,z]%pres_in`| Real | Inflow pressure |
1060
-
|`bc_[x,y,z]%pres_out`| Real | Outflow pressure |
1061
-
|`bc_[x,y,z]%alpha_rho_in`| Real Array | Inflow density |
1062
-
|`bc_[x,y,z]%alpha_in`| Real Array | Inflow void fraction |
1054
+
|`bc_[x,y,z]%%grcbc_in`| Logical | Enable grcbc for subsonic inflow |
1055
+
|`bc_[x,y,z]%%grcbc_out`| Logical | Enable grcbc for subsonic outflow (pressure)|
1056
+
|`bc_[x,y,z]%%grcbc_vel_out`| Logical | Enable grcbc for subsonic outflow (pressure + normal velocity) |
1057
+
|`bc_[x,y,z]%%vel_in`| Real Array | Inflow velocities in x, y and z directions |
1058
+
|`bc_[x,y,z]%%vel_out`| Real Array | Outflow velocities in x, y and z directions |
1059
+
|`bc_[x,y,z]%%pres_in`| Real | Inflow pressure |
1060
+
|`bc_[x,y,z]%%pres_out`| Real | Outflow pressure |
1061
+
|`bc_[x,y,z]%%alpha_rho_in`| Real Array | Inflow density |
1062
+
|`bc_[x,y,z]%%alpha_in`| Real Array | Inflow void fraction |
1063
1063
1064
1064
This boundary condition can be used for subsonic inflow (`bc_[x,y,z]%[beg,end]` = -7) and subsonic outflow (`bc_[x,y,z]%[beg,end]` = -8) characteristic boundary conditions. These are based on \cite Pirozzoli13. This enables to provide inflow and outflow conditions outside the computational domain.
0 commit comments