@@ -901,86 +901,102 @@ contains
901901
902902 call MPI_BCAST(proc_bubble_counts, file_num_procs, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
903903
904- gsizes(1) = file_tot_part
905- gsizes(2) = lag_io_vars
906- lsizes(1) = file_tot_part
907- lsizes(2) = lag_io_vars
908- start_idx_part(1) = 0
909- start_idx_part(2) = 0
904+ if (file_tot_part > 0) then
905+ gsizes(1) = file_tot_part
906+ gsizes(2) = lag_io_vars
907+ lsizes(1) = file_tot_part
908+ lsizes(2) = lag_io_vars
909+ start_idx_part(1) = 0
910+ start_idx_part(2) = 0
910911
911- call MPI_TYPE_CREATE_SUBARRAY(2, gsizes, lsizes, start_idx_part, MPI_ORDER_FORTRAN, mpi_p, view, ierr)
912- call MPI_TYPE_COMMIT(view, ierr)
912+ call MPI_TYPE_CREATE_SUBARRAY(2, gsizes, lsizes, start_idx_part, MPI_ORDER_FORTRAN, mpi_p, view, ierr)
913+ call MPI_TYPE_COMMIT(view, ierr)
913914
914- call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
915+ call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
915916
916- disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs) &
917- & + file_num_procs*sizeof(proc_bubble_counts(1)), MPI_OFFSET_KIND)
918- call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, view, ' native' , mpi_info_null, ierr)
917+ disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs) &
918+ & + file_num_procs*sizeof(proc_bubble_counts(1)), MPI_OFFSET_KIND)
919+ call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, view, ' native' , mpi_info_null, ierr)
919920
920- allocate (MPI_IO_DATA_lg_bubbles(file_tot_part,1:lag_io_vars))
921+ allocate (MPI_IO_DATA_lg_bubbles(file_tot_part,1:lag_io_vars))
921922
922- call MPI_FILE_READ_ALL(ifile, MPI_IO_DATA_lg_bubbles, lag_io_vars*file_tot_part, mpi_p, status, ierr)
923+ call MPI_FILE_READ_ALL(ifile, MPI_IO_DATA_lg_bubbles, lag_io_vars*file_tot_part, mpi_p, status, ierr)
923924
924- write (file_loc, ' (A,I0,A)' ) ' lag_bubbles_post_process_' , t_step, ' .dat'
925- file_loc = trim(case_dir) // ' / lag_bubbles_post_process/ ' // trim(file_loc)
925+ write (file_loc, ' (A,I0,A)' ) ' lag_bubbles_post_process_' , t_step, ' .dat'
926+ file_loc = trim(case_dir) // ' / lag_bubbles_post_process/ ' // trim(file_loc)
926927
927- if (proc_rank == 0) then
928- open (unit=29, file=file_loc, form=' formatted' , position=' rewind' )
929-
930- if (lag_header) then
931- write (29, ' (A)' , advance=' no' )
932- if (lag_id_wrt) write (29, ' (A8)' , advance=' no' ) ' id, '
933- if (lag_pos_wrt) write (29, ' (3 (A17))' , advance=' no' ) ' px, ' , ' py, ' , ' pz, '
934- if (lag_pos_prev_wrt) write (29, ' (3 (A17))' , advance=' no' ) ' pvx, ' , ' pvy, ' , ' pvz, '
935- if (lag_vel_wrt) write (29, ' (3 (A17))' , advance=' no' ) ' vx, ' , ' vy, ' , ' vz, '
936- if (lag_rad_wrt) write (29, ' (A17)' , advance=' no' ) ' radius, '
937- if (lag_rvel_wrt) write (29, ' (A17)' , advance=' no' ) ' rvel, '
938- if (lag_r0_wrt) write (29, ' (A17)' , advance=' no' ) ' r0, '
939- if (lag_rmax_wrt) write (29, ' (A17)' , advance=' no' ) ' rmax, '
940- if (lag_rmin_wrt) write (29, ' (A17)' , advance=' no' ) ' rmin, '
941- if (lag_dphidt_wrt) write (29, ' (A17)' , advance=' no' ) ' dphidt, '
942- if (lag_pres_wrt) write (29, ' (A17)' , advance=' no' ) ' pressure, '
943- if (lag_mv_wrt) write (29, ' (A17)' , advance=' no' ) ' mv, '
944- if (lag_mg_wrt) write (29, ' (A17)' , advance=' no' ) ' mg, '
945- if (lag_betaT_wrt) write (29, ' (A17)' , advance=' no' ) ' betaT, '
946- if (lag_betaC_wrt) write (29, ' (A17)' , advance=' no' ) ' betaC, '
947- write (29, ' (A15)' ) ' time'
928+ if (proc_rank == 0) then
929+ open (unit=29, file=file_loc, form=' formatted' , position=' rewind' )
930+
931+ if (lag_header) then
932+ write (29, ' (A)' , advance=' no' )
933+ if (lag_id_wrt) write (29, ' (A8)' , advance=' no' ) ' id, '
934+ if (lag_pos_wrt) write (29, ' (3 (A17))' , advance=' no' ) ' px, ' , ' py, ' , ' pz, '
935+ if (lag_pos_prev_wrt) write (29, ' (3 (A17))' , advance=' no' ) ' pvx, ' , ' pvy, ' , ' pvz, '
936+ if (lag_vel_wrt) write (29, ' (3 (A17))' , advance=' no' ) ' vx, ' , ' vy, ' , ' vz, '
937+ if (lag_rad_wrt) write (29, ' (A17)' , advance=' no' ) ' radius, '
938+ if (lag_rvel_wrt) write (29, ' (A17)' , advance=' no' ) ' rvel, '
939+ if (lag_r0_wrt) write (29, ' (A17)' , advance=' no' ) ' r0, '
940+ if (lag_rmax_wrt) write (29, ' (A17)' , advance=' no' ) ' rmax, '
941+ if (lag_rmin_wrt) write (29, ' (A17)' , advance=' no' ) ' rmin, '
942+ if (lag_dphidt_wrt) write (29, ' (A17)' , advance=' no' ) ' dphidt, '
943+ if (lag_pres_wrt) write (29, ' (A17)' , advance=' no' ) ' pressure, '
944+ if (lag_mv_wrt) write (29, ' (A17)' , advance=' no' ) ' mv, '
945+ if (lag_mg_wrt) write (29, ' (A17)' , advance=' no' ) ' mg, '
946+ if (lag_betaT_wrt) write (29, ' (A17)' , advance=' no' ) ' betaT, '
947+ if (lag_betaC_wrt) write (29, ' (A17)' , advance=' no' ) ' betaC, '
948+ write (29, ' (A15)' ) ' time'
949+ end if
950+
951+ do i = 1, file_tot_part
952+ id = int(MPI_IO_DATA_lg_bubbles(i, 1))
953+ inputvals(1:20) = MPI_IO_DATA_lg_bubbles(i,2:21)
954+ if (id > 0) then
955+ write (29, ' (100 (A))' , advance=' no' ) ''
956+ if (lag_id_wrt) write (29, ' (I6, A)' , advance=' no' ) id, ' , '
957+ if (lag_pos_wrt) write (29, ' (3 (E15.7 , A))' , advance=' no' ) inputvals(1), ' , ' , inputvals(2), ' , ' , &
958+ & inputvals(3), ' , '
959+ if (lag_pos_prev_wrt) write (29, ' (3 (E15.7 , A))' , advance=' no' ) inputvals(4), ' , ' , inputvals(5), ' , ' , &
960+ & inputvals(6), ' , '
961+ if (lag_vel_wrt) write (29, ' (3 (E15.7 , A))' , advance=' no' ) inputvals(7), ' , ' , inputvals(8), ' , ' , &
962+ & inputvals(9), ' , '
963+ if (lag_rad_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(10), ' , '
964+ if (lag_rvel_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(11), ' , '
965+ if (lag_r0_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(12), ' , '
966+ if (lag_rmax_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(13), ' , '
967+ if (lag_rmin_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(14), ' , '
968+ if (lag_dphidt_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(15), ' , '
969+ if (lag_pres_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(16), ' , '
970+ if (lag_mv_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(17), ' , '
971+ if (lag_mg_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(18), ' , '
972+ if (lag_betaT_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(19), ' , '
973+ if (lag_betaC_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(20), ' , '
974+ write (29, ' (E15.7 )' ) time_real
975+ end if
976+ end do
977+ close (29)
948978 end if
949979
950- do i = 1, file_tot_part
951- id = int(MPI_IO_DATA_lg_bubbles(i, 1))
952- inputvals(1:20) = MPI_IO_DATA_lg_bubbles(i,2:21)
953- if (id > 0) then
954- write (29, ' (100 (A))' , advance=' no' ) ''
955- if (lag_id_wrt) write (29, ' (I6, A)' , advance=' no' ) id, ' , '
956- if (lag_pos_wrt) write (29, ' (3 (E15.7 , A))' , advance=' no' ) inputvals(1), ' , ' , inputvals(2), ' , ' , &
957- & inputvals(3), ' , '
958- if (lag_pos_prev_wrt) write (29, ' (3 (E15.7 , A))' , advance=' no' ) inputvals(4), ' , ' , inputvals(5), ' , ' , &
959- & inputvals(6), ' , '
960- if (lag_vel_wrt) write (29, ' (3 (E15.7 , A))' , advance=' no' ) inputvals(7), ' , ' , inputvals(8), ' , ' , &
961- & inputvals(9), ' , '
962- if (lag_rad_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(10), ' , '
963- if (lag_rvel_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(11), ' , '
964- if (lag_r0_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(12), ' , '
965- if (lag_rmax_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(13), ' , '
966- if (lag_rmin_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(14), ' , '
967- if (lag_dphidt_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(15), ' , '
968- if (lag_pres_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(16), ' , '
969- if (lag_mv_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(17), ' , '
970- if (lag_mg_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(18), ' , '
971- if (lag_betaT_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(19), ' , '
972- if (lag_betaC_wrt) write (29, ' (E15.7 , A)' , advance=' no' ) inputvals(20), ' , '
973- write (29, ' (E15.7 )' ) time_real
974- end if
975- end do
976- close (29)
977- end if
980+ deallocate (MPI_IO_DATA_lg_bubbles)
978981
979- deallocate (MPI_IO_DATA_lg_bubbles )
982+ call s_mpi_barrier( )
980983
981- call s_mpi_barrier()
984+ call MPI_FILE_CLOSE(ifile, ierr)
985+ else
986+ call MPI_TYPE_CONTIGUOUS(0, mpi_p, view, ierr)
987+ call MPI_TYPE_COMMIT(view, ierr)
988+
989+ call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
982990
983- call MPI_FILE_CLOSE(ifile, ierr)
991+ disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs) &
992+ & + file_num_procs*sizeof(proc_bubble_counts(1)), MPI_OFFSET_KIND)
993+ call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, view, ' native' , mpi_info_null, ierr)
994+
995+ call MPI_FILE_READ_ALL(ifile, lag_io_null, 0, mpi_p, status, ierr)
996+
997+ call MPI_FILE_CLOSE(ifile, ierr)
998+ call MPI_TYPE_FREE(view, ierr)
999+ end if
9841000#endif
9851001
9861002 end subroutine s_write_lag_bubbles_results_to_text
@@ -1083,7 +1099,6 @@ contains
10831099 allocate (${VAR}$ (nBub))
10841100 #:endfor
10851101 allocate (MPI_IO_DATA_lg_bubbles(nBub,1:lag_io_vars))
1086-
10871102 call MPI_TYPE_CREATE_SUBARRAY(2, gsizes, lsizes, start_idx_part, MPI_ORDER_FORTRAN, mpi_p, view, ierr)
10881103 call MPI_TYPE_COMMIT(view, ierr)
10891104
0 commit comments