146 rdry => const_rdry, &
147 cvdry => const_cvdry, &
148 cpdry => const_cpdry, &
151 grav => const_grav, &
181 real(RP),
intent(out) :: DENS_RK(KA,IA,JA)
182 real(RP),
intent(out) :: MOMZ_RK(KA,IA,JA)
183 real(RP),
intent(out) :: MOMX_RK(KA,IA,JA)
184 real(RP),
intent(out) :: MOMY_RK(KA,IA,JA)
185 real(RP),
intent(out) :: RHOT_RK(KA,IA,JA)
187 real(RP),
intent(out) :: PROG_RK(KA,IA,JA,VA)
189 real(RP),
intent(inout) :: mflx_hi(KA,IA,JA,3)
190 real(RP),
intent(out) :: tflx_hi(KA,IA,JA,3)
192 real(RP),
intent(in),
target :: DENS0(KA,IA,JA)
193 real(RP),
intent(in),
target :: MOMZ0(KA,IA,JA)
194 real(RP),
intent(in),
target :: MOMX0(KA,IA,JA)
195 real(RP),
intent(in),
target :: MOMY0(KA,IA,JA)
196 real(RP),
intent(in),
target :: RHOT0(KA,IA,JA)
198 real(RP),
intent(in) :: DENS(KA,IA,JA)
199 real(RP),
intent(in) :: MOMZ(KA,IA,JA)
200 real(RP),
intent(in) :: MOMX(KA,IA,JA)
201 real(RP),
intent(in) :: MOMY(KA,IA,JA)
202 real(RP),
intent(in) :: RHOT(KA,IA,JA)
204 real(RP),
intent(in) :: DENS_t(KA,IA,JA)
205 real(RP),
intent(in) :: MOMZ_t(KA,IA,JA)
206 real(RP),
intent(in) :: MOMX_t(KA,IA,JA)
207 real(RP),
intent(in) :: MOMY_t(KA,IA,JA)
208 real(RP),
intent(in) :: RHOT_t(KA,IA,JA)
210 real(RP),
intent(in) :: PROG0(KA,IA,JA,VA)
211 real(RP),
intent(in) :: PROG (KA,IA,JA,VA)
213 real(RP),
intent(in) :: DPRES0(KA,IA,JA)
214 real(RP),
intent(in) :: RT2P(KA,IA,JA)
215 real(RP),
intent(in) :: CORIOLI(IA,JA)
216 real(RP),
intent(in) :: num_diff(KA,IA,JA,5,3)
217 real(RP),
intent(in) :: wdamp_coef(KA)
218 real(RP),
intent(in) :: divdmp_coef
219 real(RP),
intent(in) :: DDIV(KA,IA,JA)
221 logical,
intent(in) :: FLAG_FCT_MOMENTUM
222 logical,
intent(in) :: FLAG_FCT_T
223 logical,
intent(in) :: FLAG_FCT_ALONG_STREAM
225 real(RP),
intent(in) :: CDZ(KA)
226 real(RP),
intent(in) :: FDZ(KA-1)
227 real(RP),
intent(in) :: FDX(IA-1)
228 real(RP),
intent(in) :: FDY(JA-1)
229 real(RP),
intent(in) :: RCDZ(KA)
230 real(RP),
intent(in) :: RCDX(IA)
231 real(RP),
intent(in) :: RCDY(JA)
232 real(RP),
intent(in) :: RFDZ(KA-1)
233 real(RP),
intent(in) :: RFDX(IA-1)
234 real(RP),
intent(in) :: RFDY(JA-1)
236 real(RP),
intent(in) :: PHI (KA,IA,JA)
237 real(RP),
intent(in) :: GSQRT (KA,IA,JA,7)
238 real(RP),
intent(in) :: J13G (KA,IA,JA,7)
239 real(RP),
intent(in) :: J23G (KA,IA,JA,7)
240 real(RP),
intent(in) :: J33G
241 real(RP),
intent(in) :: MAPF (IA,JA,2,4)
242 real(RP),
intent(in) :: REF_dens(KA,IA,JA)
243 real(RP),
intent(in) :: REF_rhot(KA,IA,JA)
245 logical,
intent(in) :: BND_W
246 logical,
intent(in) :: BND_E
247 logical,
intent(in) :: BND_S
248 logical,
intent(in) :: BND_N
249 logical,
intent(in) :: TwoD
251 real(RP),
intent(in) :: dtrk
252 logical,
intent(in) :: last
256 real(RP) :: POTT(KA,IA,JA)
257 real(RP) :: DPRES(KA,IA,JA)
259 real(RP) :: qflx_hi (KA,IA,JA,3)
260 real(RP) :: qflx_J13(KA,IA,JA)
261 real(RP) :: qflx_J23(KA,IA,JA)
270 real(RP) :: advch_t(KA,IA,JA,5)
271 real(RP) :: advcv_t(KA,IA,JA,5)
272 real(RP) :: wdmp_t(KA,IA,JA)
273 real(RP) :: ddiv_t(KA,IA,JA,3)
274 real(RP) :: pg_t(KA,IA,JA,3)
275 real(RP) :: cf_t(KA,IA,JA,2)
282 real(RP) :: Sr(KA,IA,JA)
283 real(RP) :: Sw(KA,IA,JA)
284 real(RP) :: St(KA,IA,JA)
286 real(RP) :: C(KMAX-1)
292 integer :: IIS, IIE, JJS, JJE
302 qflx_hi(:,:,:,:) = undef
303 qflx_j13(:,:,:) = undef
304 qflx_j23(:,:,:) = undef
307 #if defined DEBUG || defined QUICKDEBUG
308 dens_rk( 1:
ks-1,:,:) = undef
309 dens_rk(
ke+1:
ka ,:,:) = undef
310 momz_rk( 1:
ks-1,:,:) = undef
311 momz_rk(
ke+1:
ka ,:,:) = undef
312 momx_rk( 1:
ks-1,:,:) = undef
313 momx_rk(
ke+1:
ka ,:,:) = undef
314 momy_rk( 1:
ks-1,:,:) = undef
315 momy_rk(
ke+1:
ka ,:,:) = undef
316 rhot_rk( 1:
ks-1,:,:) = undef
317 rhot_rk(
ke+1:
ka ,:,:) = undef
318 prog_rk( 1:
ks-1,:,:,:) = undef
319 prog_rk(
ke+1:
ka ,:,:,:) = undef
332 if ( bnd_w ) ifs_off = 0
333 if ( bnd_s ) jfs_off = 0
341 profile_start(
"hevi_pres")
345 do i = iis, min(iie+1,
ia)
348 call check( __line__, dpres0(k,i,j) )
349 call check( __line__, rt2p(k,i,j) )
350 call check( __line__, rhot(k,i,j) )
351 call check( __line__, ref_rhot(k,i,j) )
353 dpres(k,i,j) = dpres0(k,i,j) + rt2p(k,i,j) * ( rhot(k,i,j) - ref_rhot(k,i,j) )
355 dpres(
ks-1,i,j) = dpres0(
ks-1,i,j) - dens(
ks,i,j) * ( phi(
ks-1,i,j) - phi(
ks+1,i,j) )
356 dpres(
ke+1,i,j) = dpres0(
ke+1,i,j) - dens(
ke,i,j) * ( phi(
ke+1,i,j) - phi(
ke-1,i,j) )
359 profile_stop(
"hevi_pres")
363 profile_start(
"hevi_mflx_z")
372 call check( __line__, momy(k+1,
is,j) )
373 call check( __line__, momy(k+1,
is,j-1) )
374 call check( __line__, momy(k ,
is,j) )
375 call check( __line__, momy(k ,
is,j-1) )
378 * ( momy(k+1,
is,j)+momy(k+1,
is,j-1) &
379 + momy(k ,
is,j)+momy(k ,
is,j-1) ) &
380 + gsqrt(k,
is,j,
i_xyw) / mapf(
is,j,2,
i_xy) * num_diff(k,
is,j,
i_dens,
zdir)
389 mflx_hi(
ks-1,i,j,
zdir) = 0.0_rp
392 call check( __line__, momx(k+1,i ,j) )
393 call check( __line__, momx(k+1,i-1,j) )
394 call check( __line__, momx(k ,i ,j) )
395 call check( __line__, momx(k ,i+1,j) )
396 call check( __line__, momy(k+1,i,j) )
397 call check( __line__, momy(k+1,i,j-1) )
398 call check( __line__, momy(k ,i,j) )
399 call check( __line__, momy(k ,i,j-1) )
401 mflx_hi(k,i,j,
zdir) = j13g(k,i,j,
i_xyw) * 0.25_rp / mapf(i,j,2,
i_xy) &
402 * ( momx(k+1,i,j)+momx(k+1,i-1,j) &
403 + momx(k ,i,j)+momx(k ,i-1,j) ) &
404 + j23g(k,i,j,
i_xyw) * 0.25_rp / mapf(i,j,1,
i_xy) &
405 * ( momy(k+1,i,j)+momy(k+1,i,j-1) &
406 + momy(k ,i,j)+momy(k ,i,j-1) ) &
407 + 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)
409 mflx_hi(
ke ,i,j,
zdir) = 0.0_rp
414 k = iundef; i = iundef; j = iundef
416 profile_stop(
"hevi_mflx_z")
418 if ( .not. twod )
then
419 profile_start(
"hevi_mflx_x")
420 iss = max(iis-1,
is-ifs_off)
429 call check( __line__, gsqrt(k,i,j,
i_uyz) )
430 call check( __line__, momx(k,i,j) )
431 call check( __line__, num_diff(k,i,j,
i_dens,
xdir) )
433 mflx_hi(k,i,j,
xdir) = gsqrt(k,i,j,
i_uyz) / mapf(i,j,2,
i_uy) &
434 * ( momx(k,i,j) + num_diff(k,i,j,
i_dens,
xdir) )
439 k = iundef; i = iundef; j = iundef
441 profile_stop(
"hevi_mflx_x")
447 do j = max(jjs-1,
js-jfs_off), min(jje,
jeh)
451 call check( __line__, gsqrt(k,i,j,
i_xvz) )
452 call check( __line__, momy(k,i,j) )
453 call check( __line__, num_diff(k,i,j,
i_dens,
ydir) )
455 mflx_hi(k,i,j,
ydir) = gsqrt(k,i,j,
i_xvz) / mapf(i,j,1,
i_xv) &
456 * ( momy(k,i,j) + num_diff(k,i,j,
i_dens,
ydir) )
461 k = iundef; i = iundef; j = iundef
465 profile_start(
"hevi_sr")
478 call check( __line__, dens0(k,
is,j) )
479 call check( __line__, mflx_hi(k ,
is,j ,
ydir) )
480 call check( __line__, mflx_hi(k ,
is,j-1,
ydir) )
481 call check( __line__, dens_t(k,
is,j) )
483 advcv = - ( mflx_hi(k,
is,j,
zdir)-mflx_hi(k-1,
is,j,
zdir) ) * rcdz(k)
484 advch = - ( mflx_hi(k,
is,j,
ydir)-mflx_hi(k ,
is,j-1,
ydir) ) * rcdy(j)
485 sr(k,
is,j) = ( advcv + advch ) * mapf(
is,j,2,
i_xy) / gsqrt(k,
is,j,
i_xyz) + dens_t(k,
is,j)
506 call check( __line__, dens0(k,i,j) )
507 call check( __line__, mflx_hi(k ,i ,j ,
xdir) )
508 call check( __line__, mflx_hi(k ,i-1,j ,
xdir) )
509 call check( __line__, mflx_hi(k ,i ,j ,
ydir) )
510 call check( __line__, mflx_hi(k ,i ,j-1,
ydir) )
511 call check( __line__, dens_t(k,i,j) )
513 advcv = - ( mflx_hi(k,i,j,
zdir)-mflx_hi(k-1,i ,j,
zdir) ) * rcdz(k)
514 advch = - ( ( mflx_hi(k,i,j,
xdir)-mflx_hi(k ,i-1,j,
xdir) ) * rcdx(i) &
515 + ( mflx_hi(k,i,j,
ydir)-mflx_hi(k ,i, j-1,
ydir) ) * rcdy(j) )
516 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)
519 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)
527 k = iundef; i = iundef; j = iundef
529 profile_stop(
"hevi_sr")
535 profile_start(
"hevi_momz_qflxhi_z")
538 gsqrt(:,:,:,
i_xyz), j33g, &
542 profile_stop(
"hevi_momz_qflxhi_z")
544 profile_start(
"hevi_momz_qflxj")
548 gsqrt(:,:,:,
i_xyz), j13g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
553 gsqrt(:,:,:,
i_xyz), j23g(:,:,:,
i_xyz), mapf(:,:,:,
i_xy), &
556 profile_stop(
"hevi_momz_qflxj")
559 if ( .not. twod )
then
560 profile_start(
"hevi_momz_qflxhi_x")
567 profile_stop(
"hevi_momz_qflxhi_x")
571 profile_start(
"hevi_momz_qflxhi_y")
578 profile_stop(
"hevi_momz_qflxhi_y")
581 profile_start(
"hevi_sw")
595 call check( __line__, qflx_hi(k ,
is,j ,
zdir) )
596 call check( __line__, qflx_hi(k-1,
is,j ,
zdir) )
597 call check( __line__, qflx_j23(k ,
is,j) )
598 call check( __line__, qflx_j23(k-1,
is,j) )
599 call check( __line__, qflx_hi(k ,
is,j ,
ydir) )
600 call check( __line__, qflx_hi(k ,
is,j-1,
ydir) )
601 call check( __line__, ddiv(k ,
is,j) )
602 call check( __line__, ddiv(k+1,
is,j) )
603 call check( __line__, momz0(k,
is,j) )
604 call check( __line__, momz_t(k,
is,j) )
606 advcv = - ( qflx_hi(k,
is,j,
zdir) - qflx_hi(k-1,
is,j ,
zdir) &
607 + qflx_j23(k,
is,j) - qflx_j23(k-1,
is,j ) ) * rfdz(k)
608 advch = - ( qflx_hi(k,
is,j,
ydir) - qflx_hi(k,
is,j-1,
ydir) ) * rcdy(j) &
610 wdmp = - wdamp_coef(k) * momz0(k,
is,j)
611 div = divdmp_coef / dtrk * ( ddiv(k+1,
is,j)-ddiv(k,
is,j) ) * fdz(k)
612 sw(k,
is,j) = ( advcv + advch ) / gsqrt(k,
is,j,
i_xyw) &
613 + wdmp + div + momz_t(k,
is,j)
618 wdmp_t(k,
is,j) = wdmp
619 ddiv_t(k,
is,j,1) = div
638 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
639 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
640 call check( __line__, qflx_j13(k ,i ,j) )
641 call check( __line__, qflx_j13(k-1,i ,j) )
642 call check( __line__, qflx_j23(k ,i ,j) )
643 call check( __line__, qflx_j23(k-1,i ,j) )
644 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
645 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
646 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
647 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
648 call check( __line__, ddiv(k ,i,j) )
649 call check( __line__, ddiv(k+1,i,j) )
650 call check( __line__, momz0(k,i,j) )
651 call check( __line__, momz_t(k,i,j) )
653 advcv = - ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
654 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
655 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rfdz(k)
656 advch = - ( ( qflx_hi(k,i,j,
xdir) - qflx_hi(k,i-1,j ,
xdir) ) * rcdx(i) &
657 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k,i ,j-1,
ydir) ) * rcdy(j) ) &
658 * mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy)
659 wdmp = - wdamp_coef(k) * momz0(k,i,j)
660 div = divdmp_coef / dtrk * ( ddiv(k+1,i,j)-ddiv(k,i,j) ) * fdz(k)
661 sw(k,i,j) = ( advcv + advch ) / gsqrt(k,i,j,
i_xyw) &
662 + wdmp + div + momz_t(k,i,j)
668 ddiv_t(k,i,j,1) = div
675 profile_stop(
"hevi_sw")
677 k = iundef; i = iundef; j = iundef
689 call check( __line__, rhot(k,i,j) )
690 call check( __line__, dens(k,i,j) )
692 pott(k,i,j) = rhot(k,i,j) / dens(k,i,j)
697 k = iundef; i = iundef; j = iundef
702 mflx_hi(:,:,:,
zdir), pott, gsqrt(:,:,:,
i_xyw), &
710 mflx_hi(:,:,:,
xdir), pott, gsqrt(:,:,:,
i_uyz), &
717 mflx_hi(:,:,:,
ydir), pott, gsqrt(:,:,:,
i_xvz), &
723 profile_start(
"hevi_st")
736 call check( __line__, tflx_hi(k ,
is,j ,
zdir) )
737 call check( __line__, tflx_hi(k-1,
is,j ,
zdir) )
738 call check( __line__, tflx_hi(k ,
is,j ,
ydir) )
739 call check( __line__, tflx_hi(k ,
is,j-1,
ydir) )
740 call check( __line__, rhot_t(k,
is,j) )
742 advcv = - ( tflx_hi(k,
is,j,
zdir) - tflx_hi(k-1,
is,j ,
zdir) ) * rcdz(k)
743 advch = - ( tflx_hi(k,
is,j,
ydir) - tflx_hi(k ,
is,j-1,
ydir) ) * rcdy(j)
744 st(k,
is,j) = ( advcv + advch ) * mapf(
is,j,2,
i_xy) / gsqrt(k,
is,j,
i_xyz) + rhot_t(k,
is,j)
765 call check( __line__, tflx_hi(k ,i ,j ,
zdir) )
766 call check( __line__, tflx_hi(k-1,i ,j ,
zdir) )
767 call check( __line__, tflx_hi(k ,i ,j ,
xdir) )
768 call check( __line__, tflx_hi(k ,i-1,j ,
xdir) )
769 call check( __line__, tflx_hi(k ,i ,j ,
ydir) )
770 call check( __line__, tflx_hi(k ,i ,j-1,
ydir) )
771 call check( __line__, rhot_t(k,i,j) )
773 advcv = - ( tflx_hi(k,i,j,
zdir) - tflx_hi(k-1,i ,j ,
zdir) ) * rcdz(k)
774 advch = - ( ( tflx_hi(k,i,j,
xdir) - tflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
775 + ( tflx_hi(k,i,j,
ydir) - tflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) )
776 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)
779 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)
787 k = iundef; i = iundef; j = iundef
789 profile_stop(
"hevi_st")
793 profile_start(
"hevi_solver")
820 momz(:,i,j), pott(:,i,j), gsqrt(:,i,j,
i_xyz), &
824 a(k) = dtrk**2 * j33g * rcdz(k) * rt2p(k,i,j) * j33g / gsqrt(k,i,j,
i_xyz)
826 b = grav * dtrk**2 * j33g / ( cdz(
ks+1) + cdz(
ks) )
828 f2(
ks) = 1.0_rp + ( pt(
ks ) * rfdz(
ks) * ( a(
ks+1)+a(
ks) ) ) / gsqrt(
ks,i,j,
i_xyw)
830 b = grav * dtrk**2 * j33g / ( cdz(k+1) + cdz(k) )
831 f1(k) = - ( pt(k+1) * rfdz(k) * a(k+1) + b ) / gsqrt(k,i,j,
i_xyw)
832 f2(k) = 1.0_rp + ( pt(k ) * rfdz(k) * ( a(k+1)+a(k) ) ) / gsqrt(k,i,j,
i_xyw)
833 f3(k) = - ( pt(k-1) * rfdz(k) * a(k) - b ) / gsqrt(k,i,j,
i_xyw)
835 b = grav * dtrk**2 * j33g / ( cdz(
ke) + cdz(
ke-1) )
836 f2(
ke-1) = 1.0_rp + ( pt(
ke-1) * rfdz(
ke-1) * ( a(
ke)+a(
ke-1) ) ) / gsqrt(
ke-1,i,j,
i_xyw)
837 f3(
ke-1) = - ( pt(
ke-2) * rfdz(
ke-1) * a(
ke-1) - b ) / gsqrt(
ke-1,i,j,
i_xyw)
840 pg = - ( dpres(k+1,i,j) + rt2p(k+1,i,j)*dtrk*st(k+1,i,j) &
841 - dpres(k ,i,j) - rt2p(k ,i,j)*dtrk*st(k ,i,j) ) &
842 * rfdz(k) * j33g / gsqrt(k,i,j,
i_xyw) &
844 * ( ( dens(k+1,i,j) - ref_dens(k+1,i,j) + sr(k+1,i,j) * dtrk ) &
845 + ( dens(k ,i,j) - ref_dens(k ,i,j) + sr(k ,i,j) * dtrk ) )
846 c(k-
ks+1) = momz(k,i,j) + dtrk * ( pg + sw(k,i,j) )
848 if ( lhist ) pg_t(k,i,j,1) = pg
854 f1(:), f2(:), f3(:) )
857 #ifdef DEBUG_HEVI2HEVE
859 c(k-
ks+1) = momz(k,i,j)
860 mflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) &
861 + j33g * momz(k,i,j) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
862 tflx_hi(k,i,j,
zdir) = tflx_hi(k,i,j,
zdir) &
863 + j33g * momz(k,i,j) * pt(k) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
865 momz_rk(k,i,j) = momz0(k,i,j) &
867 - j33g * ( dpres(k+1,i,j)-dpres(k,i,j) ) * rfdz(k) / gsqrt(k,i,j,
i_xyw) &
868 - grav * 0.5_rp * ( (dens(k,i,j)-ref_dens(k,i,j)) + (dens(k+1,i,j)-ref_dens(k+1,i,j)) ) &
872 mflx_hi(k,i,j,
zdir) = mflx_hi(k,i,j,
zdir) &
873 + j33g * c(k-
ks+1) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
874 tflx_hi(k,i,j,
zdir) = tflx_hi(k,i,j,
zdir) &
875 + j33g * c(k-
ks+1) * pt(k) / ( mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) )
877 momz_rk(k,i,j) = momz0(k,i,j) &
878 + ( c(k-
ks+1) - momz(k,i,j) )
881 momz_rk(
ks-1,i,j) = 0.0_rp
882 momz_rk(
ke ,i,j) = 0.0_rp
885 advcv = - c(1) * j33g * rcdz(
ks) / gsqrt(
ks,i,j,
i_xyz)
886 dens_rk(
ks,i,j) = dens0(
ks,i,j) + dtrk * ( advcv + sr(
ks,i,j) )
888 if ( lhist ) advcv_t(
ks,i,j,
i_dens) = advcv
890 advcv = - c(1) * pt(
ks) * j33g * rcdz(
ks) / gsqrt(
ks,i,j,
i_xyz)
891 rhot_rk(
ks,i,j) = rhot0(
ks,i,j) + dtrk * ( advcv + st(
ks,i,j) )
893 if ( lhist ) advcv_t(
ks,i,j,
i_rhot) = advcv
896 advcv = - ( c(k-
ks+1) - c(k-
ks) ) &
897 * j33g * rcdz(k) / gsqrt(k,i,j,
i_xyz)
898 dens_rk(k,i,j) = dens0(k,i,j) + dtrk * ( advcv + sr(k,i,j) )
900 if ( lhist ) advcv_t(k,i,j,
i_dens) = advcv
902 advcv = - ( c(k-
ks+1) * pt(k) - c(k-
ks) * pt(k-1) ) &
903 * j33g * rcdz(k) / gsqrt(k,i,j,
i_xyz)
904 rhot_rk(k,i,j) = rhot0(k,i,j) + dtrk * ( advcv + st(k,i,j) )
906 if ( lhist ) advcv_t(k,i,j,
i_rhot) = advcv
910 dens_rk(
ke,i,j) = dens0(
ke,i,j) + dtrk * ( advcv + sr(
ke,i,j) )
912 if ( lhist ) advcv_t(
ke,i,j,
i_dens) = advcv
915 rhot_rk(
ke,i,j) = rhot0(
ke,i,j) + dtrk * ( advcv + st(
ke,i,j) )
917 if ( lhist ) advcv_t(
ke,i,j,
i_rhot) = advcv
921 call check_equation( &
923 dens(:,i,j), momz(:,i,j), rhot(:,i,j), dpres(:,i,j), &
925 sr(:,i,j), sw(:,i,j), st(:,i,j), &
926 j33g, gsqrt(:,i,j,:), &
934 k = iundef; i = iundef; j = iundef
937 profile_stop(
"hevi_solver")
942 profile_start(
"hevi_momx")
946 gsqrt(:,:,:,
i_uyw), j33g, &
953 gsqrt(:,:,:,
i_uyz), j13g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
958 gsqrt(:,:,:,
i_uyz), j23g(:,:,:,
i_uyw), mapf(:,:,:,
i_uy), &
996 call check( __line__, qflx_hi(k ,
is,j ,
zdir) )
997 call check( __line__, qflx_hi(k-1,
is,j ,
zdir) )
998 call check( __line__, qflx_hi(k ,
is,j ,
ydir) )
999 call check( __line__, qflx_hi(k ,
is,j-1,
ydir) )
1000 call check( __line__, corioli(
is,j) )
1001 call check( __line__, momy(k,
is,j ) )
1002 call check( __line__, momy(k,
is,j-1) )
1003 call check( __line__, momx0(k,
is,j) )
1005 advcv = - ( qflx_hi(k,
is,j,
zdir) - qflx_hi(k-1,
is,j ,
zdir) &
1006 + qflx_j23(k,
is,j) - qflx_j23(k-1,
is,j ) ) * rcdz(k)
1007 advch = - ( qflx_hi(k,
is,j,
ydir) - qflx_hi(k ,
is,j-1,
ydir) ) * rcdy(j) &
1009 cf = 0.5_rp * corioli(
is,j) * ( momy(k,
is,j) + momy(k,
is,j-1) )
1010 momx_rk(k,
is,j) = momx0(k,
is,j) &
1011 + dtrk * ( ( advcv + advch ) / gsqrt(k,
is,j,
i_uyz) + cf + momx_t(k,
is,j) )
1016 pg_t(k,
is,j,2) = 0.0_rp
1018 ddiv_t(k,
is,j,2) = 0.0_rp
1040 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
1041 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
1042 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
1043 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
1044 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
1045 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
1046 call check( __line__, dpres(k,i+1,j) )
1047 call check( __line__, dpres(k,i ,j) )
1048 call check( __line__, corioli(i ,j) )
1049 call check( __line__, corioli(i+1,j) )
1050 call check( __line__, momy(k,i ,j ) )
1051 call check( __line__, momy(k,i+1,j ) )
1052 call check( __line__, momy(k,i ,j-1) )
1053 call check( __line__, momy(k,i+1,j-1) )
1054 call check( __line__, ddiv(k,i+1,j) )
1055 call check( __line__, ddiv(k,i ,j) )
1056 call check( __line__, momx0(k,i,j) )
1058 advcv = - ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
1059 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
1060 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rcdz(k)
1061 advch = - ( ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rfdx(i) &
1062 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rcdy(j) ) &
1063 * mapf(i,j,1,
i_uy) * mapf(i,j,2,
i_uy)
1064 pg = ( ( gsqrt(k,i+1,j,
i_xyz) * dpres(k,i+1,j) &
1065 - gsqrt(k,i ,j,
i_xyz) * dpres(k,i ,j) &
1067 + ( j13g(k ,i,j,
i_uyw) &
1068 * 0.5_rp * ( f2h(k,1,
i_uyz) * ( dpres(k+1,i+1,j)+dpres(k+1,i,j) ) &
1069 + f2h(k,2,
i_uyz) * ( dpres(k ,i+1,j)+dpres(k ,i,j) ) ) &
1070 - j13g(k-1,i,j,
i_uyw) &
1071 * 0.5_rp * ( f2h(k,1,
i_uyz) * ( dpres(k ,i+1,j)+dpres(k ,i,j) ) &
1072 + f2h(k,2,
i_uyz) * ( dpres(k-1,i+1,j)+dpres(k-1,i,j) ) ) &
1075 cf = 0.125_rp * ( corioli(i+1,j )+corioli(i,j ) ) &
1076 * ( momy(k,i+1,j )+momy(k,i,j ) &
1077 + momy(k,i+1,j-1)+momy(k,i,j-1) ) &
1078 + 0.25_rp * mapf(i,j,1,
i_uy) * mapf(i,j,2,
i_uy) &
1079 * ( momy(k,i,j) + momy(k,i,j-1) + momy(k,i+1,j) + momy(k,i+1,j-1) ) &
1080 * ( ( momy(k,i,j) + momy(k,i,j-1) + momy(k,i+1,j) + momy(k,i+1,j-1) ) * 0.25_rp &
1081 * ( 1.0_rp/mapf(i+1,j,2,
i_xy) - 1.0_rp/mapf(i,j,2,
i_xy) ) * rfdx(i) &
1083 * ( 1.0_rp/mapf(i,j,1,
i_uv) - 1.0_rp/mapf(i,j-1,1,
i_uv) ) * rcdy(j) ) &
1084 * 2.0_rp / ( dens(k,i+1,j) + dens(k,i,j) )
1085 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) ) &
1086 * mapf(i,j,1,
i_uy) * mapf(i,j,2,
i_uy) * fdx(i)
1087 momx_rk(k,i,j) = momx0(k,i,j) &
1088 + dtrk * ( ( advcv + advch - pg ) / gsqrt(k,i,j,
i_uyz) + cf + div + momx_t(k,i,j) )
1091 advcv_t(k,i,j,
i_momx) = advcv / gsqrt(k,i,j,
i_uyz)
1092 advch_t(k,i,j,
i_momx) = advch / gsqrt(k,i,j,
i_uyz)
1093 pg_t(k,i,j,2) = - pg / gsqrt(k,i,j,
i_uyz)
1095 ddiv_t(k,i,j,2) = div
1102 profile_stop(
"hevi_momx")
1104 k = iundef; i = iundef; j = iundef
1108 profile_start(
"hevi_momy")
1112 gsqrt(:,:,:,
i_xvw), j33g, &
1115 iis, iie, jjs, jje )
1119 gsqrt(:,:,:,
i_xvz), j13g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
1121 iis, iie, jjs, jje )
1124 gsqrt(:,:,:,
i_xvz), j23g(:,:,:,
i_xvw), mapf(:,:,:,
i_xv), &
1126 iis, iie, jjs, jje )
1135 iis, iie, jjs, jje )
1144 iis, iie, jjs, jje )
1160 do j = jjs, min(jje,
jeh)
1163 call check( __line__, qflx_hi(k ,
is,j ,
zdir) )
1164 call check( __line__, qflx_hi(k-1,
is,j ,
zdir) )
1165 call check( __line__, qflx_hi(k ,
is,j ,
ydir) )
1166 call check( __line__, qflx_hi(k ,
is,j-1,
ydir) )
1167 call check( __line__, dpres(k,
is,j ) )
1168 call check( __line__, dpres(k,
is,j+1) )
1169 call check( __line__, corioli(
is,j ) )
1170 call check( __line__, corioli(
is,j+1) )
1171 call check( __line__, momx(k,
is,j ) )
1172 call check( __line__, momx(k,
is,j+1) )
1173 call check( __line__, ddiv(k,
is,j+1) )
1174 call check( __line__, ddiv(k,
is,j ) )
1175 call check( __line__, momy_t(k,
is,j) )
1176 call check( __line__, momy0(k,
is,j) )
1178 advcv = - ( qflx_hi(k,
is,j,
zdir) - qflx_hi(k-1,
is,j ,
zdir) &
1179 + qflx_j23(k,
is,j) - qflx_j23(k-1,
is,j ) ) * rcdz(k)
1180 advch = - ( qflx_hi(k,
is,j,
ydir) - qflx_hi(k ,
is,j-1,
ydir) ) * rfdy(j) &
1182 pg = ( ( gsqrt(k,
is,j+1,
i_xyz) * dpres(k,
is,j+1) &
1183 - gsqrt(k,
is,j ,
i_xyz) * dpres(k,
is,j ) &
1186 * 0.5_rp * ( f2h(k ,1,
i_xvz) * ( dpres(k+1,
is,j+1)+dpres(k+1,
is,j) ) &
1187 + f2h(k ,2,
i_xvz) * ( dpres(k ,
is,j+1)+dpres(k ,
is,j) ) ) &
1189 * 0.5_rp * ( f2h(k-1,1,
i_xvz) * ( dpres(k ,
is,j+1)+dpres(k ,
is,j) ) &
1190 + f2h(k-1,2,
i_xvz) * ( dpres(k-1,
is,j+1)+dpres(k-1,
is,j) ) ) &
1193 cf = - 0.25_rp * ( corioli(
is,j+1)+corioli(
is,j) ) &
1194 * ( momx(k,
is,j+1)+momx(k,
is,j) )
1195 div = divdmp_coef / dtrk * ( ddiv(k,
is,j+1) - ddiv(k,
is,j) ) &
1196 * mapf(
is,j,2,
i_xv) * fdy(j)
1197 momy_rk(k,
is,j) = momy0(k,
is,j) &
1198 + dtrk * ( ( advcv + advch - pg ) / gsqrt(k,
is,j,
i_xvz) + cf + div + momy_t(k,
is,j) )
1203 pg_t(k,
is,j,3) = - pg / gsqrt(k,
is,j,
i_xvz)
1205 ddiv_t(k,
is,j,3) = div
1222 do j = jjs, min(jje,
jeh)
1226 call check( __line__, qflx_hi(k ,i ,j ,
zdir) )
1227 call check( __line__, qflx_hi(k-1,i ,j ,
zdir) )
1228 call check( __line__, qflx_hi(k ,i ,j ,
xdir) )
1229 call check( __line__, qflx_hi(k ,i-1,j ,
xdir) )
1230 call check( __line__, qflx_hi(k ,i ,j ,
ydir) )
1231 call check( __line__, qflx_hi(k ,i ,j-1,
ydir) )
1232 call check( __line__, dpres(k,i,j ) )
1233 call check( __line__, dpres(k,i,j+1) )
1234 call check( __line__, corioli(i,j ) )
1235 call check( __line__, corioli(i,j+1) )
1236 call check( __line__, momx(k,i ,j ) )
1237 call check( __line__, momx(k,i ,j+1) )
1238 call check( __line__, momx(k,i-1,j ) )
1239 call check( __line__, momx(k,i-1,j+1) )
1240 call check( __line__, ddiv(k,i,j+1) )
1241 call check( __line__, ddiv(k,i,j ) )
1242 call check( __line__, momy_t(k,i,j) )
1243 call check( __line__, momy0(k,i,j) )
1245 advcv = - ( qflx_hi(k,i,j,
zdir) - qflx_hi(k-1,i ,j ,
zdir) &
1246 + qflx_j13(k,i,j) - qflx_j13(k-1,i ,j ) &
1247 + qflx_j23(k,i,j) - qflx_j23(k-1,i ,j ) ) * rcdz(k)
1248 advch = - ( ( qflx_hi(k,i,j,
xdir) - qflx_hi(k ,i-1,j ,
xdir) ) * rcdx(i) &
1249 + ( qflx_hi(k,i,j,
ydir) - qflx_hi(k ,i ,j-1,
ydir) ) * rfdy(j) ) &
1250 * mapf(i,j,1,
i_xv) * mapf(i,j,2,
i_xv)
1251 pg = ( ( gsqrt(k,i,j+1,
i_xyz) * dpres(k,i,j+1) &
1252 - gsqrt(k,i,j ,
i_xyz) * dpres(k,i,j ) &
1254 + ( j23g(k ,i,j,
i_xvw) &
1255 * 0.5_rp * ( f2h(k ,1,
i_xvz) * ( dpres(k+1,i,j+1)+dpres(k+1,i,j) ) &
1256 + f2h(k ,2,
i_xvz) * ( dpres(k ,i,j+1)+dpres(k ,i,j) ) ) &
1257 - j23g(k-1,i,j,
i_xvw) &
1258 * 0.5_rp * ( f2h(k-1,1,
i_xvz) * ( dpres(k ,i,j+1)+dpres(k ,i,j) ) &
1259 + f2h(k-1,2,
i_xvz) * ( dpres(k-1,i,j+1)+dpres(k-1,i,j) ) ) &
1262 cf = - 0.125_rp * ( corioli(i ,j+1)+corioli(i ,j) ) &
1263 * ( momx(k,i ,j+1)+momx(k,i ,j) &
1264 + momx(k,i-1,j+1)+momx(k,i-1,j) ) &
1265 - 0.25_rp * mapf(i,j,1,
i_xv) * mapf(i,j,2,
i_xv) &
1266 * ( momx(k,i,j) + momx(k,i-1,j) + momx(k,i,j+1) + momx(k,i-1,j+1) ) &
1268 * ( 1.0_rp/mapf(i,j,2,
i_uv) - 1.0_rp/mapf(i-1,j,2,
i_uv) ) * rcdx(i) &
1269 - 0.25_rp * ( momx(k,i,j)+momx(k,i-1,j)+momx(k,i,j+1)+momx(k,i-1,j+1) ) &
1270 * ( 1.0_rp/mapf(i,j+1,1,
i_xy) - 1.0_rp/mapf(i,j,1,
i_xy) ) * rfdy(j) ) &
1271 * 2.0_rp / ( dens(k,i,j+1) + dens(k,i,j) )
1272 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) ) &
1273 * mapf(i,j,1,
i_xv) * mapf(i,j,2,
i_xv) * fdy(j)
1274 momy_rk(k,i,j) = momy0(k,i,j) &
1275 + dtrk * ( ( advcv + advch - pg ) / gsqrt(k,i,j,
i_xvz) + cf + div + momy_t(k,i,j) )
1278 advcv_t(k,i,j,
i_momy) = advcv / gsqrt(k,i,j,
i_xvz)
1279 advch_t(k,i,j,
i_momy) = advch / gsqrt(k,i,j,
i_xvz)
1280 pg_t(k,i,j,3) = - pg / gsqrt(k,i,j,
i_xvz)
1282 ddiv_t(k,i,j,3) = div
1289 profile_stop(
"hevi_momy")
1291 k = iundef; i = iundef; j = iundef
1303 call file_history_in(advcv_t(:,:,:,
i_dens),
'DENS_t_advcv',
'tendency of density (vert. advection) (w/ HIST_TEND)',
'kg/m3/s' )
1304 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')
1305 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')
1306 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')
1307 call file_history_in(advcv_t(:,:,:,
i_rhot),
'RHOT_t_advcv',
'tendency of rho*theta (vert. advection) (w/ HIST_TEND)',
'K kg/m3/s' )
1309 call file_history_in(advch_t(:,:,:,
i_dens),
'DENS_t_advch',
'tendency of density (horiz. advection) (w/ HIST_TEND)',
'kg/m3/s' )
1310 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')
1311 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')
1312 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')
1313 call file_history_in(advch_t(:,:,:,
i_rhot),
'RHOT_t_advch',
'tendency of rho*theta (horiz. advection) (w/ HIST_TEND)',
'K kg/m3/s' )
1315 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')
1317 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')
1318 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')
1320 call file_history_in(wdmp_t(:,:,:),
'MOMZ_t_wdamp',
'tendency of momentum z (Rayleigh damping) (w/ HIST_TEND)',
'kg/m2/s2', dim_type=
'ZHXY')
1322 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')
1324 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')
1325 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')
1327 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')
1328 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')