Skip to content

Commit 303ded6

Browse files
committed
fix post process
1 parent a55eecc commit 303ded6

File tree

4 files changed

+60
-68
lines changed

4 files changed

+60
-68
lines changed

src/post_process/m_data_input.f90

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/post_process/m_global_parameters.fpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ module m_global_parameters
153153
! Stands for "InDices With BUFFer".
154154
type(int_bounds_info) :: idwbuff(1:3)
155155

156-
!! Locations of the domain bounds in the x-, y- and z-coordinate directions
157-
type(bounds_info) :: x_domain, y_domain, z_domain
158-
159156
integer :: num_bc_patches
160157
logical :: bc_io
161158
!> @name Boundary conditions in the x-, y- and z-coordinate directions
@@ -472,13 +469,6 @@ contains
472469
z_output%beg = dflt_real
473470
z_output%end = dflt_real
474471

475-
x_domain%beg = dflt_real
476-
x_domain%end = dflt_real
477-
y_domain%beg = dflt_real
478-
y_domain%end = dflt_real
479-
z_domain%beg = dflt_real
480-
z_domain%end = dflt_real
481-
482472
! MHD
483473
Bx0 = dflt_real
484474

src/post_process/m_mpi_proxy.fpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ contains
129129
#:for VAR in [ 'pref', 'rhoref', 'R0ref', 'poly_sigma', 'Web', 'Ca', &
130130
& 'Re_inv', 'Bx0', 'sigma', 't_save', 't_stop', &
131131
& 'x_output%beg', 'x_output%end', 'y_output%beg', &
132-
& 'y_output%end', 'z_output%beg', 'z_output%end', &
133-
& 'x_domain%beg', 'y_domain%beg', 'z_domain%beg', &
134-
& 'x_domain%end', 'y_domain%end', 'z_domain%end']
132+
& 'y_output%end', 'z_output%beg', 'z_output%end']
135133
call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
136134
#:endfor
137135
call MPI_BCAST(schlieren_alpha(1), num_fluids_max, mpi_p, 0, MPI_COMM_WORLD, ierr)

src/post_process/m_start_up.f90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ impure subroutine s_read_input_file
8989
cfl_adap_dt, cfl_const_dt, t_save, t_stop, n_start, &
9090
cfl_target, surface_tension, bubbles_lagrange, &
9191
sim_data, hyperelasticity, Bx0, relativity, cont_damage, &
92-
num_bc_patches, igr, igr_order, down_sample, &
93-
x_domain, y_domain, z_domain
92+
num_bc_patches, igr, igr_order, down_sample
9493

9594
! Inquiring the status of the post_process.inp file
9695
file_loc = 'post_process.inp'

0 commit comments

Comments
 (0)