38 real(mytype),
dimension(:,:,:),
intent(in) :: u, v, w
40 real(mytype) :: cpu_t,cfl
49 if ( (
dt*abs(u(i,j,k))/
dx + &
50 dt*abs(v(i,j,k))/
dy + &
51 dt*abs(w(i,j,k))/
dz(k) ) .gt. cfl)
then 53 cfl=
dt*abs(u(i,j,k))/
dx + &
54 dt*abs(v(i,j,k))/
dy + &
55 dt*abs(w(i,j,k))/
dz(k)
65 call mpi_reduce(cfl,
cfl_max,1,real_type,mpi_max,0,mpi_comm_world,
ierr)
75 184
format(
' Time = ',es12.5,
'; CPU Time = ',es11.4,
'; CFL max = ',f5.2)
92 real(mytype),
dimension(:,:,:),
intent(in) :: u,v,w
93 integer,
intent(in) :: isfinal,ishistout
96 real(mytype) :: dudx,dvdy,dwdz
97 real(mytype) :: div_avg, div_max
98 real(mytype) :: div_avg_all,div_max_all
99 real(mytype) :: div_hist_max_all
109 if (
cds .eq. 1)
then 111 dudx = ( u(i,j,k)-u(i-1,j,k) ) /
dx 112 dvdy = ( v(i,j,k)-v(i,j-1,k) ) /
dy 114 elseif (
cds .eq. 2)
then 116 dudx = ( -u(i+1,j,k) + &
119 u(i-2,j,k) ) / 24.d0 /
dx 121 dvdy = ( -v(i,j+1,k) + &
124 v(i,j-2,k) ) / 24.d0 /
dy 128 dwdz = ( w(i,j,k)-w(i,j,k-1) ) /
dz(k)
129 div_avg=div_avg+abs(dudx+dvdy+dwdz)
131 if ( abs(dudx+dvdy+dwdz) .gt. div_max )
then 132 div_max=(dudx+dvdy+dwdz)
135 if ( u(i,j,k) .ne. u(i,j,k) .or. &
136 v(i,j,k) .ne. v(i,j,k) .or. &
137 w(i,j,k) .ne. w(i,j,k) )
then 138 print *,
'NaN error! ',i,
' ',j,
' ',k
142 if (isfinal .eq. 1)
then 155 call mpi_reduce(div_avg,div_avg_all,1,real_type,mpi_sum,0, &
158 call mpi_reduce(div_max,div_max_all,1,real_type,mpi_max,0, &
161 call mpi_reduce(
div_hist_max,div_hist_max_all,1,real_type,mpi_max,0, &
165 if (
myid .eq. 0)
then 167 if ( isfinal .eq. 0)
then 169 write (*,104) div_avg_all,div_max_all
170 104
format(
' DIV-ERR INIT : DIV_AVG = ',es11.4,
'; DIV_MAX = ',es11.4)
172 elseif ( isfinal .eq. 1 .and. ishistout .eq. 0)
then 174 write (*,105) div_avg_all,div_max_all
175 105
format(
' DIV-ERR FINAL: DIV_AVG = ',es11.4,
'; DIV_MAX = ',es11.4)
177 elseif ( isfinal .eq. 1 .and. ishistout .eq. 1)
then 179 write (*,115) div_avg_all,div_max_all
180 115
format(
' DIV-ERR FINAL: DIV_AVG = ',es11.4,
'; DIV_MAX = ',es11.4)
181 write (*,106) div_hist_max_all
182 106
format(
' DIV-ERR HIST_MAX = ', es11.4)
187 258
format(
' Ri_b = ', es12.5)
193 259
format(
' Ubar = ', es12.5)
197 print *,
'div out flag error!' 217 real(mytype),
dimension(:,:,:),
intent(in) :: u,v,w,t,p
219 integer :: k,itmsr,jtmsr
224 open(99,file=
'results/tmsr_u.dat',status=
'old', &
225 position=
'append',action=
'write')
228 if (k .eq.
kstr3)
then 230 write(99,
'(2f14.8)',advance=
'no')
time_sim,u(itmsr,jtmsr,k)+
u_mrf 231 elseif (k .eq.
kend3)
then 232 write(99,
'(1f14.8)') u(itmsr,jtmsr,k)+
u_mrf 234 write(99,
'(1f14.8)',advance=
'no') u(itmsr,jtmsr,k)+
u_mrf 240 open(98,file=
'results/tmsr_v.dat',status=
'old', &
241 position=
'append',action=
'write')
244 if (k .eq.
kstr3)
then 245 write(98,
'(2f14.8)',advance=
'no')
time_sim,v(itmsr,jtmsr,k)
246 elseif (k .eq.
kend3)
then 247 write(98,
'(1f14.8)') v(itmsr,jtmsr,k)
249 write(98,
'(1f14.8)',advance=
'no') v(itmsr,jtmsr,k)
256 open(97,file=
'results/tmsr_w.dat',status=
'old', &
257 position=
'append',action=
'write')
260 if (k .eq.
kstr3)
then 261 write(97,
'(2f14.8)',advance=
'no')
time_sim,w(itmsr,jtmsr,k)
262 elseif (k .eq.
kend3)
then 263 write(97,
'(1f14.8)') w(itmsr,jtmsr,k)
265 write(97,
'(1f14.8)',advance=
'no') w(itmsr,jtmsr,k)
272 open(96,file=
'results/tmsr_t.dat',status=
'old', &
273 position=
'append',action=
'write')
276 if (k .eq.
kstr3)
then 277 write(96,
'(2f14.8)',advance=
'no')
time_sim,t(itmsr,jtmsr,k)
278 elseif (k .eq.
kend3)
then 279 write(96,
'(1f14.8)') t(itmsr,jtmsr,k)
281 write(96,
'(1f14.8)',advance=
'no') t(itmsr,jtmsr,k)
287 open(95,file=
'results/tmsr_p.dat',status=
'old', &
288 position=
'append',action=
'write')
291 if (k .eq.
kstr3)
then 292 write(95,
'(2f14.8)',advance=
'no')
time_sim,p(itmsr,jtmsr,k)
293 elseif (k .eq.
kend3)
then 294 write(95,
'(1f14.8)') p(itmsr,jtmsr,k)
296 write(95,
'(1f14.8)',advance=
'no') p(itmsr,jtmsr,k)
317 real(mytype),
dimension(:,:,:),
intent(in) :: u,v,w,p,t,ff,gg,hh,ss
319 if (
myid .eq. 0)
then 320 print *,
'Writing Backup Files...' 345 'results/bak_ff.dat')
348 'results/bak_gg.dat')
351 'results/bak_hh.dat')
354 'results/bak_ss.dat')
372 real(mytype),
dimension(:,:,:),
intent(in) :: u, v, w, p, t
373 integer,
intent(in) :: time_step
375 character(len=8) :: fmt1
376 character(len=6) :: xx1
379 write (xx1,fmt1) time_step/
iinstfl 381 if (
myid .eq. 0)
then 382 print *,
'Writing Instantaneous Fields...' 387 'results/inst_u'//trim(xx1)//
'.dat')
390 'results/inst_v'//trim(xx1)//
'.dat')
393 'results/inst_w'//trim(xx1)//
'.dat')
396 'results/inst_p'//trim(xx1)//
'.dat')
399 'results/inst_t'//trim(xx1)//
'.dat')
414 real(mytype),
dimension(:,:,:),
intent(in) :: u, v, w, p, t
415 integer,
intent(in) :: time_step
417 character(len=8) :: fmt0
418 character(len=8) :: fmt1
419 character(len=6) :: ff1
420 character(len=6) :: ii1
422 integer :: size_xy=0,size_xz=0,size_yz=0,n,test_size,indx
426 write (ff1,fmt0) time_step/
intv_2d 431 if (
myid .eq. 0)
then 432 print *,
'Writing X-Y Slices...' 451 3,
xy2d_id(n),
'results/slices/xy2d_u_k'//trim(ii1)//
'_t'//trim(ff1) )
453 3,
xy2d_id(n),
'results/slices/xy2d_v_k'//trim(ii1)//
'_t'//trim(ff1) )
455 3,
xy2d_id(n),
'results/slices/xy2d_w_k'//trim(ii1)//
'_t'//trim(ff1) )
457 3,
xy2d_id(n),
'results/slices/xy2d_p_k'//trim(ii1)//
'_t'//trim(ff1) )
459 3,
xy2d_id(n),
'results/slices/xy2d_t_k'//trim(ii1)//
'_t'//trim(ff1) )
468 if (
myid .eq. 0)
then 469 print *,
'Writing X-Z Slices...' 488 2,
xz2d_id(n),
'results/slices/xz2d_u_j'//trim(ii1)//
'_t'//trim(ff1) )
490 2,
xz2d_id(n),
'results/slices/xz2d_v_j'//trim(ii1)//
'_t'//trim(ff1) )
492 2,
xz2d_id(n),
'results/slices/xz2d_w_j'//trim(ii1)//
'_t'//trim(ff1) )
494 2,
xz2d_id(n),
'results/slices/xz2d_p_j'//trim(ii1)//
'_t'//trim(ff1) )
496 2,
xz2d_id(n),
'results/slices/xz2d_t_j'//trim(ii1)//
'_t'//trim(ff1) )
505 if (
myid .eq. 0)
then 506 print *,
'Writing Y-Z Slices...' 525 1,
yz2d_id(n),
'results/slices/yz2d_u_i'//trim(ii1)//
'_t'//trim(ff1) )
527 1,
yz2d_id(n),
'results/slices/yz2d_v_i'//trim(ii1)//
'_t'//trim(ff1) )
529 1,
yz2d_id(n),
'results/slices/yz2d_w_i'//trim(ii1)//
'_t'//trim(ff1) )
531 1,
yz2d_id(n),
'results/slices/yz2d_p_i'//trim(ii1)//
'_t'//trim(ff1) )
533 1,
yz2d_id(n),
'results/slices/yz2d_t_i'//trim(ii1)//
'_t'//trim(ff1) )
547 mean_vv,mean_ww,mean_uw,mean_vw,mean_tt,mean_tw,time_step)
553 real(mytype),
dimension(:,:,:),
intent(in) :: &
554 mean_u,mean_v,mean_w,mean_t,mean_uu,mean_vv,mean_ww,mean_uw,mean_vw, &
556 integer,
intent(in) :: time_step
558 if (
myid .eq. 0)
then 559 print *,
'Writing Mean Fields...' 563 'results/mean_u.dat')
566 'results/mean_v.dat')
569 'results/mean_w.dat')
572 'results/mean_t.dat')
575 'results/mean_uu.dat')
578 'results/mean_vv.dat')
581 'results/mean_ww.dat')
584 'results/mean_uw.dat')
587 'results/mean_vw.dat')
590 'results/mean_tt.dat')
593 'results/mean_tw.dat')
subroutine output_time_series(u, v, w, p, t)
integer, save, protected is_ri_var
integer, save, protected myid
integer, save, protected isxy2d
real(mytype), save, protected ubar
integer, save, protected ny
integer, save, protected isyz2d
integer, dimension(50), save, protected yz2d_id
subroutine screen_div_error(u, v, w, isfinal, ishistout)
real(mytype), save, protected dt
integer, save, protected dts
integer, save, protected jend3
integer, save, protected nz
integer, save, protected intv_2d
subroutine output_2d_slices(u, v, w, p, t, time_step)
integer, save, protected iinstfl
real(mytype), dimension(:), allocatable, save, protected dz
integer, dimension(50), save, protected xy2d_id
integer, save, protected istr3
integer, save, protected isxz2d
real(mytype), save, protected dx
integer, save, protected jstr3
subroutine output_backup(u, v, w, p, t, ff, gg, hh, ss)
real(mytype), save, protected u_mrf
integer, save, protected cds
real(mytype), save time_sim
real(mytype), save, protected dy
integer, save, protected nx
real(mytype), save, protected got
subroutine output_inst_fields(u, v, w, p, t, time_step)
real(mytype), save div_hist_max
integer, save, protected iend3
subroutine output_mean_fields(mean_u, mean_v, mean_w, mean_t, mean_uu, mean_vv, mean_ww, mean_uw, mean_vw, mean_tt, mean_tw, time_step)
subroutine screen_cpu_time(u, v, w)
integer, dimension(50), save, protected xz2d_id
integer, save, protected dp_opt
real(mytype), save cfl_max
integer, save, protected kstr3
integer, save, protected kend3