29 use fv_mp_nlm_mod,
only: start_group_halo_update, complete_group_halo_update
55 real,
allocatable ::
rf(:)
59 real,
allocatable:: u00(:,:,:), v00(:,:,:)
70 subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, &
71 reproduce_sum, kappa, cp_air, zvir, ptop, ks, ncnst, n_split, &
72 q_split, u, v, w, delz, hydrostatic, pt, delp, q, &
73 ps, pe, pk, peln, pkz, phis, q_con, omga, ua, va, uc, vc, &
74 ak, bk, mfx, mfy, cx, cy, ze0, hybrid_z, &
75 gridstruct, flagstruct, neststruct, idiag, bd, &
76 parent_grid, domain, time_total)
78 real,
intent(IN) :: bdt
79 real,
intent(IN) :: consv_te
80 real,
intent(IN) :: kappa, cp_air
81 real,
intent(IN) :: zvir, ptop
82 real,
intent(IN),
optional :: time_total
84 integer,
intent(IN) :: npx
85 integer,
intent(IN) :: npy
86 integer,
intent(IN) :: npz
87 integer,
intent(IN) :: nq_tot
88 integer,
intent(IN) :: ng
89 integer,
intent(IN) :: ks
90 integer,
intent(IN) :: ncnst
91 integer,
intent(IN) :: n_split
92 integer,
intent(IN) :: q_split
93 logical,
intent(IN) :: fill
94 logical,
intent(IN) :: reproduce_sum
95 logical,
intent(IN) :: hydrostatic
96 logical,
intent(IN) :: hybrid_z
99 real,
intent(inout),
dimension(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz) :: u
100 real,
intent(inout),
dimension(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz) :: v
101 real,
intent(inout) :: w( bd%isd: ,bd%jsd: ,1:)
102 real,
intent(inout) :: pt( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
103 real,
intent(inout) :: delp(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
104 real,
intent(inout) :: q( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz, ncnst)
105 real,
intent(inout) :: delz(bd%isd:,bd%jsd:,1:)
106 real,
intent(inout) :: ze0(bd%is:, bd%js: ,1:)
114 real,
intent(inout) :: ps (bd%isd:bd%ied ,bd%jsd:bd%jed)
115 real,
intent(inout) :: pe (bd%is-1:bd%ie+1, npz+1,bd%js-1:bd%je+1)
116 real,
intent(inout) :: pk (bd%is:bd%ie,bd%js:bd%je, npz+1)
117 real,
intent(inout) :: peln(bd%is:bd%ie,npz+1,bd%js:bd%je)
118 real,
intent(inout) :: pkz (bd%is:bd%ie,bd%js:bd%je,npz)
119 real,
intent(inout):: q_con(bd%isd:, bd%jsd:, 1:)
124 real,
intent(inout) :: phis(bd%isd:bd%ied,bd%jsd:bd%jed)
125 real,
intent(inout) :: omga(bd%isd:bd%ied,bd%jsd:bd%jed,npz)
126 real,
intent(inout) :: uc(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz)
127 real,
intent(inout) :: vc(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
129 real,
intent(inout),
dimension(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz):: ua, va
130 real,
intent(in),
dimension(npz+1):: ak, bk
133 real,
intent(inout) :: mfx(bd%is:bd%ie+1, bd%js:bd%je, npz)
134 real,
intent(inout) :: mfy(bd%is:bd%ie , bd%js:bd%je+1, npz)
136 real,
intent(inout) :: cx(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
137 real,
intent(inout) :: cy(bd%isd:bd%ied ,bd%js:bd%je+1, npz)
142 type(
domain2d),
intent(INOUT) :: domain
147 real:: ws(bd%is:bd%ie,bd%js:bd%je)
148 real:: te_2d(bd%is:bd%ie,bd%js:bd%je)
149 real:: teq(bd%is:bd%ie,bd%js:bd%je)
150 real:: ps2(bd%isd:bd%ied,bd%jsd:bd%jed)
151 real:: m_fac(bd%is:bd%ie,bd%js:bd%je)
153 real,
dimension(bd%is:bd%ie):: cvm
154 real,
allocatable :: dp1(:,:,:), dtdt_m(:,:,:), cappa(:,:,:)
155 real(kind=8),
allocatable :: psx(:,:)
156 real(kind=8),
allocatable :: dpx(:,:)
157 real:: akap, rdg, ph1, ph2, mdt, gam, amdt, u0
158 integer:: kord_tracer(ncnst)
159 integer :: i,j,k, n, iq, n_map, nq, nwat, k_split
160 integer :: sphum, liq_wat = -999, ice_wat = -999
161 integer :: rainwat = -999, snowwat = -999, graupel = -999, cld_amt = -999
162 integer :: theta_d = -999
163 logical used, last_step, do_omega
164 integer,
parameter :: max_packs=12
165 type(group_halo_update_type),
save :: i_pack(max_packs)
166 integer :: is, ie, js, je
167 integer :: isd, ied, jsd, jed
169 real(kind=8) :: t1, t2
187 k_split = flagstruct%k_split
188 nwat = flagstruct%nwat
189 nq = nq_tot - flagstruct%dnats
191 allocate ( dp1(isd:ied, jsd:jed, 1:npz) )
198 allocate ( cappa(isd:ied,jsd:jed,npz) )
201 allocate ( cappa(isd:isd,jsd:jsd,1) )
206 if (gridstruct%nested .or. any(neststruct%child_grids))
then 209 u, v, w, pt, delp, delz, q, uc, vc, pkz, &
210 neststruct%nested, flagstruct%inline_q, flagstruct%make_nh, ng, &
211 gridstruct, flagstruct, neststruct, &
212 neststruct%nest_timestep, neststruct%tracer_nest_timestep, &
216 if (gridstruct%nested)
then 219 0, 0, npx, npy, npz, bd, 1., 1., &
220 neststruct%pt_BC, bctype=neststruct%nestbctype )
223 0, 0, npx, npy, npz, bd, 1., 1., &
224 neststruct%q_con_BC, bctype=neststruct%nestbctype )
227 0, 0, npx, npy, npz, bd, 1., 1., &
228 neststruct%cappa_BC, bctype=neststruct%nestbctype )
237 if ( flagstruct%no_dycore )
then 238 if ( nwat.eq.2 .and. (.not.hydrostatic) )
then 286 pfull(1) = 0.5*flagstruct%p_ref
293 ph1 = ak(k ) + bk(k )*flagstruct%p_ref
294 ph2 = ak(k+1) + bk(k+1)*flagstruct%p_ref
295 pfull(k) = (ph2 - ph1) / log(ph2/ph1)
298 if ( hydrostatic )
then 304 call moist_cp(is,ie,isd,ied,jsd,jed, npz, j, k, nwat, sphum, liq_wat, rainwat, &
305 ice_wat, snowwat, graupel, q, q_con(is:ie,j,k), cvm)
308 dp1(i,j,k) = zvir*q(i,j,k,sphum)
318 if ( flagstruct%moist_phys )
then 321 call moist_cv(is,ie,isd,ied,jsd,jed, npz, j, k, nwat, sphum, liq_wat, rainwat, &
322 ice_wat, snowwat, graupel, q, q_con(is:ie,j,k), cvm)
325 dp1(i,j,k) = zvir*q(i,j,k,sphum)
327 cappa(i,j,k) =
rdgas/(
rdgas + cvm(i)/(1.+dp1(i,j,k)))
328 pkz(i,j,k) = exp(cappa(i,j,k)*log(rdg*delp(i,j,k)*pt(i,j,k)* &
329 (1.+dp1(i,j,k))*(1.-q_con(i,j,k))/delz(i,j,k)) )
331 pkz(i,j,k) = exp( kappa*log(rdg*delp(i,j,k)*pt(i,j,k)* &
332 (1.+dp1(i,j,k))/delz(i,j,k)) )
343 pkz(i,j,k) = exp(kappa*log(rdg*delp(i,j,k)*pt(i,j,k)/delz(i,j,k)))
350 if ( flagstruct%fv_debug )
then 352 call prt_mxm(
'cappa', cappa, is, ie, js, je, ng, npz, 1., gridstruct%area_64, domain)
354 call prt_mxm(
'PS', ps, is, ie, js, je, ng, 1, 0.01, gridstruct%area_64, domain)
355 call prt_mxm(
'T_dyn_b', pt, is, ie, js, je, ng, npz, 1., gridstruct%area_64, domain)
356 if ( .not. hydrostatic)
call prt_mxm(
'delz', delz, is, ie, js, je, ng, npz, 1., gridstruct%area_64, domain)
357 call prt_mxm(
'delp_b ', delp, is, ie, js, je, ng, npz, 0.01, gridstruct%area_64, domain)
358 call prt_mxm(
'pk_b', pk, is, ie, js, je, 0, npz+1, 1.,gridstruct%area_64, domain)
359 call prt_mxm(
'pkz_b', pkz,is, ie, js, je, 0, npz, 1.,gridstruct%area_64, domain)
367 u, v, w, delz, pt, delp, q, dp1, pe, peln, phis, &
368 gridstruct%rsin2, gridstruct%cosa_s, &
369 zvir, cp_air,
rdgas,
hlv, te_2d, ua, va, teq, &
370 flagstruct%moist_phys, nwat, sphum, liq_wat, rainwat, &
371 ice_wat, snowwat, graupel, hydrostatic, idiag%id_te)
372 if( idiag%id_te>0 )
then 379 if( (flagstruct%consv_am.or.idiag%id_amdt>0) .and. (.not.
do_adiabatic_init) )
then 380 call compute_aam(npz, is, ie, js, je, isd, ied, jsd, jed, gridstruct, bd, &
381 ptop, ua, va, u, v, delp, teq, ps2, m_fac)
384 if( flagstruct%tau > 0. )
then 385 if ( gridstruct%grid_type<4 )
then 386 call rayleigh_super(abs(bdt), npx, npy, npz, ks, pfull, phis, flagstruct%tau, u, v, w, pt, &
387 ua, va, delz, gridstruct%agrid, cp_air,
rdgas, ptop, hydrostatic, (.not. neststruct%nested), flagstruct%rf_cutoff, gridstruct, domain, bd)
389 call rayleigh_friction(abs(bdt), npx, npy, npz, ks, pfull, flagstruct%tau, u, v, w, pt, &
390 ua, va, delz, cp_air,
rdgas, ptop, hydrostatic, .true., flagstruct%rf_cutoff, gridstruct, domain, bd)
398 if ( flagstruct%adiabatic )
then 403 pt(i,j,k) = pt(i,j,k)/pkz(i,j,k)
406 if ( theta_d>0 )
then 409 q(i,j,k,theta_d) = pt(i,j,k)
420 pt(i,j,k) = pt(i,j,k)*(1.+dp1(i,j,k))*(1.-q_con(i,j,k))/pkz(i,j,k)
422 pt(i,j,k) = pt(i,j,k)*(1.+dp1(i,j,k))/pkz(i,j,k)
431 mdt = bdt /
real(k_split)
434 allocate ( dtdt_m(is:ie,js:je,npz) )
446 allocate(psx(isd:ied,jsd:jed),dpx(is:ie,js:je))
450 psx(i,j) = pe(i,npz+1,j)
459 call start_group_halo_update(i_pack(11), q_con, domain)
461 call start_group_halo_update(i_pack(12), cappa, domain)
464 call start_group_halo_update(i_pack(1), delp, domain, complete=.false.)
465 call start_group_halo_update(i_pack(1), pt, domain, complete=.true.)
467 call start_group_halo_update(i_pack(8), u, v, domain, gridtype=dgrid_ne)
474 dp1(i,j,k) = delp(i,j,k)
479 if ( n_map==k_split ) last_step = .true.
483 call complete_group_halo_update(i_pack(11), domain)
485 call complete_group_halo_update(i_pack(12), domain)
491 call dyn_core(npx, npy, npz, ng, sphum, nq, mdt, n_split, zvir, cp_air, akap, cappa,
grav, hydrostatic, &
492 u, v, w, delz, pt, q, delp, pe, pk, phis, ws, omga, ptop, pfull, ua, va, &
493 uc, vc, mfx, mfy, cx, cy, pkz, peln, q_con, ak, bk, dpx, ks, &
494 gridstruct, flagstruct, neststruct, idiag, bd, &
495 domain, n_map==1, i_pack, last_step, time_total)
504 psx(i,j) = psx(i,j) + dpx(i,j)
512 pe(i,npz+1,j) = psx(i,j)
523 ps(i,j) = delp(i,j,1) *
agrav 527 if( .not. flagstruct%inline_q .and. nq /= 0 )
then 533 if (gridstruct%nested)
then 534 call tracer_2d_nested(q, dp1, mfx, mfy, cx, cy, gridstruct, bd, domain, npx, npy, npz, nq, &
535 flagstruct%hord_tr, q_split, mdt, idiag%id_divg, i_pack(10), &
536 flagstruct%nord_tr, flagstruct%trdm2, &
537 k_split, neststruct, parent_grid)
539 if ( flagstruct%z_tracer )
then 540 call tracer_2d_1l(q, dp1, mfx, mfy, cx, cy, gridstruct, bd, domain, npx, npy, npz, nq, &
541 flagstruct%hord_tr, q_split, mdt, idiag%id_divg, i_pack(10), &
542 flagstruct%nord_tr, flagstruct%trdm2)
544 call tracer_2d(q, dp1, mfx, mfy, cx, cy, gridstruct, bd, domain, npx, npy, npz, nq, &
545 flagstruct%hord_tr, q_split, mdt, idiag%id_divg, i_pack(10), &
546 flagstruct%nord_tr, flagstruct%trdm2)
551 if ( flagstruct%hord_tr<8 .and. flagstruct%moist_phys )
then 554 call fill2d(is, ie, js, je, ng, npz, q(isd,jsd,1,liq_wat), delp, gridstruct%area, domain, neststruct%nested, npx, npy)
556 call fill2d(is, ie, js, je, ng, npz, q(isd,jsd,1,rainwat), delp, gridstruct%area, domain, neststruct%nested, npx, npy)
558 call fill2d(is, ie, js, je, ng, npz, q(isd,jsd,1,ice_wat), delp, gridstruct%area, domain, neststruct%nested, npx, npy)
560 call fill2d(is, ie, js, je, ng, npz, q(isd,jsd,1,snowwat), delp, gridstruct%area, domain, neststruct%nested, npx, npy)
562 call fill2d(is, ie, js, je, ng, npz, q(isd,jsd,1,graupel), delp, gridstruct%area, domain, neststruct%nested, npx, npy)
566 if( last_step .and. idiag%id_divg>0 )
then 568 if(flagstruct%fv_debug)
call prt_mxm(
'divg', dp1, is, ie, js, je, 0, npz, 1.,gridstruct%area_64, domain)
581 kord_tracer(iq) = flagstruct%kord_tr
582 if ( iq==cld_amt ) kord_tracer(iq) = 9
585 do_omega = hydrostatic .and. last_step
588 call avec_timer_start(6)
592 pkz, pk, mdt, bdt, npz, is,ie,js,je, isd,ied,jsd,jed, &
593 nq, nwat, sphum, q_con, u, v, w, delz, pt, q, phis, &
594 zvir, cp_air, akap, cappa, flagstruct%kord_mt, flagstruct%kord_wz, &
595 kord_tracer, flagstruct%kord_tm, peln, te_2d, &
596 ng, ua, va, omga, dp1, ws, fill, reproduce_sum, &
597 idiag%id_mdt>0, dtdt_m, ptop, ak, bk, pfull, flagstruct, gridstruct, domain, &
598 flagstruct%do_sat_adj, hydrostatic, hybrid_z, do_omega, &
600 mfx, mfy, flagstruct%remap_option)
603 call avec_timer_stop(6)
607 if ( neststruct%nested .and. .not. last_step)
then 609 0, 0, npx, npy, npz, bd,
real(n_map+1),
real(k_split), &
610 neststruct%cappa_bc, bctype=neststruct%nestbctype )
615 if( .not. hydrostatic )
then 620 omga(i,j,k) = delp(i,j,k)/delz(i,j,k)*w(i,j,k)
628 if(flagstruct%nf_omega>0) &
629 call del2_cubed(omga, 0.18*gridstruct%da_min, gridstruct, domain, npx, npy, npz, flagstruct%nf_omega, bd)
641 dtdt_m(i,j,k) = dtdt_m(i,j,k) / bdt * 86400.
647 deallocate ( dtdt_m )
651 if (cld_amt > 0)
then 652 call neg_adj3(is, ie, js, je, ng, npz, &
653 flagstruct%hydrostatic, &
655 pt, delp, q(isd,jsd,1,sphum), &
656 q(isd,jsd,1,liq_wat), &
657 q(isd,jsd,1,rainwat), &
658 q(isd,jsd,1,ice_wat), &
659 q(isd,jsd,1,snowwat), &
660 q(isd,jsd,1,graupel), &
661 q(isd,jsd,1,cld_amt), flagstruct%check_negative)
663 call neg_adj3(is, ie, js, je, ng, npz, &
664 flagstruct%hydrostatic, &
666 pt, delp, q(isd,jsd,1,sphum), &
667 q(isd,jsd,1,liq_wat), &
668 q(isd,jsd,1,rainwat), &
669 q(isd,jsd,1,ice_wat), &
670 q(isd,jsd,1,snowwat), &
671 q(isd,jsd,1,graupel), check_negative=flagstruct%check_negative)
673 if ( flagstruct%fv_debug )
then 674 call prt_mxm(
'T_dyn_a3', pt, is, ie, js, je, ng, npz, 1., gridstruct%area_64, domain)
675 call prt_mxm(
'SPHUM_dyn', q(isd,jsd,1,sphum ), is, ie, js, je, ng, npz, 1.,gridstruct%area_64, domain)
676 call prt_mxm(
'liq_wat_dyn', q(isd,jsd,1,liq_wat), is, ie, js, je, ng, npz, 1.,gridstruct%area_64, domain)
677 call prt_mxm(
'rainwat_dyn', q(isd,jsd,1,rainwat), is, ie, js, je, ng, npz, 1.,gridstruct%area_64, domain)
678 call prt_mxm(
'ice_wat_dyn', q(isd,jsd,1,ice_wat), is, ie, js, je, ng, npz, 1.,gridstruct%area_64, domain)
679 call prt_mxm(
'snowwat_dyn', q(isd,jsd,1,snowwat), is, ie, js, je, ng, npz, 1.,gridstruct%area_64, domain)
680 call prt_mxm(
'graupel_dyn', q(isd,jsd,1,graupel), is, ie, js, je, ng, npz, 1.,gridstruct%area_64, domain)
684 if( (flagstruct%consv_am.or.idiag%id_amdt>0.or.idiag%id_aam>0) .and. (.not.
do_adiabatic_init) )
then 685 call compute_aam(npz, is, ie, js, je, isd, ied, jsd, jed, gridstruct, bd, &
686 ptop, ua, va, u, v, delp, te_2d, ps, m_fac)
687 if( idiag%id_aam>0 )
then 690 gam =
g_sum( domain, te_2d, is, ie, js, je, ng, gridstruct%area_64, 0)
691 if( is_master() )
write(6,*)
'Total AAM =', gam
696 if( (flagstruct%consv_am.or.idiag%id_amdt>0) .and. (.not.
do_adiabatic_init) )
then 702 te_2d(i,j) = te_2d(i,j)-teq(i,j) + dt2*(ps2(i,j)+ps(i,j))*idiag%zxg(i,j)
707 if ( flagstruct%consv_am .or.
prt_minmax )
then 708 amdt =
g_sum( domain, te_2d, is, ie, js, je, ng, gridstruct%area_64, 0, reproduce=.true.)
709 u0 = -
radius*amdt/
g_sum( domain, m_fac, is, ie, js, je, ng, gridstruct%area_64, 0,reproduce=.true.)
711 write(6,*)
'Dynamic AM tendency (Hadleys)=', amdt/(bdt*1.e18),
'del-u (per day)=', u0*86400./bdt
714 if( flagstruct%consv_am )
then 718 m_fac(i,j) = u0*cos(gridstruct%agrid(i,j,2))
726 u(i,j,k) = u(i,j,k) + u0*gridstruct%l2c_u(i,j)
731 v(i,j,k) = v(i,j,k) + u0*gridstruct%l2c_v(i,j)
739 npx, npy, npz, 1, gridstruct%grid_type, domain, gridstruct%nested, flagstruct%c2l_ord, bd)
744 if ( flagstruct%fv_debug )
then 745 call prt_mxm(
'UA', ua, is, ie, js, je, ng, npz, 1., gridstruct%area_64, domain)
746 call prt_mxm(
'VA', va, is, ie, js, je, ng, npz, 1., gridstruct%area_64, domain)
747 call prt_mxm(
'TA', pt, is, ie, js, je, ng, npz, 1., gridstruct%area_64, domain)
748 if (.not. hydrostatic)
call prt_mxm(
'W ', w, is, ie, js, je, ng, npz, 1., gridstruct%area_64, domain)
751 if ( flagstruct%range_warn )
then 752 call range_check(
'UA_dyn', ua, is, ie, js, je, ng, npz, gridstruct%agrid, &
754 call range_check(
'VA_dyn', ua, is, ie, js, je, ng, npz, gridstruct%agrid, &
756 call range_check(
'TA_dyn', pt, is, ie, js, je, ng, npz, gridstruct%agrid, &
758 if ( .not. hydrostatic ) &
759 call range_check(
'W_dyn', w, is, ie, js, je, ng, npz, gridstruct%agrid, &
770 subroutine rayleigh_super(dt, npx, npy, npz, ks, pm, phis, tau, u, v, w, pt, &
771 ua, va, delz, agrid, cp, rg, ptop, hydrostatic, conserve, rf_cutoff, gridstruct, domain, bd)
772 real,
intent(in):: dt
773 real,
intent(in):: tau
774 real,
intent(in):: cp, rg, ptop, rf_cutoff
775 real,
intent(in),
dimension(npz):: pm
776 integer,
intent(in):: npx, npy, npz, ks
777 logical,
intent(in):: hydrostatic
778 logical,
intent(in):: conserve
779 type(fv_grid_bounds_type),
intent(IN) :: bd
780 real,
intent(inout):: u(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
781 real,
intent(inout):: v(bd%isd:bd%ied+1,bd%jsd:bd%jed,npz)
782 real,
intent(inout):: w(bd%isd: ,bd%jsd: ,1: )
783 real,
intent(inout):: pt(bd%isd:bd%ied,bd%jsd:bd%jed,npz)
784 real,
intent(inout):: ua(bd%isd:bd%ied,bd%jsd:bd%jed,npz)
785 real,
intent(inout):: va(bd%isd:bd%ied,bd%jsd:bd%jed,npz)
786 real,
intent(inout):: delz(bd%isd: ,bd%jsd: ,1: )
787 real,
intent(in) :: agrid(bd%isd:bd%ied, bd%jsd:bd%jed,2)
788 real,
intent(in) :: phis(bd%isd:bd%ied,bd%jsd:bd%jed)
789 type(fv_grid_type),
intent(IN) :: gridstruct
790 type(domain2d),
intent(INOUT) :: domain
792 real,
allocatable :: u2f(:,:,:)
793 real,
parameter:: u0 = 60.
794 real,
parameter:: sday = 86400.
798 integer :: is, ie, js, je
799 integer :: isd, ied, jsd, jed
814 allocate ( u00(is:ie, js:je+1,npz) )
815 allocate ( v00(is:ie+1,js:je ,npz) )
820 u00(i,j,k) = u(i,j,k)
825 v00(i,j,k) = v(i,j,k)
839 if( is_master() )
write(6,*) k, 0.01*pm(k)
841 if( is_master() )
write(6,*)
'Rayleigh friction E-folding time (days):' 843 if ( pm(k) < rf_cutoff )
then 844 rf(k) = dt/tau0*sin(0.5*
pi*log(rf_cutoff/pm(k))/log(rf_cutoff/ptop))**2
845 if( is_master() )
write(6,*) k, 0.01*pm(k), dt/(
rf(k)*sday)
854 call c2l_ord2(u, v, ua, va, gridstruct, npz, gridstruct%grid_type, bd, gridstruct%nested)
856 allocate( u2f(isd:ied,jsd:jed,
kmax) )
861 if ( pm(k) < rf_cutoff )
then 862 u2f(:,:,k) = 1. / (1.+
rf(k))
877 if ( pm(k) < rf_cutoff )
then 879 if (.not. hydrostatic)
then 882 w(i,j,k) = w(i,j,k)/(1.+
rf(k))
888 u(i,j,k) = (u(i,j,k)+
rf(k)*u00(i,j,k))/(1.+
rf(k))
893 v(i,j,k) = (v(i,j,k)+
rf(k)*v00(i,j,k))/(1.+
rf(k))
899 if ( hydrostatic )
then 902 pt(i,j,k) = pt(i,j,k) + 0.5*(ua(i,j,k)**2+va(i,j,k)**2)*(1.-u2f(i,j,k)**2)/(cp-rg*ptop/pm(k))
908 pt(i,j,k) = pt(i,j,k) + 0.5*(ua(i,j,k)**2+va(i,j,k)**2+w(i,j,k)**2)*(1.-u2f(i,j,k)**2)*rcv
916 u(i,j,k) = 0.5*(u2f(i,j-1,k)+u2f(i,j,k))*u(i,j,k)
921 v(i,j,k) = 0.5*(u2f(i-1,j,k)+u2f(i,j,k))*v(i,j,k)
924 if ( .not. hydrostatic )
then 927 w(i,j,k) = u2f(i,j,k)*w(i,j,k)
940 subroutine rayleigh_friction(dt, npx, npy, npz, ks, pm, tau, u, v, w, pt, &
941 ua, va, delz, cp, rg, ptop, hydrostatic, conserve, &
942 rf_cutoff, gridstruct, domain, bd)
943 real,
intent(in):: dt
944 real,
intent(in):: tau
945 real,
intent(in):: cp, rg, ptop, rf_cutoff
946 real,
intent(in),
dimension(npz):: pm
947 integer,
intent(in):: npx, npy, npz, ks
948 logical,
intent(in):: hydrostatic
949 logical,
intent(in):: conserve
950 type(fv_grid_bounds_type),
intent(IN) :: bd
951 real,
intent(inout):: u(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
952 real,
intent(inout):: v(bd%isd:bd%ied+1,bd%jsd:bd%jed,npz)
953 real,
intent(inout):: w(bd%isd: ,bd%jsd: ,1: )
954 real,
intent(inout):: pt(bd%isd:bd%ied,bd%jsd:bd%jed,npz)
955 real,
intent(inout):: ua(bd%isd:bd%ied,bd%jsd:bd%jed,npz)
956 real,
intent(inout):: va(bd%isd:bd%ied,bd%jsd:bd%jed,npz)
957 real,
intent(inout):: delz(bd%isd: ,bd%jsd: ,1: )
958 type(fv_grid_type),
intent(IN) :: gridstruct
959 type(domain2d),
intent(INOUT) :: domain
961 real,
allocatable :: u2f(:,:,:)
962 real,
parameter:: sday = 86400.
963 real,
parameter:: u000 = 4900.
967 integer :: is, ie, js, je
968 integer :: isd, ied, jsd, jed
985 if( is_master() )
write(6,*)
'Rayleigh friction E-folding time (days):' 987 if ( pm(k) < rf_cutoff )
then 988 rf(k) = dt/(tau*sday)*sin(0.5*
pi*log(rf_cutoff/pm(k))/log(rf_cutoff/ptop))**2
989 if( is_master() )
write(6,*) k, 0.01*pm(k), dt/(
rf(k)*sday)
998 allocate( u2f(isd:ied,jsd:jed,
kmax) )
1000 call c2l_ord2(u, v, ua, va, gridstruct, npz, gridstruct%grid_type, bd, gridstruct%nested)
1004 if ( hydrostatic )
then 1007 u2f(i,j,k) = ua(i,j,k)**2 + va(i,j,k)**2
1013 u2f(i,j,k) = ua(i,j,k)**2 + va(i,j,k)**2 + w(i,j,k)**2
1027 if ( conserve )
then 1028 if ( hydrostatic )
then 1031 pt(i,j,k) = pt(i,j,k) + 0.5*u2f(i,j,k)/(cp-rg*ptop/pm(k)) &
1032 * ( 1. - 1./(1.+
rf(k)*sqrt(u2f(i,j,k)/u000))**2 )
1038 delz(i,j,k) = delz(i,j,k) / pt(i,j,k)
1039 pt(i,j,k) = pt(i,j,k) + 0.5*u2f(i,j,k) * rcv &
1040 * ( 1. - 1./(1.+
rf(k)*sqrt(u2f(i,j,k)/u000))**2 )
1041 delz(i,j,k) = delz(i,j,k) * pt(i,j,k)
1049 u2f(i,j,k) =
rf(k)*sqrt(u2f(i,j,k)/u000)
1055 u(i,j,k) = u(i,j,k) / (1.+0.5*(u2f(i,j-1,k)+u2f(i,j,k)))
1060 v(i,j,k) = v(i,j,k) / (1.+0.5*(u2f(i-1,j,k)+u2f(i,j,k)))
1064 if ( .not. hydrostatic )
then 1067 w(i,j,k) = w(i,j,k) / (1.+u2f(i,j,k))
1078 subroutine compute_aam(npz, is, ie, js, je, isd, ied, jsd, jed, gridstruct, bd, &
1079 ptop, ua, va, u, v, delp, aam, ps, m_fac)
1081 integer,
intent(in):: npz
1082 integer,
intent(in):: is, ie, js, je
1083 integer,
intent(in):: isd, ied, jsd, jed
1084 real,
intent(in):: ptop
1085 real,
intent(inout):: u(isd:ied ,jsd:jed+1,npz)
1086 real,
intent(inout):: v(isd:ied+1,jsd:jed,npz)
1087 real,
intent(inout):: delp(isd:ied,jsd:jed,npz)
1088 real,
intent(inout),
dimension(isd:ied,jsd:jed, npz):: ua, va
1089 real,
intent(out):: aam(is:ie,js:je)
1090 real,
intent(out):: m_fac(is:ie,js:je)
1091 real,
intent(out):: ps(isd:ied,jsd:jed)
1092 type(fv_grid_bounds_type),
intent(IN) :: bd
1093 type(fv_grid_type),
intent(IN) :: gridstruct
1095 real,
dimension(is:ie):: r1, r2, dm
1098 call c2l_ord2(u, v, ua, va, gridstruct, npz, gridstruct%grid_type, bd, gridstruct%nested)
1104 r1(i) =
radius*cos(gridstruct%agrid(i,j,2))
1113 ps(i,j) = ps(i,j) + dm(i)
1115 aam(i,j) = aam(i,j) + (r2(i)*
omega + r1(i)*ua(i,j,k)) * dm(i)
1116 m_fac(i,j) = m_fac(i,j) + dm(i)*r2(i)
subroutine, public del2_cubed(q, cd, gridstruct, domain, npx, npy, km, nmax, bd)
real, parameter, public radius
Radius of the Earth [m].
integer, parameter, public model_atmos
real, parameter, public omega
Rotation rate of the Earth [1/s].
subroutine, public moist_cv(is, ie, isd, ied, jsd, jed, km, j, k, nwat, sphum, liq_wat, rainwat, ice_wat, snowwat, graupel, q, qd, cvm, t1)
subroutine, public setup_nested_grid_bcs(npx, npy, npz, zvir, ncnst, u, v, w, pt, delp, delz, q, uc, vc, pkz, nested, inline_q, make_nh, ng, gridstruct, flagstruct, neststruct, nest_timestep, tracer_nest_timestep, domain, bd, nwat)
subroutine, public nested_grid_bc_apply_intt(var_nest, istag, jstag, npx, npy, npz, bd, step, split, BC, bctype)
real(kind=8), parameter, public pi_8
Ratio of circle circumference to diameter [N/A].
subroutine rayleigh_friction(dt, npx, npy, npz, ks, pm, tau, u, v, w, pt, ua, va, delz, cp, rg, ptop, hydrostatic, conserve, rf_cutoff, gridstruct, domain, bd)
real, parameter, public hlv
Latent heat of evaporation [J/kg].
subroutine, public tracer_2d_1l(q, dp1, mfx, mfy, cx, cy, gridstruct, bd, domain, npx, npy, npz, nq, hord, q_split, dt, id_divg, q_pack, nord_tr, trdm, dpA)
subroutine, public lagrangian_to_eulerian(last_step, consv, ps, pe, delp, pkz, pk, mdt, pdt, km, is, ie, js, je, isd, ied, jsd, jed, nq, nwat, sphum, q_con, u, v, w, delz, pt, q, hs, r_vir, cp, akap, cappa, kord_mt, kord_wz, kord_tr, kord_tm, peln, te0_2d, ng, ua, va, omga, te, ws, fill, reproduce_sum, out_dt, dtdt, ptop, ak, bk, pfull, flagstruct, gridstruct, domain, do_sat_adj, hydrostatic, hybrid_z, do_omega, adiabatic, do_adiabatic_init, mfx, mfy, remap_option)
real, parameter, public rdgas
Gas constant for dry air [J/kg/deg].
real, parameter, public cp_vapor
Specific heat capacity of water vapor at constant pressure [J/kg/deg].
subroutine, public cubed_to_latlon(u, v, ua, va, gridstruct, npx, npy, km, mode, grid_type, domain, nested, c2l_ord, bd)
real, dimension(:), allocatable rf
subroutine, public c2l_ord2(u, v, ua, va, gridstruct, km, grid_type, bd, do_halo)
real, parameter, public rvgas
Gas constant for water vapor [J/kg/deg].
subroutine, public moist_cp(is, ie, isd, ied, jsd, jed, km, j, k, nwat, sphum, liq_wat, rainwat, ice_wat, snowwat, graupel, q, qd, cpm, t1)
subroutine timing_on(blk_name)
subroutine compute_aam(npz, is, ie, js, je, isd, ied, jsd, jed, gridstruct, bd, ptop, ua, va, u, v, delp, aam, ps, m_fac)
subroutine, public compute_total_energy(is, ie, js, je, isd, ied, jsd, jed, km, u, v, w, delz, pt, delp, q, qc, pe, peln, hs, rsin2_l, cosa_s_l, r_vir, cp, rg, hlv, te_2d, ua, va, teq, moist_phys, nwat, sphum, liq_wat, rainwat, ice_wat, snowwat, graupel, hydrostatic, id_te)
logical, public do_adiabatic_init
subroutine, public dyn_core(npx, npy, npz, ng, sphum, nq, bdt, n_split, zvir, cp, akap, cappa, grav, hydrostatic, u, v, w, delz, pt, q, delp, pe, pk, phis, ws, omga, ptop, pfull, ua, va, uc, vc, mfx, mfy, cx, cy, pkz, peln, q_con, ak, bk, dpx, ks, gridstruct, flagstruct, neststruct, idiag, bd, domain, init_step, i_pack, end_step, time_total)
subroutine, public fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill, reproduce_sum, kappa, cp_air, zvir, ptop, ks, ncnst, n_split, q_split, u, v, w, delz, hydrostatic, pt, delp, q, ps, pe, pk, peln, pkz, phis, q_con, omga, ua, va, uc, vc, ak, bk, mfx, mfy, cx, cy, ze0, hybrid_z, gridstruct, flagstruct, neststruct, idiag, bd, parent_grid, domain, time_total)
real, parameter, public grav
Acceleration due to gravity [m/s^2].
real function, public g_sum(domain, p, ifirst, ilast, jfirst, jlast, ngc, area, mode, reproduce)
subroutine, public neg_adj3(is, ie, js, je, ng, kbot, hydrostatic, peln, delz, pt, dp, qv, ql, qr, qi, qs, qg, qa, check_negative)
subroutine, public prt_mxm(qname, q, is, ie, js, je, n_g, km, fac, area, domain)
subroutine rayleigh_super(dt, npx, npy, npz, ks, pm, phis, tau, u, v, w, pt, ua, va, delz, agrid, cp, rg, ptop, hydrostatic, conserve, rf_cutoff, gridstruct, domain, bd)
subroutine, public init_ijk_mem(i1, i2, j1, j2, km, array, var)
subroutine, public tracer_2d(q, dp1, mfx, mfy, cx, cy, gridstruct, bd, domain, npx, npy, npz, nq, hord, q_split, dt, id_divg, q_pack, nord_tr, trdm, dpA)
subroutine, public fill2d(is, ie, js, je, ng, km, q, delp, area, domain, nested, npx, npy)
logical, public prt_minmax
subroutine, public range_check(qname, q, is, ie, js, je, n_g, km, pos, q_low, q_hi, bad_range)
type(time_type), public fv_time
real(fp), parameter, public pi
subroutine timing_off(blk_name)
subroutine, public tracer_2d_nested(q, dp1, mfx, mfy, cx, cy, gridstruct, bd, domain, npx, npy, npz, nq, hord, q_split, dt, id_divg, q_pack, nord_tr, trdm, k_split, neststruct, parent_grid)