@@ -51,6 +51,9 @@ end subroutine s_read_abstract_data_files
51
51
type (scalar_field), allocatable , dimension (:), public :: q_prim_vf ! <
52
52
! ! Primitive variables
53
53
54
+ ! type(scalar_field), public :: ib_markers !<
55
+ type (integer_field), public :: ib_markers
56
+
54
57
procedure (s_read_abstract_data_files), pointer :: s_read_data_files = > null ()
55
58
56
59
contains
@@ -75,6 +78,11 @@ subroutine s_read_serial_data_files(t_step)
75
78
! ! Used to store the variable position, in character form, of the
76
79
! ! currently manipulated conservative variable file
77
80
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
+
78
86
logical :: dir_check ! <
79
87
! ! Generic logical used to test the existence of a particular folder
80
88
@@ -87,9 +95,14 @@ subroutine s_read_serial_data_files(t_step)
87
95
write (t_step_dir, ' (A,I0,A,I0)' ) ' /p_all/p' , proc_rank, ' /' , t_step
88
96
t_step_dir = trim (case_dir)// trim (t_step_dir)
89
97
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
+
90
101
! Inquiring as to the existence of the time-step directory
91
102
file_loc = trim (t_step_dir)// ' /.'
92
103
104
+ file_loc_ib = trim (t_step_ib_dir)// ' /.'
105
+
93
106
call my_inquire(file_loc, dir_check)
94
107
95
108
! If the time-step directory is missing, the post-process exits.
@@ -98,6 +111,14 @@ subroutine s_read_serial_data_files(t_step)
98
111
' is missing. Exiting ...' )
99
112
end if
100
113
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
+
101
122
! Reading the Grid Data File for the x-direction ===================
102
123
103
124
! Checking whether x_cb.dat exists
@@ -205,6 +226,19 @@ subroutine s_read_serial_data_files(t_step)
205
226
206
227
end do
207
228
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
+
208
242
! ==================================================================
209
243
210
244
end subroutine s_read_serial_data_files
@@ -317,7 +351,11 @@ subroutine s_read_parallel_data_files(t_step)
317
351
call MPI_FILE_OPEN(MPI_COMM_SELF, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
318
352
319
353
! 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
321
359
322
360
! Size of local arrays
323
361
data_size = (m + 1 )* (n + 1 )* (p + 1 )
@@ -351,6 +389,29 @@ subroutine s_read_parallel_data_files(t_step)
351
389
call s_mpi_barrier()
352
390
353
391
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
354
415
else
355
416
call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting...' )
356
417
end if
@@ -364,7 +425,11 @@ subroutine s_read_parallel_data_files(t_step)
364
425
call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
365
426
366
427
! 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
368
433
369
434
! Size of local arrays
370
435
data_size = (m + 1 )* (n + 1 )* (p + 1 )
@@ -408,6 +473,28 @@ subroutine s_read_parallel_data_files(t_step)
408
473
call s_mpi_barrier()
409
474
410
475
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
411
498
else
412
499
call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting...' )
413
500
end if
@@ -1079,6 +1166,12 @@ subroutine s_initialize_data_input_module
1079
1166
- buff_size:p + buff_size))
1080
1167
end do
1081
1168
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
+
1082
1175
! Simulation is 2D
1083
1176
else
1084
1177
@@ -1091,6 +1184,11 @@ subroutine s_initialize_data_input_module
1091
1184
0 :0 ))
1092
1185
end do
1093
1186
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
1094
1192
end if
1095
1193
1096
1194
! Simulation is 1D
@@ -1105,6 +1203,10 @@ subroutine s_initialize_data_input_module
1105
1203
0 :0 ))
1106
1204
end do
1107
1205
1206
+ if (ib) then
1207
+ allocate (ib_markers% sf(- buff_size:m + buff_size, 0 :0 , 0 :0 ))
1208
+ end if
1209
+
1108
1210
end if
1109
1211
1110
1212
if (parallel_io .neqv. .true. ) then
@@ -1129,6 +1231,10 @@ subroutine s_finalize_data_input_module
1129
1231
deallocate (q_cons_vf)
1130
1232
deallocate (q_prim_vf)
1131
1233
1234
+ if (ib) then
1235
+ deallocate (ib_markers% sf)
1236
+ end if
1237
+
1132
1238
s_read_data_files = > null ()
1133
1239
1134
1240
end subroutine s_finalize_data_input_module
0 commit comments