@@ -51,6 +51,9 @@ end subroutine s_read_abstract_data_files
5151 type (scalar_field), allocatable , dimension (:), public :: q_prim_vf ! <
5252 ! ! Primitive variables
5353
54+ ! type(scalar_field), public :: ib_markers !<
55+ type (integer_field), public :: ib_markers
56+
5457 procedure (s_read_abstract_data_files), pointer :: s_read_data_files = > null ()
5558
5659contains
@@ -75,6 +78,11 @@ subroutine s_read_serial_data_files(t_step)
7578 ! ! Used to store the variable position, in character form, of the
7679 ! ! currently manipulated conservative variable file
7780
81+ character (LEN= len_trim (case_dir) + 2 * name_len) :: t_step_ib_dir ! <
82+ ! ! Location of the time-step directory associated with t_step
83+
84+ character (LEN= len_trim (case_dir) + 3 * name_len) :: file_loc_ib ! <
85+
7886 logical :: dir_check ! <
7987 ! ! Generic logical used to test the existence of a particular folder
8088
@@ -87,9 +95,14 @@ subroutine s_read_serial_data_files(t_step)
8795 write (t_step_dir, ' (A,I0,A,I0)' ) ' /p_all/p' , proc_rank, ' /' , t_step
8896 t_step_dir = trim (case_dir)// trim (t_step_dir)
8997
98+ write (t_step_ib_dir, ' (A,I0,A,I0)' ) ' /p_all/p' , proc_rank, ' /' , 0
99+ t_step_ib_dir = trim (case_dir)// trim (t_step_ib_dir)
100+
90101 ! Inquiring as to the existence of the time-step directory
91102 file_loc = trim (t_step_dir)// ' /.'
92103
104+ file_loc_ib = trim (t_step_ib_dir)// ' /.'
105+
93106 call my_inquire(file_loc, dir_check)
94107
95108 ! If the time-step directory is missing, the post-process exits.
@@ -98,6 +111,14 @@ subroutine s_read_serial_data_files(t_step)
98111 ' is missing. Exiting ...' )
99112 end if
100113
114+ call my_inquire(file_loc_ib, dir_check)
115+
116+ ! If the time-step directory is missing, the post-process exits.
117+ if (dir_check .neqv. .true. ) then
118+ call s_mpi_abort(' Time-step folder ' // trim (t_step_ib_dir)// &
119+ ' is missing. Exiting ...' )
120+ end if
121+
101122 ! Reading the Grid Data File for the x-direction ===================
102123
103124 ! Checking whether x_cb.dat exists
@@ -205,6 +226,19 @@ subroutine s_read_serial_data_files(t_step)
205226
206227 end do
207228
229+ if (ib) then
230+ write (file_loc_ib, ' (A,I0,A)' ) &
231+ trim (t_step_ib_dir)// ' /ib.dat'
232+ inquire (FILE= trim (file_loc_ib), EXIST= file_check)
233+ if (file_check) then
234+ open (2 , FILE= trim (file_loc_ib), &
235+ FORM= ' unformatted' , &
236+ ACTION= ' read' , &
237+ STATUS= ' old' )
238+ call s_mpi_abort(trim (file_loc)// ' is missing. Exiting ...' )
239+ end if
240+ end if
241+
208242 ! ==================================================================
209243
210244 end subroutine s_read_serial_data_files
@@ -317,7 +351,11 @@ subroutine s_read_parallel_data_files(t_step)
317351 call MPI_FILE_OPEN(MPI_COMM_SELF, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
318352
319353 ! Initialize MPI data I/O
320- call s_initialize_mpi_data(q_cons_vf)
354+ if (ib) then
355+ call s_initialize_mpi_data(q_cons_vf, ib_markers)
356+ else
357+ call s_initialize_mpi_data(q_cons_vf)
358+ end if
321359
322360 ! Size of local arrays
323361 data_size = (m + 1 )* (n + 1 )* (p + 1 )
@@ -351,6 +389,29 @@ subroutine s_read_parallel_data_files(t_step)
351389 call s_mpi_barrier()
352390
353391 call MPI_FILE_CLOSE(ifile, ierr)
392+
393+ if (ib) then
394+
395+ write (file_loc, ' (A)' ) ' ib.dat'
396+ file_loc = trim (case_dir)// ' /restart_data' // trim (mpiiofs)// trim (file_loc)
397+ inquire (FILE= trim (file_loc), EXIST= file_exist)
398+
399+ if (file_exist) then
400+
401+ call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
402+
403+ disp = 0
404+
405+ call MPI_FILE_SET_VIEW(ifile, disp, MPI_INTEGER, MPI_IO_IB_DATA% view, &
406+ ' native' , mpi_info_int, ierr)
407+ call MPI_FILE_READ(ifile, MPI_IO_IB_DATA% var% sf, data_size, &
408+ MPI_INTEGER, status, ierr)
409+
410+ else
411+ call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting...' )
412+ end if
413+
414+ end if
354415 else
355416 call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting...' )
356417 end if
@@ -364,7 +425,11 @@ subroutine s_read_parallel_data_files(t_step)
364425 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
365426
366427 ! Initialize MPI data I/O
367- call s_initialize_mpi_data(q_cons_vf)
428+ if (ib) then
429+ call s_initialize_mpi_data(q_cons_vf, ib_markers)
430+ else
431+ call s_initialize_mpi_data(q_cons_vf)
432+ end if
368433
369434 ! Size of local arrays
370435 data_size = (m + 1 )* (n + 1 )* (p + 1 )
@@ -408,6 +473,28 @@ subroutine s_read_parallel_data_files(t_step)
408473 call s_mpi_barrier()
409474
410475 call MPI_FILE_CLOSE(ifile, ierr)
476+
477+ if (ib) then
478+
479+ write (file_loc, ' (A)' ) ' ib.dat'
480+ file_loc = trim (case_dir)// ' /restart_data' // trim (mpiiofs)// trim (file_loc)
481+ inquire (FILE= trim (file_loc), EXIST= file_exist)
482+
483+ if (file_exist) then
484+
485+ call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
486+
487+ disp = 0
488+
489+ call MPI_FILE_SET_VIEW(ifile, disp, MPI_INTEGER, MPI_IO_IB_DATA% view, &
490+ ' native' , mpi_info_int, ierr)
491+ call MPI_FILE_READ(ifile, MPI_IO_IB_DATA% var% sf, data_size, &
492+ MPI_INTEGER, status, ierr)
493+
494+ else
495+ call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting...' )
496+ end if
497+ end if
411498 else
412499 call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting...' )
413500 end if
@@ -1079,6 +1166,12 @@ subroutine s_initialize_data_input_module
10791166 - buff_size:p + buff_size))
10801167 end do
10811168
1169+ if (ib) then
1170+ allocate (ib_markers% sf(- buff_size:m + buff_size, &
1171+ - buff_size:n + buff_size, &
1172+ - buff_size:p + buff_size))
1173+ end if
1174+
10821175 ! Simulation is 2D
10831176 else
10841177
@@ -1091,6 +1184,11 @@ subroutine s_initialize_data_input_module
10911184 0 :0 ))
10921185 end do
10931186
1187+ if (ib) then
1188+ allocate (ib_markers% sf(- buff_size:m + buff_size, &
1189+ - buff_size:n + buff_size, &
1190+ 0 :0 ))
1191+ end if
10941192 end if
10951193
10961194 ! Simulation is 1D
@@ -1105,6 +1203,10 @@ subroutine s_initialize_data_input_module
11051203 0 :0 ))
11061204 end do
11071205
1206+ if (ib) then
1207+ allocate (ib_markers% sf(- buff_size:m + buff_size, 0 :0 , 0 :0 ))
1208+ end if
1209+
11081210 end if
11091211
11101212 if (parallel_io .neqv. .true. ) then
@@ -1129,6 +1231,10 @@ subroutine s_finalize_data_input_module
11291231 deallocate (q_cons_vf)
11301232 deallocate (q_prim_vf)
11311233
1234+ if (ib) then
1235+ deallocate (ib_markers% sf)
1236+ end if
1237+
11321238 s_read_data_files = > null ()
11331239
11341240 end subroutine s_finalize_data_input_module
0 commit comments