1# 1 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
27 include
'silo_f9x.inc'
30 real(wp),
allocatable,
dimension(:,:,:),
public ::
q_sf
31 real(wp),
allocatable,
dimension(:,:,:) ::
q_root_sf
32 real(wp),
allocatable,
dimension(:,:,:) ::
cyl_q_sf
35 real(sp),
allocatable,
dimension(:,:,:),
public ::
q_sf_s
48 integer,
allocatable,
dimension(:) ::
dims
57 character(LEN=path_len + name_len) ::
dbdir
59 character(LEN=path_len + 2*name_len) ::
rootdir
74 integer,
private ::
err
81 character(LEN=len_trim(case_dir) + 2*name_len) :: file_loc
107 if (
format == 1)
then
132 if (
format == 1)
then
161 if (
format == 1)
then
171 if (dir_check .neqv. .true.)
then
178 file_loc = trim(
rootdir) //
'/.'
181 if (dir_check .neqv. .true.)
then
196 if (dir_check .neqv. .true.)
then
203 file_loc = trim(
rootdir) //
'/.'
207 if (dir_check .neqv. .true.)
then
216 file_loc = trim(
dbdir) //
'/.'
219 if (dir_check .neqv. .true.)
then
228 if (
format == 2)
then
233 if (
format == 2)
then
321 integer :: lower_bound, upper_bound
323# 323 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
329 do i = lower_bound, upper_bound
336 do i = upper_bound, lower_bound, -1
348# 323 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
354 do i = lower_bound, upper_bound
361 do i = upper_bound, lower_bound, -1
373# 323 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
379 do i = lower_bound, upper_bound
386 do i = upper_bound, lower_bound, -1
398# 348 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
405 integer,
intent(in) :: t_step
406 character(LEN=len_trim(case_dir) + 3*name_len) :: file_loc
409 if (
format == 1)
then
410 write (file_loc,
'(A,I0,A)')
'/', t_step,
'.silo'
413 ierr = dbcreate(trim(file_loc), len_trim(file_loc), db_clobber, db_local,
'MFC v3.0', 8, db_hdf5,
dbfile)
416 call s_mpi_abort(
'Unable to create Silo-HDF5 database ' //
'slave file ' // trim(file_loc) //
'. ' //
'Exiting.')
420 write (file_loc,
'(A,I0,A)')
'/collection_', t_step,
'.silo'
421 file_loc = trim(
rootdir) // trim(file_loc)
423 ierr = dbcreate(trim(file_loc), len_trim(file_loc), db_clobber, db_local,
'MFC v3.0', 8, db_hdf5,
dbroot)
426 call s_mpi_abort(
'Unable to create Silo-HDF5 database ' //
'master file ' // trim(file_loc) //
'. ' &
431 write (file_loc,
'(A,I0,A)')
'/', t_step,
'.dat'
434 open (
dbfile, iostat=
err, file=trim(file_loc), form=
'unformatted', status=
'replace')
437 call s_mpi_abort(
'Unable to create Binary database slave ' //
'file ' // trim(file_loc) //
'. Exiting.')
448 write (file_loc,
'(A,I0,A)')
'/', t_step,
'.dat'
449 file_loc = trim(
rootdir) // trim(file_loc)
451 open (
dbroot, iostat=
err, file=trim(file_loc), form=
'unformatted', status=
'replace')
454 call s_mpi_abort(
'Unable to create Binary database ' //
'master file ' // trim(file_loc) //
'. Exiting.')
470 character(LEN=path_len + 3*name_len) :: file_path
472 write (file_path,
'(A)')
'/intf_data.dat'
473 file_path = trim(
case_dir) // trim(file_path)
475 open (211, file=trim(file_path), form=
'formatted', position=
'append', status=
'unknown')
482 character(LEN=path_len + 3*name_len) :: file_path
484 write (file_path,
'(A)')
'/eng_data.dat'
485 file_path = trim(
case_dir) // trim(file_path)
487 open (251, file=trim(file_path), form=
'formatted', position=
'append', status=
'unknown')
494 integer,
intent(in) :: t_step
497 character(LEN=4*name_len),
dimension(num_procs) :: meshnames
498 integer,
dimension(num_procs) :: meshtypes
502 if (
format == 1)
then
524 write (meshnames(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:rectilinear_grid'
527 meshtypes = db_quad_rect
529 err = dbset2dstrlen(len(meshnames(1)))
546 err = dbputqm(
dbfile,
'rectilinear_grid', 16,
'x', 1,
'y', 1,
'z', 1,
y_cb,
z_cb,
x_cb,
dims, 3, db_double, &
549 err = dbputqm(
dbfile,
'rectilinear_grid', 16,
'x', 1,
'y', 1,
'z', 1,
x_cb,
y_cb,
z_cb,
dims, 3, db_double, &
557 err = dbputqm(
dbfile,
'rectilinear_grid', 16,
'x', 1,
'y', 1,
'z', 1,
x_cb,
y_cb, db_f77null,
dims, 2, db_double, &
564 err = dbputqm(
dbfile,
'rectilinear_grid', 16,
'x', 1,
'y', 1,
'z', 1,
x_cb, db_f77null, db_f77null,
dims, 1, &
565 & db_double, db_collinear,
optlist, ierr)
568 else if (
format == 2)
then
631 character(LEN=*),
intent(in) :: varname
632 integer,
intent(in) :: t_step
635 character(LEN=4*name_len),
dimension(num_procs) :: varnames
636 integer,
dimension(num_procs) :: vartypes
640 if (
format == 1)
then
650 write (varnames(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:' // trim(varname)
653 vartypes = db_quadvar
655 err = dbset2dstrlen(len(varnames(1)))
657 err = dbaddiopt(
optlist, dbopt_extents_size, 2)
659 err = dbputmvar(
dbroot, trim(varname), len_trim(varname),
num_procs, varnames, len_trim(varnames), vartypes, &
693 else if (wp == sp)
then
712# 662 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
716 err = dbputqv1(
dbfile, trim(varname), len_trim(varname),
'rectilinear_grid', 16,
cyl_q_sf_s, &
717 &
dims - 1, 3, db_f77null, 0, db_float, db_zonecent, db_f77null, ierr)
719 err = dbputqv1(
dbfile, trim(varname), len_trim(varname),
'rectilinear_grid', 16,
q_sf_s, &
720 &
dims - 1, 3, db_f77null, 0, db_float, db_zonecent, db_f77null, ierr)
723 err = dbputqv1(
dbfile, trim(varname), len_trim(varname),
'rectilinear_grid', 16,
q_sf_s,
dims - 1, &
724 & 2, db_f77null, 0, db_float, db_zonecent, db_f77null, ierr)
726 err = dbputqv1(
dbfile, trim(varname), len_trim(varname),
'rectilinear_grid', 16,
q_sf_s,
dims - 1, &
727 & 1, db_f77null, 0, db_float, db_zonecent, db_f77null, ierr)
730# 662 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
734 err = dbputqv1(
dbfile, trim(varname), len_trim(varname),
'rectilinear_grid', 16,
cyl_q_sf, &
735 &
dims - 1, 3, db_f77null, 0, db_double, db_zonecent, db_f77null, ierr)
737 err = dbputqv1(
dbfile, trim(varname), len_trim(varname),
'rectilinear_grid', 16,
q_sf, &
738 &
dims - 1, 3, db_f77null, 0, db_double, db_zonecent, db_f77null, ierr)
741 err = dbputqv1(
dbfile, trim(varname), len_trim(varname),
'rectilinear_grid', 16,
q_sf,
dims - 1, &
742 & 2, db_f77null, 0, db_double, db_zonecent, db_f77null, ierr)
744 err = dbputqv1(
dbfile, trim(varname), len_trim(varname),
'rectilinear_grid', 16,
q_sf,
dims - 1, &
745 & 1, db_f77null, 0, db_double, db_zonecent, db_f77null, ierr)
748# 680 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
782 integer,
intent(in) :: t_step
783 character(len=len_trim(case_dir) + 3*name_len) :: file_loc
787 real(wp),
dimension(20) :: inputvals
788 real(wp) :: time_real
789 integer,
dimension(MPI_STATUS_SIZE) :: status
790 integer(KIND=MPI_OFFSET_KIND) :: disp
792 logical :: file_exist
793 integer,
dimension(2) :: gsizes, lsizes, start_idx_part
796 real(wp) :: file_time, file_dt
797 integer :: file_num_procs, file_tot_part
799 integer,
dimension(:),
allocatable :: proc_bubble_counts
800 real(wp),
dimension(1:1,1:lag_io_vars) :: lag_io_null
805 write (file_loc,
'(A,I0,A)')
'lag_bubbles_', t_step,
'.dat'
806 file_loc = trim(
case_dir) //
'/restart_data' // trim(
mpiiofs) // trim(file_loc)
809 inquire (file=trim(file_loc), exist=file_exist)
810 if (.not. file_exist)
then
811 call s_mpi_abort(
'Restart file ' // trim(file_loc) //
' does not exist!')
817 call mpi_file_open(mpi_comm_self, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
819 call mpi_file_read(ifile, file_tot_part, 1, mpi_integer, status, ierr)
820 call mpi_file_read(ifile, file_time, 1, mpi_p, status, ierr)
821 call mpi_file_read(ifile, file_dt, 1, mpi_p, status, ierr)
822 call mpi_file_read(ifile, file_num_procs, 1, mpi_integer, status, ierr)
824 call mpi_file_close(ifile, ierr)
827 call mpi_bcast(file_tot_part, 1, mpi_integer, 0, mpi_comm_world, ierr)
828 call mpi_bcast(file_time, 1, mpi_p, 0, mpi_comm_world, ierr)
829 call mpi_bcast(file_dt, 1, mpi_p, 0, mpi_comm_world, ierr)
830 call mpi_bcast(file_num_procs, 1, mpi_integer, 0, mpi_comm_world, ierr)
831 time_real = file_time
833 allocate (proc_bubble_counts(file_num_procs))
836 call mpi_file_open(mpi_comm_self, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
839 disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs), mpi_offset_kind)
840 call mpi_file_seek(ifile, disp, mpi_seek_set, ierr)
841 call mpi_file_read(ifile, proc_bubble_counts, file_num_procs, mpi_integer, status, ierr)
843 call mpi_file_close(ifile, ierr)
846 call mpi_bcast(proc_bubble_counts, file_num_procs, mpi_integer, 0, mpi_comm_world, ierr)
848 gsizes(1) = file_tot_part
849 gsizes(2) = lag_io_vars
850 lsizes(1) = file_tot_part
851 lsizes(2) = lag_io_vars
852 start_idx_part(1) = 0
853 start_idx_part(2) = 0
855 call mpi_type_create_subarray(2, gsizes, lsizes, start_idx_part, mpi_order_fortran, mpi_p, view, ierr)
856 call mpi_type_commit(view, ierr)
858 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
860 disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs) &
861 & + file_num_procs*sizeof(proc_bubble_counts(1)), mpi_offset_kind)
862 call mpi_file_set_view(ifile, disp, mpi_p, view,
'native', mpi_info_null, ierr)
868 write (file_loc,
'(A,I0,A)')
'lag_bubbles_post_process_', t_step,
'.dat'
869 file_loc = trim(
case_dir) //
'/lag_bubbles_post_process/' // trim(file_loc)
872 open (unit=29, file=file_loc, form=
'formatted', position=
'rewind')
875 write (29,
'(A)', advance=
'no')
876 if (
lag_id_wrt)
write (29,
'(A8)', advance=
'no')
'id, '
877 if (
lag_pos_wrt)
write (29,
'(3(A17))', advance=
'no')
'px, ',
'py, ',
'pz, '
878 if (
lag_pos_prev_wrt)
write (29,
'(3(A17))', advance=
'no')
'pvx, ',
'pvy, ',
'pvz, '
879 if (
lag_vel_wrt)
write (29,
'(3(A17))', advance=
'no')
'vx, ',
'vy, ',
'vz, '
880 if (
lag_rad_wrt)
write (29,
'(A17)', advance=
'no')
'radius, '
881 if (
lag_rvel_wrt)
write (29,
'(A17)', advance=
'no')
'rvel, '
882 if (
lag_r0_wrt)
write (29,
'(A17)', advance=
'no')
'r0, '
883 if (
lag_rmax_wrt)
write (29,
'(A17)', advance=
'no')
'rmax, '
884 if (
lag_rmin_wrt)
write (29,
'(A17)', advance=
'no')
'rmin, '
886 if (
lag_pres_wrt)
write (29,
'(A17)', advance=
'no')
'pressure, '
887 if (
lag_mv_wrt)
write (29,
'(A17)', advance=
'no')
'mv, '
888 if (
lag_mg_wrt)
write (29,
'(A17)', advance=
'no')
'mg, '
889 if (
lag_betat_wrt)
write (29,
'(A17)', advance=
'no')
'betaT, '
890 if (
lag_betac_wrt)
write (29,
'(A17)', advance=
'no')
'betaC, '
891 write (29,
'(A15)')
'time'
894 do i = 1, file_tot_part
898 write (29,
'(100(A))', advance=
'no')
''
899 if (
lag_id_wrt)
write (29,
'(I6, A)', advance=
'no') id,
', '
900 if (
lag_pos_wrt)
write (29,
'(3(E15.7, A))', advance=
'no') inputvals(1),
', ', inputvals(2),
', ', &
902 if (
lag_pos_prev_wrt)
write (29,
'(3(E15.7, A))', advance=
'no') inputvals(4),
', ', inputvals(5),
', ', &
904 if (
lag_vel_wrt)
write (29,
'(3(E15.7, A))', advance=
'no') inputvals(7),
', ', inputvals(8),
', ', &
906 if (
lag_rad_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(10),
', '
907 if (
lag_rvel_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(11),
', '
908 if (
lag_r0_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(12),
', '
909 if (
lag_rmax_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(13),
', '
910 if (
lag_rmin_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(14),
', '
911 if (
lag_dphidt_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(15),
', '
912 if (
lag_pres_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(16),
', '
913 if (
lag_mv_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(17),
', '
914 if (
lag_mg_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(18),
', '
915 if (
lag_betat_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(19),
', '
916 if (
lag_betac_wrt)
write (29,
'(E15.7, A)', advance=
'no') inputvals(20),
', '
917 write (29,
'(E15.7)') time_real
927 call mpi_file_close(ifile, ierr)
935 integer,
intent(in) :: t_step
936 character(len=len_trim(case_dir) + 3*name_len) :: file_loc
940 real(wp) :: time_real
941 integer,
dimension(MPI_STATUS_SIZE) :: status
942 integer(KIND=MPI_OFFSET_KIND) :: disp
944 logical :: file_exist
945 integer,
dimension(2) :: gsizes, lsizes, start_idx_part
946 integer :: ifile, ierr, nbub
947 real(wp) :: file_time, file_dt
948 integer :: file_num_procs, file_tot_part
949 integer,
dimension(:),
allocatable :: proc_bubble_counts
950 real(wp),
dimension(1:1,1:lag_io_vars) ::
dummy
951 character(LEN=4*name_len),
dimension(num_procs) :: meshnames
952 integer,
dimension(num_procs) :: meshtypes
953 real(wp) :: dummy_data
955 real(wp),
dimension(:),
allocatable :: bub_id
956 real(wp),
dimension(:),
allocatable :: px, py, pz, ppx, ppy, ppz, vx, vy, vz
957 real(wp),
dimension(:),
allocatable :: radius, rvel, rnot, rmax, rmin, dphidt
958 real(wp),
dimension(:),
allocatable :: pressure, mv, mg, betat, betac
964 write (file_loc,
'(A,I0,A)')
'lag_bubbles_', t_step,
'.dat'
965 file_loc = trim(
case_dir) //
'/restart_data' // trim(
mpiiofs) // trim(file_loc)
968 inquire (file=trim(file_loc), exist=file_exist)
969 if (.not. file_exist)
then
970 call s_mpi_abort(
'Restart file ' // trim(file_loc) //
' does not exist!')
976 call mpi_file_open(mpi_comm_self, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
978 call mpi_file_read(ifile, file_tot_part, 1, mpi_integer, status, ierr)
979 call mpi_file_read(ifile, file_time, 1, mpi_p, status, ierr)
980 call mpi_file_read(ifile, file_dt, 1, mpi_p, status, ierr)
981 call mpi_file_read(ifile, file_num_procs, 1, mpi_integer, status, ierr)
983 call mpi_file_close(ifile, ierr)
986 call mpi_bcast(file_tot_part, 1, mpi_integer, 0, mpi_comm_world, ierr)
987 call mpi_bcast(file_time, 1, mpi_p, 0, mpi_comm_world, ierr)
988 call mpi_bcast(file_dt, 1, mpi_p, 0, mpi_comm_world, ierr)
989 call mpi_bcast(file_num_procs, 1, mpi_integer, 0, mpi_comm_world, ierr)
990 time_real = file_time
992 allocate (proc_bubble_counts(file_num_procs))
995 call mpi_file_open(mpi_comm_self, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
998 disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs), mpi_offset_kind)
999 call mpi_file_seek(ifile, disp, mpi_seek_set, ierr)
1000 call mpi_file_read(ifile, proc_bubble_counts, file_num_procs, mpi_integer, status, ierr)
1002 call mpi_file_close(ifile, ierr)
1005 call mpi_bcast(proc_bubble_counts, file_num_procs, mpi_integer, 0, mpi_comm_world, ierr)
1009 nbub = proc_bubble_counts(
proc_rank + 1)
1011 start_idx_part(1) = 0
1013 start_idx_part(1) = start_idx_part(1) + proc_bubble_counts(i)
1016 start_idx_part(2) = 0
1018 lsizes(2) = lag_io_vars
1020 gsizes(1) = file_tot_part
1021 gsizes(2) = lag_io_vars
1024# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1025 allocate (bub_id(nbub))
1026# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1028# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1030# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1032# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1033 allocate (ppx(nbub))
1034# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1035 allocate (ppy(nbub))
1036# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1037 allocate (ppz(nbub))
1038# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1040# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1042# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1044# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1045 allocate (radius(nbub))
1046# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1047 allocate (rvel(nbub))
1048# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1049 allocate (rnot(nbub))
1050# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1051 allocate (rmax(nbub))
1052# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1053 allocate (rmin(nbub))
1054# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1055 allocate (dphidt(nbub))
1056# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1057 allocate (pressure(nbub))
1058# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1060# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1062# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1063 allocate (betat(nbub))
1064# 958 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1065 allocate (betac(nbub))
1066# 960 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1069 call mpi_type_create_subarray(2, gsizes, lsizes, start_idx_part, mpi_order_fortran, mpi_p, view, ierr)
1070 call mpi_type_commit(view, ierr)
1072 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
1075 disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs) &
1076 & + file_num_procs*sizeof(proc_bubble_counts(1)), mpi_offset_kind)
1077 call mpi_file_set_view(ifile, disp, mpi_p, view,
'native',
mpi_info_int, ierr)
1081 call mpi_file_close(ifile, ierr)
1082 call mpi_type_free(view, ierr)
1085# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1087# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1089# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1091# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1093# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1095# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1097# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1099# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1101# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1103# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1105# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1107# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1109# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1111# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1113# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1115# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1117# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1119# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1121# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1123# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1125# 982 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1127# 984 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1134 write (meshnames(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:lag_bubbles'
1135 meshtypes(i) = db_pointmesh
1137 err = dbset2dstrlen(len(meshnames(1)))
1138 err = dbputmmesh(
dbroot,
'lag_bubbles', 16,
num_procs, meshnames, len_trim(meshnames), meshtypes, db_f77null, ierr)
1141 err = dbputpm(
dbfile,
'lag_bubbles', 11, 3, px, py, pz, nbub, db_double, db_f77null, ierr)
1161 deallocate (bub_id, px, py, pz, ppx, ppy, ppz, vx, vy, vz, radius, rvel, rnot, rmax, rmin, dphidt, pressure, mv, mg, &
1165 call mpi_type_contiguous(0, mpi_p, view, ierr)
1166 call mpi_type_commit(view, ierr)
1168 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
1171 disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs) &
1172 & + file_num_procs*sizeof(proc_bubble_counts(1)), mpi_offset_kind)
1173 call mpi_file_set_view(ifile, disp, mpi_p, view,
'native',
mpi_info_int, ierr)
1175 call mpi_file_read_all(ifile,
dummy, 0, mpi_p, status, ierr)
1177 call mpi_file_close(ifile, ierr)
1178 call mpi_type_free(view, ierr)
1182 write (meshnames(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:lag_bubbles'
1183 meshtypes(i) = db_pointmesh
1185 err = dbset2dstrlen(len(meshnames(1)))
1186 err = dbputmmesh(
dbroot,
'lag_bubbles', 16,
num_procs, meshnames, len_trim(meshnames), meshtypes, db_f77null, ierr)
1189 err = dbsetemptyok(1)
1190 err = dbputpm(
dbfile,
'lag_bubbles', 11, 3, dummy_data, dummy_data, dummy_data, 0, db_double, db_f77null, ierr)
1217 character(len=*),
intent(in) :: varname
1218 integer,
intent(in) :: t_step
1219 real(wp),
dimension(1:),
intent(in),
optional :: data
1220 integer,
intent(in),
optional :: nBubs
1221 character(len=64),
dimension(num_procs) :: var_names
1222 integer,
dimension(num_procs) :: var_types
1223 real(wp) :: dummy_data
1229 if (
present(nbubs) .and.
present(data))
then
1232 write (var_names(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:' // trim(varname)
1233 var_types(i) = db_pointvar
1235 err = dbset2dstrlen(len(var_names(1)))
1236 err = dbputmvar(
dbroot, trim(varname), len_trim(varname),
num_procs, var_names, len_trim(var_names), var_types, &
1240 err = dbputpv1(
dbfile, trim(varname), len_trim(varname),
'lag_bubbles', 11,
data, nbubs, db_double, db_f77null, ierr)
1244 write (var_names(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:' // trim(varname)
1245 var_types(i) = db_pointvar
1247 err = dbset2dstrlen(len(var_names(1)))
1248 err = dbsetemptyok(1)
1249 err = dbputmvar(
dbroot, trim(varname), len_trim(varname),
num_procs, var_names, len_trim(var_names), var_types, &
1253 err = dbsetemptyok(1)
1254 err = dbputpv1(
dbfile, trim(varname), len_trim(varname),
'lag_bubbles', 11, dummy_data, 0, db_double, db_f77null, ierr)
1262 character(len=len_trim(case_dir) + 4*name_len) :: in_file, out_file, file_loc
1263 integer :: iu_in, ios, i, rec_id
1264 integer,
allocatable,
dimension(:) :: iu_out
1265 real(wp) :: rec_time
1266 real(wp),
dimension(3) :: rec_force, rec_torque
1267 real(wp),
dimension(3) :: rec_vel, rec_angular_vel
1268 real(wp),
dimension(3) :: rec_angles, rec_centroid
1272 in_file = trim(file_loc) //
'/ib_state.dat'
1273 open (newunit=iu_in, file=trim(in_file), form=
'unformatted', access=
'stream', status=
'old', action=
'read', iostat=ios)
1275 call s_mpi_abort(
'Cannot open IB state input file: ' // trim(in_file))
1280 write (out_file,
'(A,I0,A)') trim(file_loc) //
'/ib_', i,
'.txt'
1281 open (newunit=iu_out(i), file=trim(out_file), form=
'formatted', status=
'replace', action=
'write', iostat=ios)
1283 call s_mpi_abort(
'Cannot open IB state output file: ' // trim(out_file))
1286 &
'(A)')
'mytime fx fy fz Tau_x Tau_y Tau_z vx vy vz omega_x omega_y omega_z angle_x angle_y angle_z x_c y_c z_c'
1290 read (iu_in, iostat=ios) rec_time, rec_id, rec_force, rec_torque, rec_vel, rec_angular_vel, rec_angles, &
1291 & rec_centroid(1), rec_centroid(2), rec_centroid(3)
1294 if (rec_id >= 1 .and. rec_id <=
num_ibs)
then
1295 write (iu_out(rec_id),
'(19(ES24.16E3,1X))') rec_time, rec_force(1), rec_force(2), rec_force(3), rec_torque(1), &
1296 & rec_torque(2), rec_torque(3), rec_vel(1), rec_vel(2), rec_vel(3), rec_angular_vel(1), &
1297 & rec_angular_vel(2), rec_angular_vel(3), rec_angles(1), rec_angles(2), rec_angles(3), rec_centroid(1), &
1298 & rec_centroid(2), rec_centroid(3)
1313 type(
scalar_field),
dimension(sys_size),
intent(in) :: q_prim_vf
1314 integer :: i,
j,
k,
l, cent
1315 integer :: counter, root
1316 real(wp),
allocatable :: x_td(:), y_td(:), x_d1(:), y_d1(:), y_d(:), x_d(:)
1317 real(wp) :: axp, axm, ayp, aym, tgp, euc_d, thres, maxalph_loc, maxalph_glb
1319 allocate (x_d1(
m*
n))
1320 allocate (y_d1(
m*
n))
1326 if (q_prim_vf(
eqn_idx%E + 2)%sf(i,
j,
k) > maxalph_loc)
then
1327 maxalph_loc = q_prim_vf(
eqn_idx%E + 2)%sf(i,
j,
k)
1333 call s_mpi_allreduce_max(maxalph_loc, maxalph_glb)
1344 thres = 0.9_wp*maxalph_glb
1347 axp = q_prim_vf(
eqn_idx%E + 2)%sf(
j + 1,
k, cent)
1348 axm = q_prim_vf(
eqn_idx%E + 2)%sf(
j,
k, cent)
1349 ayp = q_prim_vf(
eqn_idx%E + 2)%sf(
j,
k + 1, cent)
1350 aym = q_prim_vf(
eqn_idx%E + 2)%sf(
j,
k, cent)
1351 if ((axp > thres .and. axm < thres) .or. (axp < thres .and. axm > thres) .or. (ayp > thres .and. aym < thres) &
1352 & .or. (ayp < thres .and. aym > thres))
then
1353 if (counter == 0)
then
1354 counter = counter + 1
1355 x_d1(counter) =
x_cc(
j)
1356 y_d1(counter) =
y_cc(
k)
1358 tgp = sqrt(
dx(
j)**2 +
dy(
k)**2)
1360 euc_d = sqrt((
x_cc(
j) - x_d1(i))**2 + (
y_cc(
k) - y_d1(i))**2)
1361 if (euc_d < tgp)
then
1363 else if (i == counter)
then
1364 counter = counter + 1
1365 x_d1(counter) =
x_cc(
j)
1366 y_d1(counter) =
y_cc(
k)
1374 allocate (x_d(counter), y_d(counter))
1382 call s_mpi_gather_data(x_d, counter, x_td, root)
1383 call s_mpi_gather_data(y_d, counter, y_td, root)
1385 do i = 1,
size(x_td)
1386 if (i ==
size(x_td))
then
1387 write (211,
'(F12.9,1X,F12.9,1X,I4)') x_td(i), y_td(i),
size(x_td)
1389 write (211,
'(F12.9,1X,F12.9,1X,F3.1)') x_td(i), y_td(i), 0._wp
1400 real(wp) :: elk, egk, elp, egint, vb, vl, pres_av, et
1401 real(wp) :: rho, pres, dv, tmp, gamma, pi_inf, maxma, maxma_glb, maxvel, c, ma, h, qv
1402 real(wp),
dimension(num_vels) :: vel
1403 real(wp),
dimension(num_fluids) ::
adv
1404 integer :: i,
j,
k,
l, s
1431 egint = egint + q_prim_vf(
eqn_idx%E + 2)%sf(i,
j,
k)*(
gammas(2)*pres)*dv
1434 egk = egk + 0.5_wp*q_prim_vf(
eqn_idx%E + 2)%sf(i,
j,
k)*q_prim_vf(2)%sf(i,
j,
k)*vel(s)*vel(s)*dv
1435 elk = elk + 0.5_wp*q_prim_vf(
eqn_idx%E + 1)%sf(i,
j,
k)*q_prim_vf(1)%sf(i,
j,
k)*vel(s)*vel(s)*dv
1436 if (abs(vel(s)) > maxvel)
then
1437 maxvel = abs(vel(s))
1444 rho = rho +
adv(
l)*q_prim_vf(
l)%sf(i,
j,
k)
1448 h = ((gamma + 1._wp)*pres + pi_inf + qv)/rho
1453 if (ma > maxma .and. (
adv(1) > (1.0_wp - 1.0e-10_wp)))
then
1458 pres_av = pres_av +
adv(1)*pres*dv
1465 call s_mpi_allreduce_sum(tmp, pres_av)
1467 call s_mpi_allreduce_sum(tmp, vl)
1469 call s_mpi_allreduce_max(maxma, maxma_glb)
1471 call s_mpi_allreduce_sum(tmp, elk)
1473 call s_mpi_allreduce_sum(tmp, egint)
1475 call s_mpi_allreduce_sum(tmp, egk)
1477 call s_mpi_allreduce_sum(tmp, vb)
1479 call s_mpi_allreduce_sum(tmp, et)
1483 write (251,
'(10X, 8F24.8)') elp, egint, elk, egk, et, vb, vl, maxma_glb
1491 integer,
intent(in) :: t_step
1492 character(len=len_trim(case_dir) + 3*name_len) :: file_loc
1495 integer,
parameter :: nfields_per_ib = 20
1496 real(wp) :: ib_buf(nfields_per_ib)
1497 real(wp),
dimension(:,:),
allocatable :: ib_data
1498 logical :: file_exist
1499 character(LEN=4*name_len),
dimension(num_procs) :: meshnames
1500 integer,
dimension(num_procs) :: meshtypes
1501 integer :: i, ios, file_unit
1502 integer :: ierr, nbodies
1503 real(wp),
dimension(:),
allocatable :: px, py, pz
1504 real(wp),
dimension(:),
allocatable :: force_x, force_y, force_z
1505 real(wp),
dimension(:),
allocatable :: torque_x, torque_y, torque_z
1506 real(wp),
dimension(:),
allocatable :: vel_x, vel_y, vel_z
1507 real(wp),
dimension(:),
allocatable :: omega_x, omega_y, omega_z
1508 real(wp),
dimension(:),
allocatable :: angle_x, angle_y, angle_z
1509 real(wp),
dimension(:),
allocatable :: ib_diameter
1512 write (file_loc,
'(A,I0,A)')
'/restart_data/ib_state_', t_step,
'.dat'
1513 file_loc = trim(
case_dir) // trim(file_loc)
1515 inquire (file=trim(file_loc), exist=file_exist)
1516 if (.not. file_exist)
then
1517 call s_mpi_abort(
'Restart file ' // trim(file_loc) //
' does not exist!')
1522 if (nbodies > 0)
then
1523 allocate (ib_data(nbodies, nfields_per_ib))
1524 allocate (px(nbodies), py(nbodies), pz(nbodies))
1525 allocate (force_x(nbodies), force_y(nbodies), force_z(nbodies))
1526 allocate (torque_x(nbodies), torque_y(nbodies), torque_z(nbodies))
1527 allocate (vel_x(nbodies), vel_y(nbodies), vel_z(nbodies))
1528 allocate (omega_x(nbodies), omega_y(nbodies), omega_z(nbodies))
1529 allocate (angle_x(nbodies), angle_y(nbodies), angle_z(nbodies))
1530 allocate (ib_diameter(nbodies))
1533 open (newunit=file_unit, file=trim(file_loc), form=
'unformatted', access=
'stream', status=
'old', iostat=ios)
1534 if (ios /= 0)
call s_mpi_abort(
'Cannot open IB state file: ' // trim(file_loc))
1537 read (file_unit, iostat=ios) ib_buf
1538 if (ios /= 0)
call s_mpi_abort(
'Error reading IB state file')
1539 ib_data(i,:) = ib_buf(:)
1545 call mpi_bcast(ib_data, nbodies*nfields_per_ib, mpi_p, 0, mpi_comm_world, ierr)
1548 force_x(i) = ib_data(i, 2); force_y(i) = ib_data(i, 3); force_z(i) = ib_data(i, 4)
1549 torque_x(i) = ib_data(i, 5); torque_y(i) = ib_data(i, 6); torque_z(i) = ib_data(i, 7)
1550 vel_x(i) = ib_data(i, 8); vel_y(i) = ib_data(i, 9); vel_z(i) = ib_data(i, 10)
1551 omega_x(i) = ib_data(i, 11); omega_y(i) = ib_data(i, 12); omega_z(i) = ib_data(i, 13)
1552 angle_x(i) = ib_data(i, 14); angle_y(i) = ib_data(i, 15); angle_z(i) = ib_data(i, 16)
1553 px(i) = ib_data(i, 17); py(i) = ib_data(i, 18); pz(i) = ib_data(i, 19)
1554 ib_diameter(i) = ib_data(i, 20)*2.0_wp
1559 write (meshnames(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:ib_bodies'
1560 meshtypes(i) = db_pointmesh
1562 err = dbset2dstrlen(len(meshnames(1)))
1563 err = dbputmmesh(
dbroot,
'ib_bodies', 16,
num_procs, meshnames, len_trim(meshnames), meshtypes, db_f77null, ierr)
1566 err = dbputpm(
dbfile,
'ib_bodies', 9, 3, px, py, pz, nbodies, db_double, db_f77null, ierr)
1585 deallocate (ib_data, px, py, pz, force_x, force_y, force_z)
1586 deallocate (torque_x, torque_y, torque_z, vel_x, vel_y, vel_z)
1587 deallocate (omega_x, omega_y, omega_z, angle_x, angle_y, angle_z)
1588 deallocate (ib_diameter)
1597 character(len=*),
intent(in) :: varname
1598 integer,
intent(in) :: t_step
1599 real(wp),
dimension(:),
intent(in) :: data
1600 integer,
intent(in) :: nBodies
1601 character(len=4*name_len),
dimension(num_procs) :: var_names
1602 integer,
dimension(num_procs) :: var_types
1607 write (var_names(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:' // trim(varname)
1608 var_types(i) = db_pointvar
1610 err = dbset2dstrlen(len(var_names(1)))
1611 err = dbputmvar(
dbroot, trim(varname), len_trim(varname),
num_procs, var_names, len_trim(var_names), var_types, &
1615 err = dbputpv1(
dbfile, trim(varname), len_trim(varname),
'ib_bodies', 9,
data, nbodies, db_double, db_f77null, ierr)
1624 if (
format == 1)
then
1660 if (
format == 1)
then
type(scalar_field), dimension(sys_size), intent(inout) q_cons_vf
Platform-specific file and directory operations: create, delete, inquire, getcwd, and basename.
impure subroutine my_inquire(fileloc, dircheck)
Inquires on the existence of a directory.
impure subroutine s_create_directory(dir_name)
Create a directory and all its parents if it does not exist.
Writes post-processed grid and flow-variable data to Silo-HDF5 or binary database files.
impure subroutine, public s_write_grid_to_formatted_database_file(t_step)
Write the computational grid (cell-boundary coordinates) to the formatted database slave and master f...
real(wp), dimension(:,:,:), allocatable cyl_q_sf
integer, dimension(:), allocatable hi_offset
real(wp), dimension(:,:), allocatable data_extents
impure subroutine, public s_write_variable_to_formatted_database_file(varname, t_step)
Write a single flow variable field to the formatted database slave and master files for a given time ...
impure subroutine, public s_open_energy_data_file()
Open the energy data file for appending volume-integrated energy budget quantities.
impure subroutine, public s_open_intf_data_file()
Open the interface data file for appending extracted interface coordinates.
character(len=path_len+name_len) dbdir
impure subroutine, public s_write_ib_state_files()
Convert the binary immersed-boundary state file to per-body formatted text files.
impure subroutine, public s_write_energy_data_file(q_prim_vf, q_cons_vf)
Compute volume-integrated kinetic, potential, and internal energies and write the energy budget to th...
impure subroutine, public s_write_lag_bubbles_to_formatted_database_file(t_step)
Read Lagrangian bubble restart data and write bubble positions and scalar fields to the Silo database...
integer, dimension(:), allocatable lo_offset
impure subroutine, public s_write_intf_data_file(q_prim_vf)
Extract the volume-fraction interface contour from primitive fields and write the coordinates to the ...
real(wp), dimension(:,:,:), allocatable q_root_sf
subroutine s_write_ib_variable(varname, t_step, data, nbodies)
Write a single IB point-variable to the Silo database slave and master files.
impure subroutine, public s_initialize_data_output_module()
Allocate storage arrays, configure output directories, and count flow variables for formatted databas...
real(wp), dimension(:,:,:), allocatable, public q_sf
impure subroutine, public s_close_energy_data_file()
Close the energy data file.
impure subroutine, public s_close_formatted_database_file()
Close the formatted database slave file and, for the root process, the master file.
real(sp), dimension(:,:,:), allocatable cyl_q_sf_s
impure subroutine, public s_open_formatted_database_file(t_step)
Open (or create) the Silo-HDF5 or Binary formatted database slave and master files for a given time s...
impure subroutine, public s_close_intf_data_file()
Close the interface data file.
impure subroutine, public s_write_lag_bubbles_results_to_text(t_step)
Write the post-processed results in the folder 'lag_bubbles_data'.
impure subroutine, public s_finalize_data_output_module()
Deallocate module arrays and release all data-output resources.
real(sp), dimension(:,:,:), allocatable q_root_sf_s
integer, dimension(:), allocatable dims
real(wp), dimension(:,:), allocatable spatial_extents
impure subroutine, public s_define_output_region
Compute the cell-index bounds for the user-specified partial output domain in each coordinate directi...
impure subroutine, public s_write_ib_bodies_to_formatted_database_file(t_step)
Read IB state and write a Silo point mesh with per-body scalar fields.
character(len=path_len+2 *name_len) proc_rank_dir
subroutine s_write_lag_variable_to_formatted_database_file(varname, t_step, data, nbubs)
Write a single Lagrangian bubble point-variable to the Silo database slave and master files.
real(sp), dimension(:,:,:), allocatable, public q_sf_s
character(len=path_len+2 *name_len) rootdir
Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures.
Computes derived flow quantities (sound speed, vorticity, Schlieren, etc.) from conservative and prim...
Global parameters for the post-process: domain geometry, equation of state, and output database setti...
logical cont_damage
Continuum damage modeling.
logical hypoelasticity
Turn hypoelasticity on.
type(int_bounds_info) offset_y
integer num_fluids
Number of different fluids present in the flow.
real(wp), dimension(:,:), allocatable, public mpi_io_data_lg_bubbles
logical, dimension(3) flux_wrt
real(wp), dimension(:), allocatable y_cc
integer proc_rank
Rank of the local processor.
logical output_partial_domain
Specify portion of domain to output for post-processing.
real(wp), dimension(:), allocatable adv
Advection variables.
type(int_bounds_info) z_output_idx
Indices of domain to output for post-processing.
logical dummy
AMDFlang workaround for case-optimization + GPU-kernel bug.
real(wp), dimension(:), allocatable y_cb
type(bounds_info) x_output
character(len=name_len) mpiiofs
real(wp), dimension(:), allocatable dz
logical, dimension(3) mom_wrt
real(wp), dimension(:), allocatable x_root_cb
logical, dimension(num_fluids_max) alpha_wrt
logical, dimension(num_fluids_max) alpha_rho_wrt
integer model_eqns
Multicomponent flow model.
integer precision
Floating point precision of the database file(s).
real(wp), dimension(:), allocatable z_cb
type(bounds_info) z_output
Portion of domain to output for post-processing.
integer num_dims
Number of spatial dimensions.
type(int_bounds_info) x_output_idx
real(wp), dimension(:), allocatable x_cc
integer num_vels
Number of velocity components (different from num_dims for mhd).
real(wp), dimension(:), allocatable x_cb
real(wp), dimension(:), allocatable dy
type(int_bounds_info) offset_x
logical hyper_cleaning
Hyperbolic cleaning for MHD.
real(wp), dimension(:), allocatable z_cc
logical, dimension(3) omega_wrt
integer num_procs
Number of processors.
character(len=path_len) case_dir
Case folder location.
type(int_bounds_info) y_output_idx
type(int_bounds_info) offset_z
logical mhd
Magnetohydrodynamics.
logical parallel_io
Format of the data files.
logical, dimension(3) vel_wrt
logical relativity
Relativity for RMHD.
real(wp), dimension(:), allocatable dx
Cell-width distributions in the x-, y- and z-coordinate directions.
type(eqn_idx_info) eqn_idx
All conserved-variable equation index ranges and scalars.
integer num_ibs
Number of immersed boundaries.
type(bounds_info) y_output
Utility routines for bubble model setup, coordinate transforms, array sampling, and special functions...
MPI gather and scatter operations for distributing post-process grid and flow-variable data.
impure subroutine s_mpi_defragment_1d_grid_variable
Collect the sub-domain cell-boundary or cell-center location data from all processors and put back to...
impure subroutine s_mpi_defragment_1d_flow_variable(q_sf, q_root_sf)
Gather the sub-domain flow variable data from all processors and reassemble it for the entire computa...
impure subroutine s_mpi_gather_spatial_extents(spatial_extents)
Gather spatial extents from all ranks for Silo database metadata.
impure subroutine s_mpi_gather_data_extents(q_sf, data_extents)
Gather the Silo database metadata for the flow variable's extents to boost performance of the multidi...
Conservative-to-primitive variable conversion, mixture property evaluation, and pressure computation.
real(wp), dimension(:), allocatable, public gammas
subroutine s_compute_speed_of_sound(pres, rho, gamma, pi_inf, h, adv, vel_sum, c_c, c, qv)
Compute the speed of sound from thermodynamic state variables, supporting multiple equation-of-state ...
real(wp), dimension(:), allocatable, public qvs
real(wp), dimension(:), allocatable, public pi_infs
Derived type annexing a scalar field (SF).