146 rdry => const_rdry, &
147 cvdry => const_cvdry, &
148 cpdry => const_cpdry, &
151 grav => const_grav, &
180 matrix_solver_tridiagonal, &
184 real(RP),
intent(out) :: DENS_RK(KA,IA,JA)
185 real(RP),
intent(out) :: MOMZ_RK(KA,IA,JA)
186 real(RP),
intent(out) :: MOMX_RK(KA,IA,JA)
187 real(RP),
intent(out) :: MOMY_RK(KA,IA,JA)
188 real(RP),
intent(out) :: RHOT_RK(KA,IA,JA)
190 real(RP),
intent(out) :: PROG_RK(KA,IA,JA,VA)
192 real(RP),
intent(inout) :: mflx_hi(KA,IA,JA,3)
193 real(RP),
intent(out) :: tflx_hi(KA,IA,JA,3)
195 real(RP),
intent(in),
target :: DENS0(KA,IA,JA)
196 real(RP),
intent(in),
target :: MOMZ0(KA,IA,JA)
197 real(RP),
intent(in),
target :: MOMX0(KA,IA,JA)
198 real(RP),
intent(in),
target :: MOMY0(KA,IA,JA)
199 real(RP),
intent(in),
target :: RHOT0(KA,IA,JA)
201 real(RP),
intent(in) :: DENS(KA,IA,JA)
202 real(RP),
intent(in) :: MOMZ(KA,IA,JA)
203 real(RP),
intent(in) :: MOMX(KA,IA,JA)
204 real(RP),
intent(in) :: MOMY(KA,IA,JA)
205 real(RP),
intent(in) :: RHOT(KA,IA,JA)
207 real(RP),
intent(in) :: DENS_t(KA,IA,JA)
208 real(RP),
intent(in) :: MOMZ_t(KA,IA,JA)
209 real(RP),
intent(in) :: MOMX_t(KA,IA,JA)
210 real(RP),
intent(in) :: MOMY_t(KA,IA,JA)
211 real(RP),
intent(in) :: RHOT_t(KA,IA,JA)
213 real(RP),
intent(in) :: PROG0(KA,IA,JA,VA)
214 real(RP),
intent(in) :: PROG (KA,IA,JA,VA)
216 real(RP),
intent(in) :: DPRES0(KA,IA,JA)
217 real(RP),
intent(in) :: RT2P(KA,IA,JA)
218 real(RP),
intent(in) :: CORIOLI(IA,JA)
219 real(RP),
intent(in) :: num_diff(KA,IA,JA,5,3)
220 real(RP),
intent(in) :: wdamp_coef(KA)
221 real(RP),
intent(in) :: divdmp_coef
222 real(RP),
intent(in) :: DDIV(KA,IA,JA)
224 logical,
intent(in) :: FLAG_FCT_MOMENTUM
225 logical,
intent(in) :: FLAG_FCT_T
226 logical,
intent(in) :: FLAG_FCT_ALONG_STREAM
228 real(RP),
intent(in) :: CDZ(KA)
229 real(RP),
intent(in) :: FDZ(KA-1)
230 real(RP),
intent(in) :: FDX(IA-1)
231 real(RP),
intent(in) :: FDY(JA-1)
232 real(RP),
intent(in) :: RCDZ(KA)
233 real(RP),
intent(in) :: RCDX(IA)
234 real(RP),
intent(in) :: RCDY(JA)
235 real(RP),
intent(in) :: RFDZ(KA-1)
236 real(RP),
intent(in) :: RFDX(IA-1)
237 real(RP),
intent(in) :: RFDY(JA-1)
239 real(RP),
intent(in) :: PHI (KA,IA,JA)
240 real(RP),
intent(in) :: GSQRT (KA,IA,JA,7)
241 real(RP),
intent(in) :: J13G (KA,IA,JA,7)
242 real(RP),
intent(in) :: J23G (KA,IA,JA,7)
243 real(RP),
intent(in) :: J33G
244 real(RP),
intent(in) :: MAPF (IA,JA,2,4)
245 real(RP),
intent(in) :: REF_dens(KA,IA,JA)
246 real(RP),
intent(in) :: REF_rhot(KA,IA,JA)
248 logical,
intent(in) :: BND_W
249 logical,
intent(in) :: BND_E
250 logical,
intent(in) :: BND_S
251 logical,
intent(in) :: BND_N
252 logical,
intent(in) :: TwoD
254 real(RP),
intent(in) :: dtrk
255 logical,
intent(in) :: last
259 real(RP) :: POTT(KA,IA,JA)
260 real(RP) :: DPRES(KA,IA,JA)
262 real(RP) :: qflx_hi (KA,IA,JA,3)
263 real(RP) :: qflx_J13(KA,IA,JA)
264 real(RP) :: qflx_J23(KA,IA,JA)
273 real(RP) :: advch_t(KA,IA,JA,5)
274 real(RP) :: advcv_t(KA,IA,JA,5)
275 real(RP) :: wdmp_t(KA,IA,JA)
276 real(RP) :: ddiv_t(KA,IA,JA,3)
277 real(RP) :: pg_t(KA,IA,JA,3)
278 real(RP) :: cf_t(KA,IA,JA,2)
285 real(RP) :: Sr(KA,IA,JA)
286 real(RP) :: Sw(KA,IA,JA)
287 real(RP) :: St(KA,IA,JA)
289 real(RP) :: PT(KA,LSIZE)
290 real(RP) :: Ci(KS:KE-1,LSIZE)
291 real(RP) :: Co(KS:KE-1,LSIZE)
292 real(RP) :: F1(KS:KE-1,LSIZE)
293 real(RP) :: F2(KS:KE-1,LSIZE)
294 real(RP) :: F3(KS:KE-1,LSIZE)
297 real(RP) :: work(KMAX-1,4)
300 integer :: IIS, IIE, JJS, JJE
301 integer :: k, i, j, ii
304 integer,
parameter :: l = 1
314 qflx_hi(:,:,:,:) = undef
315 qflx_j13(:,:,:) = undef
316 qflx_j23(:,:,:) = undef
319 #if defined DEBUG || defined QUICKDEBUG
320 dens_rk( 1:
ks-1,:,:) = undef
321 dens_rk(
ke+1:
ka ,:,:) = undef
322 momz_rk( 1:
ks-1,:,:) = undef
323 momz_rk(
ke+1:
ka ,:,:) = undef
324 momx_rk( 1:
ks-1,:,:) = undef
325 momx_rk(
ke+1:
ka ,:,:) = undef
326 momy_rk( 1:
ks-1,:,:) = undef
327 momy_rk(
ke+1:
ka ,:,:) = undef
328 rhot_rk( 1:
ks-1,:,:) = undef
329 rhot_rk(
ke+1:
ka ,:,:) = undef
330 prog_rk( 1:
ks-1,:,:,:) = undef
331 prog_rk(
ke+1:
ka ,:,:,:) = undef
344 if ( bnd_w ) ifs_off = 0
345 if ( bnd_s ) jfs_off = 0
372 profile_start(
"hevi_pres")
377 do i = iis, min(iie+1,
ia)
380 call check( __line__, dpres0(k,i,j) )
381 call check( __line__, rt2p(k,i,j) )
382 call check( __line__, rhot(k,i,j) )
383 call check( __line__, ref_rhot(k,i,j) )
385 dpres(k,i,j) = dpres0(k,i,j) + rt2p(k,i,j) * ( rhot(k,i,j) - ref_rhot(k,i,j) )
387 dpres(
ks-1,i,j) = dpres0(
ks-1,i,j) - dens(
ks,i,j) * ( phi(
ks-1,i,j) - phi(
ks+1,i,j) )
388 dpres(
ke+1,i,j) = dpres0(
ke+1,i,j) - dens(
ke,i,j) * ( phi(
ke+1,i,j) - phi(
ke-1,i,j) )
392 profile_stop(
"hevi_pres")
396 profile_start(
"hevi_mflx_z")
406 call check( __line__, momy(k+1,
is,j) )
407 call check( __line__, momy(k+1,
is,j-1) )
408 call check( __line__, momy(k ,
is,j) )
409 call check( __line__, momy(k ,
is,j-1) )
412 * ( momy(k+1,
is,j)+momy(k+1,
is,j-1) &
413 + momy(k ,
is,j)+momy(k ,
is,j-1) ) &
414 + gsqrt(k,
is,j,
i_xyw) / mapf(
is,j,2,
i_xy) * num_diff(k,
is,j,
i_dens,
zdir)
425 mflx_hi(
ks-1,i,j,
zdir) = 0.0_rp
428 call check( __line__, momx(k+1,i ,j) )
429 call check( __line__, momx(k+1,i-1,j) )
430 call check( __line__, momx(k ,i ,j) )
431 call check( __line__, momx(k ,i+1,j) )
432 call check( __line__, momy(k+1,i,j) )
433 call check( __line__, momy(k+1,i,j-1) )
434 call check( __line__, momy(k ,i,j) )
435 call check( __line__, momy(k ,i,j-1) )
437 mflx_hi(k,i,j,
zdir) = j13g(k,i,j,
i_xyw) * 0.25_rp / mapf(i,j,2,
i_xy) &
438 * ( momx(k+1,i,j)+momx(k+1,i-1,j) &
439 + momx(k ,i,j)+momx(k ,i-1,j) ) &
440 + j23g(k,i,j,
i_xyw) * 0.25_rp / mapf(i,j,1,
i_xy) &
441 * ( momy(k+1,i,j)+momy(k+1,i,j-1) &
442 + momy(k ,i,j)+momy(k ,i,j-1) ) &
443 + gsqrt(k,i,j,
i_xyw) / ( mapf(i,j,1,
i_xy)*mapf(i,j,2,
i_xy) ) * num_diff(k,i,j,
i_dens,
zdir)
445 mflx_hi(
ke ,i,j,
zdir) = 0.0_rp
451 k = iundef; i = iundef; j = iundef
453 profile_stop(
"hevi_mflx_z")
455 if ( .not. twod )
then
456 profile_start(
"hevi_mflx_x")
457 iss = max(iis-1,
is-ifs_off)
467 call check( __line__, gsqrt(k,i,j,
i_uyz) )
468 call check( __line__, momx(k,i,j) )
469 call check( __line__, num_diff(k,i,j,
i_dens,
xdir) )
471 mflx_hi(k,i,j,
xdir) = gsqrt(k,i,j,
i_uyz) / mapf(i,j,2,
i_uy) &
472 * ( momx(k,i,j) + num_diff(k,i,j,
i_dens,
xdir) )
478 k = iundef; i = iundef; j = iundef
480 profile_stop(
"hevi_mflx_x")
487 do j = max(jjs-1,
js-jfs_off), min(jje,
jeh)
491 call check( __line__, gsqrt(k,i,j,
i_xvz) )
492 call check( __line__, momy(k,i,j) )
493 call check( __line__, num_diff(k,i,j,
i_dens,
ydir) )
495 mflx_hi(k,i,j,
ydir) = gsqrt(k,i,j,
i_xvz) / mapf(i,j,1,
i_xv) &
496 * ( momy(k,i,j) + num_diff(k,i,j,
i_dens,
ydir) )
502 k = iundef; i = iundef; j = iundef
506 profile_start(
"hevi_sr")
520 call check( __line__, dens0(k,
is,j) )
521 call check( __line__, mflx_hi(k ,
is,j ,
ydir) )
522 call check( __line__, mflx_hi(k ,
is,j-1,
ydir) )
523 call check( __line__, dens_t(k,
is,j) )
525 advcv = - ( mflx_hi(k,
is,j,
zdir)-mflx_hi(k-1,
is,j,
zdir) ) * rcdz(k)
526 advch = - ( mflx_hi(k,
is,j,
ydir)-mflx_hi(k ,
is,j-1,
ydir) ) * rcdy(j)
527 sr(k,
is,j) = ( advcv + advch ) * mapf(
is,j,2,
i_xy) / gsqrt(k,
is,j,
i_xyz) + dens_t(k,
is,j)
550 call check( __line__, dens0(k,i,j) )
551 call check( __line__, mflx_hi(k ,i ,j ,
xdir) )
552 call check( __line__, mflx_hi(k ,i-1,j ,
xdir) )
553 call check( __line__, mflx_hi(k ,i ,j ,
ydir) )
554 call check( __line__, mflx_hi(k ,i ,j-1,
ydir) )
555 call check( __line__, dens_t(k,i,j) )
557 advcv = - ( mflx_hi(k,i,j,
zdir)-mflx_hi(k-1,i ,j,
zdir) ) * rcdz(k)
558 advch = - ( ( mflx_hi(k,i,j,
xdir)-mflx_hi(k ,i-1,j,
xdir) ) * rcdx(i) &
559 + ( mflx_hi(k,i,j,
ydir)-mflx_hi(k ,i, j-1,
ydir) ) * rcdy(j) )
560 sr(k,i,j) = ( advcv + advch ) * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) + dens_t(k,i,j)
563 advch_t(k,i,j,
i_dens) = ( advch + advcv ) * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz)
572 k = iundef; i = iundef; j = iundef
574 profile_stop(
"hevi_sr")
580 profile_start(
"hevi_momz_qflxhi_z")
583 gsqrt(:,:,:,
i_xyz), j33g, &
587 profile_stop(
"hevi_momz_qflxhi_z")
589 profile_start(
"hevi_momz_qflxj")
593 gsqrt(:,:,:,
i_xyz), j13g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
598 gsqrt(:,:,:,
i_xyz), j23g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
601 profile_stop(
"hevi_momz_qflxj")
604 if ( .not. twod )
then
605 profile_start(
"hevi_momz_qflxhi_x")
612 profile_stop(
"hevi_momz_qflxhi_x")
616 profile_start(
"hevi_momz_qflxhi_y")
623 profile_stop(
"hevi_momz_qflxhi_y")
626 profile_start(
"hevi_sw")
642 call check( __line__, qflx_hi(k ,
is,j ,
zdir) )
643 call check( __line__, qflx_hi(k-1,
is,j ,
zdir) )
644 call check( __line__, qflx_j23(k ,
is,j) )
645 call check( __line__, qflx_j23(k-1,
is,j) )
646 call check( __line__, qflx_hi(k ,
is,j ,
ydir) )
647 call check( __line__, qflx_hi(k ,
is,j-1,
ydir) )
648 call check( __line__, ddiv(k ,
is,j) )
649 call check( __line__, ddiv(k+1,
is,j) )
650 call check( __line__, momz0(k,
is,j) )
651 call check( __line__, momz_t(k,
is,j) )
653 advcv = - ( qflx_hi(k,
is,j,
zdir) - qflx_hi(k-1,
is,j ,
zdir) &
654 + qflx_j23(k,
is,j) - qflx_j23(k-1,
is,j ) ) * rfdz(k)
655 advch = - ( qflx_hi(k,
is,j,
ydir) - qflx_hi(k,
is,j-1,
ydir) ) * rcdy(j) &
657 wdmp = - wdamp_coef(k) * momz0(k,
is,j)
658 div = divdmp_coef / dtrk * ( ddiv(k+1,
is,j)-ddiv(k,
is,j) ) * fdz(k)
659 sw(k,
is,j) = ( advcv + advch ) / gsqrt(k,
is,j,
i_xyw) &
660 + wdmp + div + momz_t(k,
is,j)
665 wdmp_t(k,
is,j) = wdmp
666 ddiv_t(k,
is,j,1) = div
688 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
689 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
690 call check( __line__, qflx_j13(k ,i ,j) )
691 call check( __line__, qflx_j13(k-1,i ,j) )
692 call check( __line__, qflx_j23(k ,i ,j) )
693 call check( __line__, qflx_j23(k-1,i ,j) )
694 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
695 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
696 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
697 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
698 call check( __line__, ddiv(k ,i,j) )
699 call check( __line__, ddiv(k+1,i,j) )
700 call check( __line__, momz0(k,i,j) )
701 call check( __line__, momz_t(k,i,j) )
703 advcv = - ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
704 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
705 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rfdz(k)
706 advch = - ( ( qflx_hi(k,i,j,
xdir) - qflx_hi(k,i-1,j ,
xdir) ) * rcdx(i) &
707 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k,i ,j-1,
ydir) ) * rcdy(j) ) &
708 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy)
709 wdmp = - wdamp_coef(k) * momz0(k,i,j)
710 div = divdmp_coef / dtrk * ( ddiv(k+1,i,j)-ddiv(k,i,j) ) * fdz(k)
711 sw(k,i,j) = ( advcv + advch ) / gsqrt(k,i,j,
i_xyw) &
712 + wdmp + div + momz_t(k,i,j)
718 ddiv_t(k,i,j,1) = div
726 profile_stop(
"hevi_sw")
728 k = iundef; i = iundef; j = iundef
741 call check( __line__, rhot(k,i,j) )
742 call check( __line__, dens(k,i,j) )
744 pott(k,i,j) = rhot(k,i,j) / dens(k,i,j)
750 k = iundef; i = iundef; j = iundef
755 mflx_hi(:,:,:,
zdir), pott, gsqrt(:,:,:,
i_xyw), &
763 mflx_hi(:,:,:,
xdir), pott, gsqrt(:,:,:,
i_uyz), &
770 mflx_hi(:,:,:,
ydir), pott, gsqrt(:,:,:,
i_xvz), &
776 profile_start(
"hevi_st")
790 call check( __line__, tflx_hi(k ,
is,j ,
zdir) )
791 call check( __line__, tflx_hi(k-1,
is,j ,
zdir) )
792 call check( __line__, tflx_hi(k ,
is,j ,
ydir) )
793 call check( __line__, tflx_hi(k ,
is,j-1,
ydir) )
794 call check( __line__, rhot_t(k,
is,j) )
796 advcv = - ( tflx_hi(k,
is,j,
zdir) - tflx_hi(k-1,
is,j ,
zdir) ) * rcdz(k)
797 advch = - ( tflx_hi(k,
is,j,
ydir) - tflx_hi(k ,
is,j-1,
ydir) ) * rcdy(j)
798 st(k,
is,j) = ( advcv + advch ) * mapf(
is,j,2,
i_xy) / gsqrt(k,
is,j,
i_xyz) + rhot_t(k,
is,j)
821 call check( __line__, tflx_hi(k ,i ,j ,
zdir) )
822 call check( __line__, tflx_hi(k-1,i ,j ,
zdir) )
823 call check( __line__, tflx_hi(k ,i ,j ,
xdir) )
824 call check( __line__, tflx_hi(k ,i-1,j ,
xdir) )
825 call check( __line__, tflx_hi(k ,i ,j ,
ydir) )
826 call check( __line__, tflx_hi(k ,i ,j-1,
ydir) )
827 call check( __line__, rhot_t(k,i,j) )
829 advcv = - ( tflx_hi(k,i,j,
zdir) - tflx_hi(k-1,i ,j ,
zdir) ) * rcdz(k)
830 advch = - ( ( tflx_hi(k,i,j,
xdir) - tflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
831 + ( tflx_hi(k,i,j,
ydir) - tflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) )
832 st(k,i,j) = ( advcv + advch ) * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz) + rhot_t(k,i,j)
835 advch_t(k,i,j,
i_rhot) = ( advcv + advch ) * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz)
844 k = iundef; i = iundef; j = iundef
846 profile_stop(
"hevi_st")
850 profile_start(
"hevi_solver")
852 call prof_rapstart(
"DYN_HEVI", 3)
865 #if defined DEBUG || defined QUICKDEBUG
884 do ii = iis, iie, lsize
886 #if defined DEBUG || defined QUICKDEBUG
902 momz(:,i,j), pott(:,i,j), gsqrt(:,i,j,
i_xyz), &
906 a(k) = dtrk**2 * j33g * rcdz(k) * rt2p(k,i,j) * j33g / gsqrt(k,i,j,
i_xyz)
908 b = grav * dtrk**2 * j33g / ( cdz(
ks+1) + cdz(
ks) )
909 f1(
ks,l) = - ( pt(
ks+1,l) * rfdz(
ks) * a(
ks+1) + b ) / gsqrt(
ks,i,j,
i_xyw)
910 f2(
ks,l) = 1.0_rp + ( pt(
ks ,l) * rfdz(
ks) * ( a(
ks+1)+a(
ks) ) ) / gsqrt(
ks,i,j,
i_xyw)
912 b = grav * dtrk**2 * j33g / ( cdz(k+1) + cdz(k) )
913 f1(k,l) = - ( pt(k+1,l) * rfdz(k) * a(k+1) + b ) / gsqrt(k,i,j,
i_xyw)
914 f2(k,l) = 1.0_rp + ( pt(k ,l) * rfdz(k) * ( a(k+1)+a(k) ) ) / gsqrt(k,i,j,
i_xyw)
915 f3(k,l) = - ( pt(k-1,l) * rfdz(k) * a(k) - b ) / gsqrt(k,i,j,
i_xyw)
918 b = grav * dtrk**2 * j33g / ( cdz(
ke) + cdz(
ke-1) )
919 f2(
ke-1,l) = 1.0_rp + ( pt(
ke-1,l) * rfdz(
ke-1) * ( a(
ke)+a(
ke-1) ) ) / gsqrt(
ke-1,i,j,
i_xyw)
920 f3(
ke-1,l) = - ( pt(
ke-2,l) * rfdz(
ke-1) * a(
ke-1) - b ) / gsqrt(
ke-1,i,j,
i_xyw)
923 pg = - ( dpres(k+1,i,j) + rt2p(k+1,i,j)*dtrk*st(k+1,i,j) &
924 - dpres(k ,i,j) - rt2p(k ,i,j)*dtrk*st(k ,i,j) ) &
925 * rfdz(k) * j33g / gsqrt(k,i,j,
i_xyw) &
927 * ( ( dens(k+1,i,j) - ref_dens(k+1,i,j) + sr(k+1,i,j) * dtrk ) &
928 + ( dens(k ,i,j) - ref_dens(k ,i,j) + sr(k ,i,j) * dtrk ) )
929 ci(k,l) = momz(k,i,j) + dtrk * ( pg + sw(k,i,j) )
931 if ( lhist ) pg_t(k,i,j,1) = pg
940 f1(:,1), f2(:,1), f3(:,1), &
946 call matrix_solver_tridiagonal(
kmax-1, 1,
kmax-1, &
947 f1(:,:), f2(:,:), f3(:,:), &
958 #ifdef DEBUG_HEVI2HEVE
960 co(k,l) = momz(k,i,j)
961 mflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) &
962 + j33g * momz(k,i,j) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
963 tflx_hi(k,i,j,
zdir) = tflx_hi(k,i,j,
zdir) &
964 + j33g * momz(k,i,j) * pt(k,l) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
966 momz_rk(k,i,j) = momz0(k,i,j) &
968 - j33g * ( dpres(k+1,i,j)-dpres(k,i,j) ) * rfdz(k) / gsqrt(k,i,j,
i_xyw) &
969 - grav * 0.5_rp * ( (dens(k,i,j)-ref_dens(k,i,j)) + (dens(k+1,i,j)-ref_dens(k+1,i,j)) ) &
973 mflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) &
974 + j33g * co(k,l) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
975 tflx_hi(k,i,j,
zdir) = tflx_hi(k,i,j,
zdir) &
976 + j33g * co(k,l) * pt(k,l) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
978 momz_rk(k,i,j) = momz0(k,i,j) &
979 + ( co(k,l) - momz(k,i,j) )
982 momz_rk(
ks-1,i,j) = 0.0_rp
983 momz_rk(
ke ,i,j) = 0.0_rp
986 advcv = - co(
ks,l) * j33g * rcdz(
ks) / gsqrt(
ks,i,j,
i_xyz)
987 dens_rk(
ks,i,j) = dens0(
ks,i,j) + dtrk * ( advcv + sr(
ks,i,j) )
989 if ( lhist ) advcv_t(
ks,i,j,
i_dens) = advcv
991 advcv = - co(
ks,l) * pt(
ks,l) * j33g * rcdz(
ks) / gsqrt(
ks,i,j,
i_xyz)
992 rhot_rk(
ks,i,j) = rhot0(
ks,i,j) + dtrk * ( advcv + st(
ks,i,j) )
994 if ( lhist ) advcv_t(
ks,i,j,
i_rhot) = advcv
998 advcv = - ( co(k,l) - co(k-1,l) ) &
999 * j33g * rcdz(k) / gsqrt(k,i,j,
i_xyz)
1000 dens_rk(k,i,j) = dens0(k,i,j) + dtrk * ( advcv + sr(k,i,j) )
1002 if ( lhist ) advcv_t(k,i,j,
i_dens) = advcv
1004 advcv = - ( co(k,l) * pt(k,l) - co(k-1,l) * pt(k-1,l) ) &
1005 * j33g * rcdz(k) / gsqrt(k,i,j,
i_xyz)
1006 rhot_rk(k,i,j) = rhot0(k,i,j) + dtrk * ( advcv + st(k,i,j) )
1008 if ( lhist ) advcv_t(k,i,j,
i_rhot) = advcv
1011 advcv = co(
ke-1,l) * j33g * rcdz(
ke) / gsqrt(
ke,i,j,
i_xyz)
1012 dens_rk(
ke,i,j) = dens0(
ke,i,j) + dtrk * ( advcv + sr(
ke,i,j) )
1014 if ( lhist ) advcv_t(
ke,i,j,
i_dens) = advcv
1016 advcv = co(
ke-1,l) * pt(
ke-1,l) * j33g * rcdz(
ke) / gsqrt(
ke,i,j,
i_xyz)
1017 rhot_rk(
ke,i,j) = rhot0(
ke,i,j) + dtrk * ( advcv + st(
ke,i,j) )
1019 if ( lhist ) advcv_t(
ke,i,j,
i_rhot) = advcv
1023 call check_equation( &
1025 dens(:,i,j), momz(:,i,j), rhot(:,i,j), dpres(:,i,j), &
1027 sr(:,i,j), sw(:,i,j), st(:,i,j), &
1028 j33g, gsqrt(:,i,j,:), &
1041 k = iundef; i = iundef; j = iundef
1044 call prof_rapend(
"DYN_HEVI", 3)
1046 profile_stop(
"hevi_solver")
1051 profile_start(
"hevi_momx")
1055 gsqrt(:,:,:,
i_uyw), j33g, &
1058 iis, iie, jjs, jje )
1062 gsqrt(:,:,:,
i_uyz), j13g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
1064 iis, iie, jjs, jje )
1067 gsqrt(:,:,:,
i_uyz), j23g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
1069 iis, iie, jjs, jje )
1079 iis, iie, jjs, jje )
1087 iis, iie, jjs, jje )
1107 call check( __line__, qflx_hi(k ,
is,j ,
zdir) )
1108 call check( __line__, qflx_hi(k-1,
is,j ,
zdir) )
1109 call check( __line__, qflx_hi(k ,
is,j ,
ydir) )
1110 call check( __line__, qflx_hi(k ,
is,j-1,
ydir) )
1111 call check( __line__, corioli(
is,j) )
1112 call check( __line__, momy(k,
is,j ) )
1113 call check( __line__, momy(k,
is,j-1) )
1114 call check( __line__, momx0(k,
is,j) )
1116 advcv = - ( qflx_hi(k,
is,j,
zdir) - qflx_hi(k-1,
is,j ,
zdir) &
1117 + qflx_j23(k,
is,j) - qflx_j23(k-1,
is,j ) ) * rcdz(k)
1118 advch = - ( qflx_hi(k,
is,j,
ydir) - qflx_hi(k ,
is,j-1,
ydir) ) * rcdy(j) &
1120 cf = 0.5_rp * corioli(
is,j) * ( momy(k,
is,j) + momy(k,
is,j-1) )
1121 momx_rk(k,
is,j) = momx0(k,
is,j) &
1122 + dtrk * ( ( advcv + advch ) / gsqrt(k,
is,j,
i_uyz) + cf + momx_t(k,
is,j) )
1127 pg_t(k,
is,j,2) = 0.0_rp
1129 ddiv_t(k,
is,j,2) = 0.0_rp
1154 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
1155 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
1156 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
1157 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
1158 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
1159 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
1160 call check( __line__, dpres(k,i+1,j) )
1161 call check( __line__, dpres(k,i ,j) )
1162 call check( __line__, corioli(i ,j) )
1163 call check( __line__, corioli(i+1,j) )
1164 call check( __line__, momy(k,i ,j ) )
1165 call check( __line__, momy(k,i+1,j ) )
1166 call check( __line__, momy(k,i ,j-1) )
1167 call check( __line__, momy(k,i+1,j-1) )
1168 call check( __line__, ddiv(k,i+1,j) )
1169 call check( __line__, ddiv(k,i ,j) )
1170 call check( __line__, momx0(k,i,j) )
1172 advcv = - ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
1173 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
1174 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rcdz(k)
1175 advch = - ( ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rfdx(i) &
1176 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) ) &
1177 * mapf(i,j,1,
i_uy) * mapf(i,j,2,
i_uy)
1178 pg = ( ( gsqrt(k,i+1,j,
i_xyz) * dpres(k,i+1,j) &
1179 - gsqrt(k,i ,j,
i_xyz) * dpres(k,i ,j) &
1181 + ( j13g(k ,i,j,
i_uyw) &
1182 * 0.5_rp * ( f2h(k,1,
i_uyz) * ( dpres(k+1,i+1,j)+dpres(k+1,i,j) ) &
1183 + f2h(k,2,
i_uyz) * ( dpres(k ,i+1,j)+dpres(k ,i,j) ) ) &
1184 - j13g(k-1,i,j,
i_uyw) &
1185 * 0.5_rp * ( f2h(k,1,
i_uyz) * ( dpres(k ,i+1,j)+dpres(k ,i,j) ) &
1186 + f2h(k,2,
i_uyz) * ( dpres(k-1,i+1,j)+dpres(k-1,i,j) ) ) &
1189 cf = 0.125_rp * ( corioli(i+1,j )+corioli(i,j ) ) &
1190 * ( momy(k,i+1,j )+momy(k,i,j ) &
1191 + momy(k,i+1,j-1)+momy(k,i,j-1) ) &
1192 + 0.25_rp * mapf(i,j,1,
i_uy) * mapf(i,j,2,
i_uy) &
1193 * ( momy(k,i,j) + momy(k,i,j-1) + momy(k,i+1,j) + momy(k,i+1,j-1) ) &
1194 * ( ( momy(k,i,j) + momy(k,i,j-1) + momy(k,i+1,j) + momy(k,i+1,j-1) ) * 0.25_rp &
1195 * ( 1.0_rp/mapf(i+1,j,2,
i_xy) - 1.0_rp/mapf(i,j,2,
i_xy) ) * rfdx(i) &
1197 * ( 1.0_rp/mapf(i,j,1,
i_uv) - 1.0_rp/mapf(i,j-1,1,
i_uv) ) * rcdy(j) ) &
1198 * 2.0_rp / ( dens(k,i+1,j) + dens(k,i,j) )
1199 div = divdmp_coef / dtrk * ( ddiv(k,i+1,j)/mapf(i+1,j,2,
i_xy) - ddiv(k,i,j)/mapf(i,j,1,
i_xy) ) &
1200 * mapf(i,j,1,
i_uy) * mapf(i,j,2,
i_uy) * fdx(i)
1201 momx_rk(k,i,j) = momx0(k,i,j) &
1202 + dtrk * ( ( advcv + advch - pg ) / gsqrt(k,i,j,
i_uyz) + cf + div + momx_t(k,i,j) )
1205 advcv_t(k,i,j,
i_momx) = advcv / gsqrt(k,i,j,
i_uyz)
1206 advch_t(k,i,j,
i_momx) = advch / gsqrt(k,i,j,
i_uyz)
1207 pg_t(k,i,j,2) = - pg / gsqrt(k,i,j,
i_uyz)
1209 ddiv_t(k,i,j,2) = div
1217 profile_stop(
"hevi_momx")
1219 k = iundef; i = iundef; j = iundef
1223 profile_start(
"hevi_momy")
1227 gsqrt(:,:,:,
i_xvw), j33g, &
1230 iis, iie, jjs, jje )
1234 gsqrt(:,:,:,
i_xvz), j13g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
1236 iis, iie, jjs, jje )
1239 gsqrt(:,:,:,
i_xvz), j23g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
1241 iis, iie, jjs, jje )
1250 iis, iie, jjs, jje )
1259 iis, iie, jjs, jje )
1276 do j = jjs, min(jje,
jeh)
1280 call check( __line__, qflx_hi(k ,
is,j ,
zdir) )
1281 call check( __line__, qflx_hi(k-1,
is,j ,
zdir) )
1282 call check( __line__, qflx_hi(k ,
is,j ,
ydir) )
1283 call check( __line__, qflx_hi(k ,
is,j-1,
ydir) )
1284 call check( __line__, dpres(k,
is,j ) )
1285 call check( __line__, dpres(k,
is,j+1) )
1286 call check( __line__, corioli(
is,j ) )
1287 call check( __line__, corioli(
is,j+1) )
1288 call check( __line__, momx(k,
is,j ) )
1289 call check( __line__, momx(k,
is,j+1) )
1290 call check( __line__, ddiv(k,
is,j+1) )
1291 call check( __line__, ddiv(k,
is,j ) )
1292 call check( __line__, momy_t(k,
is,j) )
1293 call check( __line__, momy0(k,
is,j) )
1295 advcv = - ( qflx_hi(k,
is,j,
zdir) - qflx_hi(k-1,
is,j ,
zdir) &
1296 + qflx_j23(k,
is,j) - qflx_j23(k-1,
is,j ) ) * rcdz(k)
1297 advch = - ( qflx_hi(k,
is,j,
ydir) - qflx_hi(k ,
is,j-1,
ydir) ) * rfdy(j) &
1299 pg = ( ( gsqrt(k,
is,j+1,
i_xyz) * dpres(k,
is,j+1) &
1300 - gsqrt(k,
is,j ,
i_xyz) * dpres(k,
is,j ) &
1303 * 0.5_rp * ( f2h(k ,1,
i_xvz) * ( dpres(k+1,
is,j+1)+dpres(k+1,
is,j) ) &
1304 + f2h(k ,2,
i_xvz) * ( dpres(k ,
is,j+1)+dpres(k ,
is,j) ) ) &
1306 * 0.5_rp * ( f2h(k-1,1,
i_xvz) * ( dpres(k ,
is,j+1)+dpres(k ,
is,j) ) &
1307 + f2h(k-1,2,
i_xvz) * ( dpres(k-1,
is,j+1)+dpres(k-1,
is,j) ) ) &
1310 cf = - 0.25_rp * ( corioli(
is,j+1)+corioli(
is,j) ) &
1311 * ( momx(k,
is,j+1)+momx(k,
is,j) )
1312 div = divdmp_coef / dtrk * ( ddiv(k,
is,j+1) - ddiv(k,
is,j) ) &
1313 * mapf(
is,j,2,
i_xv) * fdy(j)
1314 momy_rk(k,
is,j) = momy0(k,
is,j) &
1315 + dtrk * ( ( advcv + advch - pg ) / gsqrt(k,
is,j,
i_xvz) + cf + div + momy_t(k,
is,j) )
1320 pg_t(k,
is,j,3) = - pg / gsqrt(k,
is,j,
i_xvz)
1322 ddiv_t(k,
is,j,3) = div
1341 do j = jjs, min(jje,
jeh)
1346 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
1347 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
1348 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
1349 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
1350 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
1351 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
1352 call check( __line__, dpres(k,i,j ) )
1353 call check( __line__, dpres(k,i,j+1) )
1354 call check( __line__, corioli(i,j ) )
1355 call check( __line__, corioli(i,j+1) )
1356 call check( __line__, momx(k,i ,j ) )
1357 call check( __line__, momx(k,i ,j+1) )
1358 call check( __line__, momx(k,i-1,j ) )
1359 call check( __line__, momx(k,i-1,j+1) )
1360 call check( __line__, ddiv(k,i,j+1) )
1361 call check( __line__, ddiv(k,i,j ) )
1362 call check( __line__, momy_t(k,i,j) )
1363 call check( __line__, momy0(k,i,j) )
1365 advcv = - ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
1366 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
1367 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rcdz(k)
1368 advch = - ( ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
1369 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rfdy(j) ) &
1370 * mapf(i,j,1,
i_xv) * mapf(i,j,2,
i_xv)
1371 pg = ( ( gsqrt(k,i,j+1,
i_xyz) * dpres(k,i,j+1) &
1372 - gsqrt(k,i,j ,
i_xyz) * dpres(k,i,j ) &
1374 + ( j23g(k ,i,j,
i_xvw) &
1375 * 0.5_rp * ( f2h(k ,1,
i_xvz) * ( dpres(k+1,i,j+1)+dpres(k+1,i,j) ) &
1376 + f2h(k ,2,
i_xvz) * ( dpres(k ,i,j+1)+dpres(k ,i,j) ) ) &
1377 - j23g(k-1,i,j,
i_xvw) &
1378 * 0.5_rp * ( f2h(k-1,1,
i_xvz) * ( dpres(k ,i,j+1)+dpres(k ,i,j) ) &
1379 + f2h(k-1,2,
i_xvz) * ( dpres(k-1,i,j+1)+dpres(k-1,i,j) ) ) &
1382 cf = - 0.125_rp * ( corioli(i ,j+1)+corioli(i ,j) ) &
1383 * ( momx(k,i ,j+1)+momx(k,i ,j) &
1384 + momx(k,i-1,j+1)+momx(k,i-1,j) ) &
1385 - 0.25_rp * mapf(i,j,1,
i_xv) * mapf(i,j,2,
i_xv) &
1386 * ( momx(k,i,j) + momx(k,i-1,j) + momx(k,i,j+1) + momx(k,i-1,j+1) ) &
1388 * ( 1.0_rp/mapf(i,j,2,
i_uv) - 1.0_rp/mapf(i-1,j,2,
i_uv) ) * rcdx(i) &
1389 - 0.25_rp * ( momx(k,i,j)+momx(k,i-1,j)+momx(k,i,j+1)+momx(k,i-1,j+1) ) &
1390 * ( 1.0_rp/mapf(i,j+1,1,
i_xy) - 1.0_rp/mapf(i,j,1,
i_xy) ) * rfdy(j) ) &
1391 * 2.0_rp / ( dens(k,i,j+1) + dens(k,i,j) )
1392 div = divdmp_coef / dtrk * ( ddiv(k,i,j+1)/mapf(i,j+1,1,
i_xy) - ddiv(k,i,j)/mapf(i,j,1,
i_xy) ) &
1393 * mapf(i,j,1,
i_xv) * mapf(i,j,2,
i_xv) * fdy(j)
1394 momy_rk(k,i,j) = momy0(k,i,j) &
1395 + dtrk * ( ( advcv + advch - pg ) / gsqrt(k,i,j,
i_xvz) + cf + div + momy_t(k,i,j) )
1398 advcv_t(k,i,j,
i_momy) = advcv / gsqrt(k,i,j,
i_xvz)
1399 advch_t(k,i,j,
i_momy) = advch / gsqrt(k,i,j,
i_xvz)
1400 pg_t(k,i,j,3) = - pg / gsqrt(k,i,j,
i_xvz)
1402 ddiv_t(k,i,j,3) = div
1410 profile_stop(
"hevi_momy")
1412 k = iundef; i = iundef; j = iundef
1424 call file_history_in(advcv_t(:,:,:,
i_dens),
'DENS_t_advcv',
'tendency of density (vert. advection) (w/ HIST_TEND)',
'kg/m3/s' )
1425 call file_history_in(advcv_t(:,:,:,
i_momz),
'MOMZ_t_advcv',
'tendency of momentum z (vert. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1426 call file_history_in(advcv_t(:,:,:,
i_momx),
'MOMX_t_advcv',
'tendency of momentum x (vert. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1427 call file_history_in(advcv_t(:,:,:,
i_momy),
'MOMY_t_advcv',
'tendency of momentum y (vert. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')
1428 call file_history_in(advcv_t(:,:,:,
i_rhot),
'RHOT_t_advcv',
'tendency of rho*theta (vert. advection) (w/ HIST_TEND)',
'K kg/m3/s' )
1430 call file_history_in(advch_t(:,:,:,
i_dens),
'DENS_t_advch',
'tendency of density (horiz. advection) (w/ HIST_TEND)',
'kg/m3/s' )
1431 call file_history_in(advch_t(:,:,:,
i_momz),
'MOMZ_t_advch',
'tendency of momentum z (horiz. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1432 call file_history_in(advch_t(:,:,:,
i_momx),
'MOMX_t_advch',
'tendency of momentum x (horiz. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1433 call file_history_in(advch_t(:,:,:,
i_momy),
'MOMY_t_advch',
'tendency of momentum y (horiz. advection) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')
1434 call file_history_in(advch_t(:,:,:,
i_rhot),
'RHOT_t_advch',
'tendency of rho*theta (horiz. advection) (w/ HIST_TEND)',
'K kg/m3/s' )
1436 call file_history_in(pg_t(:,:,:,1),
'MOMZ_t_pg',
'tendency of momentum z (pressure gradient) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1438 call file_history_in(pg_t(:,:,:,2),
'MOMX_t_pg',
'tendency of momentum x (pressure gradient) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1439 call file_history_in(pg_t(:,:,:,3),
'MOMY_t_pg',
'tendency of momentum y (pressure gradient) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')
1441 call file_history_in(wdmp_t(:,:,:),
'MOMZ_t_wdamp',
'tendency of momentum z (Rayleigh damping) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1443 call file_history_in(ddiv_t(:,:,:,1),
'MOMZ_t_ddiv',
'tendency of momentum z (divergence damping) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1445 call file_history_in(ddiv_t(:,:,:,2),
'MOMX_t_ddiv',
'tendency of momentum x (divergence damping) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1446 call file_history_in(ddiv_t(:,:,:,3),
'MOMY_t_ddiv',
'tendency of momentum y (divergence damping) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')
1448 call file_history_in(cf_t(:,:,:,1),
'MOMX_t_cf',
'tendency of momentum x (coliolis force) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXHY')
1449 call file_history_in(cf_t(:,:,:,2),
'MOMY_t_cf',
'tendency of momentum y (coliolis force) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZXYH')