Skip to content

Commit 6f7bf44

Browse files
committed
Make common validation policies explicit
1 parent b2dfcad commit 6f7bf44

5 files changed

Lines changed: 13 additions & 20 deletions

File tree

src/common/m_checker_common.fpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,33 @@ module m_checker_common
2020
contains
2121

2222
!> Checks compatibility of parameters in the input file. Used by all three stages
23-
impure subroutine s_check_inputs_common
23+
impure subroutine s_check_inputs_common(check_total_cells, n_global)
2424

25-
#ifndef MFC_SIMULATION
26-
call s_check_total_cells
27-
#endif
25+
logical, intent(in) :: check_total_cells
26+
integer(kind=8), intent(in) :: n_global
27+
28+
if (check_total_cells) call s_check_total_cells(n_global)
2829
#:if USING_AMD
2930
call s_check_amd
3031
#:endif
3132

3233
end subroutine s_check_inputs_common
3334

34-
#ifndef MFC_SIMULATION
3535
!> Verify that the total number of grid cells meets the minimum required by the number of dimensions and MPI ranks.
36-
impure subroutine s_check_total_cells
36+
impure subroutine s_check_total_cells(n_global)
3737

38-
character(len=18) :: numStr !< for int to string conversion
39-
integer(kind=8) :: min_cells
38+
character(len=18) :: numStr !< for int to string conversion
39+
integer(kind=8) :: min_cells
40+
integer(kind=8), intent(in) :: n_global
4041

4142
min_cells = int(2, kind=8)**int(min(1, m) + min(1, n) + min(1, p), kind=8)*int(num_procs, kind=8)
4243
call s_int_to_str(2**(min(1, m) + min(1, n) + min(1, p))*num_procs, numStr)
4344

44-
@:PROHIBIT(nGlobal < min_cells, &
45+
@:PROHIBIT(n_global < min_cells, &
4546
& "Total number of cells must be at least (2^[number of dimensions])*num_procs, " // "which is currently " &
4647
& // trim(numStr))
4748

4849
end subroutine s_check_total_cells
49-
#endif
5050

5151
!> Check that simulation parameters stay within AMD GPU compiler limits when case optimization is disabled.
5252
impure subroutine s_check_amd
@@ -59,6 +59,4 @@ contains
5959

6060
end subroutine s_check_amd
6161

62-
#ifndef MFC_POST_PROCESS
63-
#endif
6462
end module m_checker_common

src/common/m_finite_differences.fpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ contains
3838
lE = q
3939
end if
4040

41-
#ifdef MFC_POST_PROCESS
42-
if (allocated(fd_coeff_s)) deallocate (fd_coeff_s)
43-
allocate (fd_coeff_s(-fd_number_in:fd_number_in,lB:lE))
44-
#endif
45-
4641
! Computing the 1st order finite-difference coefficients
4742
if (fd_order_in == 1) then
4843
do i = lB, lE

src/post_process/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ contains
120120
call s_mpi_abort('Unsupported choice for the value of ' // 'case_dir. Exiting.')
121121
end if
122122
123-
call s_check_inputs_common()
123+
call s_check_inputs_common(check_total_cells=.true., n_global=nGlobal)
124124
call s_check_inputs()
125125
126126
end subroutine s_check_input_file

src/pre_process/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ contains
128128
call s_mpi_abort('Unsupported choice for the value of case_dir.' // 'Exiting.')
129129
end if
130130
131-
call s_check_inputs_common()
131+
call s_check_inputs_common(check_total_cells=.true., n_global=nGlobal)
132132
call s_check_inputs()
133133
134134
call s_check_patches()

src/simulation/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ contains
144144
call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
145145
end if
146146

147-
call s_check_inputs_common()
147+
call s_check_inputs_common(check_total_cells=.false., n_global=0_8)
148148
call s_check_inputs()
149149

150150
end subroutine s_check_input_file

0 commit comments

Comments
 (0)