MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_data_input.f90
Go to the documentation of this file.
1!>
2!! @file
3!> @brief Contains module m_data_input
4
5!> @brief Reads raw simulation grid and conservative-variable data for a given time-step and fills buffer regions
7
8#ifdef MFC_MPI
9 use mpi
10#endif
11
14 use m_mpi_proxy
15 use m_mpi_common
19 use m_helper
20
21 implicit none
22
25
26 abstract interface
27
28 !> Subroutine for reading data files
29 impure subroutine s_read_abstract_data_files(t_step)
30
31 implicit none
32
33 integer, intent(in) :: t_step
34
35 end subroutine s_read_abstract_data_files
36 end interface
37
38 type(scalar_field), allocatable, dimension(:), public :: q_cons_vf !< Conservative variables
39 type(scalar_field), allocatable, dimension(:), public :: q_cons_temp
40 type(scalar_field), allocatable, dimension(:), public :: q_prim_vf !< Primitive variables
41 type(integer_field), allocatable, dimension(:,:), public :: bc_type !< Boundary condition identifiers
42 type(scalar_field), public :: q_t_sf !< Temperature field
43 type(integer_field), public :: ib_markers
44
45 procedure(s_read_abstract_data_files), pointer :: s_read_data_files => null()
46
47contains
48
49 !> Helper subroutine to read grid data files for a given direction
50 impure subroutine s_read_grid_data_direction(t_step_dir, direction, cb_array, d_array, cc_array, size_dim)
51
52 character(len=*), intent(in) :: t_step_dir
53 character(len=1), intent(in) :: direction
54 real(wp), dimension(-1:), intent(out) :: cb_array
55 real(wp), dimension(0:), intent(out) :: d_array
56 real(wp), dimension(0:), intent(out) :: cc_array
57 integer, intent(in) :: size_dim
58 character(LEN=len_trim(t_step_dir) + 10) :: file_loc
59 logical :: file_check
60
61 file_loc = trim(t_step_dir) // '/' // direction // '_cb.dat'
62 inquire (file=trim(file_loc), exist=file_check)
63
64 if (file_check) then
65 open (1, file=trim(file_loc), form='unformatted', status='old', action='read')
66 read (1) cb_array(-1:size_dim)
67 close (1)
68 else
69 call s_mpi_abort('File ' // direction // '_cb.dat is missing in ' // trim(t_step_dir) // '. Exiting.')
70 end if
71
72 d_array(0:size_dim) = cb_array(0:size_dim) - cb_array(-1:size_dim - 1)
73 cc_array(0:size_dim) = cb_array(-1:size_dim - 1) + d_array(0:size_dim)/2._wp
74
75 end subroutine s_read_grid_data_direction
76
77#ifdef MFC_MPI
78 !> Helper subroutine to setup MPI data I/O parameters
79 impure subroutine s_setup_mpi_io_params(data_size, m_MOK, n_MOK, p_MOK, WP_MOK, MOK, str_MOK, NVARS_MOK)
80
81 integer, intent(out) :: data_size
82 integer(KIND=MPI_OFFSET_KIND), intent(out) :: m_mok, n_mok, p_mok
83 integer(KIND=MPI_OFFSET_KIND), intent(out) :: wp_mok, mok, str_mok, nvars_mok
84
85 if (ib) then
87 else
89 end if
90
91 data_size = (m + 1)*(n + 1)*(p + 1)
92
93 m_mok = int(m_glb + 1, mpi_offset_kind)
94 n_mok = int(n_glb + 1, mpi_offset_kind)
95 p_mok = int(p_glb + 1, mpi_offset_kind)
96 wp_mok = int(storage_size(0._stp)/8, mpi_offset_kind)
97 mok = int(1._wp, mpi_offset_kind)
98 str_mok = int(name_len, mpi_offset_kind)
99 nvars_mok = int(sys_size, mpi_offset_kind)
100
101 end subroutine s_setup_mpi_io_params
102#endif
103
104 !> Helper subroutine to read IB data files
105 impure subroutine s_read_ib_data_files(file_loc_base, t_step)
106
107 character(len=*), intent(in) :: file_loc_base
108 integer, intent(in), optional :: t_step
109 character(LEN=path_len + 2*name_len) :: file_loc
110 logical :: file_exist
111 integer :: ifile, ierr, data_size
112 character(len=10) :: t_step_string
113
114#ifdef MFC_MPI
115 integer, dimension(MPI_STATUS_SIZE) :: status
116 integer(KIND=MPI_OFFSET_KIND) :: disp
117 integer(KIND=MPI_OFFSET_KIND) :: m_mok, n_mok, p_mok, mok, wp_mok, var_mok
118 integer :: save_index
119#endif
120
121 if (.not. ib) return
122
123 if (parallel_io .and. file_per_process) then
124 call s_int_to_str(t_step, t_step_string)
125 write (file_loc, '(A,I0,A,i7.7,A)') 'ib_markers_', t_step, '_', proc_rank, '.dat'
126 file_loc = trim(case_dir) // '/restart_data/lustre_' // trim(t_step_string) // '/' // trim(file_loc)
127 else if (parallel_io) then
128 write (file_loc, '(A)') trim(file_loc_base) // 'ib.dat'
129 else
130 write (file_loc, '(A)') trim(file_loc_base) // '/ib_data.dat'
131 end if
132 inquire (file=trim(file_loc), exist=file_exist)
133
134 if (file_exist) then
135 if (parallel_io .and. file_per_process) then
136#ifdef MFC_MPI
137 call mpi_file_open(mpi_comm_self, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
138
139 data_size = (m + 1)*(n + 1)*(p + 1)
140
141 call mpi_file_read(ifile, mpi_io_ib_data%var%sf, data_size, mpi_integer, status, ierr)
142
143 call mpi_file_close(ifile, ierr)
144#endif
145 else if (parallel_io) then
146#ifdef MFC_MPI
147 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
148
149 m_mok = int(m_glb + 1, mpi_offset_kind)
150 n_mok = int(n_glb + 1, mpi_offset_kind)
151 p_mok = int(p_glb + 1, mpi_offset_kind)
152 mok = int(1._wp, mpi_offset_kind)
153 wp_mok = int(storage_size(0._stp)/8, mpi_offset_kind)
154 save_index = t_step/t_step_save ! get the number of saves done to this point
155
156 data_size = (m + 1)*(n + 1)*(p + 1)
157 var_mok = int(sys_size + 1, mpi_offset_kind)
158 if (t_step == 0) then
159 disp = 0
160 else
161 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1 + int(save_index, mpi_offset_kind))
162 end if
163
164 call mpi_file_set_view(ifile, disp, mpi_integer, mpi_io_ib_data%view, 'native', mpi_info_int, ierr)
165 call mpi_file_read(ifile, mpi_io_ib_data%var%sf, data_size, mpi_integer, status, ierr)
166
167 call mpi_file_close(ifile, ierr)
168#endif
169 else
170 open (2, file=trim(file_loc), form='unformatted', action='read', status='old')
171 read (2) ib_markers%sf(0:m,0:n,0:p)
172 close (2)
173 end if
174 else
175 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
176 end if
177
178 end subroutine s_read_ib_data_files
179
180 !> Helper subroutine to allocate field arrays for given dimensionality
181 impure subroutine s_allocate_field_arrays(local_start_idx, end_x, end_y, end_z)
182
183 integer, intent(in) :: local_start_idx, end_x, end_y, end_z
184 integer :: i
185
186 do i = 1, sys_size
187 allocate (q_cons_vf(i)%sf(local_start_idx:end_x,local_start_idx:end_y,local_start_idx:end_z))
188 allocate (q_prim_vf(i)%sf(local_start_idx:end_x,local_start_idx:end_y,local_start_idx:end_z))
189 end do
190
191 if (ib) then
192 allocate (ib_markers%sf(local_start_idx:end_x,local_start_idx:end_y,local_start_idx:end_z))
193 end if
194
195 if (chemistry .or. heat_conduction) then
196 allocate (q_t_sf%sf(local_start_idx:end_x,local_start_idx:end_y,local_start_idx:end_z))
197 q_t_sf%sf = 0._wp ! Buffer population reads the interior before anything writes it
198 end if
199
200 end subroutine s_allocate_field_arrays
201
202 !> Read the raw data files present in the corresponding time-step directory and to populate the associated grid and conservative
203 !! variables.
204 impure subroutine s_read_serial_data_files(t_step)
205
206 integer, intent(in) :: t_step
207 character(LEN=len_trim(case_dir) + 2*name_len) :: t_step_dir
208 character(LEN=len_trim(case_dir) + 3*name_len) :: file_loc
209 character(len=int(floor(log10(real(sys_size, wp)))) + 1) :: file_num
210 logical :: dir_check
211 logical :: file_check
212 integer :: i
213
214 write (t_step_dir, '(A,I0,A,I0)') '/p_all/p', proc_rank, '/', t_step
215 t_step_dir = trim(case_dir) // trim(t_step_dir)
216
217 file_loc = trim(t_step_dir) // '/.'
218 call my_inquire(file_loc, dir_check)
219
220 if (dir_check .neqv. .true.) then
221 call s_mpi_abort('Time-step folder ' // trim(t_step_dir) // ' is missing. Exiting.')
222 end if
223
224 if (bc_io) then
226 else
228 end if
229
230 ! Pass explicit slices so the dummy `dimension(-1:)` / `dimension(0:)` arguments map to the correct interior indices of the
231 ! actual arrays. Without slicing, when offset_x%beg or buff_size > 0 (i.e. format=1 parallel 3D ranks), Fortran's
232 ! assumed-shape re-mapping shifts the read by that many slots and leaves the last interior cells uninitialized - corrupting
233 ! downstream ghost-cell extrapolation.
234 call s_read_grid_data_direction(t_step_dir, 'x', x_cb(-1:m), dx(0:m), x_cc(0:m), m)
235
236 if (n > 0) then
237 call s_read_grid_data_direction(t_step_dir, 'y', y_cb(-1:n), dy(0:n), y_cc(0:n), n)
238
239 if (p > 0) then
240 call s_read_grid_data_direction(t_step_dir, 'z', z_cb(-1:p), dz(0:p), z_cc(0:p), p)
241 end if
242 end if
243
244 do i = 1, sys_size
245 write (file_num, '(I0)') i
246 file_loc = trim(t_step_dir) // '/q_cons_vf' // trim(file_num) // '.dat'
247 inquire (file=trim(file_loc), exist=file_check)
248
249 if (file_check) then
250 open (1, file=trim(file_loc), form='unformatted', status='old', action='read')
251 read (1) q_cons_vf(i)%sf(0:m,0:n,0:p)
252 close (1)
253 else
254 call s_mpi_abort('File q_cons_vf' // trim(file_num) // '.dat is missing in ' // trim(t_step_dir) // '. Exiting.')
255 end if
256 end do
257
258 call s_read_ib_data_files(t_step_dir)
259
260 end subroutine s_read_serial_data_files
261
262 !> Parallel-read the raw data files present in the corresponding time-step directory and to populate the associated grid and
263 !! conservative variables.
264 impure subroutine s_read_parallel_data_files(t_step)
265
266 integer, intent(in) :: t_step
267
268#ifdef MFC_MPI
269 real(wp), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb
270 integer :: ifile, ierr, data_size, filetype, stride
271 integer, dimension(MPI_STATUS_SIZE) :: status
272 integer(KIND=MPI_OFFSET_KIND) :: disp
273 integer(KIND=MPI_OFFSET_KIND) :: m_mok, n_mok, p_mok
274 integer(KIND=MPI_OFFSET_KIND) :: wp_mok, var_mok, str_mok
275 integer(KIND=MPI_OFFSET_KIND) :: nvars_mok
276 integer(KIND=MPI_OFFSET_KIND) :: mok
277 integer(kind=MPI_OFFSET_KIND) :: offset
278 character(LEN=path_len + 2*name_len) :: file_loc
279 logical :: file_exist
280 integer(kind=8) :: file_bytes, bytes_needed
281 character(len=10) :: case_m_str, file_m_str
282 character(len=10) :: t_step_string
283 integer :: i
284
285 allocate (x_cb_glb(-1:m_glb))
286 allocate (y_cb_glb(-1:n_glb))
287 allocate (z_cb_glb(-1:p_glb))
288
289 if (down_sample) then
290 stride = 3
291 else
292 stride = 1
293 end if
294
295 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'x_cb.dat'
296 inquire (file=trim(file_loc), exist=file_exist, size=file_bytes)
297
298 ! The grid file holds one cell boundary per value, so its size says which grid wrote the restart. Without
299 ! this check a case file whose resolution no longer matches the run reads past the end of every restart
300 ! file and post-processes silently, exiting 0 with NaN-filled output -- which is indistinguishable from
301 ! success until someone plots it. The strided read down_sample performs touches stride*(m_glb + 1) + 1
302 ! boundaries of a full-resolution file, so it needs more of the file, not less; only the un-strided read
303 ! pins the size exactly, since down-sampling three grids of different size can land on the same m_glb.
304 if (file_exist) then
305 bytes_needed = (int(stride, 8)*int(m_glb + 1, 8) + 1_8)*int(storage_size(0._wp)/8, 8)
306 if (file_bytes < bytes_needed .or. (.not. down_sample .and. file_bytes /= bytes_needed)) then
307 call s_int_to_str(m_glb, case_m_str)
308 call s_int_to_str(int(file_bytes/int(storage_size(0._wp)/8, 8)) - 2, file_m_str)
309 call s_mpi_abort('Restart grid mismatch: this case has m = ' // trim(case_m_str) // ' but ' // trim(file_loc) &
310 & // ' was written with m = ' // trim(file_m_str) &
311 & // '. Post-processing must use the same grid as the run that wrote the ' &
312 & // 'restart files, or it reads past the end of every file and writes NaN.')
313 end if
314 data_size = m_glb + 2
315 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
316
317 call mpi_type_vector(data_size, 1, stride, mpi_p, filetype, ierr)
318 call mpi_type_commit(filetype, ierr)
319
320 offset = 0
321 call mpi_file_set_view(ifile, offset, mpi_p, filetype, 'native', mpi_info_int, ierr)
322
323 call mpi_file_read(ifile, x_cb_glb, data_size, mpi_p, status, ierr)
324 call mpi_file_close(ifile, ierr)
325 else
326 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
327 end if
328
329 ! Bitwise-consistent grid distribution from the global file
330 call s_apply_grid_from_global_dim(x_cb_glb, m_glb, m, start_idx(1), bc_x%beg, bc_x%end, offset_x%beg, offset_x%end, &
332
333 if (n > 0) then
334 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'y_cb.dat'
335 inquire (file=trim(file_loc), exist=file_exist)
336
337 if (file_exist) then
338 data_size = n_glb + 2
339 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
340
341 call mpi_type_vector(data_size, 1, stride, mpi_p, filetype, ierr)
342 call mpi_type_commit(filetype, ierr)
343
344 offset = 0
345 call mpi_file_set_view(ifile, offset, mpi_p, filetype, 'native', mpi_info_int, ierr)
346
347 call mpi_file_read(ifile, y_cb_glb, data_size, mpi_p, status, ierr)
348 call mpi_file_close(ifile, ierr)
349 else
350 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
351 end if
352
353 call s_apply_grid_from_global_dim(y_cb_glb, n_glb, n, start_idx(2), bc_y%beg, bc_y%end, offset_y%beg, offset_y%end, &
355
356 if (p > 0) then
357 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'z_cb.dat'
358 inquire (file=trim(file_loc), exist=file_exist)
359
360 if (file_exist) then
361 data_size = p_glb + 2
362 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
363
364 call mpi_type_vector(data_size, 1, stride, mpi_p, filetype, ierr)
365 call mpi_type_commit(filetype, ierr)
366
367 offset = 0
368 call mpi_file_set_view(ifile, offset, mpi_p, filetype, 'native', mpi_info_int, ierr)
369
370 call mpi_file_read(ifile, z_cb_glb, data_size, mpi_p, status, ierr)
371 call mpi_file_close(ifile, ierr)
372 else
373 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
374 end if
375
376 call s_apply_grid_from_global_dim(z_cb_glb, p_glb, p, start_idx(3), bc_z%beg, bc_z%end, offset_z%beg, &
378 end if
379 end if
380
381 call s_read_parallel_conservative_data(t_step, m_mok, n_mok, p_mok, wp_mok, mok, str_mok, nvars_mok)
382
383 deallocate (x_cb_glb, y_cb_glb, z_cb_glb)
384
385 if (bc_io) then
387 else
389 end if
390#endif
391
392 end subroutine s_read_parallel_data_files
393
394#ifdef MFC_MPI
395 !> Helper subroutine to read parallel conservative variable data
396 impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK, WP_MOK, MOK, str_MOK, NVARS_MOK)
397
398 integer, intent(in) :: t_step
399 integer(KIND=MPI_OFFSET_KIND), intent(inout) :: m_mok, n_mok, p_mok
400 integer(KIND=MPI_OFFSET_KIND), intent(inout) :: wp_mok, mok, str_mok, nvars_mok
401 integer :: ifile, ierr, data_size
402 integer, dimension(MPI_STATUS_SIZE) :: status
403 integer(KIND=MPI_OFFSET_KIND) :: disp, var_mok
404 character(LEN=path_len + 2*name_len) :: file_loc
405 logical :: file_exist
406 character(len=10) :: t_step_string
407 integer :: i
408
409 if (file_per_process) then
410 call s_int_to_str(t_step, t_step_string)
411 write (file_loc, '(I0,A1,I7.7,A)') t_step, '_', proc_rank, '.dat'
412 file_loc = trim(case_dir) // '/restart_data/lustre_' // trim(t_step_string) // trim(mpiiofs) // trim(file_loc)
413 inquire (file=trim(file_loc), exist=file_exist)
414
415 if (file_exist) then
416 call mpi_file_open(mpi_comm_self, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
417
418 if (down_sample) then
420 else
421 if (ib) then
423 else
425 end if
426 end if
427
428 if (down_sample) then
429 data_size = (m + 3)*(n + 3)*(p + 3)
430 else
431 data_size = (m + 1)*(n + 1)*(p + 1)
432 end if
433
434 m_mok = int(m_glb + 1, mpi_offset_kind)
435 n_mok = int(n_glb + 1, mpi_offset_kind)
436 p_mok = int(p_glb + 1, mpi_offset_kind)
437 wp_mok = int(storage_size(0._stp)/8, mpi_offset_kind)
438 mok = int(1._wp, mpi_offset_kind)
439 str_mok = int(name_len, mpi_offset_kind)
440 nvars_mok = int(sys_size, mpi_offset_kind)
441
442 if (bubbles_euler .or. hypoelasticity .or. mhd) then
443 do i = 1, sys_size
444 var_mok = int(i, mpi_offset_kind)
445 call mpi_file_read_all(ifile, mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
446 end do
447 else
448 do i = 1, sys_size
449 var_mok = int(i, mpi_offset_kind)
450 call mpi_file_read_all(ifile, mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
451 end do
452 end if
453
454 call s_mpi_barrier()
455 call mpi_file_close(ifile, ierr)
456
457 if (down_sample) then
458 do i = 1, sys_size
459 q_cons_vf(i)%sf(0:m,0:n,0:p) = q_cons_temp(i)%sf(0:m,0:n,0:p)
460 end do
461 end if
462
463 call s_read_ib_data_files(trim(case_dir) // '/restart_data' // trim(mpiiofs), t_step)
464 else
465 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
466 end if
467 else
468 write (file_loc, '(I0,A)') t_step, '.dat'
469 file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // trim(file_loc)
470 inquire (file=trim(file_loc), exist=file_exist)
471
472 if (file_exist) then
473 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly, mpi_info_int, ifile, ierr)
474
475 call s_setup_mpi_io_params(data_size, m_mok, n_mok, p_mok, wp_mok, mok, str_mok, nvars_mok)
476
477 do i = 1, sys_size
478 var_mok = int(i, mpi_offset_kind)
479
480 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
481
482 call mpi_file_set_view(ifile, disp, mpi_p, mpi_io_data%view(i), 'native', mpi_info_int, ierr)
483 call mpi_file_read_all(ifile, mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
484 end do
485
486 call s_mpi_barrier()
487 call mpi_file_close(ifile, ierr)
488
489 call s_read_ib_data_files(trim(case_dir) // '/restart_data' // trim(mpiiofs), t_step)
490 else
491 call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.')
492 end if
493 end if
494
496#endif
497
498 !> Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the module
500
501 integer :: i
502
503 allocate (q_cons_vf(1:sys_size))
504 allocate (q_prim_vf(1:sys_size))
505 allocate (q_cons_temp(1:sys_size))
506
507 if (n > 0) then
508 if (p > 0) then
510 if (down_sample) then
511 do i = 1, sys_size
512 allocate (q_cons_temp(i)%sf(-1:m + 1,-1:n + 1,-1:p + 1))
513 end do
514 end if
515 else
517 end if
518 else
520 end if
521
522 allocate (bc_type(1:num_dims,1:2))
523
524 allocate (bc_type(1, 1)%sf(0:0,0:n,0:p))
525 allocate (bc_type(1, 2)%sf(0:0,0:n,0:p))
526 if (n > 0) then
527 allocate (bc_type(2, 1)%sf(-buff_size:m + buff_size,0:0,0:p))
528 allocate (bc_type(2, 2)%sf(-buff_size:m + buff_size,0:0,0:p))
529 if (p > 0) then
530 allocate (bc_type(3, 1)%sf(-buff_size:m + buff_size,-buff_size:n + buff_size,0:0))
531 allocate (bc_type(3, 2)%sf(-buff_size:m + buff_size,-buff_size:n + buff_size,0:0))
532 end if
533 end if
534
535 if (parallel_io .neqv. .true.) then
537 else
539 end if
540
541 end subroutine s_initialize_data_input_module
542
543 !> Deallocation procedures for the module
545
546 integer :: i
547
548 do i = 1, sys_size
549 deallocate (q_cons_vf(i)%sf)
550 deallocate (q_prim_vf(i)%sf)
551 if (down_sample) then
552 deallocate (q_cons_temp(i)%sf)
553 end if
554 end do
555
556 deallocate (q_cons_vf)
557 deallocate (q_prim_vf)
558 deallocate (q_cons_temp)
559
560 if (ib) then
561 deallocate (ib_markers%sf)
562 end if
563
564 if (chemistry .or. heat_conduction) then
565 deallocate (q_t_sf%sf)
566 end if
567
568 deallocate (bc_type(1, 1)%sf, bc_type(1, 2)%sf)
569 if (n > 0) then
570 deallocate (bc_type(2, 1)%sf, bc_type(2, 2)%sf)
571 if (p > 0) then
572 deallocate (bc_type(3, 1)%sf, bc_type(3, 2)%sf)
573 end if
574 end if
575
576 deallocate (bc_type)
577
578 s_read_data_files => null()
579
580 end subroutine s_finalize_data_input_module
581
582end module m_data_input
Subroutine for reading data files.
Noncharacteristic and processor boundary condition application for ghost cells and buffer regions.
Boundary condition restart I/O, capillary/IGR buffer population, and grid-variable buffers.
subroutine s_assign_default_bc_type(bc_type)
Initialize the per-cell boundary condition type arrays with the global default BC values.
subroutine s_read_serial_boundary_condition_files(step_dirpath, bc_type)
Read boundary condition type and buffer data from serial (unformatted) restart files.
subroutine s_read_parallel_boundary_condition_files(bc_type)
Read boundary condition type and buffer data from per-rank parallel files using MPI I/O.
Platform-specific file and directory operations: create, delete, inquire, getcwd, and basename.
impure subroutine my_inquire(fileloc, dircheck)
Inquire on the existence of a directory or file.
Reads raw simulation grid and conservative-variable data for a given time-step and fills buffer regio...
impure subroutine s_allocate_field_arrays(local_start_idx, end_x, end_y, end_z)
Helper subroutine to allocate field arrays for given dimensionality.
impure subroutine, public s_read_parallel_data_files(t_step)
Parallel-read the raw data files present in the corresponding time-step directory and to populate the...
type(scalar_field), public q_t_sf
Temperature field.
type(scalar_field), dimension(:), allocatable, public q_cons_vf
Conservative variables.
impure subroutine s_read_parallel_conservative_data(t_step, m_mok, n_mok, p_mok, wp_mok, mok, str_mok, nvars_mok)
Helper subroutine to read parallel conservative variable data.
impure subroutine, public s_initialize_data_input_module
Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the...
type(scalar_field), dimension(:), allocatable, public q_prim_vf
Primitive variables.
impure subroutine s_setup_mpi_io_params(data_size, m_mok, n_mok, p_mok, wp_mok, mok, str_mok, nvars_mok)
Helper subroutine to setup MPI data I/O parameters.
impure subroutine, public s_finalize_data_input_module
Deallocation procedures for the module.
impure subroutine s_read_grid_data_direction(t_step_dir, direction, cb_array, d_array, cc_array, size_dim)
Helper subroutine to read grid data files for a given direction.
impure subroutine, public s_read_serial_data_files(t_step)
Read the raw data files present in the corresponding time-step directory and to populate the associat...
type(scalar_field), dimension(:), allocatable, public q_cons_temp
procedure(s_read_abstract_data_files), pointer, public s_read_data_files
type(integer_field), dimension(:,:), allocatable, public bc_type
Boundary condition identifiers.
type(integer_field), public ib_markers
impure subroutine s_read_ib_data_files(file_loc_base, t_step)
Helper subroutine to read IB data files.
Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures.
Global parameters for the post-process: domain geometry, equation of state, and output database setti...
type(int_bounds_info) offset_y
real(wp), dimension(:), allocatable y_cc
integer proc_rank
Rank of the local processor.
type(mpi_io_ib_var), public mpi_io_ib_data
real(wp), dimension(:), allocatable y_cb
real(wp), dimension(:), allocatable dz
integer buff_size
Number of ghost cells for boundary condition storage.
real(wp), dimension(:), allocatable z_cb
real(wp), dimension(:), allocatable x_cc
real(wp), dimension(:), allocatable x_cb
real(wp), dimension(:), allocatable dy
type(int_bounds_info) offset_x
real(wp), dimension(:), allocatable z_cc
type(int_bounds_info) offset_z
type(mpi_io_var), public mpi_io_data
real(wp), dimension(:), allocatable dx
Cell-width distributions in the x-, y- and z-coordinate directions.
Utility routines for bubble model setup, coordinate transforms, array sampling, and special functions...
elemental subroutine, public s_int_to_str(i, res)
Convert an integer to its trimmed string representation.
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.
subroutine s_apply_grid_from_global_dim(x_cb_glb, m_dim_glb, m_dim, sidx, bc_beg, bc_end, cb_lo, cb_hi, cw_lo, cw_hi, x_cb_loc, x_cc_loc, dx_loc)
Populate the local cell-boundary, cell-center, and cell-width arrays in one direction directly from t...
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_initialize_mpi_data_ds(m_ds, n_ds, p_ds, q_cons_vf)
Set up MPI I/O data views for downsampled (coarsened) parallel file output.
MPI gather and scatter operations for distributing post-process grid and flow-variable data.
Derived type annexing an integer scalar field (SF).
Derived type annexing a scalar field (SF).