33 #include "inc_openmp.h" 45 #if defined DEBUG || defined QUICKDEBUG 75 real(RP),
private,
parameter :: OneOverThree = 1.0_rp / 3.0_rp
76 real(RP),
private,
parameter :: twoOverThree = 2.0_rp / 3.0_rp
77 real(RP),
private,
parameter :: FourOverThree = 4.0_rp / 3.0_rp
79 real(RP),
private :: Cs = 0.13_rp
80 real(RP),
private,
parameter :: Ck = 0.1_rp
81 real(RP),
private,
parameter :: PrN = 0.7_rp
82 real(RP),
private,
parameter :: RiC = 0.25_rp
83 real(RP),
private,
parameter :: FmC = 16.0_rp
84 real(RP),
private,
parameter :: FhB = 40.0_rp
85 real(RP),
private :: RPrN
86 real(RP),
private :: RRiC
87 real(RP),
private :: PrNovRiC
89 real(RP),
private,
allocatable :: nu_fact (:,:,:)
91 integer,
private :: I_TKE = -1
93 real(RP),
private :: ATMOS_PHY_TB_SMG_NU_MAX = 10000.0_rp
94 logical,
private :: ATMOS_PHY_TB_SMG_implicit = .false.
95 logical,
private :: ATMOS_PHY_TB_SMG_bottom = .false.
96 logical,
private :: ATMOS_PHY_TB_SMG_horizontal = .false.
98 real(RP),
private :: tke_fact
113 character(len=*),
intent(in) :: type_tb
114 integer,
intent(out) :: i_tke_out
118 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[Turbulence Tracer] / Categ[ATMOS PHYSICS] / Origin[SCALElib]' 119 if(
io_l )
write(
io_fid_log,*)
'*** Tracers for Smagorinsky-type Eddy Viscocity Model' 121 if ( type_tb /=
'SMAGORINSKY' )
then 122 write(*,*)
'xxx ATMOS_PHY_TB_TYPE is not SMAGORINSKY. Check!' 129 (/
'turbulent kinetic energy (Smagorinsky)' /), &
131 advc = (/ .false. /) )
146 real(RP),
intent(in) :: cdz(
ka)
147 real(RP),
intent(in) :: cdx(
ia)
148 real(RP),
intent(in) :: cdy(
ja)
149 real(RP),
intent(in) :: cz (
ka,
ia,
ja)
151 real(RP) :: atmos_phy_tb_smg_cs
152 real(RP) :: atmos_phy_tb_smg_filter_fact = 2.0_rp
153 logical :: atmos_phy_tb_smg_consistent_tke = .true.
155 namelist / param_atmos_phy_tb_smg / &
156 atmos_phy_tb_smg_cs, &
157 atmos_phy_tb_smg_nu_max, &
158 atmos_phy_tb_smg_filter_fact, &
159 atmos_phy_tb_smg_implicit, &
160 atmos_phy_tb_smg_consistent_tke, &
161 atmos_phy_tb_smg_horizontal, &
162 atmos_phy_tb_smg_bottom
169 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[Turbulence] / Categ[ATMOS PHYSICS] / Origin[SCALElib]' 170 if(
io_l )
write(
io_fid_log,*)
'*** Smagorinsky-type Eddy Viscocity Model' 172 atmos_phy_tb_smg_cs = cs
176 read(
io_fid_conf,nml=param_atmos_phy_tb_smg,iostat=ierr)
178 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 179 elseif( ierr > 0 )
then 180 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_TB_SMG. Check!' 185 cs = atmos_phy_tb_smg_cs
189 prnovric = ( 1.0_rp - prn ) * rric
191 allocate( nu_fact(
ka,
ia,
ja) )
194 nu_fact(:,:,:) = undef
196 if ( atmos_phy_tb_smg_horizontal )
then 200 nu_fact(k,i,j) = cs**2 * ( cdx(i) * cdy(j) )
205 i = iundef; j = iundef; k = iundef
207 atmos_phy_tb_smg_consistent_tke = .false.
208 atmos_phy_tb_smg_implicit = .false.
213 nu_fact(k,i,j) = ( cs *
mixlen(cdz(k),cdx(i),cdy(j),cz(k,i,j),atmos_phy_tb_smg_filter_fact) )**2
218 i = iundef; j = iundef; k = iundef
222 if ( atmos_phy_tb_smg_consistent_tke )
then 233 qflx_sgs_momz, qflx_sgs_momx, qflx_sgs_momy, &
234 qflx_sgs_rhot, qflx_sgs_rhoq, &
237 MOMZ, MOMX, MOMY, RHOT, DENS, QTRC, N2, &
238 SFLX_MW, SFLX_MU, SFLX_MV, SFLX_SH, SFLX_Q, &
239 GSQRT, J13G, J23G, J33G, MAPF, dt )
267 real(RP),
intent(out) :: qflx_sgs_momz(
ka,
ia,
ja,3)
268 real(RP),
intent(out) :: qflx_sgs_momx(
ka,
ia,
ja,3)
269 real(RP),
intent(out) :: qflx_sgs_momy(
ka,
ia,
ja,3)
270 real(RP),
intent(out) :: qflx_sgs_rhot(
ka,
ia,
ja,3)
271 real(RP),
intent(out) :: qflx_sgs_rhoq(
ka,
ia,
ja,3,
qa)
273 real(RP),
intent(inout) :: rhoq_t (
ka,
ia,
ja,
qa)
275 real(RP),
intent(out) :: nu (
ka,
ia,
ja)
276 real(RP),
intent(out) :: ri (
ka,
ia,
ja)
277 real(RP),
intent(out) :: pr (
ka,
ia,
ja)
279 real(RP),
intent(in) :: momz (
ka,
ia,
ja)
280 real(RP),
intent(in) :: momx (
ka,
ia,
ja)
281 real(RP),
intent(in) :: momy (
ka,
ia,
ja)
282 real(RP),
intent(in) :: rhot (
ka,
ia,
ja)
283 real(RP),
intent(in) :: dens (
ka,
ia,
ja)
284 real(RP),
intent(in) :: qtrc (
ka,
ia,
ja,
qa)
285 real(RP),
intent(in) :: n2 (
ka,
ia,
ja)
287 real(RP),
intent(in) :: sflx_mw (
ia,
ja)
288 real(RP),
intent(in) :: sflx_mu (
ia,
ja)
289 real(RP),
intent(in) :: sflx_mv (
ia,
ja)
290 real(RP),
intent(in) :: sflx_sh (
ia,
ja)
291 real(RP),
intent(in) :: sflx_q (
ia,
ja,
qa)
293 real(RP),
intent(in) :: gsqrt (
ka,
ia,
ja,7)
294 real(RP),
intent(in) :: j13g (
ka,
ia,
ja,7)
295 real(RP),
intent(in) :: j23g (
ka,
ia,
ja,7)
296 real(RP),
intent(in) :: j33g
297 real(RP),
intent(in) :: mapf(
ia,
ja,2,4)
298 real(DP),
intent(in) :: dt
301 real(RP) :: tke (
ka,
ia,
ja)
302 real(RP) :: pott (
ka,
ia,
ja)
305 real(RP) :: s33_c(
ka,
ia,
ja)
306 real(RP) :: s11_c(
ka,
ia,
ja)
307 real(RP) :: s22_c(
ka,
ia,
ja)
308 real(RP) :: s31_c(
ka,
ia,
ja)
309 real(RP) :: s12_c(
ka,
ia,
ja)
310 real(RP) :: s23_c(
ka,
ia,
ja)
311 real(RP) :: s12_z(
ka,
ia,
ja)
312 real(RP) :: s23_x(
ka,
ia,
ja)
313 real(RP) :: s31_y(
ka,
ia,
ja)
318 real(RP) :: tend (
ka,
ia,
ja)
328 integer :: k, i, j, iq
331 if(
io_l )
write(
io_fid_log,*)
'*** Atmos physics step: Turbulence(smagorinsky)' 334 qflx_sgs_momz(:,:,:,:) = undef
335 qflx_sgs_momx(:,:,:,:) = undef
336 qflx_sgs_momy(:,:,:,:) = undef
337 qflx_sgs_rhot(:,:,:,:) = undef
338 qflx_sgs_rhoq(:,:,:,:,:) = undef
350 qflx_sgs_momz(
ks:
ke, 1:
is-1, : ,:) = undef
351 qflx_sgs_momz(
ks:
ke,
ie+1:
ia , : ,:) = undef
352 qflx_sgs_momz(
ks:
ke, : , 1:
js-1,:) = undef
353 qflx_sgs_momz(
ks:
ke, : ,
je+1:
ja ,:) = undef
354 qflx_sgs_momx(
ks:
ke, 1:
is-1, : ,:) = undef
355 qflx_sgs_momx(
ks:
ke,
ie+1:
ia , : ,:) = undef
356 qflx_sgs_momx(
ks:
ke, : , 1:
js-1,:) = undef
357 qflx_sgs_momx(
ks:
ke, : ,
je+1:
ja ,:) = undef
358 qflx_sgs_momy(
ks:
ke, 1:
is-1, : ,:) = undef
359 qflx_sgs_momy(
ks:
ke,
ie+1:
ia , : ,:) = undef
360 qflx_sgs_momy(
ks:
ke, : , 1:
js-1,:) = undef
361 qflx_sgs_momy(
ks:
ke, : ,
je+1:
ja ,:) = undef
372 call check( __line__, rhot(k,i,j) )
373 call check( __line__, dens(k,i,j) )
375 pott(k,i,j) = rhot(k,i,j) / dens(k,i,j)
380 i = iundef; j = iundef; k = iundef
385 call calc_strain_tensor( &
386 s33_c, s11_c, s22_c, &
387 s31_c, s12_c, s23_c, &
388 s12_z, s23_x, s31_y, &
390 dens, momz, momx, momy, &
391 gsqrt, j13g, j23g, j33g, mapf )
403 call check( __line__, s2(k,i,j) )
404 call check( __line__, n2(k,i,j) )
406 ri(k,i,j) = n2(k,i,j) / s2(k,i,j)
411 i = iundef; j = iundef; k = iundef
418 call check( __line__, ri(k,i,j) )
419 call check( __line__, nu_fact(k,i,j) )
420 call check( __line__, s2(k,i,j) )
422 if ( ri(k,i,j) < 0.0_rp )
then 423 nu(k,i,j) = nu_fact(k,i,j) &
424 * sqrt( s2(k,i,j) * (1.0_rp - fmc*ri(k,i,j)) )
425 else if ( ri(k,i,j) < ric )
then 426 nu(k,i,j) = nu_fact(k,i,j) &
427 * sqrt( s2(k,i,j) ) * ( 1.0_rp - ri(k,i,j)*rric )**4
435 i = iundef; j = iundef; k = iundef
442 call check( __line__, ri(k,i,j) )
444 if ( ri(k,i,j) < 0.0_rp )
then 445 pr(k,i,j) = sqrt( ( 1.0_rp - fmc*ri(k,i,j) ) &
446 / ( 1.0_rp - fhb*ri(k,i,j) ) ) * prn
447 else if ( ri(k,i,j) < ric )
then 448 pr(k,i,j) = prn / ( 1.0_rp - prnovric * ri(k,i,j) )
452 kh(k,i,j) = min( nu(k,i,j)/pr(k,i,j), atmos_phy_tb_smg_nu_max )
453 nu(k,i,j) = min( nu(k,i,j), atmos_phy_tb_smg_nu_max )
454 pr(k,i,j) = nu(k,i,j) / ( kh(k,i,j) + ( 0.5_rp - sign(0.5_rp, kh(k,i,j)-eps) ) )
459 i = iundef; j = iundef; k = iundef
471 call check( __line__, nu(k,i,j) )
472 call check( __line__, nu_fact(k,i,j) )
474 tke(k,i,j) = ( nu(k,i,j) * cs / ck )**2 / nu_fact(k,i,j)
479 i = iundef; j = iundef; k = iundef
484 if ( atmos_phy_tb_smg_horizontal )
then 485 qflx_sgs_momz(:,:,:,
zdir) = 0.0_rp
491 call check( __line__, dens(k,i,j) )
492 call check( __line__, nu(k,i,j) )
493 call check( __line__, s33_c(k,i,j) )
494 call check( __line__, s11_c(k,i,j) )
495 call check( __line__, s22_c(k,i,j) )
496 call check( __line__, tke(k,i,j) )
498 qflx_sgs_momz(k,i,j,
zdir) = dens(k,i,j) * ( &
499 - 2.0_rp * nu(k,i,j) &
500 * ( s33_c(k,i,j) - ( s11_c(k,i,j) + s22_c(k,i,j) + s33_c(k,i,j) ) * oneoverthree * tke_fact ) &
501 + twooverthree * tke(k,i,j) * tke_fact )
506 i = iundef; j = iundef; k = iundef
510 qflx_sgs_momz(
ks,i,j,
zdir) = 0.0_rp
511 qflx_sgs_momz(
ke,i,j,
zdir) = 0.0_rp
515 i = iundef; j = iundef; k = iundef
523 call check( __line__, dens(k,i,j) )
524 call check( __line__, dens(k,i+1,j) )
525 call check( __line__, dens(k+1,i,j) )
526 call check( __line__, dens(k+1,i+1,j) )
527 call check( __line__, nu(k,i,j) )
528 call check( __line__, nu(k,i+1,j) )
529 call check( __line__, nu(k+1,i,j) )
530 call check( __line__, nu(k+1,i+1,j) )
531 call check( __line__, s31_y(k,i,j) )
533 qflx_sgs_momz(k,i,j,
xdir) = - 0.125_rp &
534 * ( dens(k,i,j)+dens(k+1,i,j)+dens(k,i+1,j)+dens(k+1,i+1,j) ) &
535 * ( nu(k,i,j)+nu(k+1,i,j)+nu(k,i+1,j)+nu(k+1,i+1,j)) &
541 i = iundef; j = iundef; k = iundef
551 call check( __line__, dens(k,i,j) )
552 call check( __line__, dens(k,i,j+1) )
553 call check( __line__, dens(k+1,i,j) )
554 call check( __line__, dens(k+1,i,j+1) )
555 call check( __line__, nu(k,i,j) )
556 call check( __line__, nu(k,i,j+1) )
557 call check( __line__, nu(k+1,i,j) )
558 call check( __line__, nu(k+1,i,j+1) )
559 call check( __line__, s23_x(k,i,j) )
561 qflx_sgs_momz(k,i,j,
ydir) = - 0.125_rp &
562 * ( dens(k,i,j)+dens(k+1,i,j)+dens(k,i,j+1)+dens(k+1,i,j+1) ) &
563 * ( nu(k,i,j)+nu(k+1,i,j)+nu(k,i,j+1)+nu(k+1,i,j+1) ) &
569 i = iundef; j = iundef; k = iundef
572 if ( atmos_phy_tb_smg_implicit )
then 574 call calc_tend_momz( tend, &
576 gsqrt, j13g, j23g, j33g, mapf, &
582 ap = - fouroverthree * dt &
583 * dens(
ks+1,i,j)*nu(
ks+1,i,j) &
587 b(
ks,i,j) = - a(
ks,i,j) + 0.5_rp * ( dens(
ks,i,j)+dens(
ks+1,i,j) )
589 c(k,i,j) = ap * rfdz(k+1) / gsqrt(k+1,i,j,
i_xyw)
590 ap = - fouroverthree * dt &
591 * dens(k+1,i,j)*nu(k+1,i,j) &
592 * rcdz(k+1) / gsqrt(k+1,i,j,
i_xyz)
593 a(k,i,j) = ap * rfdz(k) / gsqrt(k,i,j,
i_xyw)
594 b(k,i,j) = - a(k,i,j) - c(k,i,j) + 0.5_rp * ( dens(k,i,j)+dens(k+1,i,j) )
598 b(
ke-1,i,j) = - c(
ke-1,i,j) + 0.5_rp * ( dens(
ke-1,i,j)+dens(
ke,i,j) )
604 call diffusion_solver( &
606 a(:,i,j), b(:,i,j), c(:,i,j), d, &
610 qflx_sgs_momz(k,i,j,
zdir) = qflx_sgs_momz(k,i,j,
zdir) &
611 - fouroverthree * dens(k,i,j) * nu(k,i,j) * dt &
612 * ( tend(k,i,j) - tend(k-1,i,j) ) * rcdz(k) / gsqrt(k,i,j,
i_xyz)
622 if ( atmos_phy_tb_smg_horizontal )
then 623 qflx_sgs_momx(:,:,:,
zdir) = 0.0_rp
629 call check( __line__, dens(k,i,j) )
630 call check( __line__, dens(k,i+1,j) )
631 call check( __line__, dens(k+1,i,j) )
632 call check( __line__, dens(k+1,i+1,j) )
633 call check( __line__, nu(k,i,j) )
634 call check( __line__, nu(k,i+1,j) )
635 call check( __line__, nu(k+1,i,j) )
636 call check( __line__, nu(k+1,i+1,j) )
637 call check( __line__, s31_y(k,i,j) )
639 qflx_sgs_momx(k,i,j,
zdir) = - 0.125_rp &
640 * ( dens(k,i,j)+dens(k+1,i,j)+dens(k,i+1,j)+dens(k+1,i+1,j) ) &
641 * ( nu(k,i,j)+nu(k+1,i,j)+nu(k,i+1,j)+nu(k+1,i+1,j) ) &
647 i = iundef; j = iundef; k = iundef
651 qflx_sgs_momx(
ks-1,i,j,
zdir) = 0.0_rp
652 qflx_sgs_momx(
ke ,i,j,
zdir) = 0.0_rp
656 i = iundef; j = iundef; k = iundef
667 call check( __line__, dens(k,i,j) )
668 call check( __line__, nu(k,i,j) )
669 call check( __line__, s11_c(k,i,j) )
670 call check( __line__, s22_c(k,i,j) )
671 call check( __line__, s33_c(k,i,j) )
672 call check( __line__, tke(k,i,j) )
674 qflx_sgs_momx(k,i,j,
xdir) = dens(k,i,j) * ( &
675 - 2.0_rp * nu(k,i,j) &
676 * ( s11_c(k,i,j) - ( s11_c(k,i,j) + s22_c(k,i,j) + s33_c(k,i,j) ) * oneoverthree * tke_fact ) &
677 + twooverthree * tke(k,i,j) * tke_fact )
682 i = iundef; j = iundef; k = iundef
692 call check( __line__, dens(k,i,j) )
693 call check( __line__, dens(k,i+1,j) )
694 call check( __line__, dens(k,i,j+1) )
695 call check( __line__, dens(k,i+1,j+1) )
696 call check( __line__, nu(k,i,j) )
697 call check( __line__, nu(k,i+1,j) )
698 call check( __line__, nu(k,i,j+1) )
699 call check( __line__, nu(k,i+1,j+1) )
700 call check( __line__, s12_z(k,i,j) )
702 qflx_sgs_momx(k,i,j,
ydir) = - 0.125_rp &
703 * ( dens(k,i,j)+dens(k,i+1,j)+dens(k,i,j+1)+dens(k,i+1,j+1) ) &
704 * ( nu(k,i,j)+nu(k,i+1,j)+nu(k,i,j+1)+nu(k,i+1,j+1) ) &
710 i = iundef; j = iundef; k = iundef
713 if ( atmos_phy_tb_smg_implicit )
then 714 call calc_tend_momx( tend, &
716 gsqrt, j13g, j23g, j33g, mapf, &
722 ap = - dt * 0.25_rp * ( dens(
ks ,i ,j)*nu(
ks ,i ,j) &
723 + dens(
ks+1,i ,j)*nu(
ks+1,i ,j) &
724 + dens(
ks ,i+1,j)*nu(
ks ,i+1,j) &
725 + dens(
ks+1,i+1,j)*nu(
ks+1,i+1,j) ) &
729 b(
ks,i,j) = - a(
ks,i,j) + 0.5_rp * ( dens(
ks,i,j)+dens(
ks,i+1,j) )
731 c(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_uyz)
732 ap = - dt * 0.25_rp * ( dens(k ,i ,j)*nu(k ,i ,j) &
733 + dens(k+1,i ,j)*nu(k+1,i ,j) &
734 + dens(k ,i+1,j)*nu(k ,i+1,j) &
735 + dens(k+1,i+1,j)*nu(k+1,i+1,j) ) &
736 * rfdz(k) / gsqrt(k,i,j,
i_uyw)
737 a(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_uyz)
738 b(k,i,j) = - a(k,i,j) - c(k,i,j) + 0.5_rp * ( dens(k,i,j)+dens(k,i+1,j) )
742 b(
ke,i,j) = - c(
ke,i,j) + 0.5_rp * ( dens(
ke,i,j)+dens(
ke,i+1,j) )
748 call diffusion_solver( &
750 a(:,i,j), b(:,i,j), c(:,i,j), d, &
754 qflx_sgs_momx(k,i,j,
zdir) = qflx_sgs_momx(k,i,j,
zdir) &
755 - 0.25_rp * ( dens(k ,i ,j)*nu(k ,i ,j) &
756 + dens(k+1,i ,j)*nu(k+1,i ,j) &
757 + dens(k ,i+1,j)*nu(k ,i+1,j) &
758 + dens(k+1,i+1,j)*nu(k+1,i+1,j) ) &
759 * dt * ( tend(k+1,i,j) - tend(k,i,j) ) * rfdz(k) / gsqrt(k,i,j,
i_uyw)
769 if ( atmos_phy_tb_smg_horizontal )
then 770 qflx_sgs_momy(:,:,:,
zdir) = 0.0_rp
776 call check( __line__, dens(k,i,j) )
777 call check( __line__, dens(k,i,j+1) )
778 call check( __line__, dens(k+1,i,j) )
779 call check( __line__, dens(k+1,i,j+1) )
780 call check( __line__, nu(k,i,j) )
781 call check( __line__, nu(k,i,j+1) )
782 call check( __line__, nu(k+1,i,j) )
783 call check( __line__, nu(k+1,i,j+1) )
784 call check( __line__, s23_x(k,i,j) )
786 qflx_sgs_momy(k,i,j,
zdir) = - 0.125_rp &
787 * ( dens(k,i,j)+dens(k+1,i,j)+dens(k,i,j+1)+dens(k+1,i,j+1) ) &
788 * ( nu(k,i,j)+nu(k+1,i,j)+nu(k,i,j+1)+nu(k+1,i,j+1) ) &
794 i = iundef; j = iundef; k = iundef
798 qflx_sgs_momy(
ks-1,i,j,
zdir) = 0.0_rp
799 qflx_sgs_momy(
ke ,i,j,
zdir) = 0.0_rp
803 i = iundef; j = iundef; k = iundef
815 call check( __line__, dens(k,i,j) )
816 call check( __line__, dens(k,i+1,j) )
817 call check( __line__, dens(k,i,j+1) )
818 call check( __line__, dens(k,i+1,j+1) )
819 call check( __line__, nu(k,i,j) )
820 call check( __line__, nu(k,i+1,j) )
821 call check( __line__, nu(k,i,j+1) )
822 call check( __line__, nu(k,i+1,j+1) )
823 call check( __line__, s12_z(k,i,j) )
825 qflx_sgs_momy(k,i,j,
xdir) = - 0.125_rp &
826 * ( dens(k,i,j)+dens(k,i+1,j)+dens(k,i,j+1)+dens(k,i+1,j+1) ) &
827 * ( nu(k,i,j)+nu(k,i+1,j)+nu(k,i,j+1)+nu(k,i+1,j+1) ) &
833 i = iundef; j = iundef; k = iundef
844 call check( __line__, dens(k,i,j) )
845 call check( __line__, nu(k,i,j) )
846 call check( __line__, s11_c(k,i,j) )
847 call check( __line__, s22_c(k,i,j) )
848 call check( __line__, s33_c(k,i,j) )
849 call check( __line__, tke(k,i,j) )
851 qflx_sgs_momy(k,i,j,
ydir) = dens(k,i,j) * ( &
852 - 2.0_rp * nu(k,i,j) &
853 * ( s22_c(k,i,j) - ( s11_c(k,i,j) + s22_c(k,i,j) + s33_c(k,i,j) ) * oneoverthree * tke_fact ) &
854 + twooverthree * tke(k,i,j) * tke_fact)
859 i = iundef; j = iundef; k = iundef
862 if ( atmos_phy_tb_smg_implicit )
then 863 call calc_tend_momy( tend, &
865 gsqrt, j13g, j23g, j33g, mapf, &
871 ap = - dt * 0.25_rp * ( dens(
ks ,i,j )*nu(
ks ,i,j ) &
872 + dens(
ks+1,i,j )*nu(
ks+1,i,j ) &
873 + dens(
ks ,i,j+1)*nu(
ks ,i,j+1) &
874 + dens(
ks+1,i,j+1)*nu(
ks+1,i,j+1) ) &
878 b(
ks,i,j) = - a(
ks,i,j) + 0.5_rp * ( dens(
ks,i,j)+dens(
ks,i,j+1) )
880 c(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_xvz)
881 ap = - dt * 0.25_rp * ( dens(k ,i,j )*nu(k ,i,j ) &
882 + dens(k+1,i,j )*nu(k+1,i,j ) &
883 + dens(k ,i,j+1)*nu(k ,i,j+1) &
884 + dens(k+1,i,j+1)*nu(k+1,i,j+1) ) &
885 * rfdz(k) / gsqrt(k,i,j,
i_xvw)
886 a(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_xvz)
887 b(k,i,j) = - a(k,i,j) - c(k,i,j) + 0.5_rp * ( dens(k,i,j)+dens(k,i,j+1) )
891 b(
ke,i,j) = - c(
ke,i,j) + 0.5_rp * ( dens(
ke,i,j)+dens(
ke,i,j+1) )
897 call diffusion_solver( &
899 a(:,i,j), b(:,i,j), c(:,i,j), d, &
903 qflx_sgs_momy(k,i,j,
zdir) = qflx_sgs_momy(k,i,j,
zdir) &
904 - 0.25_rp * ( dens(k ,i,j )*nu(k ,i,j ) &
905 + dens(k+1,i,j )*nu(k+1,i,j ) &
906 + dens(k ,i,j+1)*nu(k ,i,j+1) &
907 + dens(k+1,i,j+1)*nu(k+1,i,j+1) ) &
908 * dt * ( tend(k+1,i,j) - tend(k,i,j) ) * rfdz(k) / gsqrt(k,i,j,
i_xvw)
918 if ( atmos_phy_tb_smg_implicit )
then 923 ap = - dt * 0.25_rp * ( dens(
ks,i,j)+dens(
ks+1,i,j) ) &
924 * ( kh(
ks,i,j)+kh(
ks+1,i,j) ) &
928 b(
ks,i,j) = - a(
ks,i,j) + dens(
ks,i,j)
930 c(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_xyz)
931 ap = - dt * 0.25_rp * ( dens(k,i,j)+dens(k+1,i,j) ) &
932 * ( kh(k,i,j)+kh(k+1,i,j) ) &
933 * rfdz(k) / gsqrt(k,i,j,
i_xyw)
934 a(k,i,j) = ap * rcdz(k) / gsqrt(k,i,j,
i_xyz)
935 b(k,i,j) = - a(k,i,j) - c(k,i,j) + dens(k,i,j)
939 b(
ke,i,j) = - c(
ke,i,j) + dens(
ke,i,j)
946 call calc_flux_phi( &
948 dens, pott, kh, 1.0_rp, &
949 gsqrt, j13g, j23g, j33g, mapf, &
951 atmos_phy_tb_smg_implicit, &
961 if ( iq == i_tke .or. .not.
tracer_advc(iq) ) cycle
968 call calc_flux_phi( &
969 qflx_sgs_rhoq(:,:,:,:,iq), &
970 dens, qtrc(:,:,:,iq), kh, 1.0_rp, &
971 gsqrt, j13g, j23g, j33g, mapf, &
973 atmos_phy_tb_smg_implicit, &
980 iis = iundef; iie = iundef; jjs = iundef; jje = iundef
991 rhoq_t(k,i,j,i_tke) = ( tke(k,i,j) - qtrc(k,i,j,i_tke) ) * dens(k,i,j) / dt
1000 function mixlen(dz, dx, dy, z, filter_fact)
1004 real(RP),
intent(in) :: dz
1005 real(RP),
intent(in) :: dx
1006 real(RP),
intent(in) :: dy
1007 real(RP),
intent(in) :: z
1008 real(RP),
intent(in) :: filter_fact
1013 d0 =
fact(dz, dx, dy) * filter_fact * ( dz * dx * dy )**oneoverthree
1014 if ( atmos_phy_tb_smg_bottom )
then 1015 mixlen = sqrt( 1.0_rp / ( 1.0_rp/d0**2 + 1.0_rp/(karman*z)**2 ) )
1023 function fact(dz, dx, dy)
1024 real(RP),
intent(in) :: dz
1025 real(RP),
intent(in) :: dx
1026 real(RP),
intent(in) :: dy
1029 real(RP),
parameter :: oot = -1.0_rp/3.0_rp
1030 real(RP),
parameter :: fot = 5.0_rp/3.0_rp
1031 real(RP),
parameter :: eot = 11.0_rp/3.0_rp
1032 real(RP),
parameter :: tof = -3.0_rp/4.0_rp
1033 real(RP) :: a1, a2, b1, b2, dmax
1036 dmax = max(dz, dx, dy)
1037 if ( dz == dmax )
then 1040 else if ( dx == dmax )
then 1050 fact = 1.736_rp * (a1*a2)**oot &
1051 * ( 4.0_rp*p1(b1)*a1**oot + 0.222_rp*p2(b1)*a1**fot + 0.077*p3(b1)*a1**eot - 3.0_rp*b1 &
1052 + 4.0_rp*p1(b2)*a2**oot + 0.222_rp*p2(b2)*a2**fot + 0.077*p3(b2)*a2**eot - 3.0_rp*b2 &
1057 real(RP),
intent(in) :: z
1060 p1 = 2.5_rp * p2(z) - 1.5_rp * sin(z) * cos(z)**twooverthree
1064 real(RP),
intent(in) :: z
1067 p2 = 0.986_rp * z + 0.073_rp * z**2 - 0.418_rp * z**3 + 0.120_rp * z**4
1071 real(RP),
intent(in) :: z
1074 p3 = 0.976_rp * z + 0.188_rp * z**2 - 1.169_rp * z**3 + 0.755_rp * z**4 - 0.151_rp * z**5
integer, public is
start point of inner domain: x, local
subroutine, public atmos_phy_tb_calc_tend_momz(MOMZ_t_TB, QFLX_MOMZ, GSQRT, J13G, J23G, J33G, MAPF, IIS, IIE, JJS, JJE)
integer, public je
end point of inner domain: y, local
subroutine, public prc_mpistop
Abort MPI.
subroutine, public atmos_phy_tb_diffusion_solver(phi, a, b, c, d, KE_TB)
subroutine, public atmos_phy_tb_calc_flux_phi(qflx_phi, DENS, PHI, Kh, FACT, GSQRT, J13G, J23G, J33G, MAPF, a, b, c, dt, implicit, IIS, IIE, JJS, JJE)
integer, public iblock
block size for cache blocking: x
subroutine, public atmos_phy_tb_calc_tend_momy(MOMY_t_TB, QFLX_MOMY, GSQRT, J13G, J23G, J33G, MAPF, IIS, IIE, JJS, JJE)
logical, public io_l
output log or not? (this process)
integer, parameter, public zdir
real(rp) function fact(dz, dx, dy)
integer, parameter, public ydir
integer, public ke
end point of inner domain: z, local
integer, parameter, public xdir
subroutine, public atmos_phy_tb_smg_setup(CDZ, CDX, CDY, CZ)
Setup.
logical, dimension(qa_max), public tracer_advc
subroutine, public check(current_line, v)
Undefined value checker.
real(rp), dimension(:), allocatable, public grid_rcdz
reciprocal of center-dz
real(rp), parameter, public const_karman
von Karman constant
real(rp), public const_undef
real(rp) function mixlen(dz, dx, dy, z, filter_fact)
subroutine, public atmos_phy_tb_calc_tend_phi(phi_t_TB, QFLX_phi, GSQRT, J13G, J23G, J33G, MAPF, IIS, IIE, JJS, JJE)
logical, public io_nml
output log or not? (for namelist, this process)
module ATMOSPHERE / Physics Turbulence
integer, public ia
of whole cells: x, local, with HALO
subroutine, public atmos_phy_tb_calc_tend_momx(MOMX_t_TB, QFLX_MOMX, GSQRT, J13G, J23G, J33G, MAPF, IIS, IIE, JJS, JJE)
integer, public ka
of whole cells: z, local, with HALO
integer, public jblock
block size for cache blocking: y
real(rp), public const_grav
standard acceleration of gravity [m/s2]
integer, public js
start point of inner domain: y, local
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, parameter, public const_undef2
undefined value (INT2)
integer, public ks
start point of inner domain: z, local
module ATMOSPHERE / Physics Turbulence
subroutine, public atmos_phy_tb_smg(qflx_sgs_momz, qflx_sgs_momx, qflx_sgs_momy, qflx_sgs_rhot, qflx_sgs_rhoq, RHOQ_t, Nu, Ri, Pr, MOMZ, MOMX, MOMY, RHOT, DENS, QTRC, N2, SFLX_MW, SFLX_MU, SFLX_MV, SFLX_SH, SFLX_Q, GSQRT, J13G, J23G, J33G, MAPF, dt)
integer, public ie
end point of inner domain: x, local
real(rp), public const_eps
small number
real(rp), dimension(:), allocatable, public grid_rfdz
reciprocal of face-dz
integer, public io_fid_conf
Config file ID.
subroutine, public tracer_regist(QS, NQ, NAME, DESC, UNIT, CV, CP, R, ADVC, MASS)
Regist tracer.
integer, public io_fid_log
Log file ID.
subroutine, public atmos_phy_tb_smg_config(TYPE_TB, I_TKE_out)
Config.
integer, public io_fid_nml
Log file ID (only for output namelist)
integer, public ja
of whole cells: y, local, with HALO