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 :: lg_bub_file, 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, 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),
dimension(20) :: inputvals
941 real(wp) :: time_real
942 integer,
dimension(MPI_STATUS_SIZE) :: status
943 integer(KIND=MPI_OFFSET_KIND) :: disp
945 logical :: lg_bub_file, file_exist
946 integer,
dimension(2) :: gsizes, lsizes, start_idx_part
947 integer :: ifile, ierr, tot_data, valid_data, nbub
948 real(wp) :: file_time, file_dt
949 integer :: file_num_procs, file_tot_part
950 integer,
dimension(:),
allocatable :: proc_bubble_counts
951 real(wp),
dimension(1:1,1:lag_io_vars) ::
dummy
952 character(LEN=4*name_len),
dimension(num_procs) :: meshnames
953 integer,
dimension(num_procs) :: meshtypes
954 real(wp) :: dummy_data
956 real(wp),
dimension(:),
allocatable :: bub_id
957 real(wp),
dimension(:),
allocatable :: px, py, pz, ppx, ppy, ppz, vx, vy, vz
958 real(wp),
dimension(:),
allocatable :: radius, rvel, rnot, rmax, rmin, dphidt
959 real(wp),
dimension(:),
allocatable :: pressure, mv, mg, betat, betac
965 write (file_loc,
'(A,I0,A)')
'lag_bubbles_', t_step,
'.dat'
966 file_loc = trim(
case_dir) //
'/restart_data' // trim(
mpiiofs) // trim(file_loc)
969 inquire (file=trim(file_loc), exist=file_exist)
970 if (.not. file_exist)
then
971 call s_mpi_abort(
'Restart file ' // trim(file_loc) //
' does not exist!')
977 call mpi_file_open(mpi_comm_self, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
979 call mpi_file_read(ifile, file_tot_part, 1, mpi_integer, status, ierr)
980 call mpi_file_read(ifile, file_time, 1, mpi_p, status, ierr)
981 call mpi_file_read(ifile, file_dt, 1, mpi_p, status, ierr)
982 call mpi_file_read(ifile, file_num_procs, 1, mpi_integer, status, ierr)
984 call mpi_file_close(ifile, ierr)
987 call mpi_bcast(file_tot_part, 1, mpi_integer, 0, mpi_comm_world, ierr)
988 call mpi_bcast(file_time, 1, mpi_p, 0, mpi_comm_world, ierr)
989 call mpi_bcast(file_dt, 1, mpi_p, 0, mpi_comm_world, ierr)
990 call mpi_bcast(file_num_procs, 1, mpi_integer, 0, mpi_comm_world, ierr)
991 time_real = file_time
993 allocate (proc_bubble_counts(file_num_procs))
996 call mpi_file_open(mpi_comm_self, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
999 disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs), mpi_offset_kind)
1000 call mpi_file_seek(ifile, disp, mpi_seek_set, ierr)
1001 call mpi_file_read(ifile, proc_bubble_counts, file_num_procs, mpi_integer, status, ierr)
1003 call mpi_file_close(ifile, ierr)
1006 call mpi_bcast(proc_bubble_counts, file_num_procs, mpi_integer, 0, mpi_comm_world, ierr)
1010 nbub = proc_bubble_counts(
proc_rank + 1)
1012 start_idx_part(1) = 0
1014 start_idx_part(1) = start_idx_part(1) + proc_bubble_counts(i)
1017 start_idx_part(2) = 0
1019 lsizes(2) = lag_io_vars
1021 gsizes(1) = file_tot_part
1022 gsizes(2) = lag_io_vars
1025# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1026 allocate (bub_id(nbub))
1027# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1029# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1031# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1033# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1034 allocate (ppx(nbub))
1035# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1036 allocate (ppy(nbub))
1037# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1038 allocate (ppz(nbub))
1039# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1041# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1043# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1045# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1046 allocate (radius(nbub))
1047# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1048 allocate (rvel(nbub))
1049# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1050 allocate (rnot(nbub))
1051# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1052 allocate (rmax(nbub))
1053# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1054 allocate (rmin(nbub))
1055# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1056 allocate (dphidt(nbub))
1057# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1058 allocate (pressure(nbub))
1059# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1061# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1063# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1064 allocate (betat(nbub))
1065# 959 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1066 allocate (betac(nbub))
1067# 961 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1070 call mpi_type_create_subarray(2, gsizes, lsizes, start_idx_part, mpi_order_fortran, mpi_p, view, ierr)
1071 call mpi_type_commit(view, ierr)
1073 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
1076 disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs) &
1077 & + file_num_procs*sizeof(proc_bubble_counts(1)), mpi_offset_kind)
1078 call mpi_file_set_view(ifile, disp, mpi_p, view,
'native',
mpi_info_int, ierr)
1082 call mpi_file_close(ifile, ierr)
1083 call mpi_type_free(view, ierr)
1086# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1088# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1090# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1092# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1094# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1096# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1098# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1100# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1102# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1104# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1106# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1108# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1110# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1112# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1114# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1116# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1118# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1120# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1122# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1124# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1126# 983 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1128# 985 "/home/runner/work/MFC/MFC/src/post_process/m_data_output.fpp"
1135 write (meshnames(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:lag_bubbles'
1136 meshtypes(i) = db_pointmesh
1138 err = dbset2dstrlen(len(meshnames(1)))
1139 err = dbputmmesh(
dbroot,
'lag_bubbles', 16,
num_procs, meshnames, len_trim(meshnames), meshtypes, db_f77null, ierr)
1142 err = dbputpm(
dbfile,
'lag_bubbles', 11, 3, px, py, pz, nbub, db_double, db_f77null, ierr)
1162 deallocate (bub_id, px, py, pz, ppx, ppy, ppz, vx, vy, vz, radius, rvel, rnot, rmax, rmin, dphidt, pressure, mv, mg, &
1166 call mpi_type_contiguous(0, mpi_p, view, ierr)
1167 call mpi_type_commit(view, ierr)
1169 call mpi_file_open(mpi_comm_world, file_loc, mpi_mode_rdonly,
mpi_info_int, ifile, ierr)
1172 disp = int(sizeof(file_tot_part) + 2*sizeof(file_time) + sizeof(file_num_procs) &
1173 & + file_num_procs*sizeof(proc_bubble_counts(1)), mpi_offset_kind)
1174 call mpi_file_set_view(ifile, disp, mpi_p, view,
'native',
mpi_info_int, ierr)
1176 call mpi_file_read_all(ifile,
dummy, 0, mpi_p, status, ierr)
1178 call mpi_file_close(ifile, ierr)
1179 call mpi_type_free(view, ierr)
1183 write (meshnames(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:lag_bubbles'
1184 meshtypes(i) = db_pointmesh
1186 err = dbset2dstrlen(len(meshnames(1)))
1187 err = dbputmmesh(
dbroot,
'lag_bubbles', 16,
num_procs, meshnames, len_trim(meshnames), meshtypes, db_f77null, ierr)
1190 err = dbsetemptyok(1)
1191 err = dbputpm(
dbfile,
'lag_bubbles', 11, 3, dummy_data, dummy_data, dummy_data, 0, db_double, db_f77null, ierr)
1218 character(len=*),
intent(in) :: varname
1219 integer,
intent(in) :: t_step
1220 real(wp),
dimension(1:),
intent(in),
optional :: data
1221 integer,
intent(in),
optional :: nBubs
1222 character(len=64),
dimension(num_procs) :: var_names
1223 integer,
dimension(num_procs) :: var_types
1224 real(wp) :: dummy_data
1230 if (
present(nbubs) .and.
present(data))
then
1233 write (var_names(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:' // trim(varname)
1234 var_types(i) = db_pointvar
1236 err = dbset2dstrlen(len(var_names(1)))
1237 err = dbputmvar(
dbroot, trim(varname), len_trim(varname),
num_procs, var_names, len_trim(var_names), var_types, &
1241 err = dbputpv1(
dbfile, trim(varname), len_trim(varname),
'lag_bubbles', 11,
data, nbubs, db_double, db_f77null, ierr)
1245 write (var_names(i),
'(A,I0,A,I0,A)')
'../p', i - 1,
'/', t_step,
'.silo:' // trim(varname)
1246 var_types(i) = db_pointvar
1248 err = dbset2dstrlen(len(var_names(1)))
1249 err = dbsetemptyok(1)
1250 err = dbputmvar(
dbroot, trim(varname), len_trim(varname),
num_procs, var_names, len_trim(var_names), var_types, &
1254 err = dbsetemptyok(1)
1255 err = dbputpv1(
dbfile, trim(varname), len_trim(varname),
'lag_bubbles', 11, dummy_data, 0, db_double, db_f77null, ierr)
1263 character(len=len_trim(case_dir) + 4*name_len) :: in_file, out_file, file_loc
1264 integer :: iu_in, ios, i, rec_id
1265 integer,
allocatable,
dimension(:) :: iu_out
1266 real(wp) :: rec_time
1267 real(wp),
dimension(3) :: rec_force, rec_torque
1268 real(wp),
dimension(3) :: rec_vel, rec_angular_vel
1269 real(wp),
dimension(3) :: rec_angles, rec_centroid
1273 in_file = trim(file_loc) //
'/ib_state.dat'
1274 open (newunit=iu_in, file=trim(in_file), form=
'unformatted', access=
'stream', status=
'old', action=
'read', iostat=ios)
1276 call s_mpi_abort(
'Cannot open IB state input file: ' // trim(in_file))
1281 write (out_file,
'(A,I0,A)') trim(file_loc) //
'/ib_', i,
'.txt'
1282 open (newunit=iu_out(i), file=trim(out_file), form=
'formatted', status=
'replace', action=
'write', iostat=ios)
1284 call s_mpi_abort(
'Cannot open IB state output file: ' // trim(out_file))
1287 &
'(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'
1291 read (iu_in, iostat=ios) rec_time, rec_id, rec_force, rec_torque, rec_vel, rec_angular_vel, rec_angles, &
1292 & rec_centroid(1), rec_centroid(2), rec_centroid(3)
1295 if (rec_id >= 1 .and. rec_id <=
num_ibs)
then
1296 write (iu_out(rec_id),
'(19(ES24.16E3,1X))') rec_time, rec_force(1), rec_force(2), rec_force(3), rec_torque(1), &
1297 & rec_torque(2), rec_torque(3), rec_vel(1), rec_vel(2), rec_vel(3), rec_angular_vel(1), &
1298 & rec_angular_vel(2), rec_angular_vel(3), rec_angles(1), rec_angles(2), rec_angles(3), rec_centroid(1), &
1299 & rec_centroid(2), rec_centroid(3)
1314 type(
scalar_field),
dimension(sys_size),
intent(in) :: q_prim_vf
1315 integer :: i,
j,
k,
l, cent
1316 integer :: counter, root
1317 real(wp),
allocatable :: x_td(:), y_td(:), x_d1(:), y_d1(:), y_d(:), x_d(:)
1318 real(wp) :: axp, axm, ayp, aym, tgp, euc_d, thres, maxalph_loc, maxalph_glb
1320 allocate (x_d1(
m*
n))
1321 allocate (y_d1(
m*
n))
1327 if (q_prim_vf(
e_idx + 2)%sf(i,
j,
k) > maxalph_loc)
then
1328 maxalph_loc = q_prim_vf(
e_idx + 2)%sf(i,
j,
k)
1334 call s_mpi_allreduce_max(maxalph_loc, maxalph_glb)
1345 thres = 0.9_wp*maxalph_glb
1348 axp = q_prim_vf(
e_idx + 2)%sf(
j + 1,
k, cent)
1349 axm = q_prim_vf(
e_idx + 2)%sf(
j,
k, cent)
1350 ayp = q_prim_vf(
e_idx + 2)%sf(
j,
k + 1, cent)
1351 aym = q_prim_vf(
e_idx + 2)%sf(
j,
k, cent)
1352 if ((axp > thres .and. axm < thres) .or. (axp < thres .and. axm > thres) .or. (ayp > thres .and. aym < thres) &
1353 & .or. (ayp < thres .and. aym > thres))
then
1354 if (counter == 0)
then
1355 counter = counter + 1
1356 x_d1(counter) =
x_cc(
j)
1357 y_d1(counter) =
y_cc(
k)
1359 tgp = sqrt(
dx(
j)**2 +
dy(
k)**2)
1361 euc_d = sqrt((
x_cc(
j) - x_d1(i))**2 + (
y_cc(
k) - y_d1(i))**2)
1362 if (euc_d < tgp)
then
1364 else if (i == counter)
then
1365 counter = counter + 1
1366 x_d1(counter) =
x_cc(
j)
1367 y_d1(counter) =
y_cc(
k)
1375 allocate (x_d(counter), y_d(counter))
1383 call s_mpi_gather_data(x_d, counter, x_td, root)
1384 call s_mpi_gather_data(y_d, counter, y_td, root)
1386 do i = 1,
size(x_td)
1387 if (i ==
size(x_td))
then
1388 write (211,
'(F12.9,1X,F12.9,1X,I4)') x_td(i), y_td(i),
size(x_td)
1390 write (211,
'(F12.9,1X,F12.9,1X,F3.1)') x_td(i), y_td(i), 0._wp
1401 real(wp) :: elk, egk, elp, egint, vb, vl, pres_av, et
1402 real(wp) :: rho, pres, dv, tmp, gamma, pi_inf, maxma, maxma_glb, maxvel, c, ma, h, qv
1403 real(wp),
dimension(num_vels) :: vel
1404 real(wp),
dimension(num_fluids) ::
adv
1405 integer :: i,
j,
k,
l, s
1431 pres = q_prim_vf(
e_idx)%sf(i,
j,
k)
1432 egint = egint + q_prim_vf(
e_idx + 2)%sf(i,
j,
k)*(
gammas(2)*pres)*dv
1435 egk = egk + 0.5_wp*q_prim_vf(
e_idx + 2)%sf(i,
j,
k)*q_prim_vf(2)%sf(i,
j,
k)*vel(s)*vel(s)*dv
1436 elk = elk + 0.5_wp*q_prim_vf(
e_idx + 1)%sf(i,
j,
k)*q_prim_vf(1)%sf(i,
j,
k)*vel(s)*vel(s)*dv
1437 if (abs(vel(s)) > maxvel)
then
1438 maxvel = abs(vel(s))
1445 rho = rho +
adv(
l)*q_prim_vf(
l)%sf(i,
j,
k)
1449 h = ((gamma + 1._wp)*pres + pi_inf + qv)/rho
1454 if (ma > maxma .and. (
adv(1) > (1.0_wp - 1.0e-10_wp)))
then
1459 pres_av = pres_av +
adv(1)*pres*dv
1466 call s_mpi_allreduce_sum(tmp, pres_av)
1468 call s_mpi_allreduce_sum(tmp, vl)
1470 call s_mpi_allreduce_max(maxma, maxma_glb)
1472 call s_mpi_allreduce_sum(tmp, elk)
1474 call s_mpi_allreduce_sum(tmp, egint)
1476 call s_mpi_allreduce_sum(tmp, egk)
1478 call s_mpi_allreduce_sum(tmp, vb)
1480 call s_mpi_allreduce_sum(tmp, et)
1484 write (251,
'(10X, 8F24.8)') elp, egint, elk, egk, et, vb, vl, maxma_glb
1494 if (
format == 1)
then
1530 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
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...
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
type(int_bounds_info) mom_idx
Indexes of first & last momentum eqns.
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) adv_idx
Indexes of first & last advection eqns.
type(int_bounds_info) offset_z
logical mhd
Magnetohydrodynamics.
logical parallel_io
Format of the data files.
integer e_idx
Index of energy equation.
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.
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).