Skip to content

Commit ec9bfb9

Browse files
sbryngelsonclaude
andcommitted
Surface dimensional handling docs and reorganize Section 1b
Reorganize equations.md Section 1b into three logical groups: - General Users (dimensions in = dimensions out, stored forms, materials) - Bubble Users (non-dimensional framework, reference scales, parameters) - Worked Examples Add stored-form parameter callout to case.md Section 5 (Fluid Materials) so users see the gamma/pi_inf/Re transforms at point of use. Add "Units and Dimensions" section to getting-started.md for new users. Update doc linter to collect {#id} anchors for cross-file @ref validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4c007ff commit ec9bfb9

4 files changed

Lines changed: 42 additions & 11 deletions

File tree

docs/documentation/case.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,14 @@ Details of implementation of viscosity in MFC can be found in \cite Coralic15.
387387

388388
- `fluid_pp(i)%%G` is required for `hypoelasticity`.
389389

390+
> **Stored-form parameters:** The values `gamma`, `pi_inf`, and `Re(1)`/`Re(2)` are **not** the raw physical quantities. MFC expects transformed stored forms:
391+
> - `gamma` = \f$1/(\gamma-1)\f$, not \f$\gamma\f$ itself
392+
> - `pi_inf` = \f$\gamma\,\pi_\infty / (\gamma - 1)\f$, not \f$\pi_\infty\f$ itself
393+
> - `Re(1)` = \f$1/\mu\f$ (inverse viscosity), not \f$\mu\f$ itself
394+
>
395+
> Setting `gamma = 1.4` for air is a common mistake; the correct value is `1.0 / (1.4 - 1.0) = 2.5`.
396+
> See @ref sec-stored-forms and @ref sec-material-values in the Equations reference for the full table.
397+
390398
### 6. Simulation Algorithm {#sec-simulation-algorithm}
391399

392400
See @ref equations "Equations" for the mathematical models these parameters control.

docs/documentation/equations.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ The parameter `model_eqns` (1, 2, 3, or 4) selects the governing equation set.
2929

3030
---
3131

32-
## 1b. Units, Dimensions, and Non-Dimensionalization
32+
## 1b. Units, Dimensions, and Non-Dimensionalization {#sec-units-dimensions}
3333

34-
### Dimensional Handling in the Flow Solver
34+
### General Users: Dimensional Handling {#sec-dimensional-handling}
35+
36+
#### Dimensions In = Dimensions Out {#sec-dimensions-in-out}
3537

3638
The main flow solver (Navier-Stokes equations, Riemann solvers, viscous stress, body forces, surface tension, etc.) is **unit-agnostic**: whatever units the user provides for the initial and boundary conditions, the solver preserves them throughout the computation. If the user inputs SI units, the outputs are in SI units. If the user inputs CGS, the outputs are in CGS. No internal non-dimensionalization is performed by the flow solver.
3739

3840
This means that for simulations **without** sub-grid bubble models, the user can work in any consistent unit system without additional effort.
3941

40-
### Stored Parameter Conventions
42+
#### Stored Parameter Conventions {#sec-stored-forms}
4143

4244
Several EOS and transport parameters use **transformed stored forms** that differ from the standard physical values. This is the most common source of input errors:
4345

@@ -52,7 +54,7 @@ These transformations arise because MFC internally solves the energy equation us
5254

5355
**Common mistake:** setting `fluid_pp(1)%%gamma = 1.4` for air. The correct value is `1.0 / (1.4 - 1.0) = 2.5`. Setting `gamma = 1.4` corresponds to a physical \f$\gamma \approx 1.71\f$, which is not a standard gas.
5456

55-
### Common Material Values
57+
#### Common Material Values {#sec-material-values}
5658

5759
Pre-computed stored-form values for common fluids (SI units):
5860

@@ -85,11 +87,13 @@ mu = 1.002e-3 # water viscosity [Pa·s]
8587
"fluid_pp(1)%Re(1)": 1.0 / mu, # ≈ 998
8688
```
8789

88-
### Unit Consistency
90+
#### Unit Consistency {#sec-unit-consistency}
8991

9092
The solver does not check or convert units. All inputs must use the **same consistent unit system** (e.g., all SI or all CGS). Mixing units — for example, pressures in atmospheres with densities in kg/m³ — will produce silently incorrect results.
9193

92-
### Non-Dimensional Bubble Dynamics
94+
### Bubble Users: Non-Dimensional Framework {#sec-bubble-nondim}
95+
96+
#### Non-Dimensional Bubble Dynamics {#sec-nondim-bubble-dynamics}
9397

9498
The sub-grid bubble models (`bubbles_euler = .true.` or `bubbles_lagrange = .true.`) solve the bubble wall dynamics in **non-dimensional form**. The bubble wall pressure equation as implemented is:
9599

@@ -108,7 +112,7 @@ The dimensionless groups are:
108112

109113
Because the bubble equations use these dimensionless numbers directly, all `bub_pp%%` inputs are interpreted by the code as **already non-dimensional**. The code does **not** non-dimensionalize bubble quantities internally. Therefore, when bubbles are enabled, the simulation must be run in a **fully non-dimensional** form: **all** inputs — flow ICs/BCs, EOS parameters, domain lengths, `dt`, and `bub_pp%%` values — must be scaled with the same \f$(x_0, p_0, \rho_0, u_0, t_0, T_0)\f$ reference quantities, or the coupled solution will be physically incorrect.
110114

111-
### Reference Scales
115+
#### Reference Scales {#sec-reference-scales}
112116

113117
When using bubble models, the user must choose reference scales and non-dimensionalize **all** inputs (flow and bubble) consistently. The standard convention used in the MFC examples is:
114118

@@ -121,7 +125,7 @@ When using bubble models, the user must choose reference scales and non-dimensio
121125
| Time | \f$t_0\f$ | \f$x_0 / u_0\f$ (derived) |
122126
| Temperature | \f$T_0\f$ | \f$T_{0,\text{ref}}\f$ (reference temperature) |
123127

124-
### Non-Dimensionalization of Input Parameters
128+
#### Non-Dimensionalization of Input Parameters {#sec-nondim-inputs}
125129

126130
The following table lists every `bub_pp%%` parameter and its required non-dimensionalization:
127131

@@ -150,7 +154,7 @@ The following table lists every `bub_pp%%` parameter and its required non-dimens
150154

151155
When the reference scales match the bubble reference values (e.g., \f$x_0 = R_{0,\text{ref}}\f$, \f$p_0 = p_{0,\text{ref}}\f$, \f$\rho_0 = \rho_{0,\text{ref}}\f$), the reference parameters simplify to unity: `bub_pp%%R0ref = 1`, `bub_pp%%p0ref = 1`, `bub_pp%%rho0ref = 1`.
152156

153-
### Flow Parameters with Bubbles
157+
#### Flow Parameters with Bubbles {#sec-flow-params-bubbles}
154158

155159
When bubbles are enabled, the flow-level parameters must also be non-dimensionalized with the same reference scales:
156160

@@ -165,7 +169,7 @@ When bubbles are enabled, the flow-level parameters must also be non-dimensional
165169
| `fluid_pp(i)%%Re(1)` | \f$\rho_0\,x_0\,u_0 / \mu_i\f$ (Reynolds number, inverse viscosity) |
166170
| `dt` | Time step divided by \f$t_0\f$ |
167171

168-
### Two Different Viscosity Parameters
172+
#### Two Different Viscosity Parameters {#sec-two-viscosities}
169173

170174
MFC has two conceptually distinct viscosity-related parameters that serve different physical roles:
171175

@@ -179,7 +183,9 @@ MFC has two conceptually distinct viscosity-related parameters that serve differ
179183

180184
These two parameters represent viscous effects at fundamentally different scales — bulk flow dissipation vs. single-bubble-wall damping — and are stored in separate derived types with separate code paths. They are **not** interchangeable: `fluid_pp%%Re(1)` is an inverse viscosity while `bub_pp%%mu_l` is a viscosity (non-dimensionalized).
181185

182-
### Example: Non-Dimensionalizing a Bubble Case
186+
### Worked Examples {#sec-nondim-example}
187+
188+
#### Example: Non-Dimensionalizing a Bubble Case {#sec-bubble-example}
183189

184190
A typical bubble case setup in `case.py` follows this pattern:
185191

docs/documentation/getting-started.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ MFC has example cases in the `examples` folder. You can run such a case interact
198198

199199
Please refer to the @ref running "Running" document for more information on `case.py` files and how to run them.
200200

201+
## Units and Dimensions
202+
203+
MFC is **unit-agnostic**: the solver performs no internal unit conversions. Whatever units you provide for initial conditions, boundary conditions, and material properties, the same units appear in the output.
204+
205+
The only requirement is **consistency** — all inputs must use the same unit system. Note that some parameters use **transformed stored forms** rather than standard physical values (e.g., `gamma` expects \f$1/(\gamma-1)\f$, not \f$\gamma\f$ itself). See @ref sec-stored-forms for details.
206+
201207
## Helpful Tools
202208

203209
### Parameter Lookup

toolchain/mfc/lint_docs.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,17 @@ def check_page_refs(repo_root: Path) -> list[str]:
377377
if m:
378378
page_ids.add(m.group(1))
379379

380+
# Also collect {#id} anchors (valid @ref targets across files)
381+
for md_file in doc_dir.glob("*.md"):
382+
text = md_file.read_text(encoding="utf-8")
383+
in_code = False
384+
for line in text.split("\n"):
385+
if line.strip().startswith("```"):
386+
in_code = not in_code
387+
continue
388+
if not in_code:
389+
page_ids.update(re.findall(r"\{#([\w-]+)\}", line))
390+
380391
errors = []
381392
for md_file in sorted(doc_dir.glob("*.md")):
382393
text = _strip_code_blocks(md_file.read_text(encoding="utf-8"))

0 commit comments

Comments
 (0)