Skip to content

Commit 06089bd

Browse files
authored
Merge branch 'master' into github-containers
2 parents dfe1d05 + febffab commit 06089bd

12 files changed

Lines changed: 419 additions & 95 deletions

File tree

.github/workflows/test.yml

Lines changed: 67 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened, ready_for_review]
88
workflow_dispatch:
9+
schedule:
10+
- cron: '0 6 * * 1' # Weekly Monday 6 AM UTC: refresh coverage cache before 7-day expiry
911

1012
concurrency:
1113
# PRs: group by branch (new push cancels old). Push to master: unique per SHA (never cancelled).
@@ -39,21 +41,15 @@ jobs:
3941
- name: Lint Toolchain
4042
run: ./mfc.sh lint
4143

42-
- name: Lint Source - No Raw Directives
43-
run: |
44-
! grep -iR '!\$acc\|!\$omp' --exclude="parallel_macros.fpp" --exclude="acc_macros.fpp" --exclude="omp_macros.fpp" --exclude="shared_parallel_macros.fpp" --exclude="syscheck.fpp" ./src/*
45-
46-
- name: Lint Source - No Double Precision Intrinsics
47-
run: |
48-
! grep -iR 'double_precision\|dsqrt\|dexp\|dlog\|dble\|dabs\|double\ precision\|real(8)\|real(4)\|dprod\|dmin\|dmax\|dfloat\|dreal\|dcos\|dsin\|dtan\|dsign\|dtanh\|dsinh\|dcosh\|d0' --exclude-dir=syscheck --exclude="*nvtx*" --exclude="*precision_select*" ./src/*
49-
50-
- name: Lint Source - No Junk Code
51-
run: |
52-
! grep -iR -e '\.\.\.' -e '\-\-\-' -e '===' ./src/*
44+
- name: Lint Source
45+
run: python3 toolchain/mfc/lint_source.py
5346

5447
- name: Lint Docs
5548
run: python3 toolchain/mfc/lint_docs.py
5649

50+
- name: Lint Parameter Docs
51+
run: python3 toolchain/mfc/lint_param_docs.py
52+
5753
file-changes:
5854
name: Detect File Changes
5955
runs-on: 'ubuntu-latest'
@@ -117,14 +113,13 @@ jobs:
117113
(github.event_name == 'push' &&
118114
(needs.file-changes.outputs.cases_py == 'true' ||
119115
needs.file-changes.outputs.dep_changed == 'true')) ||
120-
github.event_name == 'workflow_dispatch'
116+
github.event_name == 'workflow_dispatch' ||
117+
github.event_name == 'schedule'
121118
)
122119
timeout-minutes: 240
123120
runs-on:
124121
group: phoenix
125122
labels: gt
126-
permissions:
127-
contents: write # Required for Commit Cache to Master on push events
128123
steps:
129124
- name: Clone
130125
uses: actions/checkout@v4
@@ -140,36 +135,18 @@ jobs:
140135
run: cat rebuild-cache-cpu-none.out
141136

142137
- name: Upload Cache Artifact
143-
if: github.event_name == 'pull_request'
144138
uses: actions/upload-artifact@v4
145139
with:
146140
name: coverage-cache
147141
path: toolchain/mfc/test/test_coverage_cache.json.gz
148142
retention-days: 1
149143

150-
- name: Commit Cache to Master
151-
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master'
152-
env:
153-
CACHE_PUSH_TOKEN: ${{ secrets.CACHE_PUSH_TOKEN }}
154-
run: |
155-
git config user.name "github-actions[bot]"
156-
git config user.email "github-actions[bot]@users.noreply.github.com"
157-
git add toolchain/mfc/test/test_coverage_cache.json.gz
158-
if git diff --cached --quiet; then
159-
echo "Coverage cache unchanged."
160-
else
161-
git commit --no-verify -m "Regenerate gcov coverage cache [skip ci]"
162-
# Rebase onto latest master in case it advanced during the build
163-
# (which can take 20-240 minutes). Only test_coverage_cache.json.gz
164-
# is changed, so rebase conflicts are essentially impossible.
165-
git fetch origin master
166-
git rebase origin/master || { git rebase --abort; echo "Rebase conflict — cache will be regenerated on the next trigger."; exit 0; }
167-
# Push using admin token to bypass branch protection rulesets.
168-
# The default GITHUB_TOKEN lacks the Repository Admin role needed
169-
# to push directly to master. Use credential helper to avoid
170-
# leaking the token in git error messages.
171-
git -c "http.https://github.com/.extraheader=Authorization: basic $(echo -n "x-access-token:${CACHE_PUSH_TOKEN}" | base64)" push origin HEAD:refs/heads/master
172-
fi
144+
- name: Save Coverage Cache
145+
uses: actions/cache/save@v4
146+
with:
147+
path: toolchain/mfc/test/test_coverage_cache.json.gz
148+
key: coverage-cache-${{ github.event.pull_request.number || 'master' }}-${{ hashFiles('toolchain/mfc/test/cases.py') }}-${{ github.sha }}
149+
continue-on-error: true
173150

174151
github:
175152
name: Github
@@ -212,13 +189,38 @@ jobs:
212189
git fetch --deepen=200
213190
continue-on-error: true
214191

215-
- name: Download Coverage Cache
192+
- name: Download Coverage Cache (from rebuild in this run)
193+
id: cache-artifact
216194
uses: actions/download-artifact@v4
217195
with:
218196
name: coverage-cache
219197
path: toolchain/mfc/test
220198
continue-on-error: true
221199

200+
- name: Restore Coverage Cache (from previous run)
201+
if: steps.cache-artifact.outcome != 'success'
202+
id: cache-restore
203+
uses: actions/cache/restore@v4
204+
with:
205+
path: toolchain/mfc/test/test_coverage_cache.json.gz
206+
key: coverage-cache-${{ github.event.pull_request.number || 'master' }}-${{ hashFiles('toolchain/mfc/test/cases.py') }}-${{ github.sha }}
207+
restore-keys: |
208+
coverage-cache-${{ github.event.pull_request.number || 'master' }}-
209+
coverage-cache-master-
210+
continue-on-error: true
211+
212+
- name: Coverage Cache Status
213+
run: |
214+
if [ "${{ steps.cache-artifact.outcome }}" = "success" ]; then
215+
echo "Coverage cache: loaded from rebuild artifact (this run)"
216+
elif [ "${{ steps.cache-restore.outputs.cache-hit }}" = "true" ]; then
217+
echo "Coverage cache: restored from actions/cache (previous run)"
218+
elif [ -f toolchain/mfc/test/test_coverage_cache.json.gz ]; then
219+
echo "Coverage cache: using committed fallback in repo"
220+
else
221+
echo "Coverage cache: none available — full test suite will run"
222+
fi
223+
222224
- name: Setup MacOS
223225
if: matrix.os == 'macos'
224226
run: |
@@ -366,13 +368,38 @@ jobs:
366368
- name: Clean stale output files
367369
run: rm -f *.out
368370

369-
- name: Download Coverage Cache
371+
- name: Download Coverage Cache (from rebuild in this run)
372+
id: cache-artifact
370373
uses: actions/download-artifact@v4
371374
with:
372375
name: coverage-cache
373376
path: toolchain/mfc/test
374377
continue-on-error: true
375378

379+
- name: Restore Coverage Cache (from previous run)
380+
if: steps.cache-artifact.outcome != 'success'
381+
id: cache-restore
382+
uses: actions/cache/restore@v4
383+
with:
384+
path: toolchain/mfc/test/test_coverage_cache.json.gz
385+
key: coverage-cache-${{ github.event.pull_request.number || 'master' }}-${{ hashFiles('toolchain/mfc/test/cases.py') }}-${{ github.sha }}
386+
restore-keys: |
387+
coverage-cache-${{ github.event.pull_request.number || 'master' }}-
388+
coverage-cache-master-
389+
continue-on-error: true
390+
391+
- name: Coverage Cache Status
392+
run: |
393+
if [ "${{ steps.cache-artifact.outcome }}" = "success" ]; then
394+
echo "Coverage cache: loaded from rebuild artifact (this run)"
395+
elif [ "${{ steps.cache-restore.outputs.cache-hit }}" = "true" ]; then
396+
echo "Coverage cache: restored from actions/cache (previous run)"
397+
elif [ -f toolchain/mfc/test/test_coverage_cache.json.gz ]; then
398+
echo "Coverage cache: using committed fallback in repo"
399+
else
400+
echo "Coverage cache: none available — full test suite will run"
401+
fi
402+
376403
- name: Build (login node)
377404
if: matrix.cluster != 'phoenix'
378405
timeout-minutes: 60

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ IMPORTANT: Follow this loop for ALL code changes. Do not skip steps.
9999
2. **Plan** — For multi-file changes, outline your approach before implementing.
100100
3. **Implement** — Make small, focused changes. One logical change per commit.
101101
4. **Format** — Run `./mfc.sh format -j 8` to auto-format.
102-
5. **Verify** — Run `./mfc.sh precheck -j 8` (same 5 checks as CI lint gate).
102+
5. **Verify** — Run `./mfc.sh precheck -j 8` (same 6 checks as CI lint gate).
103103
6. **Build** — Run `./mfc.sh build -j 8` to verify compilation.
104104
7. **Test** — Run relevant tests: `./mfc.sh test --only <feature> -j 8`.
105105
For changes to `src/common/`, test ALL three targets: `./mfc.sh test -j 8`.

docs/documentation/case.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ Definition of the parameters is described in the following subsections.
104104
| ---: | :----: | :--- |
105105
| `run_time_info` | Logical | Output run-time information |
106106
| `rdma_mpi` | Logical | (GPUs) Enable RDMA for MPI communication. |
107+
| `case_dir` | String | Case directory path |
108+
| `old_grid` | Logical | Use grid from previous simulation |
109+
| `old_ic` | Logical | Use initial conditions from previous simulation |
110+
| `t_step_old` | Integer | Time step to restart from |
111+
| `n_start_old` | Integer | Starting index from previous simulation |
107112

108113
- `run_time_info` generates a text file that includes run-time information including the CFL number(s) at each time-step.
109114
- `rdma_mpi` optimizes data transfers between GPUs using Remote Direct Memory Access (RDMA).
@@ -124,6 +129,8 @@ feature, detecting GPU pointers and performing RDMA accordingly.
124129
| `m` | Integer | Number of grid cells in the $x$-coordinate direction |
125130
| `n` | Integer | Number of grid cells in the $y$-coordinate direction |
126131
| `p` | Integer | Number of grid cells in the $z$-coordinate direction |
132+
| `pref` | Real | Reference pressure |
133+
| `rhoref` | Real | Reference density |
127134

128135
The parameters define the boundaries of the spatial and temporal domains, and their discretization that are used in simulation.
129136

@@ -304,6 +311,7 @@ This is enabled by adding ``'elliptic_smoothing': "T",`` and ``'elliptic_smoothi
304311

305312
| Parameter | Type | Description |
306313
| ---: | :----: | :--- |
314+
| `num_ibs` | Integer | Number of immersed boundary patches |
307315
| `geometry` | Integer | Geometry configuration of the patch.|
308316
| `x[y,z]_centroid` | Real | Centroid of the applied geometry in the [x,y,z]-direction. |
309317
| `length_x[y,z]` | Real | Length, if applicable, in the [x,y,z]-direction. |
@@ -425,6 +433,7 @@ See @ref equations "Equations" for the mathematical models these parameters cont
425433
| `mp_weno` | Logical | Monotonicity preserving WENO |
426434
| `muscl_order` | Integer | MUSCL order [1,2] |
427435
| `muscl_lim` | Integer | MUSCL Slope Limiter: [1] minmod; [2] monotonized central; [3] Van Albada; [4] Van Leer; [5] SUPERBEE |
436+
| `flux_lim` | Integer | Flux limiter for post-process: [1] minmod; [2] MUSCL; [3] OSPRE; [4] SUPERBEE |
428437
| `int_comp` | Logical | THINC Interface Compression |
429438
| `ic_eps` | Real | Interface compression threshold (default: 1e-4) |
430439
| `ic_beta` | Real | Interface compression sharpness parameter (default: 1.6) |
@@ -441,13 +450,15 @@ See @ref equations "Equations" for the mathematical models these parameters cont
441450
| `t_step_print` | Integer | Frequency to print the current step number to standard output (default 1) |
442451
| `cfl_adap_dt` | Logical | CFL based adaptive time-stepping |
443452
| `cfl_const_dt` | Logical | CFL based non-adaptive time-stepping |
453+
| `cfl_dt` | Logical | Enable CFL-based time stepping |
444454
| `cfl_target` | Real | Specified CFL value |
445455
| `n_start` | Integer | Save file from which to start simulation |
446456
| `t_save` | Real | Time duration between data output |
447457
| `t_stop` | Real | Simulation stop time |
448458
| `surface_tension` | Logical | Activate surface tension |
449459
| `viscous` | Logical | Activate viscosity |
450460
| `hypoelasticity` | Logical | Activate hypoelasticity* |
461+
| `pre_stress` | Logical | Enable pre-stress initialization for hypoelasticity |
451462
| `igr` | Logical | Enable solution via information geometric regularization (IGR) \cite Cao24 |
452463
| `igr_order` | Integer | Order of reconstruction for IGR [3,5] |
453464
| `alf_factor` | Real | Alpha factor for IGR entropic pressure (default 10) |
@@ -623,6 +634,13 @@ To restart the simulation from $k$-th time step, see @ref running "Restarting Ca
623634
| `schlieren_wrt` | Logical | Add the numerical schlieren to the database|
624635
| `qm_wrt` | Logical | Add the Q-criterion to the database|
625636
| `liutex_wrt` | Logical | Add the Liutex to the database|
637+
| `cf_wrt` | Logical | Write color function field |
638+
| `chem_wrt_T` | Logical | Write temperature field for chemistry output |
639+
| `fft_wrt` | Logical | Enable FFT output |
640+
| `sim_data` | Logical | Write interface and energy data files (post_process) |
641+
| `integral_wrt` | Logical | Write integral data |
642+
| `num_integrals` | Integer | Number of integral regions |
643+
| `down_sample` | Logical | Enable output downsampling |
626644
| `fd_order` | Integer | Order of finite differences for computing the vorticity and the numerical Schlieren function [1,2,4] |
627645
| `schlieren_alpha(i)` | Real | Intensity of the numerical Schlieren computed via `alpha(i)` |
628646
| `probe_wrt` | Logical | Write the flow chosen probes data files for each time step |
@@ -771,6 +789,12 @@ Details of the transducer acoustic source model can be found in \cite Maeda17.
771789
| `bubbles_euler` | Logical | Ensemble-averaged bubble modeling |
772790
| `bubbles_lagrange` | Logical | Volume-averaged bubble modeling |
773791
| `bubble_model` | Integer | [1] Gilmore; [2] Keller--Miksis; [3] Rayleigh-Plesset |
792+
| `Ca` | Real | Cavitation number |
793+
| `Web` | Real | Weber number |
794+
| `Re_inv` | Real | Inverse Reynolds number |
795+
| `pref` | Real | Reference pressure for bubble models |
796+
| `rhoref` | Real | Reference density for bubble models |
797+
| `fluid_rho` | Real | Reference fluid density |
774798
| `bub_pp%%R0ref`*†‡ | Real | Reference bubble radius |
775799
| `bub_pp%%p0ref`*†‡ | Real | Reference pressure |
776800
| `bub_pp%%rho0ref`*†‡| Real | Reference density |
@@ -893,6 +917,9 @@ When ``polytropic = 'F'``, the gas compression is modeled as non-polytropic due
893917
| `mixlayer_vel_profile` | Logical | Set the mean streamwise velocity to hyperbolic tangent profile |
894918
| `mixlayer_vel_coef` | Real | Coefficient for the hyperbolic tangent profile of a mixing layer |
895919
| `mixlayer_perturb` | Logical | Perturb the initial velocity field using a spectrum-based synthetic turbulence generation method |
920+
| `mixlayer_perturb_k0` | Real | Base wavenumber for mixing layer perturbation |
921+
| `mixlayer_perturb_nk` | Integer | Number of perturbation modes for mixing layer |
922+
| `simplex_perturb` | Logical | Enable simplex noise perturbation of initial conditions |
896923

897924
The table lists velocity field parameters.
898925
The parameters are optionally used to define initial velocity profiles and perturbations.
@@ -1030,6 +1057,16 @@ When ``cyl_coord = 'T'`` is set in 2D the following constraints must be met:
10301057
- `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
10311058

10321059

1060+
### 18. GPU Performance (NVIDIA UVM)
1061+
1062+
| Parameter | Type | Description |
1063+
| ---: | :---: | :--- |
1064+
| `nv_uvm_out_of_core` | Logical | Enable NVIDIA Unified Virtual Memory out-of-core execution |
1065+
| `nv_uvm_pref_gpu` | Logical | Prefer GPU placement for NVIDIA UVM allocations |
1066+
| `nv_uvm_igr_temps_on_gpu` | Integer | Store IGR temporaries on GPU with UVM |
1067+
1068+
- These parameters are for NVIDIA Grace-Hopper and similar architectures with hardware-managed unified memory. They allow MFC to run problems larger than GPU memory by paging data between host and device.
1069+
10331070
## Enumerations
10341071

10351072
### Boundary conditions {#boundary-conditions}

toolchain/bootstrap/precheck.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,21 @@ if ! python3 toolchain/mfc/lint_docs.py > /dev/null 2>&1; then
117117
DOC_FAILED=1
118118
fi
119119

120+
# Parameter documentation check
121+
(
122+
if python3 toolchain/mfc/lint_param_docs.py > /dev/null 2>&1; then
123+
echo "0" > "$TMPDIR_PC/param_docs_exit"
124+
else
125+
echo "1" > "$TMPDIR_PC/param_docs_exit"
126+
fi
127+
) &
128+
PID_PARAM_DOCS=$!
129+
120130
# --- Collect results ---
121131

122132
FAILED=0
123133

124-
log "[$CYAN 1/5$COLOR_RESET] Checking$MAGENTA formatting$COLOR_RESET..."
134+
log "[$CYAN 1/6$COLOR_RESET] Checking$MAGENTA formatting$COLOR_RESET..."
125135
if [ "$FORMAT_OK" = "1" ]; then
126136
error "Formatting check failed to run."
127137
FAILED=1
@@ -136,7 +146,7 @@ else
136146
fi
137147

138148
wait $PID_SPELL
139-
log "[$CYAN 2/5$COLOR_RESET] Running$MAGENTA spell check$COLOR_RESET..."
149+
log "[$CYAN 2/6$COLOR_RESET] Running$MAGENTA spell check$COLOR_RESET..."
140150
SPELL_RC=$(cat "$TMPDIR_PC/spell_exit" 2>/dev/null || echo "1")
141151
if [ "$SPELL_RC" = "0" ]; then
142152
ok "Spell check passed."
@@ -146,7 +156,7 @@ else
146156
fi
147157

148158
wait $PID_LINT
149-
log "[$CYAN 3/5$COLOR_RESET] Running$MAGENTA toolchain lint$COLOR_RESET..."
159+
log "[$CYAN 3/6$COLOR_RESET] Running$MAGENTA toolchain lint$COLOR_RESET..."
150160
LINT_RC=$(cat "$TMPDIR_PC/lint_exit" 2>/dev/null || echo "1")
151161
if [ "$LINT_RC" = "0" ]; then
152162
ok "Toolchain lint passed."
@@ -156,7 +166,7 @@ else
156166
fi
157167

158168
wait $PID_SOURCE
159-
log "[$CYAN 4/5$COLOR_RESET] Running$MAGENTA source lint$COLOR_RESET..."
169+
log "[$CYAN 4/6$COLOR_RESET] Running$MAGENTA source lint$COLOR_RESET..."
160170
SOURCE_RC=$(cat "$TMPDIR_PC/source_exit" 2>/dev/null || echo "1")
161171
if [ "$SOURCE_RC" = "0" ]; then
162172
ok "Source lint passed."
@@ -165,14 +175,24 @@ else
165175
FAILED=1
166176
fi
167177

168-
log "[$CYAN 5/5$COLOR_RESET] Checking$MAGENTA doc references$COLOR_RESET..."
178+
log "[$CYAN 5/6$COLOR_RESET] Checking$MAGENTA doc references$COLOR_RESET..."
169179
if [ $DOC_FAILED -eq 0 ]; then
170180
ok "Doc references are valid."
171181
else
172182
error "Doc reference check failed. Run$MAGENTA python3 toolchain/mfc/lint_docs.py$COLOR_RESET for details."
173183
FAILED=1
174184
fi
175185

186+
wait $PID_PARAM_DOCS
187+
log "[$CYAN 6/6$COLOR_RESET] Checking$MAGENTA parameter docs$COLOR_RESET..."
188+
PARAM_DOCS_RC=$(cat "$TMPDIR_PC/param_docs_exit" 2>/dev/null || echo "1")
189+
if [ "$PARAM_DOCS_RC" = "0" ]; then
190+
ok "Parameter documentation check passed."
191+
else
192+
error "Parameter documentation check failed. Run$MAGENTA python3 toolchain/mfc/lint_param_docs.py$COLOR_RESET for details."
193+
FAILED=1
194+
fi
195+
176196
echo ""
177197

178198
if [ $FAILED -eq 0 ]; then

0 commit comments

Comments
 (0)