Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .claude/rules/common-pitfalls.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
## PR Checklist
Before submitting a PR:
- [ ] `./mfc.sh format -j 8` (auto-format)
- [ ] `./mfc.sh precheck -j 8` (5 CI lint checks)
- [ ] `./mfc.sh precheck -j 8` (6 CI lint checks)
- [ ] `./mfc.sh build -j 8` (compiles)
- [ ] `./mfc.sh test --only <relevant> -j 8` (tests pass)
- [ ] If adding parameters: all 4 locations updated
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/cleanliness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ jobs:
grep -F 'Wmaybe-uninitialized' master.txt > mMaybe.txt
diff prMaybe.txt mMaybe.txt

- name: Conversion Warnings Diff
continue-on-error: true
run: |
grep -F 'Wconversion' pr.txt > prConversion.txt
grep -F 'Wconversion' master.txt > mConversion.txt
diff prConversion.txt mConversion.txt

- name: Everything Diff
continue-on-error: true
Expand All @@ -106,12 +112,14 @@ jobs:
pr_argument=$(grep -c -F 'Wunused-dummy-argument' pr.txt)
pr_value=$(grep -c -F 'Wunused-value' pr.txt)
pr_uninit=$(grep -c -F 'Wmaybe-uninitialized' pr.txt)
pr_conversion=$(grep -c -F 'Wconversion' pr.txt)
pr_everything=$(grep -c '\-W' pr.txt)

master_variable=$(grep -c -F 'Wunused-variable' master.txt)
master_argument=$(grep -c -F 'Wunused-dummy-argument' master.txt)
master_value=$(grep -c -F 'Wunused-value' master.txt)
master_uninit=$(grep -c -F 'Wmaybe-uninitialized' master.txt)
master_conversion=$(grep -c -F 'Wconversion' master.txt)
master_everything=$(grep -c '\-W' master.txt )

echo "pr_everything=$pr_everything" >> $GITHUB_ENV
Expand All @@ -124,6 +132,7 @@ jobs:
echo "Unused Dummy Argument: $pr_argument, Difference: $((pr_argument - master_argument))"
echo "Unused Value: $pr_value, Difference: $((pr_value - master_value))"
echo "Maybe Uninitialized: $pr_uninit, Difference: $((pr_uninit - master_uninit))"
echo "Conversion: $pr_conversion, Difference: $((pr_conversion - master_conversion))"
echo "Everything: $pr_everything, Difference: $((pr_everything - master_everything))"


Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ jobs:
! grep -R '===' ./benchmarks/**/*.py
! grep -R '===' ./examples/**/*.py

- name: Fortran/Fypp static analysis
run: python3 toolchain/mfc/lint_source.py

4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ All commands run from the repo root via `./mfc.sh`.
./mfc.sh test --generate --only <feature> # Regenerate golden files after intentional output change

# Verification (pre-commit CI checks)
./mfc.sh precheck -j 8 # Run all 5 lint checks (same as CI gate)
./mfc.sh precheck -j 8 # Run all 6 lint checks (same as CI gate)
./mfc.sh format -j 8 # Auto-format Fortran (.fpp/.f90) + Python
./mfc.sh lint # Pylint + Python unit tests
./mfc.sh spelling # Spell check
Expand Down Expand Up @@ -99,7 +99,7 @@ IMPORTANT: Follow this loop for ALL code changes. Do not skip steps.
2. **Plan** — For multi-file changes, outline your approach before implementing.
3. **Implement** — Make small, focused changes. One logical change per commit.
4. **Format** — Run `./mfc.sh format -j 8` to auto-format.
5. **Verify** — Run `./mfc.sh precheck -j 8` (same 5 checks as CI lint gate).
5. **Verify** — Run `./mfc.sh precheck -j 8` (same 6 checks as CI lint gate).
6. **Build** — Run `./mfc.sh build -j 8` to verify compilation.
7. **Test** — Run relevant tests: `./mfc.sh test --only <feature> -j 8`.
For changes to `src/common/`, test ALL three targets: `./mfc.sh test -j 8`.
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
-fsignaling-nans
-finit-real=snan
-finit-integer=-99999999
-Wconversion
-Wintrinsic-shadow
-Wunderflow
-Wrealloc-lhs
Expand Down
6 changes: 3 additions & 3 deletions src/post_process/m_data_input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impure subroutine s_setup_mpi_io_params(data_size, m_MOK, n_MOK, p_MOK, WP_MOK,
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)
str_MOK = int(name_len, MPI_OFFSET_KIND)
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
Expand Down Expand Up @@ -177,7 +177,7 @@ impure subroutine s_read_ib_data_files(file_loc_base, t_step)
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
save_index = t_step/t_step_save ! get the number of saves done to this point

