259 real(RP),
intent(out) :: qflx_sgs_momz(
ka,
ia,
ja,3)
260 real(RP),
intent(out) :: qflx_sgs_momx(
ka,
ia,
ja,3)
261 real(RP),
intent(out) :: qflx_sgs_momy(
ka,
ia,
ja,3)
262 real(RP),
intent(out) :: qflx_sgs_rhot(
ka,
ia,
ja,3)
263 real(RP),
intent(out) :: qflx_sgs_rhoq(
ka,
ia,
ja,3,
qa)
265 real(RP),
intent(out) :: momz_t (
ka,
ia,
ja)
266 real(RP),
intent(out) :: momx_t (
ka,
ia,
ja)
267 real(RP),
intent(out) :: momy_t (
ka,
ia,
ja)
268 real(RP),
intent(out) :: rhot_t (
ka,
ia,
ja)
269 real(RP),
intent(out) :: rhoq_t (
ka,
ia,
ja,
qa)
271 real(RP),
intent(out) :: nu (
ka,
ia,
ja)
272 real(RP),
intent(out) :: ri (
ka,
ia,
ja)
273 real(RP),
intent(out) :: pr (
ka,
ia,
ja)
275 real(RP),
intent(in) :: momz (
ka,
ia,
ja)
276 real(RP),
intent(in) :: momx (
ka,
ia,
ja)
277 real(RP),
intent(in) :: momy (
ka,
ia,
ja)
278 real(RP),
intent(in) :: pott (
ka,
ia,
ja)
279 real(RP),
intent(in) :: dens (
ka,
ia,
ja)
280 real(RP),
intent(in) :: qtrc (
ka,
ia,
ja,
qa)
281 real(RP),
intent(in) :: n2 (
ka,
ia,
ja)
283 real(RP),
intent(in) :: fz (0:
ka,
ia,
ja)
284 real(RP),
intent(in) :: fdz (
ka-1)
285 real(RP),
intent(in) :: rcdz (
ka)
286 real(RP),
intent(in) :: rfdz (
ka-1)
287 real(RP),
intent(in) :: cdx (
ia)
288 real(RP),
intent(in) :: fdx (
ia-1)
289 real(RP),
intent(in) :: cdy (
ja)
290 real(RP),
intent(in) :: fdy (
ja-1)
292 real(RP),
intent(in) :: gsqrt (
ka,
ia,
ja,7)
293 real(RP),
intent(in) :: j13g (
ka,
ia,
ja,7)
294 real(RP),
intent(in) :: j23g (
ka,
ia,
ja,7)
295 real(RP),
intent(in) :: j33g
296 real(RP),
intent(in) :: mapf(
ia,
ja,2,4)
297 real(DP),
intent(in) :: dt
303 real(RP) :: s33_c(
ka,
ia,
ja)
304 real(RP) :: s11_c(
ka,
ia,
ja)
305 real(RP) :: s22_c(
ka,
ia,
ja)
306 real(RP) :: s31_c(
ka,
ia,
ja)
307 real(RP) :: s12_c(
ka,
ia,
ja)
308 real(RP) :: s23_c(
ka,
ia,
ja)
309 real(RP) :: s12_z(
ka,
ia,
ja)
310 real(RP) :: s23_x(
ka,
ia,
ja)
311 real(RP) :: s31_y(
ka,
ia,
ja)
318 real(RP) :: lambda_r(
ka)
325 real(RP) :: tend(
ka,
ia,
ja)
333 real(RP) :: random (
ka,
ia,
ja)
334 real(RP) :: random_mz(
ka,
ia,
ja)
335 real(RP) :: random_mx(
ka,
ia,
ja)
336 real(RP) :: random_my(
ka,
ia,
ja)
337 real(RP) :: random_qz(
ka,
ia,
ja)
338 real(RP) :: random_qx(
ka,
ia,
ja)
339 real(RP) :: random_qy(
ka,
ia,
ja)
340 real(RP) :: acc (
ka,
ia,
ja)
343 real(RP) :: dz, dx, dy
349 integer :: k, i, j, iq
352 log_progress(*)
'atmosphere / physics / turbulence / Smagorinsky' 355 qflx_sgs_momz(:,:,:,:) = undef
356 qflx_sgs_momx(:,:,:,:) = undef
357 qflx_sgs_momy(:,:,:,:) = undef
358 qflx_sgs_rhot(:,:,:,:) = undef
359 qflx_sgs_rhoq(:,:,:,:,:) = undef
369 qflx_sgs_momz(
ks:
ke, 1:
is-1, : ,:) = undef
370 qflx_sgs_momz(
ks:
ke,
ie+1:
ia , : ,:) = undef
371 qflx_sgs_momz(
ks:
ke, : , 1:
js-1,:) = undef
372 qflx_sgs_momz(
ks:
ke, : ,
je+1:
ja ,:) = undef
373 qflx_sgs_momx(
ks:
ke, 1:
is-1, : ,:) = undef
374 qflx_sgs_momx(
ks:
ke,
ie+1:
ia , : ,:) = undef
375 qflx_sgs_momx(
ks:
ke, : , 1:
js-1,:) = undef
376 qflx_sgs_momx(
ks:
ke, : ,
je+1:
ja ,:) = undef
377 qflx_sgs_momy(
ks:
ke, 1:
is-1, : ,:) = undef
378 qflx_sgs_momy(
ks:
ke,
ie+1:
ia , : ,:) = undef
379 qflx_sgs_momy(
ks:
ke, : , 1:
js-1,:) = undef
380 qflx_sgs_momy(
ks:
ke, : ,
je+1:
ja ,:) = undef
386 call calc_strain_tensor( &
387 s33_c, s11_c, s22_c, &
388 s31_c, s12_c, s23_c, &
389 s12_z, s23_x, s31_y, &
391 dens, momz, momx, momy, &
392 gsqrt, j13g, j23g, j33g, mapf )
394 if ( atmos_phy_tb_smg_backscatter )
then 402 random_mz(k,i,j) = ( random(k,i,j) * 2.0_rp &
403 + random(k+1,i,j) + random(k-1,i,j) &
404 + random(k,i+1,j) + random(k,i-1,j) &
405 + random(k,i,j+1) + random(k,i,j-1) ) / 8.0_rp
407 random_mz(
ks,i,j) = ( random(
ks,i,j) * 2.0_rp &
409 + random(
ks,i+1,j) + random(
ks,i-1,j) &
410 + random(
ks,i,j+1) + random(
ks,i,j-1) ) / 7.0_rp
411 random_mz(
ke,i,j) = ( random(
ke,i,j) * 2.0_rp &
413 + random(
ke,i+1,j) + random(
ke,i-1,j) &
414 + random(
ke,i,j+1) + random(
ke,i,j-1) ) / 7.0_rp
424 random_mx(k,i,j) = ( random(k,i,j) * 2.0_rp &
425 + random(k+1,i,j) + random(k-1,i,j) &
426 + random(k,i+1,j) + random(k,i-1,j) &
427 + random(k,i,j+1) + random(k,i,j-1) ) / 8.0_rp
429 random_mx(
ks,i,j) = ( random(
ks,i,j) * 2.0_rp &
431 + random(
ks,i+1,j) + random(
ks,i-1,j) &
432 + random(
ks,i,j+1) + random(
ks,i,j-1) ) / 7.0_rp
433 random_mx(
ke,i,j) = ( random(
ke,i,j) * 2.0_rp &
435 + random(
ke,i+1,j) + random(
ke,i-1,j) &
436 + random(
ke,i,j+1) + random(
ke,i,j-1) ) / 7.0_rp
446 random_my(k,i,j) = ( random(k,i,j) * 2.0_rp &
447 + random(k+1,i,j) + random(k-1,i,j) &
448 + random(k,i+1,j) + random(k,i-1,j) &
449 + random(k,i,j+1) + random(k,i,j-1) ) / 8.0_rp
451 random_my(
ks,i,j) = ( random(
ks,i,j) * 2.0_rp &
453 + random(
ks,i+1,j) + random(
ks,i-1,j) &
454 + random(
ks,i,j+1) + random(
ks,i,j-1) ) / 7.0_rp
455 random_my(
ke,i,j) = ( random(
ke,i,j) * 2.0_rp &
457 + random(
ke,i+1,j) + random(
ke,i-1,j) &
458 + random(
ke,i,j+1) + random(
ke,i,j-1) ) / 7.0_rp
468 random_qz(k,i,j) = ( random(k,i,j) * 2.0_rp &
469 + random(k+1,i,j) + random(k-1,i,j) &
470 + random(k,i+1,j) + random(k,i-1,j) &
471 + random(k,i,j+1) + random(k,i,j-1) ) / 8.0_rp
473 random_qz(
ks,i,j) = ( random(
ks,i,j) * 2.0_rp &
475 + random(
ks,i+1,j) + random(
ks,i-1,j) &
476 + random(
ks,i,j+1) + random(
ks,i,j-1) ) / 7.0_rp
477 random_qz(
ke,i,j) = ( random(
ke,i,j) * 2.0_rp &
479 + random(
ke,i+1,j) + random(
ke,i-1,j) &
480 + random(
ke,i,j+1) + random(
ke,i,j-1) ) / 7.0_rp
490 random_qx(k,i,j) = ( random(k,i,j) * 2.0_rp &
491 + random(k+1,i,j) + random(k-1,i,j) &
492 + random(k,i+1,j) + random(k,i-1,j) &
493 + random(k,i,j+1) + random(k,i,j-1) ) / 8.0_rp
495 random_qx(
ks,i,j) = ( random(
ks,i,j) * 2.0_rp &
497 + random(
ks,i+1,j) + random(
ks,i-1,j) &
498 + random(
ks,i,j+1) + random(
ks,i,j-1) ) / 7.0_rp
499 random_qx(
ke,i,j) = ( random(
ke,i,j) * 2.0_rp &
501 + random(
ke,i+1,j) + random(
ke,i-1,j) &
502 + random(
ke,i,j+1) + random(
ke,i,j-1) ) / 7.0_rp
512 random_qy(k,i,j) = ( random(k,i,j) * 2.0_rp &
513 + random(k+1,i,j) + random(k-1,i,j) &
514 + random(k,i+1,j) + random(k,i-1,j) &
515 + random(k,i,j+1) + random(k,i,j-1) ) / 8.0_rp
517 random_qy(
ks,i,j) = ( random(
ks,i,j) * 2.0_rp &
519 + random(
ks,i+1,j) + random(
ks,i-1,j) &
520 + random(
ks,i,j+1) + random(
ks,i,j-1) ) / 7.0_rp
521 random_qy(
ke,i,j) = ( random(
ke,i,j) * 2.0_rp &
523 + random(
ke,i+1,j) + random(
ke,i-1,j) &
524 + random(
ke,i,j+1) + random(
ke,i,j-1) ) / 7.0_rp
539 ri(k,i,j) = n2(k,i,j) / max(s2(k,i,j), eps)
545 if ( ri(k,i,j) < 0.0_rp )
then 546 fm(k) = sqrt( 1.0_rp - fmc * ri(k,i,j) )
547 nu(k,i,j) = lambda(k,i,j)**2 * sqrt( s2(k,i,j) ) * fm(k)
548 pr(k,i,j) = fm(k) / sqrt( 1.0_rp - fhb*ri(k,i,j) ) * prn
549 else if ( ri(k,i,j) < ric )
then 550 fm(k) = ( 1.0_rp - ri(k,i,j)*rric )**4
551 nu(k,i,j) = lambda(k,i,j)**2 * sqrt( s2(k,i,j) ) * fm(k)
552 pr(k,i,j) = prn / ( 1.0_rp - prnovric * ri(k,i,j) )
560 if ( ri(k,i,j) < ric )
then 561 kh(k,i,j) = max( min( nu(k,i,j) / pr(k,i,j), atmos_phy_tb_smg_nu_max ), eps )
562 nu(k,i,j) = max( min( nu(k,i,j), atmos_phy_tb_smg_nu_max ), eps )
563 pr(k,i,j) = nu(k,i,j) / kh(k,i,j)
564 rf = ri(k,i,j) / pr(k,i,j)
565 lambda_r(k) = lambda(k,i,j) * sqrt( fm(k) / sqrt( 1.0_rp - rf ) )
572 if ( atmos_phy_tb_smg_backscatter )
then 575 lambda_r(k) = min( 1.8_rp * lambda0(k,i,j), lambda_r(k) )
576 leovleo5 = ( lambda_r(k) / lambda0(k,i,j) )**5
577 c2 = cb * leovleo5 / ( 1.0_rp + cb * leovleo5 )
579 c1(k) = c1o / sqrt( 1.0_rp - c2 )
581 e(k) = nu(k,i,j)**3 * ( 1.0_rp - c2 ) / ( lambda_r(k)**4 + eps )
582 et = kh(k,i,j) * ( 1.0_rp - d2 )
584 dz = fz(k,i,j) - fz(k-1,i,j)
585 dx = cdx(i) / mapf(i,j,1,
i_xy)
586 dy = cdy(j) / mapf(i,j,2,
i_xy)
588 fact = sqrt( cb * leovleo5 * e(k) / ( dt * ( dz**2 + dx**2 + dy**2 ) ) ) * dens(k,i,j)
589 random_mz(k,i,j) = random_mz(k,i,j) * fact * dx * dy
590 random_mx(k,i,j) = random_mx(k,i,j) * fact * dy * dz
591 random_my(k,i,j) = random_my(k,i,j) * fact * dz * dx
593 fact = sqrt( twooverthree * cbt * leovleo5 * et / dt ) * dens(k,i,j)
594 random_qz(k,i,j) = random_qz(k,i,j) * fact * dz
595 random_qx(k,i,j) = random_qx(k,i,j) * fact * dx
596 random_qy(k,i,j) = random_qy(k,i,j) * fact * dy
602 e(k) = nu(k,i,j)**3 / ( lambda_r(k)**4 + eps )
610 tke(k,i,j) = ( e(k) * lambda_r(k) / c1(k) )**twooverthree
616 i = iundef; j = iundef; k = iundef
628 if ( atmos_phy_tb_smg_horizontal )
then 629 qflx_sgs_momz(:,:,:,
zdir) = 0.0_rp
636 call check( __line__, dens(k,i,j) )
637 call check( __line__, nu(k,i,j) )
638 call check( __line__, s33_c(k,i,j) )
639 call check( __line__, s11_c(k,i,j) )
640 call check( __line__, s22_c(k,i,j) )
641 call check( __line__, tke(k,i,j) )
643 qflx_sgs_momz(k,i,j,
zdir) = dens(k,i,j) * ( &
644 - 2.0_rp * nu(k,i,j) &
645 * ( s33_c(k,i,j) - ( s11_c(k,i,j) + s22_c(k,i,j) + s33_c(k,i,j) ) * oneoverthree ) &
646 + twooverthree * tke(k,i,j) * tke_fact )
651 i = iundef; j = iundef; k = iundef
657 qflx_sgs_momz(
ks,i,j,
zdir) = dens(
ks,i,j) * twooverthree * tke(
ks,i,j) * tke_fact
658 qflx_sgs_momz(
ke,i,j,
zdir) = dens(
ke,i,j) * twooverthree * tke(
ke,i,j) * tke_fact
663 i = iundef; j = iundef; k = iundef
672 call check( __line__, dens(k,i,j) )
673 call check( __line__, dens(k,i+1,j) )
674 call check( __line__, dens(k+1,i,j) )
675 call check( __line__, dens(k+1,i+1,j) )
676 call check( __line__, nu(k,i,j) )
677 call check( __line__, nu(k,i+1,j) )
678 call check( __line__, nu(k+1,i,j) )
679 call check( __line__, nu(k+1,i+1,j) )
680 call check( __line__, s31_y(k,i,j) )
682 qflx_sgs_momz(k,i,j,
xdir) = - 0.125_rp &
683 * ( dens(k,i,j)+dens(k+1,i,j)+dens(k,i+1,j)+dens(k+1,i+1,j) ) &
684 * ( nu(k,i,j)+nu(k+1,i,j)+nu(k,i+1,j)+nu(k+1,i+1,j)) &
690 i = iundef; j = iundef; k = iundef
700 call check( __line__, dens(k,i,j) )
701 call check( __line__, dens(k,i,j+1) )
702 call check( __line__, dens(k+1,i,j) )
703 call check( __line__, dens(k+1,i,j+1) )
704 call check( __line__, nu(k,i,j) )
705 call check( __line__, nu(k,i,j+1) )
706 call check( __line__, nu(k+1,i,j) )
707 call check( __line__, nu(k+1,i,j+1) )
708 call check( __line__, s23_x(k,i,j) )
710 qflx_sgs_momz(k,i,j,
ydir) = - 0.125_rp &
711 * ( dens(k,i,j)+dens(k+1,i,j)+dens(k,i,j+1)+dens(k+1,i,j+1) ) &
712 * ( nu(k,i,j)+nu(k+1,i,j)+nu(k,i,j+1)+nu(k+1,i,j+1) ) &
718 i = iundef; j = iundef; k = iundef
721 if ( atmos_phy_tb_smg_implicit )
then 723 call calc_tend_momz( tend, &
725 gsqrt, j13g, j23g, j33g, mapf, &
733 ap = - fouroverthree * dt &
734 * dens(
ks+1,i,j)*nu(
ks+1,i,j) &
738 b(
ks,i,j) = - a(
ks,i,j) + 0.5_rp * ( dens(
ks,i,j)+dens(
ks+1,i,j) )
740 c(k,i,j) = ap * rfdz(k+1) / gsqrt(k+1,i,j,
i_xyw)
741 ap = - fouroverthree * dt &
742 * dens(k+1,i,j)*nu(k+1,i,j) &
743 * rcdz(k+1) / gsqrt(k+1,i,j,
i_xyz)
744 a(k,i,j) = ap * rfdz(k) / gsqrt(k,i,j,
i_xyw)
745 b(k,i,j) = - a(k,i,j) - c(k,i,j) + 0.5_rp * ( dens(k,i,j)+dens(k+1,i,j) )
749 b(
ke-1,i,j) = - c(
ke-1,i,j) + 0.5_rp * ( dens(
ke-1,i,j)+dens(
ke,i,j) )
755 call diffusion_solver( &
757 a(:,i,j), b(:,i,j), c(:,i,j), d, &
761 qflx_sgs_momz(k,i,j,
zdir) = qflx_sgs_momz(k,i,j,
zdir) &
762 - fouroverthree * dens(k,i,j) * nu(k,i,j) * dt &
763 * ( tend(k,i,j) - tend(k-1,i,j) ) * rcdz(k) / gsqrt(k,i,j,
i_xyz)
773 if ( atmos_phy_tb_smg_horizontal )
then 774 qflx_sgs_momx(:,:,:,
zdir) = 0.0_rp
781 call check( __line__, dens(k,i,j) )
782 call check( __line__, dens(k,i+1,j) )
783 call check( __line__, dens(k+1,i,j) )
784 call check( __line__, dens(k+1,i+1,j) )
785 call check( __line__, nu(k,i,j) )
786 call check( __line__, nu(k,i+1,j) )
787 call check( __line__, nu(k+1,i,j) )
788 call check( __line__, nu(k+1,i+1,j) )
789 call check( __line__, s31_y(k,i,j) )
791 qflx_sgs_momx(k,i,j,
zdir) = - 0.125_rp &
792 * ( dens(k,i,j)+dens(k+1,i,j)+dens(k,i+1,j)+dens(k+1,i+1,j) ) &
793 * ( nu(k,i,j)+nu(k+1,i,j)+nu(k,i+1,j)+nu(k+1,i+1,j) ) &
799 i = iundef; j = iundef; k = iundef
804 qflx_sgs_momx(
ks-1,i,j,
zdir) = 0.0_rp
805 qflx_sgs_momx(
ke ,i,j,
zdir) = 0.0_rp
809 i = iundef; j = iundef; k = iundef
820 call check( __line__, dens(k,i,j) )
821 call check( __line__, nu(k,i,j) )
822 call check( __line__, s11_c(k,i,j) )
823 call check( __line__, s22_c(k,i,j) )
824 call check( __line__, s33_c(k,i,j) )
825 call check( __line__, tke(k,i,j) )
827 qflx_sgs_momx(k,i,j,
xdir) = dens(k,i,j) * ( &
828 - 2.0_rp * nu(k,i,j) &
829 * ( s11_c(k,i,j) - ( s11_c(k,i,j) + s22_c(k,i,j) + s33_c(k,i,j) ) * oneoverthree ) &
830 + twooverthree * tke(k,i,j) * tke_fact )
835 i = iundef; j = iundef; k = iundef
845 call check( __line__, dens(k,i,j) )
846 call check( __line__, dens(k,i+1,j) )
847 call check( __line__, dens(k,i,j+1) )
848 call check( __line__, dens(k,i+1,j+1) )
849 call check( __line__, nu(k,i,j) )
850 call check( __line__, nu(k,i+1,j) )
851 call check( __line__, nu(k,i,j+1) )
852 call check( __line__, nu(k,i+1,j+1) )
853 call check( __line__, s12_z(k,i,j) )
855 qflx_sgs_momx(k,i,j,
ydir) = - 0.125_rp &
856 * ( dens(k,i,j)+dens(k,i+1,j)+dens(k,i,j+1)+dens(k,i+1,j+1) ) &
857 * ( nu(k,i,j)+nu(k,i+1,j)+nu(k,i,j+1)+nu(k,i+1,j+1) ) &
863 i = iundef; j = iundef; k = iundef
866 if ( atmos_phy_tb_smg_implicit )
then 867 call calc_tend_momx( tend, &
869 gsqrt, j13g, j23g, j33g, mapf, &
877 ap = - dt * 0.25_rp * ( dens(
ks ,i ,j)*nu(
ks ,i ,j) &
878 + dens(
ks+1,i ,j)*nu(
ks+1,i ,j) &
879 + dens(
ks ,i+1,j)*nu(
ks ,i+1,j) &
880 + dens(
ks+1,i+1,j)*nu(
ks+1,i+1,j) ) &
884 b(
ks,i,j) = - a(
ks,i,j) + 0.5_rp * ( dens(
ks,i,j)+dens(
ks,i+1,j) )
886 c(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_uyz)
887 ap = - dt * 0.25_rp * ( dens(k ,i ,j)*nu(k ,i ,j) &
888 + dens(k+1,i ,j)*nu(k+1,i ,j) &
889 + dens(k ,i+1,j)*nu(k ,i+1,j) &
890 + dens(k+1,i+1,j)*nu(k+1,i+1,j) ) &
891 * rfdz(k) / gsqrt(k,i,j,
i_uyw)
892 a(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_uyz)
893 b(k,i,j) = - a(k,i,j) - c(k,i,j) + 0.5_rp * ( dens(k,i,j)+dens(k,i+1,j) )
897 b(
ke,i,j) = - c(
ke,i,j) + 0.5_rp * ( dens(
ke,i,j)+dens(
ke,i+1,j) )
903 call diffusion_solver( &
905 a(:,i,j), b(:,i,j), c(:,i,j), d, &
909 qflx_sgs_momx(k,i,j,
zdir) = qflx_sgs_momx(k,i,j,
zdir) &
910 - 0.25_rp * ( dens(k ,i ,j)*nu(k ,i ,j) &
911 + dens(k+1,i ,j)*nu(k+1,i ,j) &
912 + dens(k ,i+1,j)*nu(k ,i+1,j) &
913 + dens(k+1,i+1,j)*nu(k+1,i+1,j) ) &
914 * dt * ( tend(k+1,i,j) - tend(k,i,j) ) * rfdz(k) / gsqrt(k,i,j,
i_uyw)
924 if ( atmos_phy_tb_smg_horizontal )
then 925 qflx_sgs_momy(:,:,:,
zdir) = 0.0_rp
932 call check( __line__, dens(k,i,j) )
933 call check( __line__, dens(k,i,j+1) )
934 call check( __line__, dens(k+1,i,j) )
935 call check( __line__, dens(k+1,i,j+1) )
936 call check( __line__, nu(k,i,j) )
937 call check( __line__, nu(k,i,j+1) )
938 call check( __line__, nu(k+1,i,j) )
939 call check( __line__, nu(k+1,i,j+1) )
940 call check( __line__, s23_x(k,i,j) )
942 qflx_sgs_momy(k,i,j,
zdir) = - 0.125_rp &
943 * ( dens(k,i,j)+dens(k+1,i,j)+dens(k,i,j+1)+dens(k+1,i,j+1) ) &
944 * ( nu(k,i,j)+nu(k+1,i,j)+nu(k,i,j+1)+nu(k+1,i,j+1) ) &
950 i = iundef; j = iundef; k = iundef
955 qflx_sgs_momy(
ks-1,i,j,
zdir) = 0.0_rp
956 qflx_sgs_momy(
ke ,i,j,
zdir) = 0.0_rp
960 i = iundef; j = iundef; k = iundef
972 call check( __line__, dens(k,i,j) )
973 call check( __line__, dens(k,i+1,j) )
974 call check( __line__, dens(k,i,j+1) )
975 call check( __line__, dens(k,i+1,j+1) )
976 call check( __line__, nu(k,i,j) )
977 call check( __line__, nu(k,i+1,j) )
978 call check( __line__, nu(k,i,j+1) )
979 call check( __line__, nu(k,i+1,j+1) )
980 call check( __line__, s12_z(k,i,j) )
982 qflx_sgs_momy(k,i,j,
xdir) = - 0.125_rp &
983 * ( dens(k,i,j)+dens(k,i+1,j)+dens(k,i,j+1)+dens(k,i+1,j+1) ) &
984 * ( nu(k,i,j)+nu(k,i+1,j)+nu(k,i,j+1)+nu(k,i+1,j+1) ) &
990 i = iundef; j = iundef; k = iundef
1001 call check( __line__, dens(k,i,j) )
1002 call check( __line__, nu(k,i,j) )
1003 call check( __line__, s11_c(k,i,j) )
1004 call check( __line__, s22_c(k,i,j) )
1005 call check( __line__, s33_c(k,i,j) )
1006 call check( __line__, tke(k,i,j) )
1008 qflx_sgs_momy(k,i,j,
ydir) = dens(k,i,j) * ( &
1009 - 2.0_rp * nu(k,i,j) &
1010 * ( s22_c(k,i,j) - ( s11_c(k,i,j) + s22_c(k,i,j) + s33_c(k,i,j) ) * oneoverthree ) &
1011 + twooverthree * tke(k,i,j) * tke_fact)
1016 i = iundef; j = iundef; k = iundef
1019 if ( atmos_phy_tb_smg_implicit )
then 1020 call calc_tend_momy( tend, &
1022 gsqrt, j13g, j23g, j33g, mapf, &
1023 iis, iie, jjs, jje )
1030 ap = - dt * 0.25_rp * ( dens(
ks ,i,j )*nu(
ks ,i,j ) &
1031 + dens(
ks+1,i,j )*nu(
ks+1,i,j ) &
1032 + dens(
ks ,i,j+1)*nu(
ks ,i,j+1) &
1033 + dens(
ks+1,i,j+1)*nu(
ks+1,i,j+1) ) &
1037 b(
ks,i,j) = - a(
ks,i,j) + 0.5_rp * ( dens(
ks,i,j)+dens(
ks,i,j+1) )
1039 c(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_xvz)
1040 ap = - dt * 0.25_rp * ( dens(k ,i,j )*nu(k ,i,j ) &
1041 + dens(k+1,i,j )*nu(k+1,i,j ) &
1042 + dens(k ,i,j+1)*nu(k ,i,j+1) &
1043 + dens(k+1,i,j+1)*nu(k+1,i,j+1) ) &
1044 * rfdz(k) / gsqrt(k,i,j,
i_xvw)
1045 a(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_xvz)
1046 b(k,i,j) = - a(k,i,j) - c(k,i,j) + 0.5_rp * ( dens(k,i,j)+dens(k,i,j+1) )
1050 b(
ke,i,j) = - c(
ke,i,j) + 0.5_rp * ( dens(
ke,i,j)+dens(
ke,i,j+1) )
1056 call diffusion_solver( &
1058 a(:,i,j), b(:,i,j), c(:,i,j), d, &
1062 qflx_sgs_momy(k,i,j,
zdir) = qflx_sgs_momy(k,i,j,
zdir) &
1063 - 0.25_rp * ( dens(k ,i,j )*nu(k ,i,j ) &
1064 + dens(k+1,i,j )*nu(k+1,i,j ) &
1065 + dens(k ,i,j+1)*nu(k ,i,j+1) &
1066 + dens(k+1,i,j+1)*nu(k+1,i,j+1) ) &
1067 * dt * ( tend(k+1,i,j) - tend(k,i,j) ) * rfdz(k) / gsqrt(k,i,j,
i_xvw)
1075 if ( atmos_phy_tb_smg_backscatter )
then 1082 acc(k,i,j) = ( ( gsqrt(k,i+1,j,
i_xyz) * random_my(k,i+1,j) - gsqrt(k,i-1,j,
i_xyz) * random_my(k,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1083 + ( j13g(k+1,i,j,
i_xyz) * random_my(k+1,i,j) - j13g(k-1,i,j,
i_xyz) * random_my(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1084 - ( gsqrt(k,i,j+1,
i_xyz) * random_mx(k,i,j+1) - gsqrt(k,i,j-1,
i_xyz) * random_mx(k,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1085 + ( j23g(k+1,i,j,
i_xyz) * random_mx(k+1,i,j) - j23g(k-1,i,j,
i_xyz) * random_mx(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1086 ) / gsqrt(k,i,j,
i_xyz)
1088 acc(
ks,i,j) = ( ( gsqrt(
ks,i+1,j,
i_xyz) * random_my(
ks,i+1,j) - gsqrt(
ks,i-1,j,
i_xyz) * random_my(
ks,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1089 + ( j13g(
ks+1,i,j,
i_xyz) * random_my(
ks+1,i,j) - j13g(
ks,i,j,
i_xyz) * random_my(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1090 - ( gsqrt(
ks,i,j+1,
i_xyz) * random_mx(
ks,i,j+1) - gsqrt(
ks,i,j-1,
i_xyz) * random_mx(
ks,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1091 + ( j23g(
ks+1,i,j,
i_xyz) * random_mx(
ks+1,i,j) - j23g(
ks,i,j,
i_xyz) * random_mx(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1093 acc(
ke,i,j) = ( ( gsqrt(
ke,i+1,j,
i_xyz) * random_my(
ke,i+1,j) - gsqrt(
ke,i-1,j,
i_xyz) * random_my(
ke,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1094 + ( j13g(
ke,i,j,
i_xyz) * random_my(
ke,i,j) - j13g(
ke-1,i,j,
i_xyz) * random_my(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1095 - ( gsqrt(
ke,i,j+1,
i_xyz) * random_mx(
ke,i,j+1) - gsqrt(
ke,i,j-1,
i_xyz) * random_mx(
ke,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1096 + ( j23g(
ke,i,j,
i_xyz) * random_mx(
ke,i,j) - j23g(
ke-1,i,j,
i_xyz) * random_mx(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1101 #define f2h(k,i,j,p) ( ( FZ(k+p-1,i,j) - FZ(k+p-2,i,j) ) / ( FZ(k+1,i,j) - FZ(k-1,i,j) ) ) 1106 momz_t(k,i,j) = acc(k+1,i,j) * f2h(k,i,j,1) + acc(k,i,j) * f2h(k,i,j,2)
1108 momz_t(
ke,i,j) = 0.0_rp
1117 acc(k,i,j) = ( ( gsqrt(k,i,j+1,
i_xyz) * random_mz(k,i,j+1) - gsqrt(k,i,j-1,
i_xyz) * random_mz(k,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1118 + ( j23g(k+1,i,j,
i_xyz) * random_mz(k+1,i,j) - j23g(k-1,i,j,
i_xyz) * random_mz(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1119 - j33g * ( random_my(k+1,i,j) - random_my(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1120 ) / gsqrt(k,i,j,
i_xyz)
1122 acc(
ks,i,j) = ( ( gsqrt(
ks,i,j+1,
i_xyz) * random_mz(
ks,i,j+1) - gsqrt(
ks,i,j-1,
i_xyz) * random_mz(
ks,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1123 + ( j23g(
ks+1,i,j,
i_xyz) * random_mz(
ks+1,i,j) - j23g(
ks,i,j,
i_xyz) * random_mz(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1124 - j33g * ( random_my(
ks+1,i,j) - random_my(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1126 acc(
ke,i,j) = ( ( gsqrt(
ke,i,j+1,
i_xyz) * random_mz(
ke,i,j+1) - gsqrt(
ke,i,j-1,
i_xyz) * random_mz(
ke,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1127 + ( j23g(
ke,i,j,
i_xyz) * random_mz(
ke,i,j) - j23g(
ke-1,i,j,
i_xyz) * random_mz(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1128 - j33g * ( random_my(
ke,i,j) - random_my(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1137 momx_t(k,i,j) = ( acc(k,i+1,j) + acc(k,i,j) ) * 0.5_rp
1147 acc(k,i,j) = ( j33g * ( random_mx(k+1,i,j) - random_mx(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1148 - ( gsqrt(k,i+1,j,
i_xyz) * random_mz(k,i+1,j) - gsqrt(k,i-1,j,
i_xyz) * random_mz(k,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1149 + ( j13g(k+1,i,j,
i_xyz) * random_mz(k+1,i,j) - j13g(k-1,i,j,
i_xyz) * random_mz(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1150 ) / gsqrt(k,i,j,
i_xyz)
1152 acc(
ks,i,j) = ( j33g * ( random_mx(
ks+1,i,j) - random_mx(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1153 - ( gsqrt(
ks,i+1,j,
i_xyz) * random_mz(
ks,i+1,j) - gsqrt(
ks,i-1,j,
i_xyz) * random_mz(
ks,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1154 + ( j13g(
ks+1,i,j,
i_xyz) * random_mz(
ks+1,i,j) - j13g(
ks,i,j,
i_xyz) * random_mz(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1156 acc(
ke,i,j) = ( j33g * ( random_mx(
ke,i,j) - random_mx(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1157 - ( gsqrt(
ke,i+1,j,
i_xyz) * random_mz(
ke,i+1,j) - gsqrt(
ke,i-1,j,
i_xyz) * random_mz(
ke,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1158 + ( j13g(
ke,i,j,
i_xyz) * random_mz(
ke,i,j) - j13g(
ke-1,i,j,
i_xyz) * random_mz(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1167 momy_t(k,i,j) = ( acc(k,i,j+1) + acc(k,i,j) ) * 0.5_rp
1179 momz_t(k,i,j) = 0.0_rp
1188 momx_t(k,i,j) = 0.0_rp
1197 momy_t(k,i,j) = 0.0_rp
1206 if ( atmos_phy_tb_smg_implicit )
then 1213 ap = - dt * 0.25_rp * ( dens(
ks,i,j)+dens(
ks+1,i,j) ) &
1214 * ( kh(
ks,i,j)+kh(
ks+1,i,j) ) &
1218 b(
ks,i,j) = - a(
ks,i,j) + dens(
ks,i,j)
1220 c(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_xyz)
1221 ap = - dt * 0.25_rp * ( dens(k,i,j)+dens(k+1,i,j) ) &
1222 * ( kh(k,i,j)+kh(k+1,i,j) ) &
1223 * rfdz(k) / gsqrt(k,i,j,
i_xyw)
1224 a(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_xyz)
1225 b(k,i,j) = - a(k,i,j) - c(k,i,j) + dens(k,i,j)
1229 b(
ke,i,j) = - c(
ke,i,j) + dens(
ke,i,j)
1236 call calc_flux_phi( &
1238 dens, pott, kh, 1.0_rp, &
1239 gsqrt, j13g, j23g, j33g, mapf, &
1240 atmos_phy_tb_smg_horizontal, &
1241 atmos_phy_tb_smg_implicit, &
1243 iis, iie, jjs, jje )
1245 if ( atmos_phy_tb_smg_backscatter )
then 1252 dd(k,i,j) = sqrt( ( ( pott(k+1,i,j) - pott(k-1,i,j) ) * j33g / ( fdz(k) + fdz(k-1) ) )**2 &
1253 + ( ( ( gsqrt(k,i+1,j,
i_xyz)*pott(k,i+1,j) - gsqrt(k,i-1,j,
i_xyz)*pott(k,i-1,j) ) / ( fdx(i) + fdx(i-1) ) &
1254 + ( j13g(k+1,i,j,
i_xyz)*pott(k+1,i,j) - j13g(k-1,i,j,
i_xyz)*pott(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) ) * mapf(i,j,1,
i_xy) )**2 &
1255 + ( ( ( gsqrt(k,i,j+1,
i_xyz)*pott(k,i,j+1) - gsqrt(k,i,j-1,
i_xyz)*pott(k,i,j-1) ) / ( fdy(j) + fdy(j-1) ) &
1256 + ( j23g(k+1,i,j,
i_xyz)*pott(k+1,i,j) - j23g(k-1,i,j,
i_xyz)*pott(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) ) * mapf(i,j,2,
i_xy) )**2 &
1257 ) / gsqrt(k,i,j,
i_xyz)
1259 dd(
ks,i,j) = sqrt( ( ( pott(
ks+1,i,j) - pott(
ks,i,j) ) * j33g * rfdz(
ks) )**2 &
1260 + ( ( ( gsqrt(
ks,i+1,j,
i_xyz)*pott(
ks,i+1,j) - gsqrt(
ks,i-1,j,
i_xyz)*pott(
ks,i-1,j) ) / ( fdx(i) + fdx(i-1) ) &
1261 + ( j13g(
ks+1,i,j,
i_xyz)*pott(
ks+1,i,j) - j13g(
ks,i,j,
i_xyz)*pott(
ks,i,j) ) * rfdz(
ks) ) * mapf(i,j,1,
i_xy) )**2 &
1262 + ( ( ( gsqrt(
ks,i,j+1,
i_xyz)*pott(
ks,i,j+1) - gsqrt(
ks,i,j-1,
i_xyz)*pott(
ks,i,j-1) ) / ( fdy(j) + fdy(j-1) ) &
1263 + ( j23g(
ks+1,i,j,
i_xyz)*pott(
ks+1,i,j) - j23g(
ks,i,j,
i_xyz)*pott(
ks,i,j) ) * rfdz(
ks) ) * mapf(i,j,2,
i_xy) )**2 &
1265 dd(
ke,i,j) = sqrt( ( ( pott(
ke,i,j) - pott(
ke-1,i,j) ) * j33g * rfdz(
ke-1) )**2 &
1266 + ( ( ( gsqrt(
ke,i+1,j,
i_xyz)*pott(
ke,i+1,j) - gsqrt(
ke,i-1,j,
i_xyz)*pott(
ke,i-1,j) ) / ( fdx(i) + fdx(i-1) ) &
1267 + ( j13g(
ke,i,j,
i_xyz)*pott(
ke,i,j) - j13g(
ke-1,i,j,
i_xyz)*pott(
ke-1,i,j) ) * rfdz(
ke-1) ) * mapf(i,j,1,
i_xy) )**2 &
1268 + ( ( ( gsqrt(
ke,i,j+1,
i_xyz)*pott(
ke,i,j+1) - gsqrt(
ke,i,j-1,
i_xyz)*pott(
ke,i,j-1) ) / ( fdy(j) + fdy(j-1) ) &
1269 + ( j23g(
ke,i,j,
i_xyz)*pott(
ke,i,j) - j23g(
ke-1,i,j,
i_xyz)*pott(
ke-1,i,j) ) * rfdz(
ke-1) ) * mapf(i,j,2,
i_xy) )**2 &
1279 rhot_t(k,i,j) = ( j33g * ( random_qz(k+1,i,j) * dd(k+1,i,j) - random_qz(k-1,i,j) * dd(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1280 + ( gsqrt(k,i+1,j,
i_xyz) * random_qx(k,i+1,j) * dd(k,i+1,j) - gsqrt(k,i-1,j,
i_xyz) * random_qx(k,i-1,j) * dd(k,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1281 + ( j13g(k+1,i,j,
i_xyz) * random_qx(k+1,i,j) * dd(k+1,i,j) - j13g(k-1,i,j,
i_xyz) * random_qx(k-1,i,j) * dd(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1282 + ( gsqrt(k,i,j+1,
i_xyz) * random_qy(k,i,j+1) * dd(k,i,j+1) - gsqrt(k,i,j-1,
i_xyz) * random_qy(k,i,j-1) * dd(k,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1283 + ( j23g(k+1,i,j,
i_xyz) * random_qy(k+1,i,j) * dd(k+1,i,j) - j23g(k-1,i,j,
i_xyz) * random_qy(k-1,i,j) * dd(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1284 ) / gsqrt(k,i,j,
i_xyz)
1286 rhot_t(
ks,i,j) = ( j33g * ( random_qz(
ks+1,i,j) * dd(
ks+1,i,j) - random_qz(
ks,i,j) * dd(
ks,i,j) ) * rfdz(
ks) &
1287 + ( gsqrt(
ks,i+1,j,
i_xyz) * random_qx(
ks,i+1,j) * dd(
ks,i+1,j) - gsqrt(
ks,i-1,j,
i_xyz) * random_qx(
ks,i-1,j) * dd(
ks,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1288 + ( j13g(
ks+1,i,j,
i_xyz) * random_qx(
ks+1,i,j) * dd(
ks+1,i,j) - j13g(
ks,i,j,
i_xyz) * random_qx(
ks,i,j) * dd(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1289 + ( gsqrt(
ks,i,j+1,
i_xyz) * random_qy(
ks,i,j+1) * dd(
ks,i,j+1) - gsqrt(
ks,i,j-1,
i_xyz) * random_qy(
ks,i,j-1) * dd(
ks,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1290 + ( j23g(
ks+1,i,j,
i_xyz) * random_qy(
ks+1,i,j) * dd(
ks+1,i,j) - j23g(
ks,i,j,
i_xyz) * random_qy(
ks,i,j) * dd(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1292 rhot_t(
ke,i,j) = ( j33g * ( random_qz(
ke,i,j) * dd(
ke,i,j) - random_qz(
ke-1,i,j) * dd(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1293 + ( gsqrt(
ke,i+1,j,
i_xyz) * random_qx(
ke,i+1,j) * dd(
ke,i+1,j) - gsqrt(
ke,i-1,j,
i_xyz) * random_qx(
ke,i-1,j) * dd(
ke,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1294 + ( j13g(
ke,i,j,
i_xyz) * random_qx(
ke,i,j) * dd(
ke,i,j) - j13g(
ke-1,i,j,
i_xyz) * random_qx(
ke-1,i,j) * dd(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1295 + ( gsqrt(
ke,i,j+1,
i_xyz) * random_qy(
ke,i,j+1) * dd(
ke,i,j+1) - gsqrt(
ke,i,j-1,
i_xyz) * random_qy(
ke,i,j-1) * dd(
ke,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1296 + ( j23g(
ke,i,j,
i_xyz) * random_qy(
ke,i,j) * dd(
ke,i,j) - j23g(
ke-1,i,j,
i_xyz) * random_qy(
ke-1,i,j) * dd(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1308 rhot_t(k,i,j) = 0.0_rp
1328 call calc_flux_phi( &
1329 qflx_sgs_rhoq(:,:,:,:,iq), &
1330 dens, qtrc(:,:,:,iq), kh, 1.0_rp, &
1331 gsqrt, j13g, j23g, j33g, mapf, &
1332 atmos_phy_tb_smg_horizontal, &
1333 atmos_phy_tb_smg_implicit, &
1335 iis, iie, jjs, jje )
1338 if ( atmos_phy_tb_smg_backscatter .and. iq ==
i_qv )
then 1345 dd(k,i,j) = sqrt( ( ( qtrc(k+1,i,j,iq) - qtrc(k-1,i,j,iq) ) * j33g / ( fdz(k) + fdz(k-1) ) )**2 &
1346 + ( ( ( gsqrt(k,i+1,j,
i_xyz)*qtrc(k,i+1,j,iq) - gsqrt(k,i-1,j,
i_xyz)*qtrc(k,i-1,j,iq) ) / ( fdx(i) + fdx(i-1) ) &
1347 + ( j13g(k+1,i,j,
i_xyz)*qtrc(k+1,i,j,iq) - j13g(k-1,i,j,
i_xyz)*qtrc(k-1,i,j,iq) ) / ( fdz(k) + fdz(k-1) ) ) * mapf(i,j,1,
i_xy) )**2 &
1348 + ( ( ( gsqrt(k,i,j+1,
i_xyz)*qtrc(k,i,j+1,iq) - gsqrt(k,i,j-1,
i_xyz)*qtrc(k,i,j-1,iq) ) / ( fdy(j) + fdy(j-1) ) &
1349 + ( j23g(k+1,i,j,
i_xyz)*qtrc(k+1,i,j,iq) - j23g(k-1,i,j,
i_xyz)*qtrc(k-1,i,j,iq) ) / ( fdz(k) + fdz(k-1) ) ) * mapf(i,j,2,
i_xy) )**2 &
1350 ) / gsqrt(k,i,j,
i_xyz)
1352 dd(
ks,i,j) = sqrt( ( ( qtrc(
ks+1,i,j,iq) - qtrc(
ks,i,j,iq) ) * j33g * rfdz(
ks) )**2 &
1353 + ( ( ( gsqrt(
ks,i+1,j,
i_xyz)*qtrc(
ks,i+1,j,iq) - gsqrt(
ks,i-1,j,
i_xyz)*qtrc(
ks,i-1,j,iq) ) / ( fdx(i) + fdx(i-1) ) &
1354 + ( j13g(
ks+1,i,j,
i_xyz)*qtrc(
ks+1,i,j,iq) - j13g(
ks,i,j,
i_xyz)*qtrc(
ks,i,j,iq) ) * rfdz(
ks) ) * mapf(i,j,1,
i_xy) )**2 &
1355 + ( ( ( gsqrt(
ks,i,j+1,
i_xyz)*qtrc(
ks,i,j+1,iq) - gsqrt(
ks,i,j-1,
i_xyz)*qtrc(
ks,i,j-1,iq) ) / ( fdy(j) + fdy(j-1) ) &
1356 + ( j23g(
ks+1,i,j,
i_xyz)*qtrc(
ks+1,i,j,iq) - j23g(
ks,i,j,
i_xyz)*qtrc(
ks,i,j,iq) ) * rfdz(
ks) ) * mapf(i,j,2,
i_xy) )**2 &
1358 dd(
ke,i,j) = sqrt( ( ( qtrc(
ke,i,j,iq) - qtrc(
ke-1,i,j,iq) ) * j33g * rfdz(
ke-1) )**2 &
1359 + ( ( ( gsqrt(
ke,i+1,j,
i_xyz)*qtrc(
ke,i+1,j,iq) - gsqrt(
ke,i-1,j,
i_xyz)*qtrc(
ke,i-1,j,iq) ) / ( fdx(i) + fdx(i-1) ) &
1360 + ( j13g(
ke,i,j,
i_xyz)*qtrc(
ke,i,j,iq) - j13g(
ke-1,i,j,
i_xyz)*qtrc(
ke-1,i,j,iq) ) * rfdz(
ke-1) ) * mapf(i,j,1,
i_xy) )**2 &
1361 + ( ( ( gsqrt(
ke,i,j+1,
i_xyz)*qtrc(
ke,i,j+1,iq) - gsqrt(
ke,i,j-1,
i_xyz)*qtrc(
ke,i,j-1,iq) ) / ( fdy(j) + fdy(j-1) ) &
1362 + ( j23g(
ke,i,j,
i_xyz)*qtrc(
ke,i,j,iq) - j23g(
ke-1,i,j,
i_xyz)*qtrc(
ke-1,i,j,iq) ) * rfdz(
ke-1) ) * mapf(i,j,2,
i_xy) )**2 &
1372 rhoq_t(k,i,j,iq) = ( j33g * ( random_qz(k+1,i,j) * dd(k+1,i,j) - random_qz(k-1,i,j) * dd(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1373 + ( gsqrt(k,i+1,j,
i_xyz) * random_qx(k,i+1,j) * dd(k,i+1,j) - gsqrt(k,i-1,j,
i_xyz) * random_qx(k,i-1,j) * dd(k,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1374 + ( j13g(k+1,i,j,
i_xyz) * random_qx(k+1,i,j) * dd(k+1,i,j) - j13g(k-1,i,j,
i_xyz) * random_qx(k-1,i,j) * dd(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1375 + ( gsqrt(k,i,j+1,
i_xyz) * random_qy(k,i,j+1) * dd(k,i,j+1) - gsqrt(k,i,j-1,
i_xyz) * random_qy(k,i,j-1) * dd(k,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1376 + ( j23g(k+1,i,j,
i_xyz) * random_qy(k+1,i,j) * dd(k+1,i,j) - j23g(k-1,i,j,
i_xyz) * random_qy(k-1,i,j) * dd(k-1,i,j) ) / ( fdz(k) + fdz(k-1) ) &
1377 ) / gsqrt(k,i,j,
i_xyz)
1379 rhoq_t(
ks,i,j,iq) = ( j33g * ( random_qz(
ks+1,i,j) * dd(
ks+1,i,j) - random_qz(
ks,i,j) * dd(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1380 + ( gsqrt(
ks,i+1,j,
i_xyz) * random_qx(
ks,i+1,j) * dd(
ks,i+1,j) - gsqrt(
ks,i-1,j,
i_xyz) * random_qx(
ks,i-1,j) * dd(
ks,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1381 + ( j13g(
ks+1,i,j,
i_xyz) * random_qx(
ks+1,i,j) * dd(
ks+1,i,j) - j13g(
ks,i,j,
i_xyz) * random_qx(
ks,i,j) * dd(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1382 + ( gsqrt(
ks,i,j+1,
i_xyz) * random_qy(
ks,i,j+1) * dd(
ks,i,j+1) - gsqrt(
ks,i,j-1,
i_xyz) * random_qy(
ks,i,j-1) * dd(
ks,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1383 + ( j23g(
ks+1,i,j,
i_xyz) * random_qy(
ks+1,i,j) * dd(
ks+1,i,j) - j23g(
ks,i,j,
i_xyz) * random_qy(
ks,i,j) * dd(
ks,i,j) ) * rfdz(
ks) * 0.5_rp &
1385 rhoq_t(
ke,i,j,iq) = ( j33g * ( random_qz(
ke,i,j) * dd(
ke,i,j) - random_qz(
ke-1,i,j) * dd(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1386 + ( gsqrt(
ke,i+1,j,
i_xyz) * random_qx(
ke,i+1,j) * dd(
ke,i+1,j) - gsqrt(
ke,i-1,j,
i_xyz) * random_qx(
ke,i-1,j) * dd(
ke,i-1,j) ) / ( fdx(i) + fdx(i-1) ) * mapf(i,j,1,
i_xy) &
1387 + ( j13g(
ke,i,j,
i_xyz) * random_qx(
ke,i,j) * dd(
ke,i,j) - j13g(
ke-1,i,j,
i_xyz) * random_qx(
ke-1,i,j) * dd(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1388 + ( gsqrt(
ke,i,j+1,
i_xyz) * random_qy(
ke,i,j+1) * dd(
ke,i,j+1) - gsqrt(
ke,i,j-1,
i_xyz) * random_qy(
ke,i,j-1) * dd(
ke,i,j-1) ) / ( fdy(j) + fdy(j-1) ) * mapf(i,j,2,
i_xy) &
1389 + ( j23g(
ke,i,j,
i_xyz) * random_qy(
ke,i,j) * dd(
ke,i,j) - j23g(
ke-1,i,j,
i_xyz) * random_qy(
ke-1,i,j) * dd(
ke-1,i,j) ) * rfdz(
ke-1) * 0.5_rp &
1401 rhoq_t(k,i,j,iq) = 0.0_rp
1416 call file_history_in( tke(:,:,:),
'TKE_SMG',
'turbulent kinetic energy (Smagorinsky)',
'm2/s2', fill_halo=.true. )
subroutine, public atmos_phy_tb_calc_tend_momz(MOMZ_t_TB, QFLX_MOMZ, GSQRT, J13G, J23G, J33G, MAPF, IIS, IIE, JJS, JJE)
subroutine, public atmos_phy_tb_diffusion_solver(phi, a, b, c, d, KE_TB)
subroutine, public atmos_phy_tb_calc_tend_momy(MOMY_t_TB, QFLX_MOMY, GSQRT, J13G, J23G, J33G, MAPF, IIS, IIE, JJS, JJE)
integer, public ia
of whole cells: x, local, with HALO
integer, public iblock
block size for cache blocking: x
logical, dimension(qa_max), public tracer_advc
integer, public ja
of whole cells: y, local, with HALO
integer, public is
start point of inner domain: x, local
integer, public ie
end point of inner domain: x, local
subroutine, public atmos_phy_tb_calc_tend_momx(MOMX_t_TB, QFLX_MOMX, GSQRT, J13G, J23G, J33G, MAPF, IIS, IIE, JJS, JJE)
integer, parameter, public ydir
module atmosphere / hydrometeor
module atmosphere / grid / cartesC index
integer, public ke
end point of inner domain: z, local
integer, public je
end point of inner domain: y, local
real(rp), public const_grav
standard acceleration of gravity [m/s2]
subroutine, public atmos_phy_tb_calc_strain_tensor(S33_C, S11_C, S22_C, S31_C, S12_C, S23_C, S12_Z, S23_X, S31_Y, S2, DENS, MOMZ, MOMX, MOMY, GSQRT, J13G, J23G, J33G, MAPF)
integer, public ks
start point of inner domain: z, local
integer, public jblock
block size for cache blocking: y
integer, public js
start point of inner domain: y, local
integer, parameter, public xdir
module ATMOSPHERE / Physics Turbulence
subroutine, public atmos_phy_tb_calc_flux_phi(qflx_phi, DENS, PHI, Kh, FACT, GSQRT, J13G, J23G, J33G, MAPF, horizontal, implicit, a, b, c, dt, IIS, IIE, JJS, JJE)
real(rp), public const_eps
small number
subroutine, public random_normal(var)
Get normal random number.
integer, public ka
of whole cells: z, local, with HALO
integer, parameter, public zdir