@@ -25,7 +25,6 @@ module m_data_input
2525 abstract interface
2626
2727 ! > Subroutine for reading data files
28- ! ! @param t_step Current time-step to input
2928 impure subroutine s_read_abstract_data_files (t_step )
3029
3130 implicit none
@@ -40,7 +39,6 @@ end subroutine s_read_abstract_data_files
4039 type (scalar_field), allocatable , dimension (:), public :: q_prim_vf ! < Primitive variables
4140 type (integer_field), allocatable , dimension (:,:), public :: bc_type ! < Boundary condition identifiers
4241 type (scalar_field), public :: q_T_sf ! < Temperature field
43-
4442 ! type(scalar_field), public :: ib_markers !<
4543 type (integer_field), public :: ib_markers
4644
@@ -49,12 +47,6 @@ end subroutine s_read_abstract_data_files
4947contains
5048
5149 ! > Helper subroutine to read grid data files for a given direction
52- ! ! @param t_step_dir Directory containing the time-step data
53- ! ! @param direction Direction name ('x', 'y', 'z')
54- ! ! @param cb_array Cell boundary array to populate
55- ! ! @param d_array Cell width array to populate
56- ! ! @param cc_array Cell center array to populate
57- ! ! @param size_dim Size of the dimension
5850 impure subroutine s_read_grid_data_direction (t_step_dir , direction , cb_array , d_array , cc_array , size_dim )
5951
6052 character (len=* ), intent (in ) :: t_step_dir
@@ -66,12 +58,9 @@ impure subroutine s_read_grid_data_direction(t_step_dir, direction, cb_array, d_
6658 character (LEN= len_trim (t_step_dir) + 10 ) :: file_loc
6759 logical :: file_check
6860
69- ! Checking whether direction_cb.dat exists
70-
7161 file_loc = trim (t_step_dir) // ' /' // direction // ' _cb.dat'
7262 inquire (FILE= trim (file_loc), EXIST= file_check)
7363
74- ! Reading direction_cb.dat if it exists, exiting otherwise
7564 if (file_check) then
7665 open (1 , FILE= trim (file_loc), form= ' unformatted' , STATUS= ' old' , ACTION= ' read' )
7766 read (1 ) cb_array(- 1 :size_dim)
@@ -80,37 +69,27 @@ impure subroutine s_read_grid_data_direction(t_step_dir, direction, cb_array, d_
8069 call s_mpi_abort(' File ' // direction // ' _cb.dat is missing in ' // trim (t_step_dir) // ' . Exiting.' )
8170 end if
8271
83- ! Computing the cell-width distribution
8472 d_array(0 :size_dim) = cb_array(0 :size_dim) - cb_array(- 1 :size_dim - 1 )
85-
86- ! Computing the cell-center locations
8773 cc_array(0 :size_dim) = cb_array(- 1 :size_dim - 1 ) + d_array(0 :size_dim)/ 2._wp
8874
8975 end subroutine s_read_grid_data_direction
9076
9177#ifdef MFC_MPI
9278 ! > Helper subroutine to setup MPI data I/O parameters
93- ! ! @param data_size Local array size (output)
94- ! ! @param m_MOK, n_MOK, p_MOK MPI offset kinds for dimensions (output)
95- ! ! @param WP_MOK, MOK, str_MOK, NVARS_MOK Other MPI offset kinds (output)
9679 impure subroutine s_setup_mpi_io_params (data_size , m_MOK , n_MOK , p_MOK , WP_MOK , MOK , str_MOK , NVARS_MOK )
9780
9881 integer , intent (out ) :: data_size
9982 integer (KIND= MPI_OFFSET_KIND), intent (out ) :: m_MOK, n_MOK, p_MOK
10083 integer (KIND= MPI_OFFSET_KIND), intent (out ) :: WP_MOK, MOK, str_MOK, NVARS_MOK
10184
102- ! Initialize MPI data I/O
103-
10485 if (ib) then
10586 call s_initialize_mpi_data(q_cons_vf, ib_markers)
10687 else
10788 call s_initialize_mpi_data(q_cons_vf)
10889 end if
10990
110- ! Size of local arrays
11191 data_size = (m + 1 )* (n + 1 )* (p + 1 )
11292
113- ! Resize some integers so MPI can read even the biggest file
11493 m_MOK = int (m_glb + 1 , MPI_OFFSET_KIND)
11594 n_MOK = int (n_glb + 1 , MPI_OFFSET_KIND)
11695 p_MOK = int (p_glb + 1 , MPI_OFFSET_KIND)
@@ -123,8 +102,6 @@ end subroutine s_setup_mpi_io_params
123102#endif
124103
125104 ! > Helper subroutine to read IB data files
126- ! ! @param file_loc_base Base file location for IB data
127- ! ! @param t_step Time step index
128105 impure subroutine s_read_ib_data_files (file_loc_base , t_step )
129106
130107 character (len=* ), intent (in ) :: file_loc_base
@@ -139,6 +116,7 @@ impure subroutine s_read_ib_data_files(file_loc_base, t_step)
139116 integer (KIND= MPI_OFFSET_KIND) :: m_MOK, n_MOK, p_MOK, MOK, WP_MOK, var_MOK
140117 integer :: save_index
141118#endif
119+
142120 if (.not. ib) return
143121
144122 if (parallel_io) then
@@ -185,10 +163,6 @@ impure subroutine s_read_ib_data_files(file_loc_base, t_step)
185163 end subroutine s_read_ib_data_files
186164
187165 ! > Helper subroutine to allocate field arrays for given dimensionality
188- ! ! @param local_start_idx Starting index for allocation
189- ! ! @param end_x End index for x dimension
190- ! ! @param end_y End index for y dimension
191- ! ! @param end_z End index for z dimension
192166 impure subroutine s_allocate_field_arrays (local_start_idx , end_x , end_y , end_z )
193167
194168 integer , intent (in ) :: local_start_idx, end_x, end_y, end_z
@@ -209,16 +183,13 @@ impure subroutine s_allocate_field_arrays(local_start_idx, end_x, end_y, end_z)
209183
210184 end subroutine s_allocate_field_arrays
211185
212- ! > This subroutine is called at each time-step that has to be post-processed in order to read the raw data files present in the
213- ! ! corresponding time-step directory and to populate the associated grid and conservative variables.
214- ! ! @param t_step Current time-step
186+ ! > Read the raw data files present in the corresponding time-step directory and to populate the associated grid and conservative
187+ ! ! variables.
215188 impure subroutine s_read_serial_data_files (t_step )
216189
217- integer , intent (in ) :: t_step
218- character (LEN= len_trim (case_dir) + 2 * name_len) :: t_step_dir
219- character (LEN= len_trim (case_dir) + 3 * name_len) :: file_loc
220-
221- ! > Used to store the variable position, in character form, of the currently manipulated conservative variable file
190+ integer , intent (in ) :: t_step
191+ character (LEN= len_trim (case_dir) + 2 * name_len) :: t_step_dir
192+ character (LEN= len_trim (case_dir) + 3 * name_len) :: file_loc
222193 character (LEN= int (floor (log10 (real (sys_size, wp)))) + 1 ) :: file_num
223194 logical :: dir_check
224195 logical :: file_check
@@ -227,11 +198,9 @@ impure subroutine s_read_serial_data_files(t_step)
227198 write (t_step_dir, ' (A,I0,A,I0)' ) ' /p_all/p' , proc_rank, ' /' , t_step
228199 t_step_dir = trim (case_dir) // trim (t_step_dir)
229200
230- ! Inquiring as to the existence of the time-step directory
231201 file_loc = trim (t_step_dir) // ' /.'
232202 call my_inquire(file_loc, dir_check)
233203
234- ! If the time-step directory is missing, the post-process exits.
235204 if (dir_check .neqv. .true. ) then
236205 call s_mpi_abort(' Time-step folder ' // trim (t_step_dir) // ' is missing. Exiting.' )
237206 end if
@@ -256,15 +225,11 @@ impure subroutine s_read_serial_data_files(t_step)
256225 end if
257226 end if
258227
259- ! Reading the Conservative Variables Data Files
260228 do i = 1 , sys_size
261- ! Checking whether the data file associated with the variable position of currently manipulated conservative variable
262- ! exists
263229 write (file_num, ' (I0)' ) i
264230 file_loc = trim (t_step_dir) // ' /q_cons_vf' // trim (file_num) // ' .dat'
265231 inquire (FILE= trim (file_loc), EXIST= file_check)
266232
267- ! Reading the data file if it exists, exiting otherwise
268233 if (file_check) then
269234 open (1 , FILE= trim (file_loc), form= ' unformatted' , STATUS= ' old' , ACTION= ' read' )
270235 read (1 ) q_cons_vf(i)% sf(0 :m,0 :n,0 :p)
@@ -274,14 +239,12 @@ impure subroutine s_read_serial_data_files(t_step)
274239 end if
275240 end do
276241
277- ! Reading IB data using helper subroutine
278242 call s_read_ib_data_files(t_step_dir)
279243
280244 end subroutine s_read_serial_data_files
281245
282- ! > This subroutine is called at each time-step that has to be post-processed in order to parallel-read the raw data files
283- ! ! present in the corresponding time-step directory and to populate the associated grid and conservative variables.
284- ! ! @param t_step Current time-step
246+ ! > Parallel-read the raw data files present in the corresponding time-step directory and to populate the associated grid and
247+ ! ! conservative variables.
285248 impure subroutine s_read_parallel_data_files (t_step )
286249
287250 integer , intent (in ) :: t_step
@@ -311,7 +274,6 @@ impure subroutine s_read_parallel_data_files(t_step)
311274 stride = 1
312275 end if
313276
314- ! Read in cell boundary locations in x-direction
315277 file_loc = trim (case_dir) // ' /restart_data' // trim (mpiiofs) // ' x_cb.dat'
316278 inquire (FILE= trim (file_loc), EXIST= file_exist)
317279
@@ -336,7 +298,6 @@ impure subroutine s_read_parallel_data_files(t_step)
336298 & buff_size, buff_size, x_cb, x_cc, dx)
337299
338300 if (n > 0 ) then
339- ! Read in cell boundary locations in y-direction
340301 file_loc = trim (case_dir) // ' /restart_data' // trim (mpiiofs) // ' y_cb.dat'
341302 inquire (FILE= trim (file_loc), EXIST= file_exist)
342303
@@ -360,7 +321,6 @@ impure subroutine s_read_parallel_data_files(t_step)
360321 & buff_size, buff_size, y_cb, y_cc, dy)
361322
362323 if (p > 0 ) then
363- ! Read in cell boundary locations in z-direction
364324 file_loc = trim (case_dir) // ' /restart_data' // trim (mpiiofs) // ' z_cb.dat'
365325 inquire (FILE= trim (file_loc), EXIST= file_exist)
366326
@@ -400,9 +360,6 @@ end subroutine s_read_parallel_data_files
400360
401361#ifdef MFC_MPI
402362 ! > Helper subroutine to read parallel conservative variable data
403- ! ! @param t_step Current time-step
404- ! ! @param m_MOK, n_MOK, p_MOK MPI offset kinds for dimensions
405- ! ! @param WP_MOK, MOK, str_MOK, NVARS_MOK Other MPI offset kinds
406363 impure subroutine s_read_parallel_conservative_data (t_step , m_MOK , n_MOK , p_MOK , WP_MOK , MOK , str_MOK , NVARS_MOK )
407364
408365 integer , intent (in ) :: t_step
@@ -418,7 +375,6 @@ impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK,
418375
419376 if (file_per_process) then
420377 call s_int_to_str(t_step, t_step_string)
421- ! Open the file to read conservative variables
422378 write (file_loc, ' (I0,A1,I7.7,A)' ) t_step, ' _' , proc_rank, ' .dat'
423379 file_loc = trim (case_dir) // ' /restart_data/lustre_' // trim (t_step_string) // trim (mpiiofs) // trim (file_loc)
424380 inquire (FILE= trim (file_loc), EXIST= file_exist)
@@ -429,7 +385,6 @@ impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK,
429385 if (down_sample) then
430386 call s_initialize_mpi_data_ds(q_cons_temp)
431387 else
432- ! Initialize MPI data I/O
433388 if (ib) then
434389 call s_initialize_mpi_data(q_cons_vf, ib_markers)
435390 else
@@ -438,14 +393,11 @@ impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK,
438393 end if
439394
440395 if (down_sample) then
441- ! Size of local arrays
442396 data_size = (m + 3 )* (n + 3 )* (p + 3 )
443397 else
444- ! Size of local arrays
445398 data_size = (m + 1 )* (n + 1 )* (p + 1 )
446399 end if
447400
448- ! Resize some integers so MPI can read even the biggest file
449401 m_MOK = int (m_glb + 1 , MPI_OFFSET_KIND)
450402 n_MOK = int (n_glb + 1 , MPI_OFFSET_KIND)
451403 p_MOK = int (p_glb + 1 , MPI_OFFSET_KIND)
@@ -454,7 +406,6 @@ impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK,
454406 str_MOK = int (name_len, MPI_OFFSET_KIND)
455407 NVARS_MOK = int (sys_size, MPI_OFFSET_KIND)
456408
457- ! Read the data for each variable
458409 if (bubbles_euler .or. elasticity .or. mhd) then
459410 do i = 1 , sys_size
460411 var_MOK = int (i, MPI_OFFSET_KIND)
@@ -481,7 +432,6 @@ impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK,
481432 call s_mpi_abort(' File ' // trim (file_loc) // ' is missing. Exiting.' )
482433 end if
483434 else
484- ! Open the file to read conservative variables
485435 write (file_loc, ' (I0,A)' ) t_step, ' .dat'
486436 file_loc = trim (case_dir) // ' /restart_data' // trim (mpiiofs) // trim (file_loc)
487437 inquire (FILE= trim (file_loc), EXIST= file_exist)
@@ -491,11 +441,9 @@ impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK,
491441
492442 call s_setup_mpi_io_params(data_size, m_MOK, n_MOK, p_MOK, WP_MOK, MOK, str_MOK, NVARS_MOK)
493443
494- ! Read the data for each variable
495444 do i = 1 , sys_size
496445 var_MOK = int (i, MPI_OFFSET_KIND)
497446
498- ! Initial displacement to skip at beginning of file
499447 disp = m_MOK* max (MOK, n_MOK)* max (MOK, p_MOK)* WP_MOK* (var_MOK - 1 )
500448
501449 call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA% view(i), ' native' , mpi_info_int, ierr)
@@ -519,19 +467,11 @@ impure subroutine s_initialize_data_input_module
519467
520468 integer :: i
521469
522- ! Allocating the parts of the conservative and primitive variables that do not require the direct knowledge of the
523- ! dimensionality of the simulation
524-
525470 allocate (q_cons_vf(1 :sys_size))
526471 allocate (q_prim_vf(1 :sys_size))
527472 allocate (q_cons_temp(1 :sys_size))
528473
529- ! Allocating the parts of the conservative and primitive variables that do require the direct knowledge of the
530- ! dimensionality of the simulation using helper subroutine
531-
532- ! Simulation is at least 2D
533474 if (n > 0 ) then
534- ! Simulation is 3D
535475 if (p > 0 ) then
536476 call s_allocate_field_arrays(- buff_size, m + buff_size, n + buff_size, p + buff_size)
537477 if (down_sample) then
@@ -540,15 +480,12 @@ impure subroutine s_initialize_data_input_module
540480 end do
541481 end if
542482 else
543- ! Simulation is 2D
544483 call s_allocate_field_arrays(- buff_size, m + buff_size, n + buff_size, 0 )
545484 end if
546485 else
547- ! Simulation is 1D
548486 call s_allocate_field_arrays(- buff_size, m + buff_size, 0 , 0 )
549487 end if
550488
551- ! Allocating arrays to store the bc types
552489 allocate (bc_type(1 :num_dims,1 :2 ))
553490
554491 allocate (bc_type(1 , 1 )% sf(0 :0 ,0 :n,0 :p))
@@ -575,8 +512,6 @@ impure subroutine s_finalize_data_input_module
575512
576513 integer :: i
577514
578- ! Deallocating the conservative and primitive variables
579-
580515 do i = 1 , sys_size
581516 deallocate (q_cons_vf(i)% sf)
582517 deallocate (q_prim_vf(i)% sf)
0 commit comments