-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathm_checker.fpp
More file actions
177 lines (130 loc) · 7.71 KB
/
Copy pathm_checker.fpp
File metadata and controls
177 lines (130 loc) · 7.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
!>
!!@file
!!@brief Contains module m_checker
#:include 'macros.fpp'
#:include 'case.fpp'
!> @brief Validates simulation input parameters for consistency and supported configurations
module m_checker
use m_global_parameters
use m_mpi_proxy
use m_helper
use m_helper_basic
use m_constants, only: recon_type_weno, recon_type_muscl, muscl_order_first_order
implicit none
private; public :: s_check_inputs
contains
!> Checks compatibility of parameters in the input file. Used by the simulation stage
impure subroutine s_check_inputs
call s_check_inputs_compilers
if (igr) then
call s_check_inputs_nvidia_uvm
else
if (recon_type == recon_type_weno) then
call s_check_inputs_weno
else if (recon_type == recon_type_muscl) then
call s_check_inputs_muscl
end if
end if
call s_check_inputs_time_stepping
@:PROHIBIT(chemistry .and. chem_params%reaction_substeps < 0, &
& "chem_params%reaction_substeps must be >= 0 (0 = reaction source in the flow RHS; > 0 = operator-split sub-stepping)")
@:PROHIBIT(chemistry .and. igr .and. chem_params%reaction_substeps > 0, &
& "operator-split reaction sub-stepping (reaction_substeps > 0) is not supported with igr: the reactor reads the post-flow (rho, e, T) state, which the IGR update path does not guarantee")
@:PROHIBIT(chemistry .and. chem_params%adap_substeps .and. chem_params%reaction_substeps < 1, &
& "chem_params%adap_substeps requires reaction_substeps >= 1 (the operator-split floor)")
@:PROHIBIT(chemistry .and. chem_params%adap_substeps &
& .and. chem_params%reaction_substeps_max < chem_params%reaction_substeps, &
& "chem_params%reaction_substeps_max must be >= reaction_substeps when adap_substeps = T")
@:PROHIBIT(ib_state_wrt .and. .not. ib, "ib_state_wrt requires ib to be enabled")
@:PROHIBIT(many_ib_patch_parallelism .and. .not. ib, "many_ib_patch_parallelism requires ib to be enabled")
@:PROHIBIT(chemistry .and. ib .and. (bubbles_euler .or. qbmm), &
& "immersed boundaries with chemistry are not supported together with bubbles_euler/qbmm: the ghost-point image interpolation uses a bubble/QBMM call path that does not carry the chemistry state")
@:PROHIBIT(bf_spatial_support .and. (n == 0 .or. p /= 0), &
& "bf_spatial_support is implemented for 2D only (it forces mom%beg and mom%beg+1)")
if (num_particle_clouds > 0) then
call s_check_inputs_particle_clouds
end if
if (synthetic_turbulence) then
call s_check_inputs_synthetic_turbulence
end if
end subroutine s_check_inputs
!> Checks constraints on compiler options
impure subroutine s_check_inputs_compilers
#if !defined(MFC_OpenACC) && !(defined(__PGI) || defined(_CRAYFTN))
@:PROHIBIT(rdma_mpi, "Unsupported value of rdma_mpi for the current compiler")
#endif
end subroutine s_check_inputs_compilers
!> Checks constraints on WENO scheme parameters
impure subroutine s_check_inputs_weno
character(len=5) :: numStr !< for int to string conversion
call s_int_to_str(num_stcls_min*weno_order, numStr)
@:PROHIBIT(m + 1 < num_stcls_min*weno_order, &
& "m must be greater than or equal to (num_stcls_min*weno_order - 1), whose value is " // trim(numStr))
@:PROHIBIT(n + 1 < min(1, n)*num_stcls_min*weno_order, &
& "For 2D simulation, n must be greater than or equal to (num_stcls_min*weno_order - 1), whose value is " &
& // trim(numStr))
@:PROHIBIT(p + 1 < min(1, p)*num_stcls_min*weno_order, &
& "For 3D simulation, p must be greater than or equal to (num_stcls_min*weno_order - 1), whose value is " &
& // trim(numStr))
end subroutine s_check_inputs_weno
!> Validate that the grid resolution is sufficient for the MUSCL reconstruction order
impure subroutine s_check_inputs_muscl
character(len=5) :: numStr !< for int to string conversion
call s_int_to_str(num_stcls_min*muscl_order, numStr)
@:PROHIBIT(m + 1 < num_stcls_min*muscl_order, &
& "m must be greater than or equal to (num_stcls_min*muscl_order - 1), whose value is " // trim(numStr))
@:PROHIBIT(n + 1 < min(1, n)*num_stcls_min*muscl_order, &
& "For 2D simulation, n must be greater than or equal to (num_stcls_min*muscl_order - 1), whose value is " &
& // trim(numStr))
@:PROHIBIT(p + 1 < min(1, p)*num_stcls_min*muscl_order, &
& "For 3D simulation, p must be greater than or equal to (num_stcls_min*muscl_order - 1), whose value is " &
& // trim(numStr))
@:PROHIBIT(muscl_order == muscl_order_first_order .and. int_comp > 0, &
& "int_comp requires muscl_order >= 2 (muscl_order=1 leaves the reconstruction workspace uninitialised)")
end subroutine s_check_inputs_muscl
!> Checks constraints on time stepping parameters
impure subroutine s_check_inputs_time_stepping
if (.not. cfl_dt) then
@:PROHIBIT(dt <= 0)
end if
end subroutine s_check_inputs_time_stepping
!> Validate NVIDIA unified virtual memory configuration parameters
impure subroutine s_check_inputs_nvidia_uvm
#ifdef __NVCOMPILER_GPU_UNIFIED_MEM
@:PROHIBIT(nv_uvm_igr_temps_on_gpu > 3 .or. nv_uvm_igr_temps_on_gpu < 0, &
& "nv_uvm_igr_temps_on_gpu must be in the range [0, 3]")
@:PROHIBIT(nv_uvm_igr_temps_on_gpu == 3 .and. igr_iter_solver == 2, &
& "nv_uvm_igr_temps_on_gpu must be in the range [0, 2] for igr_iter_solver == 2")
#endif
end subroutine s_check_inputs_nvidia_uvm
!> Checks that each active particle cloud has a valid packing_method specified
impure subroutine s_check_inputs_particle_clouds
integer :: i
character(len=5) :: idxStr
do i = 1, num_particle_clouds
call s_int_to_str(i, idxStr)
@:PROHIBIT(particle_cloud(i)%packing_method == dflt_int, &
& "particle_cloud("//trim(idxStr) &
& //")%packing_method must be specified (1 = rejection sampling, 2 = lattice)")
@:PROHIBIT(particle_cloud(i)%packing_method /= 1 .and. particle_cloud(i)%packing_method /= 2, &
& "particle_cloud("//trim(idxStr) //")%packing_method must be 1 (rejection sampling) or 2 (lattice)")
end do
end subroutine s_check_inputs_particle_clouds
!> Checks that each active synthetic-turbulence forcing zone has a fully specified position and a positive size in every active
!! dimension
impure subroutine s_check_inputs_synthetic_turbulence
integer :: i, d
character(len=5) :: idxStr
@:PROHIBIT(num_turbulent_sources <= 0, "num_turbulent_sources must be > 0 when synthetic_turbulence is enabled")
do i = 1, num_turbulent_sources
call s_int_to_str(i, idxStr)
do d = 1, num_dims
@:PROHIBIT(f_is_default(turb_pos(i, d)), &
& "turb_pos("//trim(idxStr) &
& //",:) must be specified for all num_dims when synthetic_turbulence is enabled")
@:PROHIBIT(f_is_default(synth_L(i, d)) .or. synth_L(i, d) <= 0._wp, &
& "synth_L("//trim(idxStr)//",:) must be positive for all num_dims when synthetic_turbulence is enabled")
end do
end do
end subroutine s_check_inputs_synthetic_turbulence
end module m_checker