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/simulation/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/case.fpp" 1
7! This file exists so that Fypp can be run without generating case.fpp files for
8! each target. This is useful when generating documentation, for example. This
9! should also let MFC be built with CMake directly, without invoking mfc.sh.
10
11! For pre-process.
12# 9 "/home/runner/work/MFC/MFC/src/common/include/case.fpp"
13
14! For moving immersed boundaries in simulation
15# 14 "/home/runner/work/MFC/MFC/src/common/include/case.fpp"
16# 6 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp" 2
17# 1 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp" 1
18# 1 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 1
19# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
20# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
21# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
22# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
23# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
24# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
25
26# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
27# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
28# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
29
30# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
31
32# 46 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
33
34# 58 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
35
36# 68 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
37
38# 98 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
39
40# 110 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
41
42# 120 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
43! New line at end of file is required for FYPP
44# 2 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
45# 1 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp" 1
46# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
47# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
48# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
49# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
50# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
51# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
52
53# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
54# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
55# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
56
57# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
58
59# 46 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
60
61# 58 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
62
63# 68 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
64
65# 98 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
66
67# 110 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
68
69# 120 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
70! New line at end of file is required for FYPP
71# 2 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp" 2
72
73# 4 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
74# 5 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
75# 6 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
76# 7 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
77# 8 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
78
79# 20 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
80
81# 43 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
82
83# 48 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
84
85# 53 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
86
87# 58 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
88
89# 63 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
90
91# 68 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
92
93# 76 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
94
95# 81 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
96
97# 86 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
98
99# 91 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
100
101# 96 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
102
103# 101 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
104
105# 106 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
106
107# 111 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
108
109# 116 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
110
111# 121 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
112
113# 151 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
114
115# 192 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
116
117# 206 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
118
119# 231 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
120
121# 242 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
122
123# 244 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
124# 255 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
125
126# 284 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
127
128# 294 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
129
130# 304 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
131
132# 313 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
133
134# 330 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
135
136# 340 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
137
138# 347 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
139
140# 353 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
141
142# 359 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
143
144# 365 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
145
146# 371 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
147
148# 377 "/home/runner/work/MFC/MFC/src/common/include/omp_macros.fpp"
149! New line at end of file is required for FYPP
150# 3 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
151# 1 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp" 1
152# 1 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp" 1
153# 2 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
154# 3 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
155# 4 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
156# 5 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
157# 6 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
158
159# 8 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
160# 9 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
161# 10 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
162
163# 17 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
164
165# 46 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
166
167# 58 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
168
169# 68 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
170
171# 98 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
172
173# 110 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
174
175# 120 "/home/runner/work/MFC/MFC/src/common/include/shared_parallel_macros.fpp"
176! New line at end of file is required for FYPP
177# 2 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp" 2
178
179# 7 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
180
181# 17 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
182
183# 22 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
184
185# 27 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
186
187# 32 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
188
189# 37 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
190
191# 42 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
192
193# 47 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
194
195# 52 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
196
197# 57 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
198
199# 62 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
200
201# 73 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
202
203# 78 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
204
205# 83 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
206
207# 88 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
208
209# 103 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
210
211# 131 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
212
213# 160 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
214
215# 175 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
216
217# 193 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
218
219# 215 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
220
221# 244 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
222
223# 259 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
224
225# 269 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
226
227# 278 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
228
229# 294 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
230
231# 304 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
232
233# 311 "/home/runner/work/MFC/MFC/src/common/include/acc_macros.fpp"
234! New line at end of file is required for FYPP
235# 4 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp" 2
236
237! GPU parallel region (scalar reductions, maxval/minval)
238# 23 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
239
240! GPU parallel loop over threads (most common GPU macro)
241# 43 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
242
243! Required closing for GPU_PARALLEL_LOOP
244# 55 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
245
246! Mark routine for device compilation
247# 112 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
248
249! Declare device-resident data
250# 130 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
251
252! Inner loop within a GPU parallel region
253# 145 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
254
255! Scoped GPU data region
256# 164 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
257
258! Host code with device pointers (for MPI with GPU buffers)
259# 193 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
260
261! Allocate device memory (unscoped)
262# 207 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
263
264! Free device memory
265# 219 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
266
267! Atomic operation on device
268# 231 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
269
270! End atomic capture block
271# 242 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
272
273! Copy data between host and device
274# 254 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
275
276! Synchronization barrier
277# 266 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
278
279! Import GPU library module (openacc or omp_lib)
280# 275 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
281
282! Emit code only for AMD compiler
283# 282 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
284
285! Emit code for non-Cray compilers
286# 289 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
287
288! Emit code only for Cray compiler
289# 296 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
290
291! Emit code for non-NVIDIA compilers
292# 303 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
293
294# 305 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
295# 306 "/home/runner/work/MFC/MFC/src/common/include/parallel_macros.fpp"
296! New line at end of file is required for FYPP
297# 2 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp" 2
298
299# 14 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
300
301! Caution: This macro requires the use of a binding script to set CUDA_VISIBLE_DEVICES, such that we have one GPU device per MPI
302! rank. That's because for both cudaMemAdvise (preferred location) and cudaMemPrefetchAsync we use location = device_id = 0. For an
303! example see misc/nvidia_uvm/bind.sh. NVIDIA unified memory page placement hint
304# 57 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
305
306! Allocate and create GPU device memory
307# 77 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
308
309! Free GPU device memory and deallocate
310# 85 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
311
312! Cray-specific GPU pointer setup for vector fields
313# 109 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
314
315! Cray-specific GPU pointer setup for scalar fields
316# 125 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
317
318! Cray-specific GPU pointer setup for acoustic source spatials
319# 150 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
320
321# 156 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
322
323# 163 "/home/runner/work/MFC/MFC/src/common/include/macros.fpp"
324! New line at end of file is required for FYPP
325# 7 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp" 2
326
327!> @brief Reads input files, loads initial conditions and grid data, and orchestrates solver initialization and finalization
329
332 use m_mpi_proxy
333 use m_mpi_common
335 use m_weno
336 use m_muscl
338 use m_cbc
341 use m_rhs
342 use m_chemistry
343 use m_data_output
345 use m_qbmm
347 use m_hypoelastic
350 use m_viscous
351 use m_bubbles_ee
352 use m_bubbles_el
353 use ieee_arithmetic
355 use m_helper
356
357#if defined(MFC_OpenACC)
358# 38 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
359 use openacc
360# 38 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
361#elif defined(MFC_OpenMP)
362# 38 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
363 use omp_lib
364# 38 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
365#endif
366
367 use m_nvtx
368 use m_ibm
371 use m_checker
373 use m_body_forces
374 use m_sim_helpers
375 use m_igr
376
377 implicit none
378
382
383 type(scalar_field), allocatable, dimension(:) :: q_cons_temp
384 real(wp) :: dt_init
385
386contains
387
388 !> Read data files. Dispatch subroutine that replaces procedure pointer.
389 impure subroutine s_read_data_files(q_cons_vf)
390
391 type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf
392
393 if (.not. parallel_io) then
395 else
397 end if
398
399 end subroutine s_read_data_files
400
401 !> Verify the input file exists and read it
402 impure subroutine s_read_input_file
403
404 character(LEN=name_len), parameter :: file_path = './simulation.inp'
405 logical :: file_exist !< Logical used to check the existence of the input file
406 integer :: iostatus
407 ! Integer to check iostat of file read
408
409 character(len=1000) :: line
410
411 namelist /user_inputs/ case_dir, run_time_info, m, n, p, dt, &
416 bc_x, bc_y, bc_z, &
417 x_a, y_a, z_a, x_b, y_b, z_b, &
420 ib, num_ibs, patch_ib, &
421 ib_state_wrt, &
428# 102 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
433# 107 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
441
442 inquire (file=trim(file_path), exist=file_exist)
443
444 if (file_exist) then
445 open (1, file=trim(file_path), form='formatted', action='read', status='old')
446 read (1, nml=user_inputs, iostat=iostatus)
447
448 if (iostatus /= 0) then
449 backspace(1)
450 read (1, fmt='(A)') line
451 print *, 'Invalid line in namelist: ' // trim(line)
452 call s_mpi_abort('Invalid line in simulation.inp. It is ' // 'likely due to a datatype mismatch. Exiting.')
453 end if
454
455 close (1)
456
457 if ((bf_x) .or. (bf_y) .or. (bf_z)) then
458 bodyforces = .true.
459 end if
460
461 m_glb = m
462 n_glb = n
463 p_glb = p
464
466
467 if (cfl_adap_dt .or. cfl_const_dt) cfl_dt = .true.
468
469 if (any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == -17) .or. num_bc_patches > 0) then
470 bc_io = .true.
471 end if
472 else
473 call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
474 end if
475
476 end subroutine s_read_input_file
477
478 !> Validate that all user-provided inputs form a consistent simulation configuration
479 impure subroutine s_check_input_file
480
481 character(LEN=path_len) :: file_path
482 logical :: file_exist
483
484 file_path = trim(case_dir) // '/.'
485
486 call my_inquire(file_path, file_exist)
487
488 if (file_exist .neqv. .true.) then
489 call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
490 end if
491
493 call s_check_inputs()
494
495 end subroutine s_check_input_file
496
497 !> Read serial initial condition and grid data files and compute cell-width distributions
498 impure subroutine s_read_serial_data_files(q_cons_vf)
499
500 type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf
501 character(LEN=path_len + 2*name_len) :: t_step_dir !< Relative path to the starting time-step directory
502 character(LEN=path_len + 3*name_len) :: file_path !< Relative path to the grid and conservative variables data files
503 logical :: file_exist
504 integer :: i, r
505
506 if (cfl_dt) then
507 write (t_step_dir, '(A,I0,A,I0)') trim(case_dir) // '/p_all/p', proc_rank, '/', n_start
508 else
509 write (t_step_dir, '(A,I0,A,I0)') trim(case_dir) // '/p_all/p', proc_rank, '/', t_step_start
510 end if
511
512 file_path = trim(t_step_dir) // '/.'
513 call my_inquire(file_path, file_exist)
514
515 if (file_exist .neqv. .true.) then
516 call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
517 end if
518
519 if (bc_io) then
521 else
523 end if
524
525 file_path = trim(t_step_dir) // '/x_cb.dat'
526
527 inquire (file=trim(file_path), exist=file_exist)
528
529 if (file_exist) then
530 open (2, file=trim(file_path), form='unformatted', action='read', status='old')
531 read (2) x_cb(-1:m); close (2)
532 else
533 call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
534 end if
535
536 dx(0:m) = x_cb(0:m) - x_cb(-1:m - 1)
537 x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2._wp
538
539 if (ib) then
540 do i = 1, num_ibs
541 if (patch_ib(i)%c > 0) then
542 np = int((patch_ib(i)%p*patch_ib(i)%c/dx(0))*20) + int(((patch_ib(i)%c - patch_ib(i)%p*patch_ib(i)%c)/dx(0)) &
543 & *20) + 1
544 end if
545 end do
546 end if
547
548 if (n > 0) then
549 file_path = trim(t_step_dir) // '/y_cb.dat'
550
551 inquire (file=trim(file_path), exist=file_exist)
552
553 if (file_exist) then
554 open (2, file=trim(file_path), form='unformatted', action='read', status='old')
555 read (2) y_cb(-1:n); close (2)
556 else
557 call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
558 end if
559
560 dy(0:n) = y_cb(0:n) - y_cb(-1:n - 1)
561 y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2._wp
562 end if
563
564 if (p > 0) then
565 file_path = trim(t_step_dir) // '/z_cb.dat'
566
567 inquire (file=trim(file_path), exist=file_exist)
568
569 if (file_exist) then
570 open (2, file=trim(file_path), form='unformatted', action='read', status='old')
571 read (2) z_cb(-1:p); close (2)
572 else
573 call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
574 end if
575
576 dz(0:p) = z_cb(0:p) - z_cb(-1:p - 1)
577 z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2._wp
578 end if
579
580 do i = 1, sys_size
581 write (file_path, '(A,I0,A)') trim(t_step_dir) // '/q_cons_vf', i, '.dat'
582 inquire (file=trim(file_path), exist=file_exist)
583 if (file_exist) then
584 open (2, file=trim(file_path), form='unformatted', action='read', status='old')
585 read (2) q_cons_vf(i)%sf(0:m,0:n,0:p); close (2)
586 else
587 call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
588 end if
589 end do
590
591 if (bubbles_euler .or. elasticity) then
592 ! Read pb and mv for non-polytropic qbmm
593 if (qbmm .and. .not. polytropic) then
594 do i = 1, nb
595 do r = 1, nnode
596 write (file_path, '(A,I0,A)') trim(t_step_dir) // '/pb', sys_size + (i - 1)*nnode + r, '.dat'
597 inquire (file=trim(file_path), exist=file_exist)
598 if (file_exist) then
599 open (2, file=trim(file_path), form='unformatted', action='read', status='old')
600 read (2) pb_ts(1)%sf(0:m,0:n,0:p,r, i); close (2)
601 else
602 call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
603 end if
604 end do
605 end do
606 do i = 1, nb
607 do r = 1, nnode
608 write (file_path, '(A,I0,A)') trim(t_step_dir) // '/mv', sys_size + (i - 1)*nnode + r, '.dat'
609 inquire (file=trim(file_path), exist=file_exist)
610 if (file_exist) then
611 open (2, file=trim(file_path), form='unformatted', action='read', status='old')
612 read (2) mv_ts(1)%sf(0:m,0:n,0:p,r, i); close (2)
613 else
614 call s_mpi_abort(trim(file_path) // ' is missing. Exiting.')
615 end if
616 end do
617 end do
618 end if
619 end if
620
621 end subroutine s_read_serial_data_files
622
623 !> Read parallel initial condition and grid data files via MPI I/O
624 impure subroutine s_read_parallel_data_files(q_cons_vf)
625
626 type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf
627
628#ifdef MFC_MPI
629 real(wp), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb
630 integer :: ifile, ierr, data_size
631 integer, dimension(MPI_STATUS_SIZE) :: status
632 integer(KIND=MPI_OFFSET_KIND) :: disp
633 integer(KIND=MPI_OFFSET_KIND) :: m_mok, n_mok, p_mok
634 integer(KIND=MPI_OFFSET_KIND) :: wp_mok, var_mok, str_mok
635 integer(KIND=MPI_OFFSET_KIND) :: nvars_mok
636 integer(KIND=MPI_OFFSET_KIND) :: mok
637 character(LEN=path_len + 2*name_len) :: file_loc
638 logical :: file_exist
639 character(len=10) :: t_step_start_string
640 integer :: i, j
641
642 ! Downsampled data variables
643 integer :: m_ds, n_ds, p_ds
644 integer :: m_glb_ds, n_glb_ds, p_glb_ds
645 integer :: m_glb_read, n_glb_read, p_glb_read !< data size of read
646
647 allocate (x_cb_glb(-1:m_glb))
648 allocate (y_cb_glb(-1:n_glb))
649 allocate (z_cb_glb(-1:p_glb))
650
651 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'x_cb.dat'
652 inquire (file=trim(file_loc), exist=file_exist)
653
654 if (down_sample) then
655 m_ds = int((m + 1)/3) - 1
656 n_ds = int((n + 1)/3) - 1
657 p_ds = int((p + 1)/3) - 1
658
659 m_glb_ds = int((m_glb + 1)/3) - 1
660 n_glb_ds = int((n_glb + 1)/3) - 1
661 p_glb_ds = int((p_glb + 1)/3) - 1
662 end if
663
664 if (file_exist) then
665 data_size = m_glb + 2
666 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
667 call mpi_file_read(ifile, x_cb_glb, data_size, mpi_p, status, ierr)
668 call mpi_file_close(ifile, ierr)
669 else
670 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
671 end if
672
673 x_cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m))
674 dx(0:m) = x_cb(0:m) - x_cb(-1:m - 1)
675 x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2._wp
676
677 if (ib) then
678 do i = 1, num_ibs
679 if (patch_ib(i)%c > 0) then
680 np = int((patch_ib(i)%p*patch_ib(i)%c/dx(0))*20) + int(((patch_ib(i)%c - patch_ib(i)%p*patch_ib(i)%c)/dx(0)) &
681 & *20) + 1
682 allocate (mpi_io_airfoil_ib_data%var(1:2*np))
683 end if
684 end do
685 end if
686
687 if (n > 0) then
688 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'y_cb.dat'
689 inquire (file=trim(file_loc), exist=file_exist)
690
691 if (file_exist) then
692 data_size = n_glb + 2
693 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
694 call mpi_file_read(ifile, y_cb_glb, data_size, mpi_p, status, ierr)
695 call mpi_file_close(ifile, ierr)
696 else
697 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
698 end if
699
700 y_cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n))
701 dy(0:n) = y_cb(0:n) - y_cb(-1:n - 1)
702 y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2._wp
703
704 if (p > 0) then
705 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'z_cb.dat'
706 inquire (file=trim(file_loc), exist=file_exist)
707
708 if (file_exist) then
709 data_size = p_glb + 2
710 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
711 call mpi_file_read(ifile, z_cb_glb, data_size, mpi_p, status, ierr)
712 call mpi_file_close(ifile, ierr)
713 else
714 call s_mpi_abort('File ' // trim(file_loc) // 'is missing. Exiting.')
715 end if
716
717 z_cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p))
718 dz(0:p) = z_cb(0:p) - z_cb(-1:p - 1)
719 z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2._wp
720 end if
721 end if
722
723 if (file_per_process) then
724 if (cfl_dt) then
725 call s_int_to_str(n_start, t_step_start_string)
726 write (file_loc, '(I0,A1,I7.7,A)') n_start, '_', proc_rank, '.dat'
727 else
728 call s_int_to_str(t_step_start, t_step_start_string)
729 write (file_loc, '(I0,A1,I7.7,A)') t_step_start, '_', proc_rank, '.dat'
730 end if
731 file_loc = trim(case_dir) // '/restart_data/lustre_' // trim(t_step_start_string) // trim(mpiiofs) // trim(file_loc)
732 inquire (file=trim(file_loc), exist=file_exist)
733
734 if (file_exist) then
735 call mpi_file_open(mpi_comm_self, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
736
737 if (down_sample) then
739 else
740 if (ib) then
742 else
744 end if
745 end if
746
747 if (down_sample) then
748 data_size = (m_ds + 3)*(n_ds + 3)*(p_ds + 3)
749 m_glb_read = m_glb_ds + 1
750 n_glb_read = n_glb_ds + 1
751 p_glb_read = p_glb_ds + 1
752 else
753 data_size = (m + 1)*(n + 1)*(p + 1)
754 m_glb_read = m_glb + 1
755 n_glb_read = n_glb + 1
756 p_glb_read = p_glb + 1
757 end if
758
759 m_mok = int(m_glb_read + 1, mpi_offset_kind)
760 n_mok = int(m_glb_read + 1, mpi_offset_kind)
761 p_mok = int(m_glb_read + 1, mpi_offset_kind)
762 wp_mok = int(storage_size(0._stp)/8, mpi_offset_kind)
763 mok = int(1._wp, mpi_offset_kind)
764 str_mok = int(name_len, mpi_offset_kind)
765 nvars_mok = int(sys_size, mpi_offset_kind)
766
767 if (bubbles_euler .or. elasticity) then
768 do i = 1, sys_size ! adv_idx%end
769 var_mok = int(i, mpi_offset_kind)
770
771 call mpi_file_read(ifile, mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
772 end do
773 ! Read pb and mv for non-polytropic qbmm
774 if (qbmm .and. .not. polytropic) then
775 do i = sys_size + 1, sys_size + 2*nb*nnode
776 var_mok = int(i, mpi_offset_kind)
777
778 call mpi_file_read(ifile, mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
779 end do
780 end if
781 else
782 if (down_sample) then
783 do i = 1, sys_size
784 var_mok = int(i, mpi_offset_kind)
785
786 call mpi_file_read(ifile, q_cons_temp(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
787 end do
788 else
789 do i = 1, sys_size
790 var_mok = int(i, mpi_offset_kind)
791
792 call mpi_file_read(ifile, mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
793 end do
794 end if
795 end if
796
797 call s_mpi_barrier()
798
799 call mpi_file_close(ifile, ierr)
800 else
801 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
802 end if
803 else
804 if (cfl_dt) then
805 write (file_loc, '(I0,A)') n_start, '.dat'
806 else
807 write (file_loc, '(I0,A)') t_step_start, '.dat'
808 end if
809 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // trim(file_loc)
810 inquire (file=trim(file_loc), exist=file_exist)
811
812 if (file_exist) then
813 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
814
815 if (ib) then
817 else
819 end if
820
821 data_size = (m + 1)*(n + 1)*(p + 1)
822
823 m_mok = int(m_glb + 1, mpi_offset_kind)
824 n_mok = int(n_glb + 1, mpi_offset_kind)
825 p_mok = int(p_glb + 1, mpi_offset_kind)
826 wp_mok = int(storage_size(0._stp)/8, mpi_offset_kind)
827 mok = int(1._wp, mpi_offset_kind)
828 str_mok = int(name_len, mpi_offset_kind)
829 nvars_mok = int(sys_size, mpi_offset_kind)
830
831 if (bubbles_euler .or. elasticity) then
832 do i = 1, sys_size ! adv_idx%end
833 var_mok = int(i, mpi_offset_kind)
834 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
835
836 call mpi_file_set_view(ifile, disp, mpi_io_p, mpi_io_data%view(i), 'native', mpi_info_int, ierr)
837 call mpi_file_read(ifile, mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
838 end do
839 ! Read pb and mv for non-polytropic qbmm
840 if (qbmm .and. .not. polytropic) then
841 do i = sys_size + 1, sys_size + 2*nb*nnode
842 var_mok = int(i, mpi_offset_kind)
843 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
844
845 call mpi_file_set_view(ifile, disp, mpi_io_p, mpi_io_data%view(i), 'native', mpi_info_int, ierr)
846 call mpi_file_read(ifile, mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
847 end do
848 end if
849 else
850 do i = 1, sys_size
851 var_mok = int(i, mpi_offset_kind)
852
853 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
854
855 call mpi_file_set_view(ifile, disp, mpi_io_p, mpi_io_data%view(i), 'native', mpi_info_int, ierr)
856 call mpi_file_read_all(ifile, mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
857 end do
858 end if
859
860 call s_mpi_barrier()
861
862 call mpi_file_close(ifile, ierr)
863 else
864 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
865 end if
866 end if
867
868 deallocate (x_cb_glb, y_cb_glb, z_cb_glb)
869
870 if (bc_io) then
872 else
874 end if
875#endif
876
877 end subroutine s_read_parallel_data_files
878
879 !> Initialize internal-energy equations from phase mass, mixture momentum, and total energy
881
882 type(scalar_field), dimension(sys_size), intent(inout) :: v_vf
883 real(wp) :: rho
884 real(wp) :: dyn_pres
885 real(wp) :: gamma
886 real(wp) :: pi_inf
887 real(wp) :: qv
888 real(wp), dimension(2) :: re
889 real(wp) :: pres, t
890 integer :: i, j, k, l, c
891 real(wp), dimension(num_species) :: rhoyks
892 real(wp) :: pres_mag
893
894 pres_mag = 0._wp
895
896 t = dflt_t_guess
897
898 do j = 0, m
899 do k = 0, n
900 do l = 0, p
901 call s_convert_to_mixture_variables(v_vf, j, k, l, rho, gamma, pi_inf, qv, re)
902
903 dyn_pres = 0._wp
904 do i = mom_idx%beg, mom_idx%end
905 dyn_pres = dyn_pres + 5.e-1_wp*v_vf(i)%sf(j, k, l)*v_vf(i)%sf(j, k, l)/max(rho, sgm_eps)
906 end do
907
908 if (chemistry) then
909 do c = 1, num_species
910 rhoyks(c) = v_vf(chemxb + c - 1)%sf(j, k, l)
911 end do
912 end if
913
914 if (mhd) then
915 if (n == 0) then
916 pres_mag = 0.5_wp*(bx0**2 + v_vf(b_idx%beg)%sf(j, k, l)**2 + v_vf(b_idx%beg + 1)%sf(j, k, l)**2)
917 else
918 pres_mag = 0.5_wp*(v_vf(b_idx%beg)%sf(j, k, l)**2 + v_vf(b_idx%beg + 1)%sf(j, k, &
919 & l)**2 + v_vf(b_idx%beg + 2)%sf(j, k, l)**2)
920 end if
921 end if
922
923 call s_compute_pressure(v_vf(e_idx)%sf(j, k, l), 0._stp, dyn_pres, pi_inf, gamma, rho, qv, rhoyks, pres, t, &
924 & pres_mag=pres_mag)
925
926 do i = 1, num_fluids
927 v_vf(i + intxb - 1)%sf(j, k, l) = v_vf(i + advxb - 1)%sf(j, k, &
928 & l)*(gammas(i)*pres + pi_infs(i)) + v_vf(i + contxb - 1)%sf(j, k, l)*qvs(i)
929 end do
930 end do
931 end do
932 end do
933
935
936 !> Advance the simulation by one time step, handling CFL-based dt and time-stepper dispatch
937 impure subroutine s_perform_time_step(t_step, time_avg)
938
939 integer, intent(inout) :: t_step
940 real(wp), intent(inout) :: time_avg
941 integer :: i
942
943 if (cfl_dt) then
944 if (cfl_const_dt .and. t_step == 0) call s_compute_dt()
945
946 if (cfl_adap_dt) call s_compute_dt()
947
948 if (t_step == 0) dt_init = dt
949
950 if (dt < 1.e-3_wp*dt_init .and. cfl_adap_dt .and. proc_rank == 0) then
951 print *, "Delta t = ", dt
952 call s_mpi_abort("Delta t has become too small")
953 end if
954 end if
955
956 if (cfl_dt) then
957 if ((mytime + dt) >= t_stop) then
958 dt = t_stop - mytime
959
960# 632 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
961#if defined(MFC_OpenACC)
962# 632 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
963!$acc update device(dt)
964# 632 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
965#elif defined(MFC_OpenMP)
966# 632 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
967!$omp target update to(dt)
968# 632 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
969#endif
970 end if
971 else
972 if ((mytime + dt) >= finaltime) then
974
975# 637 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
976#if defined(MFC_OpenACC)
977# 637 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
978!$acc update device(dt)
979# 637 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
980#elif defined(MFC_OpenMP)
981# 637 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
982!$omp target update to(dt)
983# 637 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
984#endif
985 end if
986 end if
987
988 if (cfl_dt) then
989 if (proc_rank == 0 .and. mod(t_step - t_step_start, t_step_print) == 0) then
990 print '(" [", I3, "%] Time ", ES16.6, " dt = ", ES16.6, " @ Time Step = ", I8, " Time Avg = ", ES16.6, " Time/step = ", ES12.6, "")', &
991 & int(ceiling(100._wp*(mytime/t_stop))), mytime, dt, t_step, wall_time_avg, wall_time
992 end if
993 else
994 if (proc_rank == 0 .and. mod(t_step - t_step_start, t_step_print) == 0) then
995 print '(" [", I3, "%] Time step ", I8, " of ", I0, " @ t_step = ", I8, " Time Avg = ", ES12.6, " Time/step= ", ES12.6, "")', &
996 & int(ceiling(100._wp*(real(t_step - t_step_start)/(t_step_stop - t_step_start + 1)))), &
997 & t_step - t_step_start + 1, t_step_stop - t_step_start + 1, t_step, wall_time_avg, wall_time
998 end if
999 end if
1000
1001 if (probe_wrt) then
1002 do i = 1, sys_size
1003
1004# 656 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1005#if defined(MFC_OpenACC)
1006# 656 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1007!$acc update host(q_cons_ts(1)%vf(i)%sf)
1008# 656 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1009#elif defined(MFC_OpenMP)
1010# 656 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1011!$omp target update from(q_cons_ts(1)%vf(i)%sf)
1012# 656 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1013#endif
1014 end do
1015 end if
1016
1017 ! Total-variation-diminishing (TVD) Runge-Kutta (RK) time-steppers
1018 if (any(time_stepper == (/1, 2, 3/))) then
1019 call s_tvd_rk(t_step, time_avg, time_stepper)
1020 end if
1021
1022 ! Advance time after RK so source terms see current-step time
1023 mytime = mytime + dt
1024
1025 if (relax) call s_infinite_relaxation_k(q_cons_ts(1)%vf)
1026
1027 ! Time-stepping loop controls
1028 t_step = t_step + 1
1029
1030 end subroutine s_perform_time_step
1031
1032 !> Collect per-process wall-clock times and write aggregate performance metrics to file
1033 impure subroutine s_save_performance_metrics(time_avg, time_final, io_time_avg, io_time_final, proc_time, io_proc_time, &
1034
1035 & file_exists)
1036
1037 real(wp), intent(inout) :: time_avg, time_final
1038 real(wp), intent(inout) :: io_time_avg, io_time_final
1039 real(wp), dimension(:), intent(inout) :: proc_time
1040 real(wp), dimension(:), intent(inout) :: io_proc_time
1041 logical, intent(inout) :: file_exists
1042 real(wp) :: grind_time
1043
1044 call s_mpi_barrier()
1045
1046 if (num_procs > 1) then
1047 call mpi_bcast_time_step_values(proc_time, time_avg)
1048
1049 call mpi_bcast_time_step_values(io_proc_time, io_time_avg)
1050 end if
1051
1052 if (proc_rank == 0) then
1053 time_final = 0._wp
1054 io_time_final = 0._wp
1055 if (num_procs == 1) then
1056 time_final = time_avg
1057 io_time_final = io_time_avg
1058 else
1059 time_final = maxval(proc_time)
1060 io_time_final = maxval(io_proc_time)
1061 end if
1062
1063 grind_time = time_final*1.0e9_wp/(real(sys_size, wp)*real(maxval((/1, m_glb/)), wp)*real(maxval((/1, n_glb/)), &
1064 & wp)*real(maxval((/1, p_glb/)), wp))
1065
1066 print *, "Performance:", grind_time, "ns/gp/eq/rhs"
1067 inquire (file='time_data.dat', exist=file_exists)
1068 if (file_exists) then
1069 open (1, file='time_data.dat', position='append', status='old')
1070 else
1071 open (1, file='time_data.dat', status='new')
1072 write (1, '(A10, A15, A15)') "Ranks", "s/step", "ns/gp/eq/rhs"
1073 end if
1074
1075 write (1, '(I10, 2(F15.8))') num_procs, time_final, grind_time
1076
1077 close (1)
1078
1079 inquire (file='io_time_data.dat', exist=file_exists)
1080 if (file_exists) then
1081 open (1, file='io_time_data.dat', position='append', status='old')
1082 else
1083 open (1, file='io_time_data.dat', status='new')
1084 write (1, '(A10, A15)') "Ranks", "s/step"
1085 end if
1086
1087 write (1, '(I10, F15.8)') num_procs, io_time_final
1088 close (1)
1089 end if
1090
1091 end subroutine s_save_performance_metrics
1092
1093 !> Save conservative variable data to disk at the current time step
1094 impure subroutine s_save_data(t_step, start, finish, io_time_avg, nt)
1095
1096 integer, intent(inout) :: t_step
1097 real(wp), intent(inout) :: start, finish, io_time_avg
1098 integer, intent(inout) :: nt
1099 integer(kind=8) :: i, j, k, l
1100 integer :: stor
1101 integer :: save_count
1102
1103 if (down_sample) then
1105 end if
1106
1107 stor = 1
1108
1109 if (time_stepper /= 1) then
1110
1111# 753 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1112
1113# 753 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1114#if defined(MFC_OpenACC)
1115# 753 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1116!$acc parallel loop collapse(4) gang vector default(present) copyin(idwbuff)
1117# 753 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1118#elif defined(MFC_OpenMP)
1119# 753 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1120
1121# 753 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1122
1123# 753 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1124
1125# 753 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1126!$omp target teams loop defaultmap(firstprivate:scalar) bind(teams,parallel) collapse(4) defaultmap(tofrom:aggregate) defaultmap(tofrom:allocatable) defaultmap(tofrom:pointer) map(to:idwbuff)
1127# 753 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1128#endif
1129 do i = 1, sys_size
1130 do l = idwbuff(3)%beg, idwbuff(3)%end
1131 do k = idwbuff(2)%beg, idwbuff(2)%end
1132 do j = idwbuff(1)%beg, idwbuff(1)%end
1133 q_cons_ts(2)%vf(i)%sf(j, k, l) = q_cons_ts(1)%vf(i)%sf(j, k, l)
1134 end do
1135 end do
1136 end do
1137 end do
1138
1139# 763 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1140#if defined(MFC_OpenACC)
1141# 763 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1142!$acc end parallel loop
1143# 763 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1144#elif defined(MFC_OpenMP)
1145# 763 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1146
1147# 763 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1148!$omp end target teams loop
1149# 763 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1150#endif
1151 stor = 2
1152 end if
1153
1154 call cpu_time(start)
1155 call nvtxstartrange("SAVE-DATA")
1156 do i = 1, sys_size
1157#ifndef FRONTIER_UNIFIED
1158
1159# 771 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1160#if defined(MFC_OpenACC)
1161# 771 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1162!$acc update host(q_cons_ts(stor)%vf(i)%sf)
1163# 771 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1164#elif defined(MFC_OpenMP)
1165# 771 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1166!$omp target update from(q_cons_ts(stor)%vf(i)%sf)
1167# 771 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1168#endif
1169#endif
1170 do l = 0, p
1171 do k = 0, n
1172 do j = 0, m
1173 if (ieee_is_nan(real(q_cons_ts(stor)%vf(i)%sf(j, k, l), kind=wp))) then
1174 print *, "NaN(s) in timestep output.", j, k, l, i, proc_rank, t_step, m, n, p
1175 call s_mpi_abort("NaN(s) in timestep output.")
1176 end if
1177 end do
1178 end do
1179 end do
1180 end do
1181
1182 if (qbmm .and. .not. polytropic) then
1183
1184# 786 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1185#if defined(MFC_OpenACC)
1186# 786 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1187!$acc update host(pb_ts(1)%sf)
1188# 786 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1189#elif defined(MFC_OpenMP)
1190# 786 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1191!$omp target update from(pb_ts(1)%sf)
1192# 786 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1193#endif
1194
1195# 787 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1196#if defined(MFC_OpenACC)
1197# 787 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1198!$acc update host(mv_ts(1)%sf)
1199# 787 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1200#elif defined(MFC_OpenMP)
1201# 787 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1202!$omp target update from(mv_ts(1)%sf)
1203# 787 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1204#endif
1205 end if
1206
1207 if (cfl_dt) then
1208 save_count = int(mytime/t_save)
1209 else
1210 save_count = t_step
1211 end if
1212
1213 if (bubbles_lagrange) then
1214
1215# 797 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1216#if defined(MFC_OpenACC)
1217# 797 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1218!$acc update host(lag_id, mtn_pos, mtn_posPrev, mtn_vel, intfc_rad, intfc_vel, bub_R0, Rmax_stats, Rmin_stats, bub_dphidt, gas_p, gas_mv, gas_mg, gas_betaT, gas_betaC)
1219# 797 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1220#elif defined(MFC_OpenMP)
1221# 797 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1222!$omp target update from(lag_id, mtn_pos, mtn_posPrev, mtn_vel, intfc_rad, intfc_vel, bub_R0, Rmax_stats, Rmin_stats, bub_dphidt, gas_p, gas_mv, gas_mg, gas_betaT, gas_betaC)
1223# 797 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1224#endif
1225# 799 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1226 do i = 1, nbubs
1227 if (ieee_is_nan(intfc_rad(i, 1)) .or. intfc_rad(i, 1) <= 0._wp) then
1228 call s_mpi_abort("Bubble radius is negative or NaN, please reduce dt.")
1229 end if
1230 end do
1231
1232
1233# 805 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1234#if defined(MFC_OpenACC)
1235# 805 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1236!$acc update host(q_beta(1)%sf)
1237# 805 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1238#elif defined(MFC_OpenMP)
1239# 805 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1240!$omp target update from(q_beta(1)%sf)
1241# 805 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1242#endif
1243 call s_write_data_files(q_cons_ts(stor)%vf, q_t_sf, q_prim_vf, save_count, bc_type, q_beta(1))
1244
1245# 807 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1246#if defined(MFC_OpenACC)
1247# 807 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1248!$acc update host(Rmax_stats, Rmin_stats, gas_p, gas_mv, intfc_vel)
1249# 807 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1250#elif defined(MFC_OpenMP)
1251# 807 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1252!$omp target update from(Rmax_stats, Rmin_stats, gas_p, gas_mv, intfc_vel)
1253# 807 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1254#endif
1255 call s_write_restart_lag_bubbles(save_count) ! parallel
1256 if (lag_params%write_bubbles_stats) call s_write_lag_bubble_stats()
1257 else
1258 call s_write_data_files(q_cons_ts(stor)%vf, q_t_sf, q_prim_vf, save_count, bc_type)
1259 end if
1260
1261 call nvtxendrange
1262 call cpu_time(finish)
1263 if (cfl_dt) then
1264 nt = mytime/t_save
1265 else
1266 nt = int((t_step - t_step_start)/(t_step_save))
1267 end if
1268
1269 if (nt == 1) then
1270 io_time_avg = abs(finish - start)
1271 else
1272 io_time_avg = (abs(finish - start) + io_time_avg*(nt - 1))/nt
1273 end if
1274
1275 end subroutine s_save_data
1276
1277 !> Initialize all simulation sub-modules in the required dependency order
1278 impure subroutine s_initialize_modules
1279
1280 integer :: m_ds, n_ds, p_ds
1281 integer :: i, j, k, l, x_id, y_id, z_id, ix, iy, iz
1282 real(wp) :: temp1, temp2, temp3, temp4
1283
1285# 848 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1286 if (bubbles_euler .or. bubbles_lagrange) then
1288 end if
1292 if (grid_geometry == 3) call s_initialize_fftw_module()
1293
1295 if (ib) call s_initialize_ibm_module()
1296 if (qbmm) call s_initialize_qbmm_module()
1297
1298 if (acoustic_source) then
1300 end if
1301
1302 if (viscous .and. (.not. igr)) then
1304 end if
1305
1307
1309
1311
1315
1317
1318 if (down_sample) then
1319 m_ds = int((m + 1)/3) - 1
1320 n_ds = int((n + 1)/3) - 1
1321 p_ds = int((p + 1)/3) - 1
1322
1323 allocate (q_cons_temp(1:sys_size))
1324 do i = 1, sys_size
1325 allocate (q_cons_temp(i)%sf(-1:m_ds + 1,-1:n_ds + 1,-1:p_ds + 1))
1326 end do
1327 end if
1328
1329 if (down_sample) then
1332 do i = 1, sys_size
1333
1334# 895 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1335#if defined(MFC_OpenACC)
1336# 895 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1337!$acc update device(q_cons_ts(1)%vf(i)%sf)
1338# 895 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1339#elif defined(MFC_OpenMP)
1340# 895 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1341!$omp target update to(q_cons_ts(1)%vf(i)%sf)
1342# 895 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1343#endif
1344 end do
1345 do i = 1, sys_size
1346 deallocate (q_cons_temp(i)%sf)
1347 end do
1348 deallocate (q_cons_temp)
1349 else
1350 call s_read_data_files(q_cons_ts(1)%vf)
1351 end if
1352
1354
1356 if (ib) then
1357 call s_ibm_setup()
1358 call s_write_ib_data_file(0)
1359 end if
1362
1363 ! Initialize the Temperature cache.
1365
1366 ! Computation of parameters, allocation of memory, association of pointers, and/or execution of any other tasks that are
1367 ! needed to properly configure the modules. The preparations below DO DEPEND on the grid being complete.
1368 if (igr .or. dummy) then
1370 end if
1371 if (.not. igr .or. dummy) then
1372 if (recon_type == weno_type) then
1374 else if (recon_type == muscl_type) then
1376 end if
1379 end if
1380
1383
1386
1387 end subroutine s_initialize_modules
1388
1389 !> Set up the MPI execution environment, bind GPUs, and decompose the computational domain
1390 impure subroutine s_initialize_mpi_domain
1391
1392 integer :: ierr
1393
1394#ifdef MFC_GPU
1395 real(wp) :: starttime, endtime
1396 integer :: num_devices, local_size, num_nodes, ppn, my_device_num
1397 integer :: dev, devnum, local_rank
1398#ifdef MFC_MPI
1399 integer :: local_comm
1400#endif
1401#if defined(MFC_OpenACC)
1402 integer(acc_device_kind) :: devtype
1403#endif
1404#endif
1405
1406 call s_mpi_initialize()
1407
1408#ifdef MFC_GPU
1409#ifndef MFC_MPI
1410 local_size = 1
1411 local_rank = 0
1412#else
1413 call mpi_comm_split_type(mpi_comm_world, mpi_comm_type_shared, 0, mpi_info_null, local_comm, ierr)
1414 call mpi_comm_size(local_comm, local_size, ierr)
1415 call mpi_comm_rank(local_comm, local_rank, ierr)
1416#endif
1417#if defined(MFC_OpenACC)
1418 devtype = acc_get_device_type()
1419 devnum = acc_get_num_devices(devtype)
1420 dev = mod(local_rank, devnum)
1421
1422 call acc_set_device_num(dev, devtype)
1423#elif defined(MFC_OpenMP)
1424 devnum = omp_get_num_devices()
1425 dev = mod(local_rank, devnum)
1426 call omp_set_default_device(dev)
1427#endif
1428#endif
1429
1430 if (proc_rank == 0) then
1432 call s_read_input_file()
1433 call s_check_input_file()
1434
1435 print '(" Simulating a ", A, " ", I0, "x", I0, "x", I0, " case on ", I0, " rank(s) ", A, ".")', &
1436# 989 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1437 "regular", &
1438# 993 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1439 m, n, p, num_procs, &
1440#if defined(MFC_OpenACC)
1441 "with OpenACC offloading"
1442#elif defined(MFC_OpenMP)
1443 "with OpenMP offloading"
1444#else
1445 "on CPUs"
1446#endif
1447 end if
1448
1450
1452
1454
1455 end subroutine s_initialize_mpi_domain
1456
1457 !> Transfer initial conservative variable and model parameter data to the GPU device
1459
1460 integer :: i
1461
1462 if (.not. down_sample) then
1463 do i = 1, sys_size
1464
1465# 1018 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1466#if defined(MFC_OpenACC)
1467# 1018 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1468!$acc update device(q_cons_ts(1)%vf(i)%sf)
1469# 1018 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1470#elif defined(MFC_OpenMP)
1471# 1018 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1472!$omp target update to(q_cons_ts(1)%vf(i)%sf)
1473# 1018 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1474#endif
1475 end do
1476 end if
1477
1478 if (qbmm .and. .not. polytropic) then
1479
1480# 1023 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1481#if defined(MFC_OpenACC)
1482# 1023 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1483!$acc update device(pb_ts(1)%sf, mv_ts(1)%sf)
1484# 1023 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1485#elif defined(MFC_OpenMP)
1486# 1023 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1487!$omp target update to(pb_ts(1)%sf, mv_ts(1)%sf)
1488# 1023 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1489#endif
1490 end if
1491 if (chemistry) then
1492
1493# 1026 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1494#if defined(MFC_OpenACC)
1495# 1026 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1496!$acc update device(q_T_sf%sf)
1497# 1026 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1498#elif defined(MFC_OpenMP)
1499# 1026 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1500!$omp target update to(q_T_sf%sf)
1501# 1026 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1502#endif
1503 end if
1504
1505
1506# 1029 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1507#if defined(MFC_OpenACC)
1508# 1029 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1509!$acc update device(chem_params)
1510# 1029 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1511#elif defined(MFC_OpenMP)
1512# 1029 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1513!$omp target update to(chem_params)
1514# 1029 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1515#endif
1516
1517
1518# 1031 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1519#if defined(MFC_OpenACC)
1520# 1031 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1521!$acc update device(R0ref, p0ref, rho0ref, ss, pv, vd, mu_l, mu_v, mu_g, gam_v, gam_g, M_v, M_g, R_v, R_g, Tw, cp_v, cp_g, k_vl, k_gl, gam, gam_m, Eu, Ca, Web, Re_inv, Pe_c, phi_vg, phi_gv, omegaN, bubbles_euler, polytropic, polydisperse, qbmm, ptil, bubble_model, thermal, poly_sigma, adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters, n_idx, pi_fac, low_Mach)
1522# 1031 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1523#elif defined(MFC_OpenMP)
1524# 1031 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1525!$omp target update to(R0ref, p0ref, rho0ref, ss, pv, vd, mu_l, mu_v, mu_g, gam_v, gam_g, M_v, M_g, R_v, R_g, Tw, cp_v, cp_g, k_vl, k_gl, gam, gam_m, Eu, Ca, Web, Re_inv, Pe_c, phi_vg, phi_gv, omegaN, bubbles_euler, polytropic, polydisperse, qbmm, ptil, bubble_model, thermal, poly_sigma, adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters, n_idx, pi_fac, low_Mach)
1526# 1031 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1527#endif
1528# 1035 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1529
1530 if (bubbles_euler) then
1531
1532# 1037 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1533#if defined(MFC_OpenACC)
1534# 1037 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1535!$acc update device(weight, R0)
1536# 1037 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1537#elif defined(MFC_OpenMP)
1538# 1037 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1539!$omp target update to(weight, R0)
1540# 1037 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1541#endif
1542 if (.not. polytropic) then
1543
1544# 1039 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1545#if defined(MFC_OpenACC)
1546# 1039 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1547!$acc update device(pb0, Pe_T, k_g, k_v, mass_g0, mass_v0, Re_trans_T, Re_trans_c, Im_trans_T, Im_trans_c)
1548# 1039 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1549#elif defined(MFC_OpenMP)
1550# 1039 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1551!$omp target update to(pb0, Pe_T, k_g, k_v, mass_g0, mass_v0, Re_trans_T, Re_trans_c, Im_trans_T, Im_trans_c)
1552# 1039 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1553#endif
1554 else if (qbmm) then
1555
1556# 1041 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1557#if defined(MFC_OpenACC)
1558# 1041 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1559!$acc update device(pb0)
1560# 1041 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1561#elif defined(MFC_OpenMP)
1562# 1041 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1563!$omp target update to(pb0)
1564# 1041 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1565#endif
1566 end if
1567 end if
1568
1569
1570# 1045 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1571#if defined(MFC_OpenACC)
1572# 1045 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1573!$acc update device(adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters, n_idx, pi_fac, low_Mach)
1574# 1045 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1575#elif defined(MFC_OpenMP)
1576# 1045 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1577!$omp target update to(adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters, n_idx, pi_fac, low_Mach)
1578# 1045 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1579#endif
1580
1581
1582# 1047 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1583#if defined(MFC_OpenACC)
1584# 1047 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1585!$acc update device(acoustic_source, num_source)
1586# 1047 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1587#elif defined(MFC_OpenMP)
1588# 1047 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1589!$omp target update to(acoustic_source, num_source)
1590# 1047 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1591#endif
1592
1593# 1048 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1594#if defined(MFC_OpenACC)
1595# 1048 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1596!$acc update device(sigma, surface_tension)
1597# 1048 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1598#elif defined(MFC_OpenMP)
1599# 1048 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1600!$omp target update to(sigma, surface_tension)
1601# 1048 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1602#endif
1603
1604
1605# 1050 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1606#if defined(MFC_OpenACC)
1607# 1050 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1608!$acc update device(dx, dy, dz, x_cb, x_cc, y_cb, y_cc, z_cb, z_cc)
1609# 1050 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1610#elif defined(MFC_OpenMP)
1611# 1050 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1612!$omp target update to(dx, dy, dz, x_cb, x_cc, y_cb, y_cc, z_cb, z_cc)
1613# 1050 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1614#endif
1615
1616# 1051 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1617#if defined(MFC_OpenACC)
1618# 1051 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1619!$acc update device(bc_x%vb1, bc_x%vb2, bc_x%vb3, bc_x%ve1, bc_x%ve2, bc_x%ve3)
1620# 1051 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1621#elif defined(MFC_OpenMP)
1622# 1051 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1623!$omp target update to(bc_x%vb1, bc_x%vb2, bc_x%vb3, bc_x%ve1, bc_x%ve2, bc_x%ve3)
1624# 1051 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1625#endif
1626
1627# 1052 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1628#if defined(MFC_OpenACC)
1629# 1052 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1630!$acc update device(bc_y%vb1, bc_y%vb2, bc_y%vb3, bc_y%ve1, bc_y%ve2, bc_y%ve3)
1631# 1052 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1632#elif defined(MFC_OpenMP)
1633# 1052 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1634!$omp target update to(bc_y%vb1, bc_y%vb2, bc_y%vb3, bc_y%ve1, bc_y%ve2, bc_y%ve3)
1635# 1052 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1636#endif
1637
1638# 1053 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1639#if defined(MFC_OpenACC)
1640# 1053 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1641!$acc update device(bc_z%vb1, bc_z%vb2, bc_z%vb3, bc_z%ve1, bc_z%ve2, bc_z%ve3)
1642# 1053 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1643#elif defined(MFC_OpenMP)
1644# 1053 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1645!$omp target update to(bc_z%vb1, bc_z%vb2, bc_z%vb3, bc_z%ve1, bc_z%ve2, bc_z%ve3)
1646# 1053 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1647#endif
1648
1649
1650# 1055 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1651#if defined(MFC_OpenACC)
1652# 1055 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1653!$acc update device(bc_x%grcbc_in, bc_x%grcbc_out, bc_x%grcbc_vel_out)
1654# 1055 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1655#elif defined(MFC_OpenMP)
1656# 1055 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1657!$omp target update to(bc_x%grcbc_in, bc_x%grcbc_out, bc_x%grcbc_vel_out)
1658# 1055 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1659#endif
1660
1661# 1056 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1662#if defined(MFC_OpenACC)
1663# 1056 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1664!$acc update device(bc_y%grcbc_in, bc_y%grcbc_out, bc_y%grcbc_vel_out)
1665# 1056 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1666#elif defined(MFC_OpenMP)
1667# 1056 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1668!$omp target update to(bc_y%grcbc_in, bc_y%grcbc_out, bc_y%grcbc_vel_out)
1669# 1056 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1670#endif
1671
1672# 1057 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1673#if defined(MFC_OpenACC)
1674# 1057 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1675!$acc update device(bc_z%grcbc_in, bc_z%grcbc_out, bc_z%grcbc_vel_out)
1676# 1057 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1677#elif defined(MFC_OpenMP)
1678# 1057 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1679!$omp target update to(bc_z%grcbc_in, bc_z%grcbc_out, bc_z%grcbc_vel_out)
1680# 1057 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1681#endif
1682
1683
1684# 1059 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1685#if defined(MFC_OpenACC)
1686# 1059 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1687!$acc update device(relax, relax_model)
1688# 1059 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1689#elif defined(MFC_OpenMP)
1690# 1059 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1691!$omp target update to(relax, relax_model)
1692# 1059 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1693#endif
1694 if (relax) then
1695
1696# 1061 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1697#if defined(MFC_OpenACC)
1698# 1061 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1699!$acc update device(palpha_eps, ptgalpha_eps)
1700# 1061 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1701#elif defined(MFC_OpenMP)
1702# 1061 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1703!$omp target update to(palpha_eps, ptgalpha_eps)
1704# 1061 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1705#endif
1706 end if
1707
1708 if (ib) then
1709
1710# 1065 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1711#if defined(MFC_OpenACC)
1712# 1065 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1713!$acc update device(ib_markers%sf)
1714# 1065 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1715#elif defined(MFC_OpenMP)
1716# 1065 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1717!$omp target update to(ib_markers%sf)
1718# 1065 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1719#endif
1720 end if
1721# 1068 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1722
1723# 1068 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1724#if defined(MFC_OpenACC)
1725# 1068 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1726!$acc update device(igr, nb, igr_order)
1727# 1068 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1728#elif defined(MFC_OpenMP)
1729# 1068 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1730!$omp target update to(igr, nb, igr_order)
1731# 1068 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1732#endif
1733# 1070 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1734# 1078 "/home/runner/work/MFC/MFC/src/simulation/m_start_up.fpp"
1735
1736 end subroutine s_initialize_gpu_vars
1737
1738 !> Finalize and deallocate all simulation sub-modules in reverse initialization order
1739 impure subroutine s_finalize_modules
1740
1747 if (igr) then
1749 else
1752 if (recon_type == weno_type) then
1754 else if (recon_type == muscl_type) then
1756 end if
1757 end if
1759 if (grid_geometry == 3) call s_finalize_fftw_module
1765 if (viscous .and. (.not. igr)) then
1767 end if
1769
1772
1773 call s_mpi_finalize()
1774
1775 end subroutine s_finalize_modules
1776
1777end module m_start_up
type(scalar_field), dimension(sys_size), intent(inout) q_cons_vf
One-way acoustic source injection, Maeda and Colonius JCP (2017).
impure subroutine, public s_precalculate_acoustic_spatial_sources
Pre-compute non-zero spatial source weights before time-stepping.
impure subroutine, public s_initialize_acoustic_src
Initialize the acoustic source module.
Computes gravitational and user-defined body force source terms for the momentum equations.
impure subroutine, public s_initialize_body_forces_module
Initialize the body forces module.
impure subroutine, public s_finalize_body_forces_module
Finalize the body forces module.
Noncharacteristic and processor boundary condition application for ghost cells and buffer regions.
impure subroutine, public s_initialize_boundary_common_module()
Allocate and set up boundary condition buffer arrays for all coordinate directions.
subroutine, public s_finalize_boundary_common_module()
Deallocate boundary condition buffer arrays allocated during module initialization.
impure subroutine, public s_populate_variables_buffers(bc_type, q_prim_vf, pb_in, mv_in)
Populate the buffers of the primitive variables based on the selected boundary conditions.
subroutine, public s_read_parallel_boundary_condition_files(bc_type)
Read boundary condition type and buffer data from per-rank parallel files using MPI I/O.
subroutine, public s_populate_grid_variables_buffers
Populate the buffers of the grid variables, which are constituted of the cell-boundary locations and ...
subroutine, public s_read_serial_boundary_condition_files(step_dirpath, bc_type)
Read boundary condition type and buffer data from serial (unformatted) restart files.
subroutine, public s_assign_default_bc_type(bc_type)
Initialize the per-cell boundary condition type arrays with the global default BC values.
Computes ensemble-averaged (Euler–Euler) bubble source terms for radius, velocity,...
impure subroutine s_initialize_bubbles_ee_module
Initialize the Euler-Euler bubble module.
Tracks Lagrangian bubbles and couples their dynamics to the Eulerian flow via volume averaging.
impure subroutine s_write_lag_bubble_stats()
Write the maximum and minimum radius statistics for each bubble.
impure subroutine s_write_restart_lag_bubbles(t_step)
Write restart files for the Lagrangian bubble solver.
integer nbubs
Number of bubbles in the local domain.
impure subroutine s_initialize_bubbles_el_module(q_cons_vf)
Initializes the lagrangian subgrid bubble solver.
type(scalar_field), dimension(:), allocatable q_beta
Projection of the lagrangian particles in the Eulerian framework.
real(wp), dimension(:,:), allocatable intfc_rad
Bubble radius.
impure subroutine s_finalize_lagrangian_solver()
Finalize the Lagrangian bubble solver.
Characteristic boundary conditions (CBC) for slip walls, non-reflecting subsonic inflow/outflow,...
impure subroutine, public s_initialize_cbc_module
Initialize the CBC module.
impure subroutine, public s_finalize_cbc_module
Module deallocation and/or disassociation procedures.
Shared input validation checks for grid dimensions and AMD GPU compiler limits.
impure subroutine, public s_check_inputs_common
Checks compatibility of parameters in the input file. Used by all three stages.
Validates simulation input parameters for consistency and supported configurations.
impure subroutine, public s_check_inputs
Checks compatibility of parameters in the input file. Used by the simulation stage.
Multi-species chemistry interface for thermodynamic properties, reaction rates, and transport coeffic...
subroutine s_compute_q_t_sf(q_t_sf, q_cons_vf, bounds)
Initialize the temperature field from conservative variables by inverting the energy equation.
Platform-specific file and directory operations: create, delete, inquire, getcwd, and basename.
impure subroutine my_inquire(fileloc, dircheck)
Inquires on the existence of a directory.
Writes solution data, run-time stability diagnostics (ICFL, VCFL, CCFL, Rc), and probe/center-of-mass...
impure subroutine, public s_initialize_data_output_module
Initialize the data output module.
impure subroutine, public s_finalize_data_output_module
Module deallocation and/or disassociation procedures.
impure subroutine, public s_write_data_files(q_cons_vf, q_t_sf, q_prim_vf, t_step, bc_type, beta)
Write data files. Dispatch subroutine that replaces procedure pointer.
subroutine, public s_write_ib_data_file(time_step)
Dispatch immersed boundary data output to the serial or parallel writer.
Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures.
Derives diagnostic flow quantities (vorticity, speed of sound, numerical Schlieren,...
impure subroutine, public s_initialize_derived_variables
Allocate and open derived variables. Computing FD coefficients.
impure subroutine, public s_initialize_derived_variables_module
Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the...
impure subroutine, public s_finalize_derived_variables_module
Deallocation procedures for the module.
Global parameters for the computational domain, fluid properties, and simulation algorithm configurat...
real(wp) mytime
Current simulation time.
logical null_weights
Null undesired WENO weights.
logical bubbles_euler
Bubbles euler on/off.
real(wp) cont_damage_s
Exponent s for continuum damage modeling.
integer wave_speeds
Wave speeds estimation method.
logical cont_damage
Continuum damage modeling.
logical igr
Use information geometric regularization.
logical hypoelasticity
hypoelasticity modeling
impure subroutine s_assign_default_values_to_user_inputs
Assigns default values to the user inputs before reading them in. This enables for an easier consiste...
impure subroutine s_finalize_global_parameters_module
Module deallocation and/or disassociation procedures.
integer thermal
Thermal behavior. 1 = adiabatic, 2 = isotherm, 3 = transfer.
integer avg_state
Average state evaluation method.
logical weno_avg
Average left/right cell-boundary states.
type(int_bounds_info), dimension(1:3) idwint
real(wp), dimension(:), allocatable, target z_cb
integer recon_type
Reconstruction Type.
logical igr_pres_lim
Limit to positive pressures for IGR.
logical, parameter chemistry
Chemistry modeling.
logical acoustic_source
Acoustic source switch.
type(ib_patch_parameters), dimension(num_patches_max) patch_ib
Immersed boundary patch parameters.
type(int_bounds_info) mom_idx
Indexes of first & last momentum eqns.
integer num_fluids
number of fluids in the simulation
logical polydisperse
Polydisperse bubbles.
type(bubbles_lagrange_parameters) lag_params
Lagrange bubbles' parameters.
integer proc_rank
Rank of the local processor.
real(wp) hyper_cleaning_tau
Hyperbolic cleaning tau.
logical mixture_err
Mixture properties correction.
logical adap_dt
Adaptive step size control.
logical weno_re_flux
WENO reconstruct velocity gradients for viscous stress tensor.
real(wp) hyper_cleaning_speed
Hyperbolic cleaning wave speed (c_h).
integer t_step_print
Number of time-steps between printouts.
logical dummy
AMDFlang workaround for case-optimization + GPU-kernel bug.
real(wp) poly_sigma
log normal sigma for polydisperse PDF
character(len=name_len) mpiiofs
integer, dimension(:), allocatable start_idx
Starting cell-center index of local processor in global grid.
type(vec3_dt), dimension(num_probes_max) probe
integer sys_size
Number of unknowns in system of eqns.
integer muscl_order
Order of the MUSCL reconstruction.
logical alt_soundspeed
Alternate mixture sound speed.
real(wp) ptgalpha_eps
trigger parameter for the pTg relaxation procedure, phase change model
integer relax_model
Relaxation model.
integer t_step_old
Existing IC/grid folder.
logical viscous
Viscous effects.
logical run_time_info
Run-time output flag.
type(int_bounds_info) b_idx
Indexes of first and last magnetic field eqns.
real(wp) wenoz_q
Power constant for WENO-Z.
integer riemann_solver
Riemann solver algorithm.
type(int_bounds_info), dimension(1:3) idwbuff
logical int_comp
THINC interface compression.
real(wp) re_inv
Inverse Reynolds number.
real(wp) ic_eps
THINC Epsilon to compress on surface cells.
integer model_eqns
Multicomponent flow model.
integer precision
Precision of output files.
logical hyperelasticity
hyperelasticity modeling
real(wp) k_y
amplitude, frequency, and phase shift sinusoid in each direction
type(physical_parameters), dimension(num_fluids_max) fluid_pp
Stiffened gas EOS parameters and Reynolds numbers per fluid.
real(wp) alf_factor
alpha factor for IGR
impure subroutine s_initialize_global_parameters_module
Initialize the global parameters module.
real(wp), dimension(:), allocatable, target y_cc
type(pres_field), dimension(:), allocatable pb_ts
type(pres_field), dimension(:), allocatable mv_ts
type(chemistry_parameters) chem_params
integer fd_order
Finite-difference order for CoM and flow probe derivatives.
logical bubbles_lagrange
Lagrangian subgrid bubble model switch.
real(wp) ca
Cavitation number.
real(wp) alpha_bar
Damage rate factor for continuum damage modeling.
logical polytropic
Polytropic switch.
logical bf_z
body force toggle in three directions
logical mp_weno
Monotonicity preserving (MP) WENO.
real(wp), dimension(:), allocatable, target z_cc
logical relax
activate phase change
logical qbmm
Quadrature moment method.
real(wp) pi_fac
Factor for artificial pi_inf.
logical hyper_cleaning
Hyperbolic cleaning for MHD for divB=0.
integer adap_dt_max_iters
Maximum number of iterations.
real(wp) ic_beta
THINC Sharpness Parameter.
real(wp) bx0
Constant magnetic field in the x-direction (1D).
integer num_source
Number of acoustic sources.
real(wp), dimension(:), allocatable qvs
real(wp), dimension(:), allocatable pi_infs
logical adv_n
Solve the number density equation and compute alpha from number density.
integer num_procs
Number of processors.
character(len=path_len) case_dir
Case folder location.
real(wp) weno_eps
Binding for the WENO nonlinear weights.
integer weno_order
Order of the WENO reconstruction.
logical mhd
Magnetohydrodynamics.
real(wp), dimension(:), allocatable, target x_cc
type(acoustic_parameters), dimension(num_probes_max) acoustic
Acoustic source parameters.
real(wp) tau_star
Stress threshold for continuum damage modeling.
logical parallel_io
Format of the data files.
type(integral_parameters), dimension(num_probes_max) integral
real(wp), dimension(:), allocatable, target y_cb
real(wp) adap_dt_tol
Tolerance to control adaptive step size.
integer e_idx
Index of energy equation.
type(cell_num_bounds) cells_bounds
logical down_sample
down sample the output files
type(mpi_io_airfoil_ib_var), public mpi_io_airfoil_ib_data
logical nv_uvm_out_of_core
Enable out-of-core storage of q_cons_ts(2) in timestepping (default FALSE).
logical file_per_process
shared file or not when using parallel io
real(wp) palpha_eps
trigger parameter for the p relaxation procedure, phase change model
integer num_igr_warm_start_iters
number of warm start iterations for elliptic solve
integer nv_uvm_igr_temps_on_gpu
0 => jac, jac_rhs, and jac_old on CPU
logical elasticity
elasticity modeling, true for hyper or hypo
integer nb
Number of eq. bubble sizes.
type(mpi_io_var), public mpi_io_data
impure subroutine s_initialize_parallel_io
Initializes parallel infrastructure.
logical mpp_lim
Mixture physical parameters (MPP) limits.
integer num_igr_iters
number of iterations for elliptic solve
real(wp) teno_ct
Smoothness threshold for TENO.
integer low_mach
Low Mach number fix to HLLC Riemann solver.
integer igr_order
Reconstruction order for IGR.
logical teno
TENO (Targeted ENO).
real(wp), dimension(:), allocatable, target dy
real(wp) dt
Size of the time-step.
type(subgrid_bubble_physical_parameters) bub_pp
integer time_stepper
Time-stepper algorithm.
logical relativity
Relativity (only for MHD).
logical nv_uvm_pref_gpu
Enable explicit gpu memory hints (default FALSE).
real(wp), dimension(:), allocatable gammas
integer bubble_model
Gilmore or Keller–Miksis bubble model.
real(wp) finaltime
Final simulation time.
real(wp), dimension(:), allocatable, target dz
real(wp), dimension(:), allocatable, target dx
logical mapped_weno
WENO-M (WENO with mapping of nonlinear weights).
integer igr_iter_solver
IGR elliptic solver.
integer muscl_lim
MUSCL Limiter.
real(wp), dimension(:), allocatable, target x_cb
Basic floating-point utilities: approximate equality, default detection, and coordinate bounds.
elemental subroutine, public s_update_cell_bounds(bounds, m, n, p)
Updates 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...
subroutine, public s_upsample_data(q_cons_vf, q_cons_temp)
Upsample conservative variable fields from a coarsened grid back to the original resolution using int...
impure subroutine, public s_initialize_bubbles_model()
Initialize bubble model arrays for Euler or Lagrangian bubbles with polytropic or non-polytropic gas.
elemental subroutine, public s_int_to_str(i, res)
Convert an integer to its trimmed string representation.
Computes the left Cauchy–Green deformation tensor and hyperelastic stress source terms.
impure subroutine, public s_finalize_hyperelastic_module()
Finalize the hyperelastic module.
impure subroutine, public s_initialize_hyperelastic_module
Initialize the hyperelastic module.
Computes hypoelastic stress-rate source terms and damage-state evolution.
impure subroutine, public s_initialize_hypoelastic_module
Initialize the hypoelastic module.
impure subroutine, public s_finalize_hypoelastic_module()
Finalize the hypoelastic module.
Ghost-node immersed boundary method: locates ghost/image points, computes interpolation coefficients,...
impure subroutine, public s_ibm_setup()
Initializes the values of various IBM variables, such as ghost points and image points.
type(integer_field), public ib_markers
impure subroutine, public s_initialize_ibm_module()
Allocates memory for the variables in the IBM module.
Iterative ghost rasterization (IGR) for sharp immersed boundary treatment.
subroutine, public s_initialize_igr_module()
Initialize the IGR module.
integer(kind=8) j
integer(kind=8) i
integer(kind=8) l
integer(kind=8) r
integer(kind=8) k
subroutine, public s_finalize_igr_module()
Finalize the IGR module.
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_initialize_mpi_common_module
Initialize the module.
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_initialize_mpi_data(q_cons_vf, ib_markers, beta)
Set up MPI I/O data views and variable pointers for parallel file output.
impure subroutine s_mpi_finalize
The subroutine finalizes the MPI execution environment.
subroutine s_initialize_mpi_data_ds(q_cons_vf)
Set up MPI I/O data views for downsampled (coarsened) parallel file output.
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_finalize_mpi_common_module
Module deallocation and/or disassociation procedures.
subroutine s_mpi_decompose_computational_domain
Decompose the computational domain among processors by balancing cells per rank in each coordinate di...
MPI halo exchange, domain decomposition, and buffer packing/unpacking for the simulation solver.
subroutine s_initialize_mpi_proxy_module()
Initialize the MPI proxy module.
subroutine s_finalize_mpi_proxy_module()
Finalize the MPI proxy module.
impure subroutine s_mpi_bcast_user_inputs()
Since only the processor with rank 0 reads and verifies the consistency of user inputs,...
MUSCL reconstruction with interface sharpening for contact-preserving advection.
subroutine, public s_initialize_muscl_module()
Allocate and initialize MUSCL reconstruction working arrays.
subroutine, public s_finalize_muscl_module()
Finalize the MUSCL module.
NVIDIA NVTX profiling API bindings for GPU performance instrumentation.
Definition m_nvtx.f90:6
subroutine nvtxstartrange(name, id)
Push a named NVTX range for GPU profiling, optionally with a color based on the given identifier.
Definition m_nvtx.f90:62
subroutine nvtxendrange
Pop the current NVTX range to end the GPU profiling region.
Definition m_nvtx.f90:83
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 by setting saturation curve coefficients for pT- or pTg-equilibriu...
Quadrature-based moment methods (QBMM) for polydisperse bubble moment inversion and transport.
impure subroutine, public s_initialize_qbmm_module
Initialize the QBMM module.
Assembles the right-hand side of the governing equations using finite-volume flux differencing,...
impure subroutine, public s_initialize_rhs_module
Initialize the RHS module.
impure subroutine, public s_finalize_rhs_module
Module deallocation and/or disassociation procedures.
Approximate and exact Riemann solvers (HLL, HLLC, HLLD, exact) for the multicomponent Navier–Stokes e...
impure subroutine, public s_finalize_riemann_solvers_module
Module deallocation and/or disassociation procedures.
impure subroutine, public s_initialize_riemann_solvers_module
Initialize the Riemann solvers module.
Simulation helper routines for enthalpy computation, CFL calculation, and stability checks.
Reads input files, loads initial conditions and grid data, and orchestrates solver initialization and...
impure subroutine, public s_read_serial_data_files(q_cons_vf)
Read serial initial condition and grid data files and compute cell-width distributions.
impure subroutine, public s_initialize_modules
Initialize all simulation sub-modules in the required dependency order.
impure subroutine, public s_read_data_files(q_cons_vf)
Read data files. Dispatch subroutine that replaces procedure pointer.
impure subroutine, public s_read_parallel_data_files(q_cons_vf)
Read parallel initial condition and grid data files via MPI I/O.
subroutine, public s_initialize_internal_energy_equations(v_vf)
Initialize internal-energy equations from phase mass, mixture momentum, and total energy.
impure subroutine, public s_save_performance_metrics(time_avg, time_final, io_time_avg, io_time_final, proc_time, io_proc_time, file_exists)
Collect per-process wall-clock times and write aggregate performance metrics to file.
impure subroutine, public s_save_data(t_step, start, finish, io_time_avg, nt)
Save conservative variable data to disk at the current time step.
type(scalar_field), dimension(:), allocatable q_cons_temp
subroutine, public s_initialize_gpu_vars
Transfer initial conservative variable and model parameter data to the GPU device.
impure subroutine, public s_initialize_mpi_domain
Set up the MPI execution environment, bind GPUs, and decompose the computational domain.
impure subroutine, public s_finalize_modules
Finalize and deallocate all simulation sub-modules in reverse initialization order.
impure subroutine, public s_read_input_file
Verify the input file exists and read it.
impure subroutine, public s_check_input_file
Validate that all user-provided inputs form a consistent simulation configuration.
impure subroutine, public s_perform_time_step(t_step, time_avg)
Advance the simulation by one time step, handling CFL-based dt and time-stepper dispatch.
Computes capillary source fluxes and color-function gradients for the diffuse-interface surface tensi...
impure subroutine, public s_initialize_surface_tension_module
Allocate and initialize surface tension module arrays.
impure subroutine, public s_finalize_surface_tension_module
Finalize the surface tension module.
Total-variation-diminishing (TVD) Runge–Kutta time integrators (1st-, 2nd-, and 3rd-order SSP).
type(scalar_field) q_t_sf
Cell-average temperature variables at the current time-stage.
type(integer_field), dimension(:,:), allocatable bc_type
Boundary condition identifiers.
impure subroutine s_initialize_time_steppers_module
Initialize the time steppers module.
type(vector_field), dimension(:), allocatable q_cons_ts
Cell-average conservative variables at each time-stage (TS).
type(scalar_field), dimension(:), allocatable q_prim_vf
Cell-average primitive variables at the current time-stage.
impure subroutine s_finalize_time_steppers_module
Module deallocation and/or disassociation procedures.
impure subroutine s_compute_dt()
Compute the global time step size from CFL stability constraints across all cells.
impure subroutine s_tvd_rk(t_step, time_avg, nstage)
Advance the solution one full step using a TVD Runge-Kutta time integrator.
integer stor
storage index
Conservative-to-primitive variable conversion, mixture property evaluation, and pressure computation.
subroutine, public s_compute_pressure(energy, alf, dyn_p, pi_inf, gamma, rho, qv, rhoyks, pres, t, stress, mom, g, pres_mag)
Compute the pressure from the appropriate equation of state.
impure subroutine, public s_initialize_variables_conversion_module
Initialize the variables conversion module.
impure subroutine s_finalize_variables_conversion_module()
Deallocate fluid property arrays and post-processing fields allocated during module initialization.
subroutine, public s_convert_to_mixture_variables(q_vf, i, j, k, rho, gamma, pi_inf, qv, re_k, g_k, g)
Dispatch to the s_convert_mixture_to_mixture_variables and s_convert_species_to_mixture_variables sub...
Computes viscous stress tensors and diffusive flux contributions for the Navier–Stokes equations.
impure subroutine, public s_initialize_viscous_module
Initialize the viscous module.
impure subroutine, public s_finalize_viscous_module()
Finalize the viscous module.
WENO/WENO-Z/TENO reconstruction with optional monotonicity-preserving bounds and mapped weights.
impure subroutine, public s_initialize_weno_module
Initialize the WENO module.
impure subroutine, public s_finalize_weno_module()
Module deallocation and/or disassociation procedures.
Derived type annexing a scalar field (SF).