data_size = (m + 1)*(n + 1)*(p + 1)
Expand Down Expand Up @@ -517,7 +517,7 @@ impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK,
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)
str_MOK = int(name_len, MPI_OFFSET_KIND)
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
Expand Down
1 change: 0 additions & 1 deletion src/pre_process/m_assign_variables.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ contains
if (qbmm) then
do i = 1, nb
R3bar = R3bar + weight(i)*0.5_wp*(q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l))**3._wp
R3bar = R3bar + weight(i)*0.5_wp*(q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l))**3._wp
end do
else
do i = 1, nb
Expand Down
4 changes: 2 additions & 2 deletions src/pre_process/m_data_output.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ contains
m_MOK = int(m_glb_save, MPI_OFFSET_KIND)
n_MOK = int(n_glb_save, MPI_OFFSET_KIND)
p_MOK = int(p_glb_save, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)
str_MOK = int(name_len, MPI_OFFSET_KIND)
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
Expand Down Expand Up @@ -615,7 +615,7 @@ contains
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)
str_MOK = int(name_len, MPI_OFFSET_KIND)
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
Expand Down
2 changes: 1 addition & 1 deletion src/pre_process/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ contains
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)
str_MOK = int(name_len, MPI_OFFSET_KIND)
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
Expand Down
6 changes: 3 additions & 3 deletions src/simulation/m_data_output.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ contains
m_MOK = int(m_glb_save + 1, MPI_OFFSET_KIND)
n_MOK = int(n_glb_save + 1, MPI_OFFSET_KIND)
p_MOK = int(p_glb_save + 1, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)
str_MOK = int(name_len, MPI_OFFSET_KIND)
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
Expand Down Expand Up @@ -963,7 +963,7 @@ contains
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)
str_MOK = int(name_len, MPI_OFFSET_KIND)
NVARS_MOK = int(alt_sys, MPI_OFFSET_KIND)
Expand Down Expand Up @@ -1087,7 +1087,7 @@ contains
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)

write (file_loc, '(A)') 'ib.dat'
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_mpi_proxy.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ contains

