Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0f4f41a
Add physics warning infrastructure and auto-documenting constraints
sbryngelson Feb 14, 2026
4f41b3f
Fix doc reference lint for auto-generated pages
sbryngelson Feb 14, 2026
f7febe8
Display physics warnings in ./mfc.sh validate output
sbryngelson Feb 14, 2026
2e10911
Validate all example cases in CI and clean up non-standard case files
sbryngelson Feb 14, 2026
8d781a0
Auto-generate physics_constraints.md from PHYSICS_DOCS metadata
sbryngelson Feb 14, 2026
227baa4
Fix physics docs rendering: \implies → \Rightarrow, backtick code params
sbryngelson Feb 14, 2026
3253e35
Show all enforced checks without truncation in physics docs
sbryngelson Feb 14, 2026
95310bb
Add parameter column to undocumented checks table in physics docs
sbryngelson Feb 14, 2026
978f922
Remove undocumented checks section from physics constraints page
sbryngelson Feb 14, 2026
55dcb47
Fix Fortran % accessor and AST artifacts in physics docs formatting
sbryngelson Feb 14, 2026
101f9fb
Fix Doxygen % consumption with split <code> tag workaround
sbryngelson Feb 14, 2026
7f64cd5
Use CSS classes for seamless split <code> tags around Fortran %
sbryngelson Feb 14, 2026
64721b1
Address review feedback: consolidate CMake commands, robustify genera…
sbryngelson Feb 14, 2026
e821ca7
Capture validation output once instead of re-running on failure
sbryngelson Feb 14, 2026
91bdde2
Fix cli page ID in lint_docs to match actual @page cli-reference
sbryngelson Feb 14, 2026
3dd275f
Fix 37 broken Fortran % accessors in docs and add lint check
sbryngelson Feb 14, 2026
c2b616d
Remove unnecessary __future__ imports, add _is_numeric guards, fix en…
sbryngelson Feb 14, 2026
f89ab2e
Fix additional review items: docs typos, _is_numeric, CI coverage
sbryngelson Feb 14, 2026
15a4a9a
Add _is_numeric guards for domain bounds in check_patch_within_domain
sbryngelson Feb 14, 2026
67fb5eb
Fix CI: quote Command forward ref for Python <3.14, revert benchmark.…
sbryngelson Feb 14, 2026
ddf10e4
Refactor message deduplication to explicit loop in gen_physics_docs
sbryngelson Feb 14, 2026
2f95da3
Wire constraint doc generation into ./mfc.sh generate
sbryngelson Feb 14, 2026
4ca85e0
Add 4 staleness-prevention lint checks and complete PHYSICS_DOCS cove…
sbryngelson Feb 15, 2026
200f937
Remove shallow PHYSICS_DOCS entries, move to skip set instead
sbryngelson Feb 15, 2026
6ca7345
Merge branch 'master' into physics
sbryngelson Feb 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/lint-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,20 @@ jobs:

- name: Validate example cases
run: |
./mfc.sh validate examples/1D_sodshocktube/case.py
./mfc.sh validate examples/2D_shockbubble/case.py
failed=0
passed=0
for case in examples/*/case.py; do
output=$(./mfc.sh validate "$case" 2>&1)
if [ $? -eq 0 ]; then
passed=$((passed + 1))
else
echo "FAIL: $case"
echo "$output"
failed=$((failed + 1))
fi
done
echo ""
echo "Results: $passed passed, $failed failed"
if [ "$failed" -ne 0 ]; then
exit 1
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ docs/*/result*
docs/documentation/*-example.png
docs/documentation/examples.md
docs/documentation/case_constraints.md
docs/documentation/physics_constraints.md

examples/*batch/*/
examples/**/D/*
Expand Down
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -660,16 +660,19 @@ if (MFC_DOCUMENTATION)
VERBATIM
)

# Generate case_constraints.md from case_validator.py and examples/
# Generate case_constraints.md and physics_constraints.md together.
# Both are produced by gen_constraints.sh, so a single command avoids races.
add_custom_command(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/case_constraints.md"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/physics_constraints.md"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/gen_case_constraints_docs.py"
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/gen_physics_docs.py"
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/case_validator.py"
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/params/definitions.py"
"${examples_DOCs}"
COMMAND "bash" "${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_constraints.sh"
"${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Generating case_constraints.md"
COMMENT "Generating case_constraints.md and physics_constraints.md"
VERBATIM
)

Expand Down Expand Up @@ -732,11 +735,13 @@ if (MFC_DOCUMENTATION)

set(opt_example_dependency "")
set(opt_constraints_dependency "")
set(opt_physics_dependency "")
set(opt_cli_reference_dependency "")
set(opt_parameters_dependency "")
if (${target} STREQUAL documentation)
set(opt_example_dependency "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/examples.md")
set(opt_constraints_dependency "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/case_constraints.md")
set(opt_physics_dependency "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/physics_constraints.md")
set(opt_cli_reference_dependency "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/cli-reference.md")
set(opt_parameters_dependency "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/parameters.md")
endif()
Expand All @@ -749,6 +754,7 @@ if (MFC_DOCUMENTATION)
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target}-Doxyfile"
"${opt_example_dependency}"
"${opt_constraints_dependency}"
"${opt_physics_dependency}"
"${opt_cli_reference_dependency}"
"${opt_parameters_dependency}"
"${${target}_SRCs}" "${${target}_DOCs}"
Expand Down
16 changes: 16 additions & 0 deletions docs/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
* Overrides for doxygen-awesome theme
*/

