498 type(
scalar_field),
dimension(sys_size),
intent(in) :: q_prim_vf
499 integer,
intent(in) :: t_step
502# 169 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
503 real(wp),
dimension(num_fluids) :: alpha, alpha_rho
504 real(wp),
dimension(num_vels) :: vel
505# 172 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
512 real(wp),
dimension(2) :: re
514 real(wp) :: icfl_max_loc, icfl_max_glb
515 real(wp) :: vcfl_max_loc, vcfl_max_glb
516 real(wp) :: ccfl_max_loc, ccfl_max_glb
517 real(wp) :: tcfl_max_loc, tcfl_max_glb
518 real(wp) :: rc_min_loc, rc_min_glb
519 real(wp) :: icfl, vcfl, ccfl, tcfl, rc
520 real(wp) :: mu_frac, mu_frac_max_loc, mu_frac_max_glb
522 real(wp),
dimension(4) :: stab_max_loc, stab_max_glb
523 real(wp),
dimension(1) :: stab_min_loc, stab_min_glb
529 rc_min_loc = huge(1.0_wp)
530 mu_frac_max_loc = 0._wp
533# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
535# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
536#if defined(MFC_OpenACC)
537# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
539# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
541# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
542#elif defined(MFC_OpenMP)
543# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
545# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
547# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
549# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
551# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
553# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
555# 198 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
557# 201 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
561 call s_compute_cell_state(q_prim_vf, pres, rho, gamma, pi_inf, re, alpha, alpha_rho, vel, vel_sum, qv,
j,
k,
l)
563 call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, alpha, c, alpha_rho)
568 if (any_state_dependent_eos)
then
570# 212 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
571#if defined(MFC_OpenACC)
572# 212 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
574# 212 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
575#elif defined(MFC_OpenMP)
576# 212 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
578# 212 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
580 do fl = 1, num_fluids
582 mu_frac = (alpha_rho(fl)/max(alpha(fl),
sgm_eps)/eos_coeffs(fl)%rho0 - 1._wp)/eos_coeffs(fl)%mu_max
583 mu_frac_max_loc = max(mu_frac_max_loc, mu_frac)
590 do fl = 1, num_fluids
597 re(1) = 1._wp/max(re(1),
sgm_eps)
600 call s_compute_stability_from_dt(vel, c, rho, re, alpha, alpha_rho,
j,
k,
l, icfl, vcfl, rc, ccfl, tcfl)
602 icfl_max_loc = max(icfl_max_loc, icfl)
603 vcfl_max_loc = max(vcfl_max_loc, merge(vcfl, 0.0_wp, viscous))
604 ccfl_max_loc = max(ccfl_max_loc, merge(ccfl, 0.0_wp, surface_tension))
605 tcfl_max_loc = max(tcfl_max_loc, merge(tcfl, 0.0_wp, heat_conduction))
606 rc_min_loc = min(rc_min_loc, merge(rc, huge(1.0_wp), viscous))
611# 243 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
612#if defined(MFC_OpenACC)
613# 243 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
615# 243 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
616#elif defined(MFC_OpenMP)
617# 243 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
619# 243 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
621# 243 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
626 stab_max_loc = (/icfl_max_loc, vcfl_max_loc, ccfl_max_loc, tcfl_max_loc/)
627 stab_min_loc = (/rc_min_loc/)
628 call s_mpi_reduce_stability_criteria_extrema(stab_max_loc, stab_min_loc,
n_el_bubs_loc, stab_max_glb, stab_min_glb, &
630 icfl_max_glb = stab_max_glb(1)
631 vcfl_max_glb = stab_max_glb(2)
632 ccfl_max_glb = stab_max_glb(3)
633 tcfl_max_glb = stab_max_glb(4)
634 rc_min_glb = stab_min_glb(1)
636 icfl_max_glb = icfl_max_loc
637 if (viscous) vcfl_max_glb = vcfl_max_loc
638 if (viscous) rc_min_glb = rc_min_loc
639 if (surface_tension) ccfl_max_glb = ccfl_max_loc
640 if (heat_conduction) tcfl_max_glb = tcfl_max_loc
644 mu_frac_max_glb = mu_frac_max_loc
645 if (
num_procs > 1)
call s_mpi_allreduce_max(mu_frac_max_loc, mu_frac_max_glb)
649 if (surface_tension)
then
653 if (heat_conduction)
then
663 write (3,
'(13X,I9,13X,F10.6,13X,F10.6,13X,F10.6)', advance=
"no") t_step, dt,
mytime, icfl_max_glb
665 if (surface_tension)
then
666 write (3,
'(13X,F10.6)', advance=
"no") ccfl_max_glb
669 if (heat_conduction)
then
670 write (3,
'(13X,F10.6)', advance=
"no") tcfl_max_glb
674 write (3,
'(13X,F10.6,13X,ES16.6)', advance=
"no") vcfl_max_glb, rc_min_glb
677 if (bubbles_lagrange)
then
683 if (mu_frac_max_glb > 1._wp)
then
684 print *,
'compression as a fraction of the Hugoniot fit limit', mu_frac_max_glb
685 call s_mpi_abort(
'A Mie-Gruneisen phase is compressed past what its Hugoniot fit represents. Exiting.')
689 call s_mpi_abort(
'ICFL is NaN. Exiting.')
690 else if (icfl_max_glb > 1._wp)
then
691 print *,
'icfl', icfl_max_glb
692 call s_mpi_abort(
'ICFL is greater than 1.0. Exiting.')
697 call s_mpi_abort(
'VCFL is NaN. Exiting.')
698 else if (vcfl_max_glb > 1._wp)
then
699 print *,
'vcfl', vcfl_max_glb
700 call s_mpi_abort(
'VCFL is greater than 1.0. Exiting.')
704 if (bubbles_lagrange)
then
706 call s_mpi_abort(
'No Lagrangian bubbles remain in the domain. Exiting.')
720 type(
scalar_field),
dimension(sys_size),
intent(inout) :: q_prim_vf
721 integer,
intent(in) :: t_step
723 type(
integer_field),
dimension(1:num_dims,-1:1),
intent(in) :: bc_type
724 character(LEN=path_len + 2*name_len) :: t_step_dir
725 character(LEN=path_len + 3*name_len) :: file_path
726 logical :: file_exist
727 character(LEN=15) :: fmt
728 integer :: i,
j,
k,
l, r
730 write (t_step_dir,
'(A,I0,A,I0)') trim(case_dir) //
'/p_all'
731 write (t_step_dir,
'(a,i0,a,i0)') trim(case_dir) //
'/p_all/p',
proc_rank,
'/', t_step
733 file_path = trim(t_step_dir) //
'/.'
738 file_path = trim(t_step_dir) //
'/x_cb.dat'
740 open (2, file=trim(file_path), form=
'unformatted', status=
'new')
741 write (2)
x_cb(-1:m);
close (2)
744 file_path = trim(t_step_dir) //
'/y_cb.dat'
746 open (2, file=trim(file_path), form=
'unformatted', status=
'new')
747 write (2)
y_cb(-1:n);
close (2)
750 file_path = trim(t_step_dir) //
'/z_cb.dat'
752 open (2, file=trim(file_path), form=
'unformatted', status=
'new')
753 write (2)
z_cb(-1:p);
close (2)
758 write (file_path,
'(A,I0,A)') trim(t_step_dir) //
'/q_cons_vf', i,
'.dat'
760 open (2, file=trim(file_path), form=
'unformatted', status=
'new')
762 write (2)
q_cons_vf(i)%sf(0:m,0:n,0:p);
close (2)
767 if (bubbles_lagrange)
then
768 write (file_path,
'(A,I0,A)') trim(t_step_dir) //
'/q_cons_vf', sys_size + 1,
'.dat'
770 open (2, file=trim(file_path), form=
'unformatted', status=
'new')
772 write (2) beta%sf(0:m,0:n,0:p);
close (2)
775 if (qbmm .and. .not. polytropic)
then
778 write (file_path,
'(A,I0,A)') trim(t_step_dir) //
'/pb', sys_size + (i - 1)*
nnode + r,
'.dat'
780 open (2, file=trim(file_path), form=
'unformatted', status=
'new')
782 write (2)
pb_ts(1)%sf(0:m,0:n,0:p,r, i);
close (2)
788 write (file_path,
'(A,I0,A)') trim(t_step_dir) //
'/mv', sys_size + (i - 1)*
nnode + r,
'.dat'
790 open (2, file=trim(file_path), form=
'unformatted', status=
'new')
792 write (2)
mv_ts(1)%sf(0:m,0:n,0:p,r, i);
close (2)
808 write (t_step_dir,
'(A,I0,A,I0)') trim(case_dir) //
'/D'
809 file_path = trim(t_step_dir) //
'/.'
811 inquire (file=trim(file_path), exist=file_exist)
815 if ((prim_vars_wrt .or. (n == 0 .and. p == 0)) .and. (.not. igr))
then
819# 439 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
820#if defined(MFC_OpenACC)
821# 439 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
823# 439 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
824#elif defined(MFC_OpenMP)
825# 439 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
827# 439 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
833 q_prim_vf(eqn_idx%bub%beg)%sf = 1._wp
837 if (n == 0 .and. p == 0)
then
840 write (file_path,
'(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/prim.', i,
'.',
proc_rank,
'.', t_step,
'.dat'
842 open (2, file=trim(file_path))
845 if (((i >= eqn_idx%adv%beg) .and. (i <= eqn_idx%adv%end)))
then
848 write (2, fmt)
x_cb(
j), q_prim_vf(i)%sf(
j, 0, 0)
856 write (file_path,
'(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/cons.', i,
'.',
proc_rank,
'.', t_step,
'.dat'
858 open (2, file=trim(file_path))
865 if (qbmm .and. .not. polytropic)
then
868 write (file_path,
'(A,I0,A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/pres.', i,
'.', r,
'.',
proc_rank, &
869 &
'.', t_step,
'.dat'
871 open (2, file=trim(file_path))
880 write (file_path,
'(A,I0,A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/mv.', i,
'.', r,
'.',
proc_rank, &
881 &
'.', t_step,
'.dat'
883 open (2, file=trim(file_path))
899 if ((n > 0) .and. (p == 0))
then
901 write (file_path,
'(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/cons.', i,
'.',
proc_rank,
'.', t_step,
'.dat'
902 open (2, file=trim(file_path))
912 if (
present(beta))
then
913 write (file_path,
'(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/beta.', i,
'.',
proc_rank,
'.', t_step,
'.dat'
914 open (2, file=trim(file_path))
924 if (qbmm .and. .not. polytropic)
then
927 write (file_path,
'(A,I0,A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/pres.', i,
'.', r,
'.',
proc_rank, &
928 &
'.', t_step,
'.dat'
930 open (2, file=trim(file_path))
941 write (file_path,
'(A,I0,A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/mv.', i,
'.', r,
'.',
proc_rank, &
942 &
'.', t_step,
'.dat'
944 open (2, file=trim(file_path))
955 if (prim_vars_wrt .and. (.not. igr))
then
957 write (file_path,
'(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/prim.', i,
'.',
proc_rank,
'.', t_step,
'.dat'
959 open (2, file=trim(file_path))
963 if (((i >= eqn_idx%cont%beg) .and. (i <= eqn_idx%cont%end)) .or. ((i >= eqn_idx%adv%beg) &
964 & .and. (i <= eqn_idx%adv%end)))
then
967 write (2, fmt)
x_cb(
j),
y_cb(
k), q_prim_vf(i)%sf(
j,
k, 0)
985 write (file_path,
'(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/cons.', i,
'.',
proc_rank,
'.', t_step,
'.dat'
986 open (2, file=trim(file_path))
999 if (
present(beta))
then
1000 write (file_path,
'(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/beta.', i,
'.',
proc_rank,
'.', t_step,
'.dat'
1001 open (2, file=trim(file_path))
1014 if (qbmm .and. .not. polytropic)
then
1017 write (file_path,
'(A,I0,A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/pres.', i,
'.', r,
'.',
proc_rank, &
1018 &
'.', t_step,
'.dat'
1020 open (2, file=trim(file_path))
1033 write (file_path,
'(A,I0,A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/mv.', i,
'.', r,
'.',
proc_rank, &
1034 &
'.', t_step,
'.dat'
1036 open (2, file=trim(file_path))
1049 if (prim_vars_wrt .and. (.not. igr))
then
1051 write (file_path,
'(A,I0,A,I2.2,A,I6.6,A)') trim(t_step_dir) //
'/prim.', i,
'.',
proc_rank,
'.', t_step,
'.dat'
1053 open (2, file=trim(file_path))
1058 if (((i >= eqn_idx%cont%beg) .and. (i <= eqn_idx%cont%end)) .or. ((i >= eqn_idx%adv%beg) &
1059 & .and. (i <= eqn_idx%adv%end)) .or. ((i >= eqn_idx%species%beg) &
1060 & .and. (i <= eqn_idx%species%end)))
then
1081 integer,
intent(in) :: t_step
1083 type(
integer_field),
dimension(1:num_dims,-1:1),
intent(in) :: bc_type
1087 integer :: ifile, ierr, data_size
1088 integer,
dimension(MPI_STATUS_SIZE) :: status
1089 integer(kind=MPI_OFFSET_kind) :: disp
1090 integer(kind=MPI_OFFSET_kind) :: m_mok, n_mok, p_mok
1091 integer(kind=MPI_OFFSET_kind) :: wp_mok, var_mok, str_mok
1092 integer(kind=MPI_OFFSET_kind) :: nvars_mok
1093 integer(kind=MPI_OFFSET_kind) :: mok
1094 character(LEN=path_len + 2*name_len) :: file_loc
1095 logical :: file_exist, dir_check
1096 character(len=10) :: t_step_string
1100 integer :: m_ds, n_ds, p_ds
1101 integer :: m_glb_ds, n_glb_ds, p_glb_ds
1102 integer :: m_glb_save, n_glb_save, p_glb_save
1104 if (down_sample)
then
1108 if (
present(beta))
then
1109 alt_sys = sys_size + 1
1114 if (file_per_process)
then
1117 if (down_sample)
then
1118 call s_initialize_mpi_data_ds(m_ds, n_ds, p_ds)
1129 file_loc = trim(case_dir) //
'/restart_data/lustre_' // trim(t_step_string)
1131 if (dir_check .neqv. .true.)
then
1136 call s_mpi_barrier()
1141 write (file_loc,
'(I0,A,i7.7,A)') t_step,
'_',
proc_rank,
'.dat'
1142 file_loc = trim(case_dir) //
'/restart_data/lustre_' // trim(t_step_string) // trim(mpiiofs) // trim(file_loc)
1143 inquire (file=trim(file_loc), exist=file_exist)
1144 if (file_exist .and.
proc_rank == 0)
then
1145 call mpi_file_delete(file_loc, mpi_info_int, ierr)
1147 call mpi_file_open(mpi_comm_self, file_loc, ior(mpi_mode_wronly, mpi_mode_create), mpi_info_int, ifile, ierr)
1149 if (down_sample)
then
1150 data_size = (m_ds + 3)*(n_ds + 3)*(p_ds + 3)
1151 m_glb_save = m_glb_ds + 1
1152 n_glb_save = n_glb_ds + 1
1153 p_glb_save = p_glb_ds + 1
1155 data_size = (m + 1)*(n + 1)*(p + 1)
1156 m_glb_save =
m_glb + 1
1157 n_glb_save =
n_glb + 1
1158 p_glb_save =
p_glb + 1
1161 m_mok = int(m_glb_save + 1, mpi_offset_kind)
1162 n_mok = int(n_glb_save + 1, mpi_offset_kind)
1163 p_mok = int(p_glb_save + 1, mpi_offset_kind)
1164 wp_mok = int(storage_size(0._stp)/8, mpi_offset_kind)
1165 mok = int(1._wp, mpi_offset_kind)
1166 str_mok = int(
name_len, mpi_offset_kind)
1167 nvars_mok = int(sys_size, mpi_offset_kind)
1169 if (bubbles_euler)
then
1171 var_mok = int(i, mpi_offset_kind)
1173 call mpi_file_write_all(ifile,
mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
1175 if (qbmm .and. .not. polytropic)
then
1176 do i = sys_size + 1, sys_size + 2*
nb*
nnode
1177 var_mok = int(i, mpi_offset_kind)
1179 call mpi_file_write_all(ifile,
mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
1183 if (down_sample)
then
1185 var_mok = int(i, mpi_offset_kind)
1187 call mpi_file_write_all(ifile,
q_cons_temp_ds(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
1191 var_mok = int(i, mpi_offset_kind)
1193 call mpi_file_write_all(ifile,
mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
1198 call mpi_file_close(ifile, ierr)
1207 else if (
present(beta))
then
1213 write (file_loc,
'(I0,A)') t_step,
'.dat'
1214 file_loc = trim(case_dir) //
'/restart_data' // trim(mpiiofs) // trim(file_loc)
1215 inquire (file=trim(file_loc), exist=file_exist)
1216 if (file_exist .and.
proc_rank == 0)
then
1217 call mpi_file_delete(file_loc, mpi_info_int, ierr)
1219 call mpi_file_open(mpi_comm_world, file_loc, ior(mpi_mode_wronly, mpi_mode_create), mpi_info_int, ifile, ierr)
1221 data_size = (m + 1)*(n + 1)*(p + 1)
1223 m_mok = int(
m_glb + 1, mpi_offset_kind)
1224 n_mok = int(
n_glb + 1, mpi_offset_kind)
1225 p_mok = int(
p_glb + 1, mpi_offset_kind)
1226 wp_mok = int(storage_size(0._stp)/8, mpi_offset_kind)
1227 mok = int(1._wp, mpi_offset_kind)
1228 str_mok = int(
name_len, mpi_offset_kind)
1229 nvars_mok = int(alt_sys, mpi_offset_kind)
1231 if (bubbles_euler)
then
1233 var_mok = int(i, mpi_offset_kind)
1235 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
1237 call mpi_file_set_view(ifile, disp, mpi_p,
mpi_io_data%view(i),
'native', mpi_info_int, ierr)
1238 call mpi_file_write_all(ifile,
mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
1240 if (qbmm .and. .not. polytropic)
then
1241 do i = sys_size + 1, sys_size + 2*
nb*
nnode
1242 var_mok = int(i, mpi_offset_kind)
1244 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
1246 call mpi_file_set_view(ifile, disp, mpi_p,
mpi_io_data%view(i),
'native', mpi_info_int, ierr)
1247 call mpi_file_write_all(ifile,
mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
1252 var_mok = int(i, mpi_offset_kind)
1254 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
1256 call mpi_file_set_view(ifile, disp, mpi_p,
mpi_io_data%view(i),
'native', mpi_info_int, ierr)
1257 call mpi_file_write_all(ifile,
mpi_io_data%var(i)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
1261 if (
present(beta))
then
1262 var_mok = int(sys_size + 1, mpi_offset_kind)
1264 disp = m_mok*max(mok, n_mok)*max(mok, p_mok)*wp_mok*(var_mok - 1)
1266 call mpi_file_set_view(ifile, disp, mpi_p,
mpi_io_data%view(sys_size + 1),
'native', mpi_info_int, ierr)
1267 call mpi_file_write_all(ifile,
mpi_io_data%var(sys_size + 1)%sf, data_size*mpi_io_type, mpi_io_p, status, ierr)
1270 call mpi_file_close(ifile, ierr)
1406 integer,
intent(in) :: t_step
1409 character(LEN=path_len + 2*name_len) :: file_loc
1410 integer(kind=MPI_OFFSET_KIND) :: disp
1411 integer(kind=MPI_OFFSET_KIND) :: WP_MOK
1412 integer :: ifile, ierr
1413 integer,
dimension(MPI_STATUS_SIZE) :: status
1414 logical :: file_exist, dir_check
1415 integer :: i, ib_idx
1416 integer,
parameter :: NFIELDS_PER_IB = 20
1417 real(wp) :: ib_buf(NFIELDS_PER_IB)
1418 integer :: file_unit
1419 character(len=10) :: t_step_string
1422 integer :: ib_start, ib_end, nibs_per_rank, remainder
1424 wp_mok = int(storage_size(0._wp)/8, mpi_offset_kind)
1426 if (file_per_process)
then
1430 file_loc = trim(case_dir) //
'/restart_data/lustre_' // trim(t_step_string)
1433 call s_mpi_barrier()
1436 write (file_loc,
'(A,I0,A,i7.7,A)')
'ib_state_', t_step,
'_',
proc_rank,
'.dat'
1437 file_loc = trim(case_dir) //
'/restart_data/lustre_' // trim(t_step_string) //
'/' // trim(file_loc)
1439 inquire (file=trim(file_loc), exist=file_exist)
1440 if (file_exist)
then
1441 open (newunit=file_unit, file=trim(file_loc), form=
'unformatted', access=
'stream', status=
'replace')
1443 open (newunit=file_unit, file=trim(file_loc), form=
'unformatted', access=
'stream', status=
'new')
1450 ib_buf(2:4) = patch_ib(ib_idx)%force(1:3)
1451 ib_buf(5:7) = patch_ib(ib_idx)%torque(1:3)
1452 ib_buf(8:10) = patch_ib(ib_idx)%vel(1:3)
1453 ib_buf(11:13) = patch_ib(ib_idx)%angular_vel(1:3)
1454 ib_buf(14:16) = patch_ib(ib_idx)%angles(1:3)
1455 ib_buf(17) = patch_ib(ib_idx)%x_centroid
1456 ib_buf(18) = patch_ib(ib_idx)%y_centroid
1457 ib_buf(19) = patch_ib(ib_idx)%z_centroid
1458 ib_buf(20) = patch_ib(ib_idx)%radius
1460 write (file_unit) patch_ib(ib_idx)%gbl_patch_id
1461 write (file_unit) ib_buf
1469 call s_mpi_barrier()
1471 write (file_loc,
'(A,I0,A)')
'/restart_data/ib_state_', t_step,
'.dat'
1472 file_loc = trim(case_dir) // trim(file_loc)
1474 inquire (file=trim(file_loc), exist=file_exist)
1475 if (file_exist .and.
proc_rank == 0)
then
1476 call mpi_file_delete(file_loc, mpi_info_int, ierr)
1478 call s_mpi_barrier()
1480 call mpi_file_open(mpi_comm_world, file_loc, ior(mpi_mode_wronly, mpi_mode_create), mpi_info_int, ifile, ierr)
1485 ib_buf(2:4) = patch_ib(ib_idx)%force(1:3)
1486 ib_buf(5:7) = patch_ib(ib_idx)%torque(1:3)
1487 ib_buf(8:10) = patch_ib(ib_idx)%vel(1:3)
1488 ib_buf(11:13) = patch_ib(ib_idx)%angular_vel(1:3)
1489 ib_buf(14:16) = patch_ib(ib_idx)%angles(1:3)
1490 ib_buf(17) = patch_ib(ib_idx)%x_centroid
1491 ib_buf(18) = patch_ib(ib_idx)%y_centroid
1492 ib_buf(19) = patch_ib(ib_idx)%z_centroid
1493 ib_buf(20) = patch_ib(ib_idx)%radius
1496 disp = int(patch_ib(ib_idx)%gbl_patch_id - 1, mpi_offset_kind)*int(nfields_per_ib, mpi_offset_kind)*wp_mok
1498 call mpi_file_write_at(ifile, disp, ib_buf, nfields_per_ib, mpi_p, status, ierr)
1501 call mpi_file_close(ifile, ierr)
1728 integer,
intent(in) :: t_step
1730 real(wp),
dimension(0:m,0:n,0:p),
intent(in) :: accel_mag
1731 real(wp),
dimension(-1:m) :: distx
1732 real(wp),
dimension(-1:n) :: disty
1733 real(wp),
dimension(-1:p) :: distz
1737 real(wp) :: lit_gamma, nbub
1739 real(wp),
dimension(num_vels) :: vel
1745 real(wp),
dimension(num_fluids) :: alpha, alpha_rho
1750 real(wp) :: m00, m10, m01, m20, m02
1751 real(wp) :: varr, varv
1752 real(wp),
dimension(Nb) :: nr, r, nrdot, rdot
1755 real(wp) :: int_pres
1756 real(wp) :: max_pres
1757 real(wp),
dimension(2) :: re
1758 real(wp),
dimension(6) :: tau_e
1759 real(wp) :: g_undamaged, g_damaged
1760 real(wp) :: dyn_p, t
1761 real(wp) :: damage_state
1762 real(wp) :: solid_partial_density
1763 integer :: i,
j,
k,
l, s, d
1764 real(wp) :: nondim_time
1766 real(wp) :: rhoyks(1:num_species)
1770 if (time_stepper == 23)
then
1774 nondim_time = real(t_step + t_step_old, wp)*dt
1776 nondim_time = real(t_step, wp)*dt
1780 do i = 1, num_probes
1791 nr = 0._wp; r = 0._wp
1792 nrdot = 0._wp; rdot = 0._wp
1799 varr = 0._wp; varv = 0._wp
1801 do s = 1, (num_dims*(num_dims + 1))/2
1804 damage_state = 0._wp
1808 if ((probe(i)%x >=
x_cb(-1)) .and. (probe(i)%x <=
x_cb(m)))
then
1810 distx(s) =
x_cb(s) - probe(i)%x
1811 if (distx(s) < 0._wp) distx(s) = 1000._wp
1813 j = minloc(distx, 1)
1819 do d = 1, num_species
1820 rhoyks(d) =
q_cons_vf(eqn_idx%species%beg + d - 1)%sf(
j - 2,
k,
l)
1825 if (hypoelasticity)
then
1826 call s_convert_to_mixture_variables(
q_cons_vf,
j - 2,
k,
l, rho, gamma, pi_inf, qv, re, g_undamaged, &
1832 vel(s) =
q_cons_vf(eqn_idx%cont%end + s)%sf(
j - 2,
k,
l)/rho
1834 do s = 1, num_fluids
1835 alpha(s) =
q_cons_vf(eqn_idx%adv%beg + s - 1)%sf(
j - 2,
k,
l)
1836 alpha_rho(s) =
q_cons_vf(eqn_idx%cont%beg + s - 1)%sf(
j - 2,
k,
l)
1839 dyn_p = 0.5_wp*rho*dot_product(vel, vel)
1841 if (hypoelasticity)
then
1842 if (cont_damage)
then
1844 solid_partial_density = 0._wp
1845 do s = 1, num_fluids
1847 solid_partial_density = solid_partial_density +
q_cons_vf(eqn_idx%cont%beg + s - 1)%sf(
j - 2, &
1851 damage_state = min(max(
q_cons_vf(eqn_idx%damage)%sf(
j - 2,
k,
l)/max(solid_partial_density, &
1854 g_damaged = g_undamaged*max(1._wp - damage_state, 0._wp)
1857 & dyn_p, pi_inf, gamma, rho, qv, rhoyks(:), pres, t, &
1861 & dyn_p, pi_inf, gamma, rho, qv, rhoyks, pres, t)
1864 if (hypoelasticity)
then
1865 tau_e(1) =
q_cons_vf(eqn_idx%stress%end)%sf(
j - 2,
k,
l)/rho
1868 if (bubbles_euler)
then
1870 if (num_fluids == 3)
then
1883 nr3 = nr3 +
weight(s)*(nr(s)**3._wp)
1886 nbub = sqrt((4._wp*
pi/3._wp)*nr3/alf)
1889 print *,
'In probe, nbub: ', nbub
1903 varr = m20 - m10**2._wp
1904 varv = m02 - m01**2._wp
1907 rdot(:) = nrdot(:)/nbub
1910 ptot = pres - ptilde
1914 call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, alpha, c, alpha_rho)
1915 if (hypoelasticity) c = sqrt(c*c + (4._wp/3._wp)*g_damaged/rho)
1917 accel = accel_mag(
j - 2,
k,
l)
1919 else if (p == 0)
then
1921 do d = 1, num_species
1922 rhoyks(d) =
q_cons_vf(eqn_idx%species%beg + d - 1)%sf(
j - 2,
k - 2,
l)
1926 if ((probe(i)%x >=
x_cb(-1)) .and. (probe(i)%x <=
x_cb(m)))
then
1927 if ((probe(i)%y >=
y_cb(-1)) .and. (probe(i)%y <=
y_cb(n)))
then
1929 distx(s) =
x_cb(s) - probe(i)%x
1930 if (distx(s) < 0._wp) distx(s) = 1000._wp
1933 disty(s) =
y_cb(s) - probe(i)%y
1934 if (disty(s) < 0._wp) disty(s) = 1000._wp
1936 j = minloc(distx, 1)
1937 k = minloc(disty, 1)
1943 call s_convert_to_mixture_variables(
q_cons_vf,
j - 2,
k - 2,
l, rho, gamma, pi_inf, qv, re, g_undamaged, &
1946 vel(s) =
q_cons_vf(eqn_idx%cont%end + s)%sf(
j - 2,
k - 2,
l)/rho
1948 do s = 1, num_fluids
1949 alpha(s) =
q_cons_vf(eqn_idx%adv%beg + s - 1)%sf(
j - 2,
k - 2,
l)
1950 alpha_rho(s) =
q_cons_vf(eqn_idx%cont%beg + s - 1)%sf(
j - 2,
k - 2,
l)
1953 dyn_p = 0.5_wp*rho*dot_product(vel, vel)
1955 if (hypoelasticity)
then
1956 if (cont_damage)
then
1958 solid_partial_density = 0._wp
1959 do s = 1, num_fluids
1961 solid_partial_density = solid_partial_density +
q_cons_vf(eqn_idx%cont%beg + s - 1)%sf(
j &
1965 damage_state = min(max(
q_cons_vf(eqn_idx%damage)%sf(
j - 2,
k - 2,
l)/max(solid_partial_density, &
1968 g_damaged = g_undamaged*max(1._wp - damage_state, 0._wp)
1971 &
k - 2,
l), dyn_p, pi_inf, gamma, rho, qv, rhoyks, pres, t, &
1975 &
k - 2,
l), dyn_p, pi_inf, gamma, rho, qv, rhoyks, pres, t)
1978 if (hypoelasticity)
then
1980 tau_e(s) =
q_cons_vf(eqn_idx%stress%beg + s - 1)%sf(
j - 2,
k - 2,
l)/rho
1984 if (bubbles_euler)
then
1996 nr3 = nr3 +
weight(s)*(nr(s)**3._wp)
1999 nbub = sqrt((4._wp*
pi/3._wp)*nr3/alf)
2003 rdot(:) = nrdot(:)/nbub
2006 call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, alpha, c, alpha_rho)
2007 if (hypoelasticity) c = sqrt(c*c + (4._wp/3._wp)*g_damaged/rho)
2011 if ((probe(i)%x >=
x_cb(-1)) .and. (probe(i)%x <=
x_cb(m)))
then
2012 if ((probe(i)%y >=
y_cb(-1)) .and. (probe(i)%y <=
y_cb(n)))
then
2013 if ((probe(i)%z >=
z_cb(-1)) .and. (probe(i)%z <=
z_cb(p)))
then
2015 distx(s) =
x_cb(s) - probe(i)%x
2016 if (distx(s) < 0._wp) distx(s) = 1000._wp
2019 disty(s) =
y_cb(s) - probe(i)%y
2020 if (disty(s) < 0._wp) disty(s) = 1000._wp
2023 distz(s) =
z_cb(s) - probe(i)%z
2024 if (distz(s) < 0._wp) distz(s) = 1000._wp
2026 j = minloc(distx, 1)
2027 k = minloc(disty, 1)
2028 l = minloc(distz, 1)
2035 & g_undamaged, fluid_pp(:)%G)
2037 vel(s) =
q_cons_vf(eqn_idx%cont%end + s)%sf(
j - 2,
k - 2,
l - 2)/rho
2039 do s = 1, num_fluids
2040 alpha(s) =
q_cons_vf(eqn_idx%adv%beg + s - 1)%sf(
j - 2,
k - 2,
l - 2)
2041 alpha_rho(s) =
q_cons_vf(eqn_idx%cont%beg + s - 1)%sf(
j - 2,
k - 2,
l - 2)
2044 dyn_p = 0.5_wp*rho*dot_product(vel, vel)
2047 do d = 1, num_species
2048 rhoyks(d) =
q_cons_vf(eqn_idx%species%beg + d - 1)%sf(
j - 2,
k - 2,
l - 2)
2052 if (hypoelasticity)
then
2053 if (cont_damage)
then
2055 solid_partial_density = 0._wp
2056 do s = 1, num_fluids
2058 solid_partial_density = solid_partial_density +
q_cons_vf(eqn_idx%cont%beg + s &
2059 & - 1)%sf(
j - 2,
k - 2,
l - 2)
2062 damage_state = min(max(
q_cons_vf(eqn_idx%damage)%sf(
j - 2,
k - 2, &
2063 &
l - 2)/max(solid_partial_density,
verysmall), 0._wp), 1._wp)
2065 g_damaged = g_undamaged*max(1._wp - damage_state, 0._wp)
2068 &
q_cons_vf(eqn_idx%alf)%sf(
j - 2,
k - 2,
l - 2), dyn_p, pi_inf, gamma, &
2070 &
l - 2, rho, g_undamaged))
2073 &
q_cons_vf(eqn_idx%alf)%sf(
j - 2,
k - 2,
l - 2), dyn_p, pi_inf, gamma, &
2074 & rho, qv, rhoyks, pres, t)
2077 if (hypoelasticity)
then
2079 tau_e(s) =
q_cons_vf(eqn_idx%stress%beg + s - 1)%sf(
j - 2,
k - 2,
l - 2)/rho
2084 call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, alpha, c, alpha_rho)
2085 if (hypoelasticity) c = sqrt(c*c + (4._wp/3._wp)*g_damaged/rho)
2087 accel = accel_mag(
j - 2,
k - 2,
l - 2)
2093# 1651 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2095 call s_mpi_allreduce_sum(tmp, rho)
2096# 1651 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2098 call s_mpi_allreduce_sum(tmp, pres)
2099# 1651 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2101 call s_mpi_allreduce_sum(tmp, gamma)
2102# 1651 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2104 call s_mpi_allreduce_sum(tmp, pi_inf)
2105# 1651 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2107 call s_mpi_allreduce_sum(tmp, qv)
2108# 1651 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2110 call s_mpi_allreduce_sum(tmp, c)
2111# 1651 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2113 call s_mpi_allreduce_sum(tmp, accel)
2114# 1654 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2118 call s_mpi_allreduce_sum(tmp, vel(s))
2121 if (bubbles_euler)
then
2122# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2124 call s_mpi_allreduce_sum(tmp, alf)
2125# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2127 call s_mpi_allreduce_sum(tmp, alfgr)
2128# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2130 call s_mpi_allreduce_sum(tmp, nbub)
2131# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2133 call s_mpi_allreduce_sum(tmp, nr(1))
2134# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2136 call s_mpi_allreduce_sum(tmp, nrdot(1))
2137# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2139 call s_mpi_allreduce_sum(tmp, m00)
2140# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2142 call s_mpi_allreduce_sum(tmp, r(1))
2143# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2145 call s_mpi_allreduce_sum(tmp, rdot(1))
2146# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2148 call s_mpi_allreduce_sum(tmp, ptilde)
2149# 1662 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2151 call s_mpi_allreduce_sum(tmp, ptot)
2152# 1665 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2155# 1668 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2157 call s_mpi_allreduce_sum(tmp, varr)
2158# 1668 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2160 call s_mpi_allreduce_sum(tmp, varv)
2161# 1668 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2163 call s_mpi_allreduce_sum(tmp, m10)
2164# 1668 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2166 call s_mpi_allreduce_sum(tmp, m01)
2167# 1668 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2169 call s_mpi_allreduce_sum(tmp, m20)
2170# 1668 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2172 call s_mpi_allreduce_sum(tmp, m02)
2173# 1671 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2177 if (hypoelasticity)
then
2178 do s = 1, (num_dims*(num_dims + 1))/2
2180 call s_mpi_allreduce_sum(tmp, tau_e(s))
2184 if (cont_damage)
then
2186 call s_mpi_allreduce_sum(tmp, damage_state)
2191 if (bubbles_euler .and. (num_fluids <= 2))
then
2193 write (i + 30,
'(6x,f12.6,14f28.16)') nondim_time, rho, vel(1), pres, alf, r(1), rdot(1), nr(1), &
2194 & nrdot(1), varr, varv, m10, m01, m20, m02
2196 write (i + 30,
'(6x,f12.6,8f24.8)') nondim_time, rho, vel(1), pres, alf, r(1), rdot(1), nr(1), nrdot(1)
2199 else if (bubbles_euler .and. (num_fluids == 3))
then
2201 &
'(6x,f12.6,f24.8,f24.8,f24.8,f24.8,f24.8,' //
'f24.8,f24.8,f24.8,f24.8,f24.8, f24.8)') &
2202 & nondim_time, rho, vel(1), pres, alf, alfgr, nr(1), nrdot(1), r(1), rdot(1), ptilde, ptot
2203 else if (bubbles_euler .and. num_fluids == 4)
then
2205 &
'(6x,f12.6,f24.8,f24.8,f24.8,f24.8,' //
'f24.8,f24.8,f24.8,f24.8,f24.8,f24.8,f24.8,f24.8,f24.8)') &
2207 & 0, 0),
q_cons_vf(4)%sf(
j - 2, 0, 0),
q_cons_vf(5)%sf(
j - 2, 0, 0),
q_cons_vf(6)%sf(
j - 2, 0, 0), &
2209 &
q_cons_vf(10)%sf(
j - 2, 0, 0), nbub, r(1), rdot(1)
2210 else if (hypoelasticity)
then
2211 write (i + 30,
'(6X,F12.6,F24.8,F24.8,F24.8,F24.8)') nondim_time, rho, vel(1), pres, tau_e(1)
2213 write (i + 30,
'(6X,F12.6,F24.8,F24.8,F24.8)') nondim_time, rho, vel(1), pres
2215 else if (p == 0)
then
2216 if (bubbles_euler)
then
2217# 1715 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2218 write (i + 30,
'(6X,10F24.8)') nondim_time, rho, vel(1), vel(2), pres, alf, nr(1), nrdot(1), r(1), &
2220# 1718 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2221 else if (hypoelasticity)
then
2222# 1720 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2223 write (i + 30,
'(6X,F12.6,F24.8,F24.8,F24.8,F24.8,' //
'F24.8,F24.8,F24.8)') nondim_time, rho, &
2224 & vel(1), vel(2), pres, tau_e(1), tau_e(2), tau_e(3)
2225# 1723 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2227# 1725 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2228 write (i + 30,
'(6X,F12.6,F24.8,F24.8,F24.8,F24.8)') nondim_time, rho, vel(1), vel(2), pres
2229# 1727 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2232# 1730 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"
2233 if (hypoelasticity)
then
2234 write (i + 30,
'(6X,F12.6,16F24.8)') nondim_time, rho, vel(1), vel(2), vel(3), pres, gamma, pi_inf, &
2235 & qv, c, accel, tau_e(1), tau_e(2), tau_e(3), tau_e(4), tau_e(5), tau_e(6)
2238 &
'(6X,F12.6,F24.8,F24.8,F24.8,F24.8,' //
'F24.8,F24.8,F24.8,F24.8,F24.8,' //
'F24.8)') &
2239 & nondim_time, rho, vel(1), vel(2), vel(3), pres, gamma, pi_inf, qv, c, accel
2241# 1739 "/home/runner/work/MFC/MFC/src/simulation/m_data_output.fpp"