#:for VAR in [ 'dt','weno_eps','teno_CT','pref','rhoref','R0ref','Web','Ca', 'sigma', &
& 'Re_inv', 'poly_sigma', 'palpha_eps', 'ptgalpha_eps', 'pi_fac', &
& 'bc_x%vb1','bc_x%vb2','bc_x%vb3','bc_x%ve1','bc_x%ve2','bc_x%ve2', &
& 'bc_x%vb1','bc_x%vb2','bc_x%vb3','bc_x%ve1','bc_x%ve2','bc_x%ve3', &
& 'bc_y%vb1','bc_y%vb2','bc_y%vb3','bc_y%ve1','bc_y%ve2','bc_y%ve3', &
& 'bc_z%vb1','bc_z%vb2','bc_z%vb3','bc_z%ve1','bc_z%ve2','bc_z%ve3', &
& 'bc_x%pres_in','bc_x%pres_out','bc_y%pres_in','bc_y%pres_out', 'bc_z%pres_in','bc_z%pres_out', &
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_rhs.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@ contains
call s_compute_viscous_stress_cylindrical_boundary(q_prim_vf, &
dq_prim_dx_vf(mom_idx%beg:mom_idx%end), &
dq_prim_dy_vf(mom_idx%beg:mom_idx%end), &
dq_prim_dy_vf(mom_idx%beg:mom_idx%end), &
dq_prim_dz_vf(mom_idx%beg:mom_idx%end), &
tau_Re_vf, &
idwbuff(1), idwbuff(2), idwbuff(3))
end if
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ contains
m_MOK = int(m_glb + 1, MPI_OFFSET_KIND)
n_MOK = int(n_glb + 1, MPI_OFFSET_KIND)
p_MOK = int(p_glb + 1, MPI_OFFSET_KIND)
WP_MOK = int(8._wp, MPI_OFFSET_KIND)
WP_MOK = int(storage_size(0._stp)/8, MPI_OFFSET_KIND)
MOK = int(1._wp, MPI_OFFSET_KIND)
str_MOK = int(name_len, MPI_OFFSET_KIND)
NVARS_MOK = int(sys_size, MPI_OFFSET_KIND)
Expand Down
21 changes: 15 additions & 6 deletions toolchain/bootstrap/precheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ log "Running$MAGENTA precheck$COLOR_RESET (same checks as CI lint-gate)..."
echo ""

# 1. Check formatting
log "[$CYAN 1/5$COLOR_RESET] Checking$MAGENTA formatting$COLOR_RESET..."
log "[$CYAN 1/6$COLOR_RESET] Checking$MAGENTA formatting$COLOR_RESET..."
# Capture state before formatting
BEFORE_HASH=$(git diff -- '*.f90' '*.fpp' '*.py' 2>/dev/null | compute_hash)
if ! ./mfc.sh format -j "$JOBS" > /dev/null 2>&1; then
Expand All @@ -82,7 +82,7 @@ else
fi

# 2. Spell check
log "[$CYAN 2/5$COLOR_RESET] Running$MAGENTA spell check$COLOR_RESET..."
log "[$CYAN 2/6$COLOR_RESET] Running$MAGENTA spell check$COLOR_RESET..."
if ./mfc.sh spelling > /dev/null 2>&1; then
ok "Spell check passed."
else
Expand All @@ -91,7 +91,7 @@ else
fi

# 3. Lint toolchain (Python)
log "[$CYAN 3/5$COLOR_RESET] Running$MAGENTA toolchain lint$COLOR_RESET..."
log "[$CYAN 3/6$COLOR_RESET] Running$MAGENTA toolchain lint$COLOR_RESET..."
if ./mfc.sh lint > /dev/null 2>&1; then
ok "Toolchain lint passed."
else
Expand All @@ -100,7 +100,7 @@ else
fi

# 4. Source code lint checks
log "[$CYAN 4/5$COLOR_RESET] Running$MAGENTA source lint$COLOR_RESET checks..."
log "[$CYAN 4/6$COLOR_RESET] Running$MAGENTA source lint$COLOR_RESET checks..."
SOURCE_FAILED=0

# Check for raw OpenACC/OpenMP directives
Expand All @@ -127,8 +127,17 @@ else
FAILED=1
fi

# 5. Doc reference check
log "[$CYAN 5/5$COLOR_RESET] Checking$MAGENTA doc references$COLOR_RESET..."
# 5. Fortran/Fypp static analysis
log "[$CYAN 5/6$COLOR_RESET] Running$MAGENTA Fortran/Fypp analysis$COLOR_RESET..."
if python3 toolchain/mfc/lint_source.py 2>&1; then
ok "Fortran/Fypp analysis passed."
else
error "Fortran/Fypp analysis failed. Run$MAGENTA python3 toolchain/mfc/lint_source.py$COLOR_RESET for details."
FAILED=1
fi

# 6. Doc reference check
log "[$CYAN 6/6$COLOR_RESET] Checking$MAGENTA doc references$COLOR_RESET..."
if python3 toolchain/mfc/lint_docs.py 2>&1; then
ok "Doc references are valid."
else
Expand Down
Loading
Loading