@@ -334,14 +334,15 @@ impure subroutine s_read_parallel_data_files(t_step)
334334
335335 real (wp), allocatable , dimension (:) :: x_cb_glb, y_cb_glb, z_cb_glb
336336
337- integer :: ifile, ierr, data_size
337+ integer :: ifile, ierr, data_size, filetype, stride
338338 integer , dimension (MPI_STATUS_SIZE) :: status
339339
340340 integer (KIND= MPI_OFFSET_KIND) :: disp
341341 integer (KIND= MPI_OFFSET_KIND) :: m_MOK, n_MOK, p_MOK
342342 integer (KIND= MPI_OFFSET_KIND) :: WP_MOK, var_MOK, str_MOK
343343 integer (KIND= MPI_OFFSET_KIND) :: NVARS_MOK
344344 integer (KIND= MPI_OFFSET_KIND) :: MOK
345+ integer (kind= MPI_OFFSET_KIND) :: offset
345346 real (wp) :: delx, dely, delz
346347
347348 character (LEN= path_len + 2 * name_len) :: file_loc
@@ -356,24 +357,29 @@ impure subroutine s_read_parallel_data_files(t_step)
356357 allocate (z_cb_glb(- 1 :p_glb))
357358
358359 if (down_sample) then
359- delx = (x_domain% end - x_domain% beg)/ real (m_glb + 1 , wp)
360- do i = 0 , m_glb
361- x_cb_glb(i - 1 ) = x_domain% beg + delx* real (i, wp)
362- end do
363- x_cb_glb(m_glb) = x_domain% end
360+ stride = 3
364361 else
365- ! Read in cell boundary locations in x-direction
366- file_loc = trim (case_dir)// ' /restart_data' // trim (mpiiofs)// ' x_cb.dat'
367- inquire (FILE= trim (file_loc), EXIST= file_exist)
362+ stride = 1
363+ end if
368364
369- if (file_exist) then
370- data_size = m_glb + 2
371- call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
372- call MPI_FILE_READ(ifile, x_cb_glb, data_size, mpi_p, status, ierr)
373- call MPI_FILE_CLOSE(ifile, ierr)
374- else
375- call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting.' )
376- end if
365+ ! Read in cell boundary locations in x-direction
366+ file_loc = trim (case_dir)// ' /restart_data' // trim (mpiiofs)// ' x_cb.dat'
367+ inquire (FILE= trim (file_loc), EXIST= file_exist)
368+
369+ if (file_exist) then
370+ data_size = m_glb + 2
371+ call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
372+
373+ call MPI_TYPE_VECTOR(data_size, 1 , stride, mpi_p, filetype, ierr)
374+ call MPI_TYPE_COMMIT(filetype, ierr)
375+
376+ offset = 0
377+ call MPI_FILE_SET_VIEW(ifile, offset, mpi_p, filetype, ' native' , mpi_info_int, ierr)
378+
379+ call MPI_FILE_READ(ifile, x_cb_glb, data_size, mpi_p, status, ierr)
380+ call MPI_FILE_CLOSE(ifile, ierr)
381+ else
382+ call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting.' )
377383 end if
378384
379385 ! Assigning local cell boundary locations
@@ -384,25 +390,24 @@ impure subroutine s_read_parallel_data_files(t_step)
384390 x_cc(0 :m) = x_cb(- 1 :m - 1 ) + dx(0 :m)/ 2._wp
385391
386392 if (n > 0 ) then
387- if (down_sample) then
388- dely = (y_domain% end - y_domain% beg)/ real (n_glb + 1 , wp)
389- do i = 0 , n_glb
390- y_cb_glb(i - 1 ) = y_domain% beg + dely* real (i, wp)
391- end do
392- y_cb_glb(n_glb) = y_domain% end
393- else
394- ! Read in cell boundary locations in y-direction
395- file_loc = trim (case_dir)// ' /restart_data' // trim (mpiiofs)// ' y_cb.dat'
396- inquire (FILE= trim (file_loc), EXIST= file_exist)
393+ ! Read in cell boundary locations in y-direction
394+ file_loc = trim (case_dir)// ' /restart_data' // trim (mpiiofs)// ' y_cb.dat'
395+ inquire (FILE= trim (file_loc), EXIST= file_exist)
397396
398- if (file_exist) then
399- data_size = n_glb + 2
400- call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
401- call MPI_FILE_READ(ifile, y_cb_glb, data_size, mpi_p, status, ierr)
402- call MPI_FILE_CLOSE(ifile, ierr)
403- else
404- call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting.' )
405- end if
397+ if (file_exist) then
398+ data_size = n_glb + 2
399+ call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
400+
401+ call MPI_TYPE_VECTOR(data_size, 1 , stride, mpi_p, filetype, ierr)
402+ call MPI_TYPE_COMMIT(filetype, ierr)
403+
404+ offset = 0
405+ call MPI_FILE_SET_VIEW(ifile, offset, mpi_p, filetype, ' native' , mpi_info_int, ierr)
406+
407+ call MPI_FILE_READ(ifile, y_cb_glb, data_size, mpi_p, status, ierr)
408+ call MPI_FILE_CLOSE(ifile, ierr)
409+ else
410+ call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting.' )
406411 end if
407412
408413 ! Assigning local cell boundary locations
@@ -413,25 +418,25 @@ impure subroutine s_read_parallel_data_files(t_step)
413418 y_cc(0 :n) = y_cb(- 1 :n - 1 ) + dy(0 :n)/ 2._wp
414419
415420 if (p > 0 ) then
416- if (down_sample) then
417- delz = (z_domain% end - z_domain% beg)/ real (p_glb + 1 , wp)
418- do i = 0 , p_glb
419- z_cb_glb(i - 1 ) = z_domain% beg + delz* real (i, wp)
420- end do
421- z_cb_glb(p_glb) = z_domain% end
421+ ! Read in cell boundary locations in z-direction
422+ file_loc = trim (case_dir)// ' /restart_data' // trim (mpiiofs)// ' z_cb.dat'
423+ inquire (FILE= trim (file_loc), EXIST= file_exist)
424+
425+ if (file_exist) then
426+ data_size = p_glb + 2
427+ call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
428+
429+ call MPI_TYPE_VECTOR(data_size, 1 , stride, mpi_p, filetype, ierr)
430+ call MPI_TYPE_COMMIT(filetype, ierr)
431+
432+ offset = 0
433+ call MPI_FILE_SET_VIEW(ifile, offset, mpi_p, filetype, ' native' , mpi_info_int, ierr)
434+
435+
436+ call MPI_FILE_READ(ifile, z_cb_glb, data_size, mpi_p, status, ierr)
437+ call MPI_FILE_CLOSE(ifile, ierr)
422438 else
423- ! Read in cell boundary locations in z-direction
424- file_loc = trim (case_dir)// ' /restart_data' // trim (mpiiofs)// ' z_cb.dat'
425- inquire (FILE= trim (file_loc), EXIST= file_exist)
426-
427- if (file_exist) then
428- data_size = p_glb + 2
429- call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
430- call MPI_FILE_READ(ifile, z_cb_glb, data_size, mpi_p, status, ierr)
431- call MPI_FILE_CLOSE(ifile, ierr)
432- else
433- call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting.' )
434- end if
439+ call s_mpi_abort(' File ' // trim (file_loc)// ' is missing. Exiting.' )
435440 end if
436441
437442 ! Assigning local cell boundary locations
0 commit comments