Skip to content

Commit b62b08b

Browse files
authored
Fix post_process non-MPI builds never reading input file (#1272)
1 parent 5a2a8a4 commit b62b08b

File tree

6 files changed

+37
-31
lines changed

6 files changed

+37
-31
lines changed

src/post_process/m_checker.fpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,8 @@ contains
2424
!> Checks compatibility of parameters in the input file.
2525
!! Used by the post_process stage
2626
impure subroutine s_check_inputs
27-
28-
call s_check_inputs_output_format
29-
3027
end subroutine s_check_inputs
3128

32-
!> Checks constraints on output format parameters
33-
impure subroutine s_check_inputs_output_format
34-
@:PROHIBIT(precision == 2 .and. wp == sp)
35-
end subroutine s_check_inputs_output_format
36-
3729
!> Checks constraints on fft_wrt
3830
impure subroutine s_check_inputs_fft
3931
integer :: num_procs_y, num_procs_z

src/post_process/m_start_up.fpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,6 @@ contains
11491149

11501150
num_dims = 1 + min(1, n) + min(1, p)
11511151

1152-
#ifdef MFC_MPI
11531152
! Initialization of the MPI environment
11541153
call s_mpi_initialize()
11551154

@@ -1167,14 +1166,12 @@ contains
11671166

11681167
! Broadcasting the user inputs to all of the processors and performing the
11691168
! parallel computational domain decomposition. Neither procedure has to be
1170-
! carried out if the simulation is in fact not truly executed in parallel.
1169+
! carried out if the post-process is in fact not truly executed in parallel.
11711170
call s_mpi_bcast_user_inputs()
11721171
call s_initialize_parallel_io()
11731172
call s_mpi_decompose_computational_domain()
11741173
call s_check_inputs_fft()
11751174

1176-
#endif
1177-
11781175
end subroutine s_initialize_mpi_domain
11791176

11801177
!> @brief Destroy FFTW plans, free MPI communicators, and finalize all post-process sub-modules.

src/pre_process/m_checker.fpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ contains
2424
!> Checks compatibility of parameters in the input file.
2525
!! Used by the pre_process stage
2626
impure subroutine s_check_inputs
27-
28-
call s_check_parallel_io
29-
3027
end subroutine s_check_inputs
3128

32-
!> Checks if mpi is enabled with parallel_io
33-
impure subroutine s_check_parallel_io
34-
#ifndef MFC_MPI
35-
@:PROHIBIT(parallel_io, "MFC built with --no-mpi requires parallel_io=F")
36-
#endif
37-
end subroutine s_check_parallel_io
38-
3929
end module m_checker

src/simulation/m_checker.fpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ contains
3636
else if (recon_type == MUSCL_TYPE) then
3737
call s_check_inputs_muscl
3838
end if
39-
call s_check_inputs_geometry_precision
4039
end if
4140

4241
call s_check_inputs_time_stepping
@@ -76,14 +75,6 @@ contains
7675
"For 3D simulation, p must be greater than or equal to (num_stcls_min*muscl_order - 1), whose value is "//trim(numStr))
7776
end subroutine s_check_inputs_muscl
7877

79-
!> Checks constraints on geometry and precision
80-
impure subroutine s_check_inputs_geometry_precision
81-
! Prevent spherical geometry in single precision
82-
#ifdef MFC_SINGLE_PRECISION
83-
@:PROHIBIT(.not. (cyl_coord .neqv. .true. .or. (cyl_coord .and. p == 0)), "Fully 3D cylindrical grid (geometry = 3) is not supported in single precision.")
84-
#endif
85-
end subroutine s_check_inputs_geometry_precision
86-
8778
!> Checks constraints on time stepping parameters
8879
impure subroutine s_check_inputs_time_stepping
8980
if (.not. cfl_dt) then

toolchain/mfc/case_validator.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from functools import lru_cache
2020
from .common import MFCException
2121
from .params.definitions import CONSTRAINTS
22+
from .state import CFG
2223

2324

2425
# Physics documentation for check methods.
@@ -1794,6 +1795,10 @@ def check_output_format(self):
17941795
if precision is not None:
17951796
self.prohibit(precision not in [1, 2],
17961797
"precision must be 1 or 2")
1798+
self.prohibit(
1799+
precision == 2 and CFG().single,
1800+
"precision = 2 (double output) requires MFC built without --single"
1801+
)
17971802

17981803
def check_vorticity(self):
17991804
"""Checks vorticity parameters (post-process)"""
@@ -2330,13 +2335,41 @@ def check_velocity_components(self):
23302335
self.prohibit(vel3 != 0,
23312336
f"patch_icpp({i})%vel(3) = {vel3} but p = 0 (1D/2D simulation)")
23322337

2338+
# ===================================================================
2339+
# Build-Flag Compatibility Checks
2340+
# ===================================================================
2341+
2342+
def check_build_flags(self):
2343+
"""Checks case parameters against the active build configuration.
2344+
2345+
These catch incompatibilities between case settings and how the
2346+
MFC binaries were compiled (--mpi/--no-mpi, --single, etc.)
2347+
before any binary is invoked.
2348+
"""
2349+
parallel_io = self.get('parallel_io', 'F') == 'T'
2350+
self.prohibit(
2351+
parallel_io and not CFG().mpi,
2352+
"parallel_io = T requires MFC built with --mpi"
2353+
)
2354+
2355+
def check_geometry_precision_simulation(self):
2356+
"""Checks that 3D cylindrical geometry is not used with --single builds."""
2357+
cyl_coord = self.get('cyl_coord', 'F') == 'T'
2358+
p = self.get('p', 0)
2359+
self.prohibit(
2360+
CFG().single and cyl_coord and p > 0,
2361+
"Fully 3D cylindrical geometry (cyl_coord = T, p > 0) is not supported "
2362+
"in single precision (--single)"
2363+
)
2364+
23332365
# ===================================================================
23342366
# Main Validation Entry Points
23352367
# ===================================================================
23362368

23372369
def validate_common(self):
23382370
"""Validate parameters common to all stages"""
23392371
self.check_parameter_types() # Type validation first
2372+
self.check_build_flags()
23402373
self.check_simulation_domain()
23412374
self.check_domain_bounds()
23422375
self.check_model_eqns_and_num_fluids()
@@ -2359,6 +2392,7 @@ def validate_common(self):
23592392
def validate_simulation(self):
23602393
"""Validate simulation-specific parameters"""
23612394
self.validate_common()
2395+
self.check_geometry_precision_simulation()
23622396
self.check_finite_difference()
23632397
self.check_time_stepping()
23642398
self.check_riemann_solver()

toolchain/mfc/lint_docs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ def check_physics_docs_coverage(repo_root: Path) -> list[str]:
423423
"check_output_format", # output format selection
424424
"check_restart", # restart file logistics
425425
"check_parallel_io_pre_process", # parallel I/O settings
426+
"check_build_flags", # build-flag compatibility (no physics meaning)
427+
"check_geometry_precision_simulation", # build-flag compatibility (no physics meaning)
426428
"check_misc_pre_process", # miscellaneous pre-process flags
427429
"check_bc_patches", # boundary patch geometry
428430
"check_grid_stretching", # grid stretching parameters

0 commit comments

Comments
 (0)