/* Seamless split <code> tags for Fortran % struct accessors.
* Doxygen consumes %<word> even inside code spans, so we split around %
* into adjacent <code> elements and remove internal borders/padding. */
code.f90l {
border-right: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
padding-right: 0;
}
code.f90r {
border-left: 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
padding-left: 0;
}

/* Fix inline code visibility in colored admonition blocks (warning, attention, important, note, etc.) */

/* Warning/Attention/Important blocks (red/pink background) */
Expand Down
2 changes: 1 addition & 1 deletion docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To run such a case, use the following format:
For example, to run the `scaling` case in "weak-scaling" mode:

```shell
./mfc.sh run examples/scaling/case.py -t pre_process -j 8 -- --scaling weak
./mfc.sh run examples/scaling/benchmark.py -t pre_process -j 8 -- --scaling weak
```

## Parameters
Expand Down
37 changes: 37 additions & 0 deletions docs/documentation/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ def check_my_feature(self):
self.errors.append("my_param requires other_param to be set")
```

If your check enforces a physics constraint, also add a `PHYSICS_DOCS` entry (see [How to Document Physics Constraints](#how-to-document-physics-constraints) below).

**Step 5: Declare in Fortran** (`src/<target>/m_global_parameters.fpp`)

Add the variable declaration in the appropriate target's global parameters module. Choose the target(s) where the parameter is used:
Expand Down Expand Up @@ -659,6 +661,41 @@ Checklist:

See @ref troubleshooting for debugging workflows, profiling tools, GPU diagnostic environment variables, common build/runtime errors, and fixes.

### How to Document Physics Constraints {#how-to-document-physics-constraints}

When adding a new `check_` method to `case_validator.py`, document its physics by adding an entry to the `PHYSICS_DOCS` dict at the top of the file:

```python
PHYSICS_DOCS = {
...
"check_my_feature": {
"title": "My Feature Constraint", # Required: human-readable title
"category": "Thermodynamic Constraints", # Required: groups the constraint in docs
"explanation": "Why this constraint exists.", # Required: plain English
"math": r"\alpha > 0", # Optional: LaTeX formula
"references": ["Wilfong26"], # Optional: BibTeX keys from references.bib
"exceptions": ["IBM cases"], # Optional: when constraint doesn't apply
},
}
```

The @ref physics_constraints "Physics Constraints" page is **auto-generated** — run `./mfc.sh generate` to rebuild it.
The generator merges your `PHYSICS_DOCS` entry with the AST-extracted `prohibit()`/`warn()` calls,
so stage, severity, and parameter information appear automatically.

**Fields:**

| Field | Required | Description |
|-------|----------|-------------|
| `title` | Yes | Section heading in generated docs |
| `category` | Yes | Grouping category (e.g., "Mixture Constraints") |
| `explanation` | Yes | Plain English description of the physics |
| `math` | No | LaTeX formula (rendered by Doxygen's MathJax) |
| `references` | No | List of BibTeX cite keys from `docs/references.bib` |
| `exceptions` | No | List of cases where the constraint doesn't apply |

**Categories:** Thermodynamic Constraints, Mixture Constraints, Domain and Geometry, Velocity and Dimensional Consistency, Model Equations, Boundary Conditions, Bubble Physics, Feature Compatibility, Numerical Schemes, Acoustic Sources, Post-Processing.

## Testing

MFC has 500+ regression tests. See @ref testing for the full guide.
Expand Down
1 change: 1 addition & 0 deletions docs/documentation/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Welcome to the Multi-component Flow Code (MFC) documentation.
- @ref parameters "Case Parameters" - All ~3,400 parameters
- @ref cli-reference "CLI Reference" - Command line options
- @ref case_constraints "Case Creator Guide" - Feature compatibility
- @ref physics_constraints "Physics Constraints" - Mathematical basis for validation rules

## Examples & Visualization

Expand Down
3 changes: 2 additions & 1 deletion docs/gen_constraints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ echo "Generating case constraints documentation..."
python3 "$REPO_ROOT/toolchain/mfc/gen_case_constraints_docs.py" > "$REPO_ROOT/docs/documentation/case_constraints.md"
echo "✓ Generated docs/documentation/case_constraints.md"


python3 "$REPO_ROOT/toolchain/mfc/gen_physics_docs.py" > "$REPO_ROOT/docs/documentation/physics_constraints.md"
echo "✓ Generated docs/documentation/physics_constraints.md"
1 change: 1 addition & 0 deletions examples/2D_bubbly_steady_shock/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"fluid_pp(1)%pi_inf": gam_l * (pi_inf_l) / (gam_l - 1.0),
# Bubbles
"bubbles_euler": "T",
"nb": nb,
"bubble_model": 2,
"polytropic": "T",
"polydisperse": "F",
Expand Down
Loading
Loading