MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_start_up.fpp.f90
Go to the documentation of this file.
1# 1 "/home/runner/work/MFC/MFC/src/pre_process/m_start_up.fpp"
2!>
3!! @file
4!! @brief Contains module m_start_up
5
6# 1 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp" 1
7# 1 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 1
8# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
9# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
10# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
11# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
12# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
13# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
14
15# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
16# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
17# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
18
19# 15 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
20# 16 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
21# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
22
23# 24 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
24
25# 53 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
26
27# 65 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
28
29# 75 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
30
31# 105 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
32
33# 117 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
34
35# 127 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
36
37# 174 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
38! New line at end of file is required for FYPP
39# 2 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
40# 1 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp" 1
41# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
42# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
43# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
44# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
45# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
46# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
47
48# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
49# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
50# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
51
52# 15 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
53# 16 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
54# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
55
56# 24 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
57
58# 53 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
59
60# 65 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
61
62# 75 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
63
64# 105 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
65
66# 117 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
67
68# 127 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
69
70# 174 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
71! New line at end of file is required for FYPP
72# 2 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp" 2
73
74# 4 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
75# 5 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
76# 6 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
77# 7 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
78# 8 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
79
80# 20 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
81
82# 43 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
83
84# 48 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
85
86# 53 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
87
88# 58 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
89
90# 63 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
91
92# 68 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
93
94# 81 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
95
96# 86 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
97
98# 91 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
99
100# 96 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
101
102# 101 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
103
104# 106 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
105
106# 111 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
107
108# 116 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
109
110# 121 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
111
112# 126 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
113
114# 156 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
115
116# 197 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
117
118# 211 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
119
120# 236 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
121
122# 247 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
123
124# 249 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
125# 260 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
126
127# 310 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
128
129# 320 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
130
131# 330 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
132
133# 339 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
134
135# 356 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
136
137# 366 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
138
139# 373 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
140
141# 379 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
142
143# 385 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
144
145# 391 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
146
147# 397 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
148
149# 403 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
150! New line at end of file is required for FYPP
151# 3 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
152# 1 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp" 1
153# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
154# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
155# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
156# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
157# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
158# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
159
160# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
161# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
162# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
163
164# 15 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
165# 16 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
166# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
167
168# 24 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
169
170# 53 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
171
172# 65 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
173
174# 75 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
175
176# 105 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
177
178# 117 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
179
180# 127 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
181
182# 174 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
183! New line at end of file is required for FYPP
184# 2 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp" 2
185
186# 7 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
187
188# 17 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
189
190# 22 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
191
192# 27 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
193
194# 32 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
195
196# 37 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
197
198# 42 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
199
200# 47 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
201
202# 52 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
203
204# 57 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
205
206# 62 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
207
208# 73 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
209
210# 78 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
211
212# 83 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
213
214# 88 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
215
216# 103 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
217
218# 131 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
219
220# 160 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
221
222# 175 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
223
224# 193 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
225
226# 215 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
227
228# 244 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
229
230# 259 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
231
232# 269 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
233
234# 278 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
235
236# 294 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
237
238# 304 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
239
240# 311 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
241! New line at end of file is required for FYPP
242# 4 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
243
244! GPU parallel region (scalar reductions, maxval/minval)
245# 23 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
246
247! GPU parallel loop over threads (most common GPU macro)
248# 43 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
249
250! Required closing for GPU_PARALLEL_LOOP
251# 55 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
252
253! Mark routine for device compilation
254# 112 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
255
256! Declare device-resident data
257# 130 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
258
259! Inner loop within a GPU parallel region
260# 145 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
261
262! Scoped GPU data region
263# 164 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
264
265! Host code with device pointers (for MPI with GPU buffers)
266# 193 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
267
268! Allocate device memory (unscoped)
269# 207 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
270
271! Free device memory
272# 219 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
273
274! Atomic operation on device
275# 231 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
276
277! End atomic capture block
278# 242 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
279
280! Copy data between host and device
281# 254 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
282
283! Synchronization barrier
284# 266 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
285
286! Import GPU library module (openacc or omp_lib)
287# 275 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
288
289! Emit code only for AMD compiler
290# 282 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
291
292! Emit code for non-Cray compilers
293# 289 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
294
295! Emit code only for Cray compiler
296# 296 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
297
298! Emit code for non-NVIDIA compilers
299# 303 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
300
301# 305 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
302# 306 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
303! New line at end of file is required for FYPP
304# 2 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp" 2
305
306# 14 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
307
308! Caution: This macro requires the use of a binding script to set CUDA_VISIBLE_DEVICES, such that we have one GPU device per MPI
309! rank. That's because for both cudaMemAdvise (preferred location) and cudaMemPrefetchAsync we use location = device_id = 0. For an
310! example see misc/nvidia_uvm/bind.sh.
311# 52 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
312
313! Allocate and create GPU device memory
314# 72 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
315
316! Free GPU device memory and deallocate
317# 80 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
318
319! Cray-specific GPU pointer setup for vector fields
320# 104 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
321
322! Cray-specific GPU pointer setup for scalar fields
323# 120 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
324
325! Cray-specific GPU pointer setup for acoustic source spatials
326# 145 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
327
328# 151 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
329
330# 158 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
331! New line at end of file is required for FYPP
332# 6 "/home/runner/work/MFC/MFC/src/pre_process/m_start_up.fpp" 2
333
334!> @brief Reads and validates user inputs, loads existing grid/IC data, and initializes pre-process modules
336
339 use m_mpi_proxy
340 use m_mpi_common
342 use m_grid
344 use m_data_output
350 use m_helper
351
352#ifdef MFC_MPI
353 use mpi
354#endif
355
359 use m_helper
361 use m_checker
364
365 implicit none
366
367 private
372
373 abstract interface
374
375 !> Abstract interface for reading grid data files in serial or parallel.
377
379
380 !> Abstract interface for reading initial condition data files in serial or parallel.
381 impure subroutine s_read_abstract_ic_data_files(q_cons_vf_in)
382
383 import :: scalar_field, integer_field, sys_size, pres_field
384
385 type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf_in
386
387 end subroutine s_read_abstract_ic_data_files
388 end interface
389
390 character(LEN=path_len + name_len) :: proc_rank_dir !< Location of the folder associated with the rank of the local processor
391 character(LEN=path_len + 2*name_len), private :: t_step_dir !< Path to preexisting time-step folder for restart
394
395contains
396
397 !> Reads the configuration file pre_process.inp, in order to populate the parameters in module m_global_parameters.f90 with the
398 !! user provided inputs
399 impure subroutine s_read_input_file
400
401 character(LEN=name_len) :: file_loc
402 logical :: file_check
403 integer :: iostatus
404 character(len=1000) :: line
405
406# 1 "/home/runner/work/MFC/MFC/build/include/pre_process/generated_namelist.fpp" 1
407! AUTO-GENERATED - do not edit directly. Regenerate: cmake reconfigure
408!
409namelist /user_inputs/ bx0, ca, r0ref, re_inv, web, a_x, a_y, a_z, adv_n, bc_x, bc_y, bc_z, bub_pp, bubbles_euler, &
410 & bubbles_lagrange, case_dir, cfl_adap_dt, cfl_const_dt, cont_damage, cyl_coord, dist_type, down_sample, elliptic_smoothing, &
411 & elliptic_smoothing_iters, fft_wrt, file_extension, file_per_process, files_dir, fluid_pp, fluid_rho, hyper_cleaning, &
412 & hypoelasticity, ib, ib_airfoil, igr, igr_order, loops_x, loops_y, loops_z, m, mhd, mixlayer_perturb, mixlayer_perturb_k0, &
413 & mixlayer_perturb_nk, mixlayer_vel_coef, mixlayer_vel_profile, model_eqns, mpp_lim, muscl_order, n, n_start, n_start_old, &
414 & nb, num_bc_patches, num_fluids, num_ibs, num_particle_clouds, num_patches, num_stl_models, old_grid, old_ic, p, &
415 & palpha_eps, parallel_io, particle_cloud, patch_bc, patch_ib, patch_icpp, perturb_flow, perturb_flow_fluid, &
416 & perturb_flow_mag, perturb_sph, perturb_sph_fluid, pi_fac, poly_sigma, polydisperse, polytropic, precision, ptgalpha_eps, &
417 & qbmm, rburn, reactive_burn, recon_type, relativity, relax, relax_model, rhorv, sigr, sigv, sigma, simplex_params, &
418 & simplex_perturb, stl_models, stretch_x, stretch_y, stretch_z, surface_tension, t_step_old, t_step_start, thermal, viscous, &
419 & weno_order, x_a, x_b, x_domain, y_a, y_b, y_domain, z_a, z_b, z_domain
420# 80 "/home/runner/work/MFC/MFC/src/pre_process/m_start_up.fpp" 2
421
422 file_loc = 'pre_process.inp'
423 inquire (file=trim(file_loc), exist=file_check)
424
425 if (file_check) then
426 open (1, file=trim(file_loc), form='formatted', status='old', action='read')
427 read (1, nml=user_inputs, iostat=iostatus)
428 if (iostatus /= 0) then
429 backspace(1)
430 read (1, fmt='(A)') line
431 print *, 'Invalid line in namelist: ' // trim(line)
432 call s_mpi_abort('Invalid line in pre_process.inp. It is ' // 'likely due to a datatype mismatch. Exiting.')
433 end if
434 close (1)
435
437
438 m_glb = m
439 n_glb = n
440 p_glb = p
441
442 nglobal = int(m_glb + 1, kind=8)*int(n_glb + 1, kind=8)*int(p_glb + 1, kind=8)
443
444 if (cfl_adap_dt .or. cfl_const_dt) cfl_dt = .true.
445
446 if (any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == bc_dirichlet) .or. num_bc_patches > 0) then
447 bc_io = .true.
448 end if
449 else
450 call s_mpi_abort('File pre_process.inp is missing. Exiting.')
451 end if
452
453 end subroutine s_read_input_file
454
455 !> Checking that the user inputs make sense, i.e. that the individual choices are compatible with the code's options and that
456 !! the combination of these choices results into a valid configuration for the pre-process
457 impure subroutine s_check_input_file
458
459 character(LEN=len_trim(case_dir)) :: file_loc
460 logical :: dir_check
461
462 case_dir = adjustl(case_dir)
463
464 file_loc = trim(case_dir) // '/.'
465
466 call my_inquire(file_loc, dir_check)
467
468 if (dir_check .neqv. .true.) then
469 print '(A)', 'WARNING: Ensure that compiler flags/choices in Makefiles match your compiler! '
470 print '(A)', 'WARNING: Ensure that preprocessor flags are enabled! '
471 call s_mpi_abort('Unsupported choice for the value of case_dir.' // 'Exiting.')
472 end if
473
474 call s_check_inputs_common(check_total_cells=.true., n_global=nglobal)
475 call s_check_inputs()
476
477 call s_check_patches()
478
479 if (ib) call s_check_ib_patches()
480
481 end subroutine s_check_input_file
482
483 !> @brief Generates the particle-cloud beds (if any) and writes the initial IB state file that simulation reads back at startup
484 !! (src/simulation/m_start_up.fpp:s_read_ib_restart_data). Must run after the domain is decomposed (s_initialize_mpi_domain) and
485 !! the grid is populated (s_read_grid). Under file_per_process every rank computes the same deterministic placement and keeps
486 !! only the IBs f_local_rank_owns_location says are its own; otherwise rank 0 alone generates and writes every IB.
487 impure subroutine s_write_ib_state_0()
488
489 type(ib_patch_parameters), allocatable :: particle_cloud_ibs(:)
490 integer :: num_particle_cloud_ibs
491 type(bounds_info), dimension(3) :: glb_bounds
492
493 if (.not. ib) return
494 if (.not. file_per_process .and. proc_rank /= 0) return
495
496 glb_bounds = (/x_domain_glb, y_domain_glb, z_domain_glb/)
497
498 call s_generate_particle_clouds(glb_bounds, particle_cloud_ibs, num_particle_cloud_ibs)
499 call s_write_ib_state_0_file(glb_bounds, particle_cloud_ibs, num_particle_cloud_ibs)
500 deallocate (particle_cloud_ibs)
501
502 end subroutine s_write_ib_state_0
503
504 !> The goal of this subroutine is to read in any preexisting grid data as well as based on the imported grid, complete the
505 !! necessary global computational domain parameters.
507
508 character(LEN=len_trim(case_dir) + 3*name_len) :: file_loc
509 logical :: dir_check
510 logical :: file_check
511
512 write (proc_rank_dir, '(A,I0)') '/p_all/p', proc_rank
513 proc_rank_dir = trim(case_dir) // trim(proc_rank_dir)
514
515 write (t_step_dir, '(A,I0)') '/', t_step_start
516 t_step_dir = trim(proc_rank_dir) // trim(t_step_dir)
517
518 file_loc = trim(t_step_dir) // '/.'
519 call my_inquire(file_loc, dir_check)
520
521 if (dir_check .neqv. .true.) then
522 call s_mpi_abort('Time-step folder ' // trim(t_step_dir) // ' is missing. Exiting.')
523 end if
524
525 file_loc = trim(t_step_dir) // '/x_cb.dat'
526 inquire (file=trim(file_loc), exist=file_check)
527
528 if (file_check) then
529 open (1, file=trim(file_loc), form='unformatted', status='old', action='read')
530 read (1) x_cb(-1:m)
531 close (1)
532 else
533 call s_mpi_abort('File x_cb.dat is missing in ' // trim(t_step_dir) // '. Exiting.')
534 end if
535
536 x_cc(0:m) = (x_cb(0:m) + x_cb(-1:(m - 1)))/2._wp
537
538 dx_min = minval(x_cb(0:m) - x_cb(-1:m - 1))
539 if (num_procs > 1) call s_mpi_reduce_min(dx_min)
540
541 x_domain%beg = x_cb(-1)
542 x_domain%end = x_cb(m)
543
544 if (n > 0) then
545 file_loc = trim(t_step_dir) // '/y_cb.dat'
546 inquire (file=trim(file_loc), exist=file_check)
547
548 if (file_check) then
549 open (1, file=trim(file_loc), form='unformatted', status='old', action='read')
550 read (1) y_cb(-1:n)
551 close (1)
552 else
553 call s_mpi_abort('File y_cb.dat is missing in ' // trim(t_step_dir) // '. Exiting.')
554 end if
555
556 y_cc(0:n) = (y_cb(0:n) + y_cb(-1:(n - 1)))/2._wp
557
558 dy_min = minval(y_cb(0:n) - y_cb(-1:n - 1))
559 if (num_procs > 1) call s_mpi_reduce_min(dy_min)
560
561 y_domain%beg = y_cb(-1)
562 y_domain%end = y_cb(n)
563
564 if (p > 0) then
565 file_loc = trim(t_step_dir) // '/z_cb.dat'
566 inquire (file=trim(file_loc), exist=file_check)
567
568 if (file_check) then
569 open (1, file=trim(file_loc), form='unformatted', status='old', action='read')
570 read (1) z_cb(-1:p)
571 close (1)
572 else
573 call s_mpi_abort('File z_cb.dat is missing in ' // trim(t_step_dir) // '. Exiting.')
574 end if
575
576 z_cc(0:p) = (z_cb(0:p) + z_cb(-1:(p - 1)))/2._wp
577
578 dz_min = minval(z_cb(0:p) - z_cb(-1:p - 1))
579 if (num_procs > 1) call s_mpi_reduce_min(dz_min)
580
581 z_domain%beg = z_cb(-1)
582 z_domain%end = z_cb(p)
583 end if
584 end if
585
586 ! Clean processor dir and create time-step dir (unless reading preexisting IC)
587 if (old_ic .neqv. .true.) then
589 call s_create_directory(trim(proc_rank_dir) // '/0')
590 end if
591
592 end subroutine s_read_serial_grid_data_files
593
594 !> Cell-boundary data are checked for consistency by looking at the (non-)uniform cell-width distributions for all the active
595 !! coordinate directions and making sure that all of the cell-widths are positively valued
596 impure subroutine s_check_grid_data_files
597
598 if (any(x_cb(0:m) - x_cb(-1:m - 1) <= 0._wp)) then
599 call s_mpi_abort('x_cb.dat in ' // trim(t_step_dir) // ' contains non-positive cell-spacings. Exiting.')
600 end if
601
602 if (n > 0) then
603 if (any(y_cb(0:n) - y_cb(-1:n - 1) <= 0._wp)) then
604 call s_mpi_abort('y_cb.dat in ' // trim(t_step_dir) // ' contains non-positive cell-spacings. ' // 'Exiting.')
605 end if
606
607 if (p > 0) then
608 if (any(z_cb(0:p) - z_cb(-1:p - 1) <= 0._wp)) then
609 call s_mpi_abort('z_cb.dat in ' // trim(t_step_dir) // ' contains non-positive cell-spacings' // ' .Exiting.')
610 end if
611 end if
612 end if
613
614 end subroutine s_check_grid_data_files
615
616 !> The goal of this subroutine is to read in any preexisting initial condition data files so that they may be used by the
617 !! pre-process as a starting point in the creation of an all new initial condition.
618 impure subroutine s_read_serial_ic_data_files(q_cons_vf_in)
619
620 type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf_in
621 character(LEN=len_trim(case_dir) + 3*name_len) :: file_loc
622 character(len=int(floor(log10(real(sys_size, wp)))) + 1) :: file_num
623 logical :: file_check
624 integer :: i, r
625
626 do i = 1, sys_size
627 write (file_num, '(I0)') i
628 file_loc = trim(t_step_dir) // '/q_cons_vf' // trim(file_num) // '.dat'
629 inquire (file=trim(file_loc), exist=file_check)
630
631 if (file_check) then
632 open (1, file=trim(file_loc), form='unformatted', status='old', action='read')
633 read (1) q_cons_vf_in(i)%sf
634 close (1)
635 else
636 call s_mpi_abort('File q_cons_vf' // trim(file_num) // '.dat is missing in ' // trim(t_step_dir) // '. Exiting.')
637 end if
638 end do
639
640 if (qbmm .and. .not. polytropic) then
641 do i = 1, nb
642 do r = 1, nnode
643 write (file_num, '(I0)') sys_size + r + (i - 1)*nnode
644 file_loc = trim(t_step_dir) // '/pb' // trim(file_num) // '.dat'
645 inquire (file=trim(file_loc), exist=file_check)
646
647 if (file_check) then
648 open (1, file=trim(file_loc), form='unformatted', status='old', action='read')
649 read (1) pb%sf(:,:,:,r, i)
650 close (1)
651 else
652 call s_mpi_abort('File pb' // trim(file_num) // '.dat is missing in ' // trim(t_step_dir) // '. Exiting.')
653 end if
654 end do
655 end do
656
657 do i = 1, nb
658 do r = 1, nnode
659 write (file_num, '(I0)') sys_size + r + (i - 1)*nnode
660 file_loc = trim(t_step_dir) // '/mv' // trim(file_num) // '.dat'
661 inquire (file=trim(file_loc), exist=file_check)
662
663 if (file_check) then
664 open (1, file=trim(file_loc), form='unformatted', status='old', action='read')
665 read (1) mv%sf(:,:,:,r, i)
666 close (1)
667 else
668 call s_mpi_abort('File mv' // trim(file_num) // '.dat is missing in ' // trim(t_step_dir) // '. Exiting.')
669 end if
670 end do
671 end do
672 end if
673
674 ! Since the preexisting grid and initial condition data files have been read in, the directory associated with the rank of
675 ! the local process may be cleaned out to make room for new pre-process data. In addition, the time-step folder that will
676 ! contain the new grid and initial condition data are also generated.
678 call s_create_directory(trim(proc_rank_dir) // '/0')
679
680 end subroutine s_read_serial_ic_data_files
681
682 !> Cell-boundary data are checked for consistency by looking at the (non-)uniform cell-width distributions for all the active
683 !! coordinate directions and making sure that all of the cell-widths are positively valued
685
686#ifdef MFC_MPI
687 real(wp), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb
688 integer :: ifile, ierr, data_size
689 integer, dimension(MPI_STATUS_SIZE) :: status
690 character(LEN=path_len + 2*name_len) :: file_loc
691 logical :: file_exist
692
693 allocate (x_cb_glb(-1:m_glb))
694 allocate (y_cb_glb(-1:n_glb))
695 allocate (z_cb_glb(-1:p_glb))
696
697 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'x_cb.dat'
698 inquire (file=trim(file_loc), exist=file_exist)
699
700 if (file_exist) then
701 data_size = m_glb + 2
702 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
703 call mpi_file_read_all(ifile, x_cb_glb, data_size, mpi_p, status, ierr)
704 call mpi_file_close(ifile, ierr)
705 else
706 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting. ')
707 end if
708
709 x_cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m))
710 x_cc(0:m) = (x_cb(0:m) + x_cb(-1:(m - 1)))/2._wp
711 dx_min = minval(x_cb(0:m) - x_cb(-1:(m - 1)))
712 if (num_procs > 1) call s_mpi_reduce_min(dx_min)
713 x_domain%beg = x_cb(-1)
714 x_domain%end = x_cb(m)
715
716 if (n > 0) then
717 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'y_cb.dat'
718 inquire (file=trim(file_loc), exist=file_exist)
719
720 if (file_exist) then
721 data_size = n_glb + 2
722 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
723 call mpi_file_read_all(ifile, y_cb_glb, data_size, mpi_p, status, ierr)
724 call mpi_file_close(ifile, ierr)
725 else
726 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting. ')
727 end if
728
729 y_cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n))
730 y_cc(0:n) = (y_cb(0:n) + y_cb(-1:(n - 1)))/2._wp
731 dy_min = minval(y_cb(0:n) - y_cb(-1:(n - 1)))
732 if (num_procs > 1) call s_mpi_reduce_min(dy_min)
733 y_domain%beg = y_cb(-1)
734 y_domain%end = y_cb(n)
735
736 if (p > 0) then
737 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'z_cb.dat'
738 inquire (file=trim(file_loc), exist=file_exist)
739
740 if (file_exist) then
741 data_size = p_glb + 2
742 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
743 call mpi_file_read_all(ifile, z_cb_glb, data_size, mpi_p, status, ierr)
744 call mpi_file_close(ifile, ierr)
745 else
746 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting. ')
747 end if
748
749 z_cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p))
750 z_cc(0:p) = (z_cb(0:p) + z_cb(-1:(p - 1)))/2._wp
751 dz_min = minval(z_cb(0:p) - z_cb(-1:(p - 1)))
752 if (num_procs > 1) call s_mpi_reduce_min(dz_min)
753 z_domain%beg = z_cb(-1)
754 z_domain%end = z_cb(p)
755 end if
756 end if
757
758 deallocate (x_cb_glb, y_cb_glb, z_cb_glb)
759#endif
760
762
763 !> The goal of this subroutine is to read in any preexisting initial condition data files so that they may be used by the
764 !! pre-process as a starting point in the creation of an all new initial condition.
765 impure subroutine s_read_parallel_ic_data_files(q_cons_vf_in)
766
767 type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf_in
768
769#ifdef MFC_MPI
770 integer :: ifile, ierr, data_size
771 integer, dimension(MPI_STATUS_SIZE) :: status
772 integer(KIND=MPI_OFFSET_KIND) :: disp
773 integer(KIND=MPI_OFFSET_KIND) :: m_mok, n_mok, p_mok
774 integer(KIND=MPI_OFFSET_KIND) :: wp_mok, var_mok
775 integer(KIND=MPI_OFFSET_KIND) :: mok
776 character(LEN=path_len + 2*name_len) :: file_loc
777 logical :: file_exist
778 integer :: i
779
780 if (cfl_adap_dt) then
781 write (file_loc, '(I0,A)') n_start, '.dat'
782 else
783 write (file_loc, '(I0,A)') t_step_start, '.dat'
784 end if
785 file_loc = trim(restart_dir) // trim(mpiiofs) // trim(file_loc)
786 inquire (file=trim(file_loc), exist=file_exist)
787
788 if (file_exist) then
789 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
790
791 call s_initialize_mpi_data(q_cons_vf_in, qbmm_pb=pb, qbmm_mv=mv)
792
793 data_size = (m + 1)*(n + 1)*(p + 1)
794
795 ! Resize some integers so MPI can read even the biggest files
796 m_mok = int(m_glb + 1, mpi_offset_kind)
797 n_mok = int(n_glb + 1, mpi_offset_kind)
798 p_mok = int(p_glb + 1, mpi_offset_kind)
799 wp_mok = int(storage_size(0._stp)/8, mpi_offset_kind)
800 mok = int(1._wp, mpi_offset_kind)
801
802 do i = 1, sys_size
803 var_mok = int(i, mpi_offset_kind)
804
805 ! Initial displacement to skip at beginning of file
806 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
807
808 call mpi_file_set_view(ifile, disp, mpi_p, mpi_io_data%view(i), 'native', mpi_info_int, ierr)
809 call mpi_file_read(ifile, mpi_io_data%var(i)%sf, data_size, mpi_p, status, ierr)
810 end do
811
812 if (qbmm .and. .not. polytropic) then
813 do i = sys_size + 1, sys_size + 2*nb*nnode
814 var_mok = int(i, mpi_offset_kind)
815
816 ! Initial displacement to skip at beginning of file
817 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
818
819 call mpi_file_set_view(ifile, disp, mpi_p, mpi_io_data%view(i), 'native', mpi_info_int, ierr)
820 call mpi_file_read(ifile, mpi_io_data%var(i)%sf, data_size, mpi_p, status, ierr)
821 end do
822 end if
823
824 call s_mpi_barrier()
825
826 call mpi_file_close(ifile, ierr)
827 else
828 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting. ')
829 end if
830
831 call s_mpi_barrier()
832#endif
833
834 end subroutine s_read_parallel_ic_data_files
835
836 !> Initialize all pre-process modules, allocate data structures, and set I/O procedure pointers.
837 impure subroutine s_initialize_modules
838
840 if (bubbles_euler .or. bubbles_lagrange) then
842 end if
843 call s_initialize_mpi_common_module(exchange_all_chemistry_temperatures_in=.false., use_rdma_transport_in=.false.)
848 call s_initialize_perturbation_module()
851 if (relax) call s_initialize_phasechange_module()
852
853 ! Create the D directory if it doesn't exit, to store the serial data files
854 call s_create_directory('D')
855
856 if (parallel_io .neqv. .true.) then
861 else
866 end if
867
868 end subroutine s_initialize_modules
869
870 !> Read an existing grid from data files or generate a new grid from user inputs.
871 impure subroutine s_read_grid()
872
873 if (old_grid) then
876 else
877 if (parallel_io .neqv. .true.) then
878 call s_generate_grid()
879 else
880 if (proc_rank == 0) call s_generate_grid()
881 call s_mpi_barrier()
884 end if
885 end if
886
887 end subroutine s_read_grid
888
889 !> Generate or read the initial condition, apply relaxation if needed, and write output data files.
890 impure subroutine s_apply_initial_condition(start, finish)
891
892 real(wp), intent(inout) :: start, finish
893 integer :: j, k, l
894 real(wp) :: r2
895
896 call cpu_time(start)
897
898 if (old_ic) call s_read_ic_data_files(ic%q_cons_vf)
899
901
902 ! hard-coded psi
903 if (hyper_cleaning) then
904 if (.not. (eqn_idx%psi > 0)) then
905# 563 "/home/runner/work/MFC/MFC/src/pre_process/m_start_up.fpp"
906 call s_mpi_abort("m_start_up.fpp:563: " // "Assertion failed: eqn_idx%psi > 0. " &
907# 563 "/home/runner/work/MFC/MFC/src/pre_process/m_start_up.fpp"
908 & // "hyper_cleaning requires eqn_idx%psi to be set")
909# 563 "/home/runner/work/MFC/MFC/src/pre_process/m_start_up.fpp"
910 end if
911 do l = 0, p
912 do k = 0, n
913 do j = 0, m
914 r2 = x_cc(j)**2
915 if (n > 0) r2 = r2 + y_cc(k)**2
916 if (p > 0) r2 = r2 + z_cc(l)**2
917 ic%q_cons_vf(eqn_idx%psi)%sf(j, k, l) = 1.0e-2_wp*exp(-r2/(2.0_wp*0.05_wp**2))
918 ic%q_prim_vf(eqn_idx%psi)%sf(j, k, l) = ic%q_cons_vf(eqn_idx%psi)%sf(j, k, l)
919 end do
920 end do
921 end do
922 end if
923
924 if (relax) then
925 if (proc_rank == 0) then
926 print *, 'initial condition might have been altered due to enforcement of pTg-equilibrium (relax = "T" activated)'
927 end if
928
929 call s_infinite_relaxation_k(ic%q_cons_vf)
930 end if
931
932 if (chemistry) then
933 call s_write_data_files(ic%q_cons_vf, ic%q_prim_vf, ic%bc_type, ic%q_T_sf)
934 else
935 call s_write_data_files(ic%q_cons_vf, ic%q_prim_vf, ic%bc_type)
936 end if
937
938 call cpu_time(finish)
939
940 end subroutine s_apply_initial_condition
941
942 !> Gather processor timing data and write elapsed wall-clock time to a summary file.
943 impure subroutine s_save_data(proc_time, time_avg, time_final, file_exists)
944
945 real(wp), dimension(:), intent(inout) :: proc_time
946 real(wp), intent(inout) :: time_avg, time_final
947 logical, intent(inout) :: file_exists
948
949 call s_mpi_barrier()
950
951 if (num_procs > 1) then
952 call mpi_bcast_time_step_values(proc_time, time_avg)
953 end if
954
955 if (proc_rank == 0) then
956 time_final = 0._wp
957 if (num_procs == 1) then
958 time_final = time_avg
959 print *, "Elapsed Time", time_final
960 else
961 time_final = maxval(proc_time)
962 print *, "Elapsed Time", time_final
963 end if
964 inquire (file='pre_time_data.dat', exist=file_exists)
965 if (file_exists) then
966 open (1, file='pre_time_data.dat', position='append', status='old')
967 write (1, *) num_procs, time_final
968 close (1)
969 else
970 open (1, file='pre_time_data.dat', status='new')
971 write (1, *) num_procs, time_final
972 close (1)
973 end if
974 end if
975
976 end subroutine s_save_data
977
978 !> Initialize MPI, read and validate user inputs on rank 0, and decompose the computational domain.
979 impure subroutine s_initialize_mpi_domain
980
981 type(bounds_info), dimension(3) :: local_domains
982
983 call s_mpi_initialize()
984
985 if (proc_rank == 0) then
987 call s_read_input_file()
988 call s_check_input_file()
989
990 print '(" Pre-processing a ", I0, "x", I0, "x", I0, " case on ", I0, " rank(s)")', m, n, p, num_procs
991 end if
992
993 ! Broadcasting the user inputs to all of the processors and performing the parallel computational domain decomposition.
994 ! Neither procedure has to be carried out if pre-process is in fact not truly executed in parallel.
996
997 ! Save original BCs before decomposition overwrites them with MPI neighbor ranks
998 ib_bc_x = bc_x
999 ib_bc_y = bc_y
1000 ib_bc_z = bc_z
1001
1003
1004 ! Save the global domain bounds before decomposition overwrites x/y/z_domain with each processor's local sub-domain bounds
1008
1009 local_domains = (/x_domain, y_domain, z_domain/)
1010 call s_mpi_decompose_computational_domain(write_silo_ghost_offsets=.false., adjust_local_domains= .not. old_grid, &
1011 & local_domains=local_domains)
1012 x_domain = local_domains(1)
1013 y_domain = local_domains(2)
1014 z_domain = local_domains(3)
1015
1017
1018 end subroutine s_initialize_mpi_domain
1019
1020 !> Finalize all pre-process modules, deallocate resources, and shut down MPI.
1021 impure subroutine s_finalize_modules
1022
1023 s_generate_grid => null()
1024 s_read_grid_data_files => null()
1025 s_read_ic_data_files => null()
1026 s_write_data_files => null()
1027
1034 call s_finalize_perturbation_module()
1036 if (relax) call s_finalize_relaxation_solver_module()
1038 call s_mpi_finalize()
1039
1040 end subroutine s_finalize_modules
1041
1042end module m_start_up
Abstract interface for reading grid data files in serial or parallel.
Abstract interface for reading initial condition data files in serial or parallel.
integer, intent(in) k
integer, intent(in) j
integer, intent(in) l
Assigns initial primitive variables to computational cells based on patch geometry.
impure subroutine, public s_initialize_assign_variables_module
Allocate volume fraction sum and set the patch primitive variable assignment procedure pointer.
impure subroutine, public s_finalize_assign_variables_module
Nullify the patch primitive variable assignment procedure pointer.
Noncharacteristic and processor boundary condition application for ghost cells and buffer regions.
subroutine, public s_finalize_boundary_common_module()
Deallocate boundary condition buffer arrays allocated during module initialization.
impure subroutine, public s_initialize_boundary_common_module(use_dirichlet_buffers)
Allocate and set up boundary condition buffer arrays for all coordinate directions.
Applies spatially varying boundary condition patches along domain edges and faces.
Validates geometry parameters and constraints for immersed boundary patches.
impure subroutine, public s_check_ib_patches
Validate the geometry parameters of all active and inactive immersed boundary patches.
Validates geometry parameters and constraints for initial condition patches.
impure subroutine, public s_check_patches
Validate the geometry parameters of all active and inactive initial condition patches.
Shared input validation checks for grid dimensions and AMD GPU compiler limits.
impure subroutine, public s_check_inputs_common(check_total_cells, n_global)
Checks compatibility of parameters in the input file. Used by all three stages.
Checks pre-process input file parameters for compatibility and correctness.
impure subroutine, public s_check_inputs
Checks compatibility of parameters in the input file. Used by the pre_process stage.
Platform-specific file and directory operations: create, delete, inquire, getcwd, and basename.
impure subroutine s_delete_directory(dir_name)
Recursively delete a directory using a platform-specific system command.
impure subroutine my_inquire(fileloc, dircheck)
Inquire on the existence of a directory or file.
impure subroutine s_create_directory(dir_name)
Create a directory and all its parents if it does not exist.
Writes grid and initial condition data to serial or parallel output files.
procedure(s_write_abstract_data_files), pointer, public s_write_data_files
impure subroutine, public s_write_ib_state_0_file(glb_bounds, particle_cloud_ibs, num_particle_cloud_ibs)
Writes the initial IB layout (namelist patch_ib entries, then generated particle-cloud beds) that sim...
impure subroutine, public s_write_serial_data_files(q_cons_vf, q_prim_vf, bc_type, q_t_sf)
Writes grid and initial condition data files to the "0" time-step directory in the local processor ra...
character(len=path_len+2 *name_len), private t_step_dir
Time-step folder into which grid and initial condition data will be placed.
impure subroutine, public s_initialize_data_output_module
Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the...
impure subroutine, public s_finalize_data_output_module
Resets s_write_data_files pointer.
impure subroutine, public s_write_parallel_data_files(q_cons_vf, q_prim_vf, bc_type, q_t_sf)
Writes grid and initial condition data files in parallel to the "0" time-step directory in the local ...
character(len=path_len+2 *name_len), public restart_dir
Restart data folder.
Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures.
Defines global parameters for the computational domain, simulation algorithm, and initial conditions.
type(int_bounds_info) ib_bc_z
bc_x/y/z before decomposition overwrites them with MPI neighbor ranks
integer p_glb
Global number of cells in each direction.
impure subroutine s_assign_default_values_to_user_inputs
Assigns default values to user inputs prior to reading them in. This allows for an easier consistency...
impure subroutine s_finalize_global_parameters_module
Deallocate all global grid, index, and equation-of-state parameter arrays.
type(int_bounds_info) ib_bc_y
type(int_bounds_info) ib_bc_x
type(int_bounds_info) bc_z
Boundary conditions in the x-, y- and z-coordinate directions.
real(wp), dimension(:), allocatable y_cc
integer proc_rank
Rank of the local processor Number of cells in the x-, y- and z-coordinate directions.
logical bc_io
whether or not to save BC data
real(wp), dimension(:), allocatable y_cb
type(bounds_info) z_domain
Locations of the domain bounds in the x-, y- and z-coordinate directions.
real(wp), dimension(:), allocatable z_cb
type(int_bounds_info) bc_y
impure subroutine s_initialize_global_parameters_module
Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the...
real(wp), dimension(:), allocatable x_cc
Locations of cell-centers (cc) in x-, y- and z-directions, respectively.
type(int_bounds_info) bc_x
real(wp), dimension(:), allocatable x_cb
Locations of cell-boundaries (cb) in x-, y- and z-directions, respectively.
real(wp), dimension(:), allocatable z_cc
integer num_procs
Number of processors.
type(bounds_info) x_domain_glb
Global (pre-decomposition) domain bounds, needed by s_generate_serial_grid to stretch the grid using ...
type(cell_num_bounds) cells_bounds
type(mpi_io_var), public mpi_io_data
impure subroutine s_initialize_parallel_io
Configure MPI parallel I/O settings and allocate processor coordinate arrays.
type(bc_xyz_info) bc
Combined BC storage (used by the shared beta-buffer routines; pre-process-local).
integer(kind=8) nglobal
Global number of cells in the domain.
Generates uniform or stretched rectilinear grids with hyperbolic-tangent spacing.
Definition m_grid.f90:6
impure subroutine, public s_generate_serial_grid
Generate a uniform or stretched rectilinear grid in serial from user parameters.
Definition m_grid.f90:35
impure subroutine, public s_initialize_grid_module
Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the...
Definition m_grid.f90:286
procedure(s_generate_abstract_grid), pointer, public s_generate_grid
Definition m_grid.f90:29
impure subroutine, public s_generate_parallel_grid
Generate a uniform or stretched rectilinear grid in parallel from user parameters.
Definition m_grid.f90:157
impure subroutine, public s_finalize_grid_module
Deallocation procedures for the module.
Definition m_grid.f90:297
Basic floating-point utilities: approximate equality, default detection, and coordinate bounds.
elemental subroutine, public s_update_cell_bounds(bounds, m, n, p)
Update the min and max number of cells in each set of axes.
Utility routines for bubble model setup, coordinate transforms, array sampling, and special functions...
impure subroutine, public s_initialize_bubbles_model()
Initialize bubble model arrays for Euler or Lagrangian bubbles with polytropic or non-polytropic gas.
Allocate memory and read initial condition data for IC extrusion.
Assembles initial conditions by layering prioritized patches via constructive solid geometry.
type(ic_context) ic
Initial-condition state (fields, bc types, patch ids).
impure subroutine s_initialize_initial_condition_module
Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the...
impure subroutine s_finalize_initial_condition_module
Deallocation procedures for the module.
impure subroutine s_generate_initial_condition
Iterate over patches and, depending on the geometry type, call the related subroutine to setup the sa...
MPI communication layer: domain decomposition, halo exchange, reductions, and parallel I/O setup.
impure subroutine s_mpi_abort(prnt, code)
The subroutine terminates the MPI execution environment.
impure subroutine s_mpi_barrier
Halts all processes until all have reached barrier.
impure subroutine s_mpi_initialize
Initialize the MPI execution environment and query the number of processors and local rank.
impure subroutine s_mpi_finalize
The subroutine finalizes the MPI execution environment.
impure subroutine s_initialize_mpi_data(q_cons_vf, ib_markers, ib_mpi_data, beta, qbmm_pb, qbmm_mv)
Set up MPI I/O data views and variable pointers for parallel file output.
subroutine s_mpi_decompose_computational_domain(write_silo_ghost_offsets, adjust_local_domains, output_offsets, local_domains)
The purpose of this procedure is to optimally decompose the computational domain among the available ...
impure subroutine mpi_bcast_time_step_values(proc_time, time_avg)
Gather per-rank time step wall-clock times onto rank 0 for performance reporting.
impure subroutine s_mpi_reduce_min(var_loc)
Reduce a local real value to its global minimum across all ranks.
impure subroutine s_finalize_mpi_common_module
Module deallocation and/or disassociation procedures.
impure subroutine s_initialize_mpi_common_module(exchange_all_chemistry_temperatures_in, use_rdma_transport_in)
Initialize the module.
Broadcasts user inputs and decomposes the domain across MPI ranks for pre-processing.
impure subroutine s_mpi_bcast_user_inputs
Since only processor with rank 0 is in charge of reading and checking the consistency of the user pro...
Generates particle beds by converting particle_cloud patch specifications into individual immersed bo...
impure subroutine, public s_generate_particle_clouds(glb_bounds, particle_cloud_ibs, num_particle_cloud_ibs)
Generate all particle beds and fill particle_cloud_ibs, keeping only the particles this rank owns und...
Phase transition relaxation solvers for liquid-vapor flows with cavitation and boiling.
impure subroutine, public s_finalize_relaxation_solver_module
Finalize the phase change module.
subroutine, public s_infinite_relaxation_k(q_cons_vf)
Apply pT- or pTg-equilibrium relaxation with mass depletion based on the incoming state conditions.
impure subroutine, public s_initialize_phasechange_module
Initialize the phase change module (no module-level state to set up; the pT/pTg relaxation solvers ar...
Reads and validates user inputs, loads existing grid/IC data, and initializes pre-process modules.
impure subroutine, public s_read_serial_ic_data_files(q_cons_vf_in)
The goal of this subroutine is to read in any preexisting initial condition data files so that they m...
impure subroutine, public s_initialize_modules
Initialize all pre-process modules, allocate data structures, and set I/O procedure pointers.
impure subroutine, public s_save_data(proc_time, time_avg, time_final, file_exists)
Gather processor timing data and write elapsed wall-clock time to a summary file.
impure subroutine, public s_write_ib_state_0()
Generates the particle-cloud beds (if any) and writes the initial IB state file that simulation reads...
impure subroutine, public s_apply_initial_condition(start, finish)
Generate or read the initial condition, apply relaxation if needed, and write output data files.
character(len=path_len+name_len) proc_rank_dir
Location of the folder associated with the rank of the local processor.
impure subroutine, public s_read_serial_grid_data_files
The goal of this subroutine is to read in any preexisting grid data as well as based on the imported ...
impure subroutine, public s_read_parallel_ic_data_files(q_cons_vf_in)
The goal of this subroutine is to read in any preexisting initial condition data files so that they m...
procedure(s_read_abstract_ic_data_files), pointer, public s_read_ic_data_files
impure subroutine, public s_read_grid()
Read an existing grid from data files or generate a new grid from user inputs.
impure subroutine, public s_check_grid_data_files
Cell-boundary data are checked for consistency by looking at the (non-)uniform cell-width distributio...
impure subroutine, public s_initialize_mpi_domain
Initialize MPI, read and validate user inputs on rank 0, and decompose the computational domain.
impure subroutine, public s_finalize_modules
Finalize all pre-process modules, deallocate resources, and shut down MPI.
impure subroutine, public s_read_input_file
Reads the configuration file pre_process.inp, in order to populate the parameters in module m_global_...
impure subroutine, public s_check_input_file
Checking that the user inputs make sense, i.e. that the individual choices are compatible with the co...
procedure(s_read_abstract_grid_data_files), pointer, public s_read_grid_data_files
impure subroutine, public s_read_parallel_grid_data_files
Cell-boundary data are checked for consistency by looking at the (non-)uniform cell-width distributio...
Conservative-to-primitive variable conversion, mixture property evaluation, and pressure computation.
impure subroutine, public s_finalize_variables_conversion_module()
Deallocate fluid property arrays and post-processing fields allocated during module initialization.
impure subroutine, public s_initialize_variables_conversion_module(store_mixture_fields, enforce_density_floor, preserve_qbmm_number, lagrange_beta_index)
Initialize the variables conversion module.
Groups the x, y, z boundary condition begin/end codes for passing as a single argument.
Derived type adding beginning (beg) and end bounds info as attributes.
Derived type annexing an integer scalar field (SF).
Derived type for bubble variables pb and mv at quadrature nodes (qbmm).
Derived type annexing a scalar field (SF).