23 use mpp_mod,
only: mpp_pe, mpp_root_pe
45 #if defined (ADA_NUDGE) 46 use fv_ada_nudge_mod,
only: breed_slp_inline_ada
93 SUBROUTINE dyn_core_tlm(npx, npy, npz, ng, sphum, nq, bdt, n_split, &
94 & zvir, cp, akap, cappa, grav, hydrostatic, u, u_tl, v, v_tl, w, w_tl&
95 & , delz, delz_tl, pt, pt_tl, q, q_tl, delp, delp_tl, pe, pe_tl, pk, &
96 & pk_tl, phis, ws, ws_tl, omga, omga_tl, ptop, pfull, ua, ua_tl, va, &
97 & va_tl, uc, uc_tl, vc, vc_tl, mfx, mfx_tl, mfy, mfy_tl, cx, cx_tl, cy&
98 & , cy_tl, pkz, pkz_tl, peln, peln_tl, q_con, ak, bk, dpx, dpx_tl, ks&
99 & , gridstruct, flagstruct, flagstructp, neststruct, idiag, bd, domain&
100 & , init_step, i_pack, end_step, gz, gz_tl, pkc, pkc_tl, ptc, ptc_tl, &
101 & crx, crx_tl, xfx, xfx_tl, cry, cry_tl, yfx, yfx_tl, divgd, divgd_tl&
102 & , delpc, delpc_tl, ut, ut_tl, vt, vt_tl, zh, zh_tl, pk3, pk3_tl, du&
103 & , du_tl, dv, dv_tl, time_total)
146 INTEGER,
INTENT(IN) :: npx
147 INTEGER,
INTENT(IN) :: npy
148 INTEGER,
INTENT(IN) :: npz
149 INTEGER,
INTENT(IN) :: ng, nq, sphum
150 INTEGER,
INTENT(IN) :: n_split
151 REAL,
INTENT(IN) :: bdt
152 REAL,
INTENT(IN) :: zvir, cp, akap, grav
153 REAL,
INTENT(IN) :: ptop
154 LOGICAL,
INTENT(IN) :: hydrostatic
155 LOGICAL,
INTENT(IN) :: init_step, end_step
156 REAL,
INTENT(IN) :: pfull(npz)
157 REAL,
DIMENSION(npz+1),
INTENT(IN) :: ak, bk
158 INTEGER,
INTENT(IN) :: ks
159 TYPE(group_halo_update_type),
INTENT(INOUT) :: i_pack(*)
162 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz),
INTENT(INOUT) &
164 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz),
INTENT(INOUT) &
167 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz),
INTENT(INOUT) &
169 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz),
INTENT(INOUT) &
172 REAL,
INTENT(INOUT) :: w(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
173 REAL,
INTENT(INOUT) :: w_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
175 REAL,
INTENT(INOUT) :: delz(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
176 REAL,
INTENT(INOUT) :: delz_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
178 REAL,
INTENT(INOUT) :: cappa(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
180 REAL,
INTENT(INOUT) :: pt(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
181 REAL,
INTENT(INOUT) :: pt_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
183 REAL,
INTENT(INOUT) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
184 REAL,
INTENT(INOUT) :: delp_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
186 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed, npz, nq)
187 REAL,
INTENT(INOUT) :: q_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz, nq)
189 REAL,
INTENT(IN),
OPTIONAL :: time_total
196 REAL,
INTENT(INOUT) :: phis(bd%isd:bd%ied, bd%jsd:bd%jed)
198 REAL,
INTENT(INOUT) :: pe(bd%is-1:bd%ie+1, npz+1, bd%js-1:bd%je+1)
199 REAL,
INTENT(INOUT) :: pe_tl(bd%is-1:bd%ie+1, npz+1, bd%js-1:bd%je+1&
202 REAL,
INTENT(INOUT) :: peln(bd%is:bd%ie, npz+1, bd%js:bd%je)
203 REAL,
INTENT(INOUT) :: peln_tl(bd%is:bd%ie, npz+1, bd%js:bd%je)
205 REAL,
INTENT(INOUT) :: pk(bd%is:bd%ie, bd%js:bd%je, npz+1)
206 REAL,
INTENT(INOUT) :: pk_tl(bd%is:bd%ie, bd%js:bd%je, npz+1)
207 REAL(kind=8),
INTENT(INOUT) :: dpx(bd%is:bd%ie, bd%js:bd%je)
208 REAL(kind=8),
INTENT(INOUT) :: dpx_tl(bd%is:bd%ie, bd%js:bd%je)
211 REAL,
PARAMETER :: near0=1.e-8
212 REAL,
PARAMETER :: huge_r=1.e8
215 REAL,
INTENT(OUT) :: ws(bd%is:bd%ie, bd%js:bd%je)
216 REAL,
INTENT(OUT) :: ws_tl(bd%is:bd%ie, bd%js:bd%je)
218 REAL,
INTENT(INOUT) :: omga(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
219 REAL,
INTENT(INOUT) :: omga_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
221 REAL,
INTENT(INOUT) :: uc(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
222 REAL,
INTENT(INOUT) :: uc_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
223 REAL,
INTENT(INOUT) :: vc(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
224 REAL,
INTENT(INOUT) :: vc_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
225 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, npz),
INTENT(INOUT) ::&
227 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, npz),
INTENT(INOUT) ::&
229 REAL,
INTENT(INOUT) :: q_con(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
231 REAL,
INTENT(INOUT) :: mfx(bd%is:bd%ie+1, bd%js:bd%je, npz)
232 REAL,
INTENT(INOUT) :: mfx_tl(bd%is:bd%ie+1, bd%js:bd%je, npz)
233 REAL,
INTENT(INOUT) :: mfy(bd%is:bd%ie, bd%js:bd%je+1, npz)
234 REAL,
INTENT(INOUT) :: mfy_tl(bd%is:bd%ie, bd%js:bd%je+1, npz)
236 REAL,
INTENT(INOUT) :: cx(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
237 REAL,
INTENT(INOUT) :: cx_tl(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
238 REAL,
INTENT(INOUT) :: cy(bd%isd:bd%ied, bd%js:bd%je+1, npz)
239 REAL,
INTENT(INOUT) :: cy_tl(bd%isd:bd%ied, bd%js:bd%je+1, npz)
240 REAL,
DIMENSION(bd%is:bd%ie, bd%js:bd%je, npz),
INTENT(INOUT) :: pkz
241 REAL,
DIMENSION(bd%is:bd%ie, bd%js:bd%je, npz),
INTENT(INOUT) :: &
248 TYPE(
domain2d),
INTENT(INOUT) :: domain
250 REAL :: pem(bd%is-1:bd%ie+1, npz+1, bd%js-1:bd%je+1), heat_source(bd&
251 & %isd:bd%ied, bd%jsd:bd%jed, npz)
252 REAL :: pem_tl(bd%is-1:bd%ie+1, npz+1, bd%js-1:bd%je+1), &
253 & heat_source_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
255 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed) :: ws3, z_rat
256 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed) :: ws3_tl, z_rat_tl
259 REAL :: zs(bd%isd:bd%ied, bd%jsd:bd%jed)
260 REAL :: p1d(bd%is:bd%ie)
261 REAL :: om2d(bd%is:bd%ie, npz)
262 REAL :: om2d_tl(bd%is:bd%ie, npz)
263 REAL :: wbuffer(npy+2, npz)
264 REAL :: ebuffer(npy+2, npz)
265 REAL :: ebuffer_tl(npy+2, npz)
266 REAL :: nbuffer(npx+2, npz)
267 REAL :: nbuffer_tl(npx+2, npz)
268 REAL :: sbuffer(npx+2, npz)
270 REAL :: divg2(bd%is:bd%ie+1, bd%js:bd%je+1)
271 REAL :: divg2_tl(bd%is:bd%ie+1, bd%js:bd%je+1)
272 REAL :: wk(bd%isd:bd%ied, bd%jsd:bd%jed)
273 REAL :: wk_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
274 REAL :: fz(bd%is:bd%ie+1, bd%js:bd%je+1)
275 REAL :: heat_s(bd%is:bd%ie, bd%js:bd%je)
276 REAL :: heat_s_tl(bd%is:bd%ie, bd%js:bd%je)
277 REAL :: damp_vt(npz+1)
278 INTEGER :: nord_v(npz+1)
280 INTEGER :: hord_m, hord_v, hord_t, hord_p
281 INTEGER :: nord_k, nord_w, nord_t
284 INTEGER :: hord_m_pert, hord_v_pert, hord_t_pert, hord_p_pert
285 INTEGER :: nord_k_pert, nord_w_pert, nord_t_pert, nord_v_pert(npz+1)
286 REAL :: d2_divg_pert, damp_vt_pert(npz+1), damp_w_pert, damp_t_pert
288 INTEGER :: i, j, k, it, iq, n_con, nf_ke
289 INTEGER :: iep1, jep1
290 REAL :: beta, beta_d, d_con_k, damp_w, damp_t, kgb, cv_air
293 REAL :: k1k, rdg, dtmp, delt
295 LOGICAL :: last_step, remap_step
297 REAL :: split_timestep_bc
298 INTEGER :: is, ie, js, je
299 INTEGER :: isd, ied, jsd, jed
300 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
301 REAL,
INTENT(INOUT) :: gz_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
302 REAL,
INTENT(INOUT) :: pkc(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
303 REAL,
INTENT(INOUT) :: pkc_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
304 REAL,
INTENT(INOUT) :: ptc(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
305 REAL,
INTENT(INOUT) :: ptc_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
306 REAL,
INTENT(INOUT) :: crx(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
307 REAL,
INTENT(INOUT) :: crx_tl(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
308 REAL,
INTENT(INOUT) :: xfx(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
309 REAL,
INTENT(INOUT) :: xfx_tl(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
310 REAL,
INTENT(INOUT) :: cry(bd%isd:bd%ied, bd%js:bd%je+1, npz)
311 REAL,
INTENT(INOUT) :: cry_tl(bd%isd:bd%ied, bd%js:bd%je+1, npz)
312 REAL,
INTENT(INOUT) :: yfx(bd%isd:bd%ied, bd%js:bd%je+1, npz)
313 REAL,
INTENT(INOUT) :: yfx_tl(bd%isd:bd%ied, bd%js:bd%je+1, npz)
314 REAL,
INTENT(INOUT) :: divgd(bd%isd:bd%ied+1, bd%jsd:bd%jed+1, npz)
315 REAL,
INTENT(INOUT) :: divgd_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed+1, &
317 REAL,
INTENT(INOUT) :: delpc(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
318 REAL,
INTENT(INOUT) :: delpc_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
319 REAL,
INTENT(INOUT) :: ut(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
320 REAL,
INTENT(INOUT) :: ut_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
321 REAL,
INTENT(INOUT) :: vt(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
322 REAL,
INTENT(INOUT) :: vt_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
323 REAL,
INTENT(INOUT) :: zh(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
324 REAL,
INTENT(INOUT) :: zh_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
325 REAL,
INTENT(INOUT) :: pk3(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
326 REAL,
INTENT(INOUT) :: pk3_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
327 REAL,
INTENT(INOUT) :: du(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
328 REAL,
INTENT(INOUT) :: du_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
329 REAL,
INTENT(INOUT) :: dv(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
330 REAL,
INTENT(INOUT) :: dv_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
364 dt = bdt/
REAL(n_split)
367 IF (1 .LT. flagstruct%m_split/2)
THEN 368 ms = flagstruct%m_split/2
372 beta = flagstruct%beta
378 IF (.NOT.hydrostatic)
THEN 384 dp_ref(k) = ak(k+1) - ak(k) + (bk(k+1)-bk(k))*1.e5
389 zs(i, j) = phis(i, j)*
rgrav 406 IF (flagstruct%d_con .GT. 1.0e-5) heat_source = 0.0
409 IF (flagstruct%convert_ke .OR. flagstruct%vtdm4 .GT. 1.e-4)
THEN 423 ELSE IF (flagstruct%d2_bg_k1 .LT. 1.e-3)
THEN 437 ELSE IF (flagstruct%d2_bg_k2 .LT. 1.e-3)
THEN 469 IF (flagstruct%breed_vortex_inline .OR. it .EQ. n_split)
THEN 474 IF (flagstruct%fv_debug)
THEN 475 IF (is_master())
WRITE(*, *)
'n_split loop, it=', it
476 IF (.NOT.flagstruct%hydrostatic)
CALL prt_mxm(
'delz', delz, is, &
477 & ie, js, je, ng, npz, 1.&
478 & , gridstruct%area_64, &
480 CALL prt_mxm(
'PT', pt, is, ie, js, je, ng, npz, 1., gridstruct%&
483 IF (gridstruct%nested) split_timestep_bc =
REAL(n_split*flagstruct&
484 & %k_split + neststruct%nest_timestep)
497 IF (.NOT.hydrostatic)
THEN 502 IF (gridstruct%nested)
THEN 506 gz_tl(i, j, npz+1) = 0.0
507 gz(i, j, npz+1) = zs(i, j)
511 gz_tl(i, j, k) = gz_tl(i, j, k+1) - delz_tl(i, j, k)
512 gz(i, j, k) = gz(i, j, k+1) - delz(i, j, k)
520 gz_tl(i, j, npz+1) = 0.0
521 gz(i, j, npz+1) = zs(i, j)
525 gz_tl(i, j, k) = gz_tl(i, j, k+1) - delz_tl(i, j, k)
526 gz(i, j, k) = gz(i, j, k+1) - delz(i, j, k)
538 CALL complete_group_halo_update(i_pack(1), domain)
544 IF (it .EQ. n_split .AND. end_step)
THEN 545 IF (flagstruct%use_old_omega)
THEN 552 pem_tl(i, 1, j) = 0.0
557 pem_tl(i, k+1, j) = pem_tl(i, k, j) + delp_tl(i, j, k)
558 pem(i, k+1, j) = pem(i, k, j) + delp(i, j, k)
568 CALL complete_group_halo_update(i_pack(8), domain)
569 IF (.NOT.hydrostatic)
CALL complete_group_halo_update(i_pack(7), &
577 CALL c_sw_tlm(delpc(isd:ied, jsd:jed, k), delpc_tl(isd:ied, jsd:&
578 & jed, k), delp(isd:ied, jsd:jed, k), delp_tl(isd:ied, jsd&
579 & :jed, k), ptc(isd:ied, jsd:jed, k), ptc_tl(isd:ied, jsd:&
580 & jed, k), pt(isd:ied, jsd:jed, k), pt_tl(isd:ied, jsd:jed&
581 & , k), u(isd:ied, jsd:jed+1, k), u_tl(isd:ied, jsd:jed+1&
582 & , k), v(isd:ied+1, jsd:jed, k), v_tl(isd:ied+1, jsd:jed&
583 & , k), w(isd:ied, jsd:jed, k), w_tl(isd:ied, jsd:jed, k)&
584 & , uc(isd:ied+1, jsd:jed, k), uc_tl(isd:ied+1, jsd:jed, k&
585 & ), vc(isd:ied, jsd:jed+1, k), vc_tl(isd:ied, jsd:jed+1, &
586 & k), ua(isd:ied, jsd:jed, k), ua_tl(isd:ied, jsd:jed, k)&
587 & , va(isd:ied, jsd:jed, k), va_tl(isd:ied, jsd:jed, k), &
588 & omga(isd:ied, jsd:jed, k), omga_tl(isd:ied, jsd:jed, k)&
589 & , ut(isd:ied, jsd:jed, k), ut_tl(isd:ied, jsd:jed, k), &
590 & vt(isd:ied, jsd:jed, k), vt_tl(isd:ied, jsd:jed, k), &
591 & divgd(isd:ied+1, jsd:jed+1, k), divgd_tl(isd:ied+1, jsd:&
592 & jed+1, k), flagstruct%nord, dt2, hydrostatic, .true., bd&
593 & , gridstruct, flagstruct)
596 IF (flagstruct%nord .GT. 0)
THEN 599 & domain, position=
corner)
602 IF (gridstruct%nested)
THEN 604 & npy, npz, bd, split_timestep_bc + &
605 & 0.5,
REAL(n_split*flagstruct%&
& k_split), neststruct%delp_bc, &
606 & bctype=neststruct%nestbctype)
608 & npz, bd, split_timestep_bc + 0.5, &
609 & REAL(n_split*flagstruct%k_split), &
610 & neststruct%pt_bc, bctype=neststruct&
614 IF (hydrostatic)
THEN 615 CALL geopk_tlm(ptop, pe, pe_tl, peln, peln_tl, delpc, delpc_tl, &
616 & pkc, pkc_tl, gz, gz_tl, phis, ptc, ptc_tl, q_con, pkz, &
617 & pkz_tl, npz, akap, .true., gridstruct%nested, .false., &
618 & npx, npy, flagstruct%a2b_ord, bd)
622 CALL complete_group_halo_update(i_pack(5), domain)
629 zh_tl(i, j, k) = gz_tl(i, j, k)
630 zh(i, j, k) = gz(i, j, k)
639 gz_tl(i, j, k) = zh_tl(i, j, k)
640 gz(i, j, k) = zh(i, j, k)
646 CALL update_dz_c_tlm(is, ie, js, je, npz, ng, dt2, dp_ref, zs, &
647 & gridstruct%area, ut, ut_tl, vt, vt_tl, gz, gz_tl&
648 & , ws3, ws3_tl, npx, npy, gridstruct%sw_corner, &
649 & gridstruct%se_corner, gridstruct%ne_corner, &
650 & gridstruct%nw_corner, bd, gridstruct%grid_type)
653 CALL riem_solver_c_tlm(ms, dt2, is, ie, js, je, npz, ng, akap, &
654 & cappa, cp, ptop, phis, omga, omga_tl, ptc, &
655 & ptc_tl, q_con, delpc, delpc_tl, gz, gz_tl, pkc&
656 & , pkc_tl, ws3, ws3_tl, flagstruct%p_fac, &
657 & flagstruct%a_imp, flagstruct%scale_z)
659 IF (gridstruct%nested)
THEN 661 & npy, npz, bd, split_timestep_bc +&
662 & 0.5,
REAL(n_split*flagstruct%&
& k_split), neststruct%delz_bc, &
663 & bctype=neststruct%nestbctype)
667 CALL nest_halo_nh_tlm(ptop, grav, akap, cp, delpc, delpc_tl, &
668 & delz, delz_tl, ptc, ptc_tl, phis, pkc, pkc_tl&
669 & , gz, gz_tl, pk3, pk3_tl, npx, npy, npz, &
670 & gridstruct%nested, .false., .false., .false., &
674 CALL p_grad_c_tlm(dt2, npz, delpc, delpc_tl, pkc, pkc_tl, gz, &
675 & gz_tl, uc, uc_tl, vc, vc_tl, bd, gridstruct%rdxc, &
676 & gridstruct%rdyc, hydrostatic)
679 & domain, gridtype=cgrid_ne)
682 IF (flagstruct%inline_q .AND. nq .GT. 0)
CALL &
683 & complete_group_halo_update(i_pack(10), domain)
684 IF (flagstruct%nord .GT. 0)
CALL complete_group_halo_update(i_pack&
686 CALL complete_group_halo_update(i_pack(9), domain)
688 IF (gridstruct%nested)
THEN 699 & npz, bd, split_timestep_bc + 0.5, &
700 &
REAL(n_split*flagstruct%k_split), &
701 & neststruct%vc_bc, bctype=neststruct&
704 & npz, bd, split_timestep_bc + 0.5, &
705 & REAL(n_split*flagstruct%k_split), &
706 & neststruct%uc_bc, bctype=neststruct&
710 & npy, npz, bd, split_timestep_bc, &
711 &
REAL(n_split*flagstruct%k_split), &
712 & neststruct%divg_bc, bctype=&
713 & neststruct%nestbctype)
719 IF (gridstruct%nested .AND. flagstruct%inline_q)
THEN 722 & , q_tl(isd:ied, jsd:jed, :, iq), &
723 & 0, 0, npx, npy, npz, bd, &
724 & split_timestep_bc + 1,
REAL(&
& n_split*flagstruct%k_split), &
725 & neststruct%q_bc(iq), bctype=&
726 & neststruct%nestbctype)
738 hord_m = flagstruct%hord_mt
739 hord_t = flagstruct%hord_tm
740 hord_v = flagstruct%hord_vt
741 hord_p = flagstruct%hord_dp
742 nord_k = flagstruct%nord
744 kgb = flagstruct%ke_bg
745 IF (2 .GT. flagstruct%nord)
THEN 746 nord_v(k) = flagstruct%nord
750 IF (0.20 .GT. flagstruct%d2_bg)
THEN 751 d2_divg = flagstruct%d2_bg
755 IF (flagstruct%do_vort_damp)
THEN 757 damp_vt(k) = flagstruct%vtdm4
765 d_con_k = flagstruct%d_con
766 IF (npz .EQ. 1 .OR. flagstruct%n_sponge .LT. 0)
THEN 767 d2_divg = flagstruct%d2_bg
768 ELSE IF (k .EQ. 1)
THEN 773 IF (0.01 .LT. flagstruct%d2_bg)
THEN 774 IF (flagstruct%d2_bg .LT. flagstruct%d2_bg_k1)
THEN 775 d2_divg = flagstruct%d2_bg_k1
777 d2_divg = flagstruct%d2_bg
779 ELSE IF (0.01 .LT. flagstruct%d2_bg_k1)
THEN 780 d2_divg = flagstruct%d2_bg_k1
787 IF (flagstruct%do_vort_damp)
THEN 790 damp_vt(k) = 0.5*d2_divg
794 IF (2 .LT. flagstruct%n_sponge - 1)
THEN 795 max1 = flagstruct%n_sponge - 1
799 IF (k .EQ. max1 .AND. flagstruct%d2_bg_k2 .GT. 0.01)
THEN 801 IF (flagstruct%d2_bg .LT. flagstruct%d2_bg_k2)
THEN 802 d2_divg = flagstruct%d2_bg_k2
804 d2_divg = flagstruct%d2_bg
808 IF (flagstruct%do_vort_damp)
THEN 810 damp_vt(k) = 0.5*d2_divg
814 IF (3 .LT. flagstruct%n_sponge)
THEN 815 max2 = flagstruct%n_sponge
819 IF (k .EQ. max2 .AND. flagstruct%d2_bg_k2 .GT. 0.05)
THEN 821 IF (flagstruct%d2_bg .LT. 0.2*flagstruct%d2_bg_k2)
THEN 822 d2_divg = 0.2*flagstruct%d2_bg_k2
824 d2_divg = flagstruct%d2_bg
832 hord_m_pert = flagstructp%hord_mt_pert
833 hord_t_pert = flagstructp%hord_tm_pert
834 hord_v_pert = flagstructp%hord_vt_pert
835 hord_p_pert = flagstructp%hord_dp_pert
836 nord_k_pert = flagstructp%nord_pert
837 IF (2 .GT. flagstructp%nord_pert)
THEN 838 nord_v_pert(k) = flagstructp%nord_pert
842 IF (0.20 .GT. flagstructp%d2_bg_pert)
THEN 843 d2_divg_pert = flagstructp%d2_bg_pert
847 IF (flagstructp%do_vort_damp_pert)
THEN 849 damp_vt_pert(k) = flagstructp%vtdm4_pert
853 nord_w_pert = nord_v_pert(k)
854 nord_t_pert = nord_v_pert(k)
855 damp_w_pert = damp_vt_pert(k)
856 damp_t_pert = damp_vt_pert(k)
858 IF (k .LE. flagstructp%n_sponge_pert)
THEN 859 IF (k .LE. flagstructp%n_sponge_pert - 1)
THEN 860 IF (flagstructp%hord_ks_traj)
THEN 861 hord_m = flagstructp%hord_mt_ks_traj
862 hord_t = flagstructp%hord_tm_ks_traj
863 hord_v = flagstructp%hord_vt_ks_traj
864 hord_p = flagstructp%hord_dp_ks_traj
866 IF (flagstructp%hord_ks_pert)
THEN 867 hord_m_pert = flagstructp%hord_mt_ks_pert
868 hord_t_pert = flagstructp%hord_tm_ks_pert
869 hord_v_pert = flagstructp%hord_vt_ks_pert
870 hord_p_pert = flagstructp%hord_dp_ks_pert
875 IF (0.01 .LT. flagstructp%d2_bg_pert)
THEN 876 IF (flagstructp%d2_bg_pert .LT. flagstructp%d2_bg_k1_pert&
878 d2_divg_pert = flagstructp%d2_bg_k1_pert
880 d2_divg_pert = flagstructp%d2_bg_pert
882 ELSE IF (0.01 .LT. flagstructp%d2_bg_k1_pert)
THEN 883 d2_divg_pert = flagstructp%d2_bg_k1_pert
887 ELSE IF (k .EQ. 2)
THEN 888 IF (0.01 .LT. flagstructp%d2_bg_pert)
THEN 889 IF (flagstructp%d2_bg_pert .LT. flagstructp%d2_bg_k2_pert&
891 d2_divg_pert = flagstructp%d2_bg_k2_pert
893 d2_divg_pert = flagstructp%d2_bg_pert
895 ELSE IF (0.01 .LT. flagstructp%d2_bg_k2_pert)
THEN 896 d2_divg_pert = flagstructp%d2_bg_k2_pert
900 ELSE IF (0.01 .LT. flagstructp%d2_bg_pert)
THEN 901 IF (flagstructp%d2_bg_pert .LT. flagstructp%d2_bg_ks_pert) &
903 d2_divg_pert = flagstructp%d2_bg_ks_pert
905 d2_divg_pert = flagstructp%d2_bg_pert
907 ELSE IF (0.01 .LT. flagstructp%d2_bg_ks_pert)
THEN 908 d2_divg_pert = flagstructp%d2_bg_ks_pert
913 damp_w_pert = d2_divg_pert
914 IF (flagstructp%do_vort_damp_pert)
THEN 916 damp_vt_pert(k) = 0.5*d2_divg_pert
920 damp_vt(npz+1) = damp_vt(npz)
921 damp_vt_pert(npz+1) = damp_vt_pert(npz)
922 nord_v(npz+1) = nord_v(npz)
923 nord_v_pert(npz+1) = nord_v_pert(npz)
924 IF (hydrostatic .AND. (.NOT.flagstruct%use_old_omega) .AND. &
929 omga_tl(i, j, k) = delp_tl(i, j, k)
930 omga(i, j, k) = delp(i, j, k)
935 IF (flagstruct%d_ext .GT. 0.)
CALL a2b_ord2_tlm(delp(isd:ied, &
936 & jsd:jed, k), delp_tl(&
937 & isd:ied, jsd:jed, k), &
938 & wk, wk_tl, gridstruct&
939 & , npx, npy, is, ie, js&
941 IF (.NOT.hydrostatic .AND. flagstruct%do_f3d)
THEN 945 z_rat_tl(i, j) = (zh_tl(i, j, k)+zh_tl(i, j, k+1))/
radius 946 z_rat(i, j) = 1. + (zh(i, j, k)+zh(i, j, k+1))/
radius 950 CALL d_sw_tlm(vt(isd:ied, jsd:jed, k), vt_tl(isd:ied, jsd:jed, k&
951 & ), delp(isd:ied, jsd:jed, k), delp_tl(isd:ied, jsd:jed, &
952 & k), ptc(isd:ied, jsd:jed, k), ptc_tl(isd:ied, jsd:jed, k&
953 & ), pt(isd:ied, jsd:jed, k), pt_tl(isd:ied, jsd:jed, k), &
954 & u(isd:ied, jsd:jed+1, k), u_tl(isd:ied, jsd:jed+1, k), v&
955 & (isd:ied+1, jsd:jed, k), v_tl(isd:ied+1, jsd:jed, k), w(&
956 & isd:ied, jsd:jed, k), w_tl(isd:ied, jsd:jed, k), uc(isd:&
957 & ied+1, jsd:jed, k), uc_tl(isd:ied+1, jsd:jed, k), vc(isd&
958 & :ied, jsd:jed+1, k), vc_tl(isd:ied, jsd:jed+1, k), ua(&
959 & isd:ied, jsd:jed, k), ua_tl(isd:ied, jsd:jed, k), va(isd&
960 & :ied, jsd:jed, k), va_tl(isd:ied, jsd:jed, k), divgd(isd&
961 & :ied+1, jsd:jed+1, k), divgd_tl(isd:ied+1, jsd:jed+1, k)&
962 & , mfx(is:ie+1, js:je, k), mfx_tl(is:ie+1, js:je, k), mfy&
963 & (is:ie, js:je+1, k), mfy_tl(is:ie, js:je+1, k), cx(is:ie&
964 & +1, jsd:jed, k), cx_tl(is:ie+1, jsd:jed, k), cy(isd:ied&
965 & , js:je+1, k), cy_tl(isd:ied, js:je+1, k), crx(is:ie+1, &
966 & jsd:jed, k), crx_tl(is:ie+1, jsd:jed, k), cry(isd:ied, &
967 & js:je+1, k), cry_tl(isd:ied, js:je+1, k), xfx(is:ie+1, &
968 & jsd:jed, k), xfx_tl(is:ie+1, jsd:jed, k), yfx(isd:ied, &
969 & js:je+1, k), yfx_tl(isd:ied, js:je+1, k), q_con(isd:ied&
970 & , jsd:jed, 1), z_rat(isd:ied, jsd:jed), z_rat_tl(isd:ied&
971 & , jsd:jed), kgb, heat_s, heat_s_tl, dpx, dpx_tl, zvir, &
972 & sphum, nq, q, q_tl, k, npz, flagstruct%inline_q, dt, &
973 & flagstruct%hord_tr, hord_m, hord_v, hord_t, hord_p, &
974 & nord_k, nord_v(k), nord_w, nord_t, flagstruct%dddmp, &
975 & d2_divg, flagstruct%d4_bg, damp_vt(k), damp_w, damp_t, &
976 & d_con_k, hydrostatic, gridstruct, flagstruct, bd, &
977 & flagstructp%hord_tr_pert, hord_m_pert, hord_v_pert, &
978 & hord_t_pert, hord_p_pert, flagstructp%split_damp, &
979 & nord_k_pert, nord_v_pert(k), nord_w_pert, nord_t_pert, &
980 & flagstructp%dddmp_pert, d2_divg_pert, flagstructp%&
981 & d4_bg_pert, damp_vt_pert(k), damp_w_pert, damp_t_pert)
982 IF (hydrostatic .AND. (.NOT.flagstruct%use_old_omega) .AND. &
987 omga_tl(i, j, k) = gridstruct%rarea(i, j)*rdt*(omga_tl(i, &
988 & j, k)*(xfx(i, j, k)-xfx(i+1, j, k)+yfx(i, j, k)-yfx(i, j&
989 & +1, k))+omga(i, j, k)*(xfx_tl(i, j, k)-xfx_tl(i+1, j, k)&
990 & +yfx_tl(i, j, k)-yfx_tl(i, j+1, k)))
991 omga(i, j, k) = omga(i, j, k)*(xfx(i, j, k)-xfx(i+1, j, k)&
992 & +yfx(i, j, k)-yfx(i, j+1, k))*gridstruct%rarea(i, j)*rdt
996 IF (flagstruct%d_ext .GT. 0.)
THEN 1000 ptc_tl(i, j, k) = wk_tl(i, j)
1001 ptc(i, j, k) = wk(i, j)
1005 IF (flagstruct%d_con .GT. 1.0e-5)
THEN 1009 heat_source_tl(i, j, k) = heat_source_tl(i, j, k) + &
1011 heat_source(i, j, k) = heat_source(i, j, k) + heat_s(i, j)
1018 IF (flagstruct%fill_dp)
CALL mix_dp_tlm(hydrostatic, w, w_tl, delp&
1019 & , delp_tl, pt, pt_tl, npz, ak, &
1020 & bk, .false., flagstruct%fv_debug&
1024 & , complete=.true.)
1028 IF (flagstruct%d_ext .GT. 0.)
THEN 1029 d2_divg = flagstruct%d_ext*gridstruct%da_min_c
1033 wk_tl(i, j) = ptc_tl(i, j, 1)
1034 wk(i, j) = ptc(i, j, 1)
1035 divg2_tl(i, j) = wk_tl(i, j)*vt(i, j, 1) + wk(i, j)*vt_tl(i&
1037 divg2(i, j) = wk(i, j)*vt(i, j, 1)
1041 wk_tl(i, j) = wk_tl(i, j) + ptc_tl(i, j, k)
1042 wk(i, j) = wk(i, j) + ptc(i, j, k)
1043 divg2_tl(i, j) = divg2_tl(i, j) + ptc_tl(i, j, k)*vt(i, j&
1044 & , k) + ptc(i, j, k)*vt_tl(i, j, k)
1045 divg2(i, j) = divg2(i, j) + ptc(i, j, k)*vt(i, j, k)
1049 divg2_tl(i, j) = (d2_divg*divg2_tl(i, j)*wk(i, j)-d2_divg*&
1050 & divg2(i, j)*wk_tl(i, j))/wk(i, j)**2
1051 divg2(i, j) = d2_divg*divg2(i, j)/wk(i, j)
1059 CALL complete_group_halo_update(i_pack(1), domain)
1061 IF (flagstruct%fv_debug)
THEN 1062 IF (.NOT.flagstruct%hydrostatic)
CALL prt_mxm(
'delz', delz, is, &
1063 & ie, js, je, ng, npz, 1.&
1064 & , gridstruct%area_64, &
1068 IF (gridstruct%nested)
THEN 1070 & , npz, bd, split_timestep_bc + 1, &
1071 &
REAL(n_split*flagstruct%k_split), &
1072 & neststruct%delp_bc, bctype=&
1073 & neststruct%nestbctype)
1075 & npz, bd, split_timestep_bc + 1, &
1076 & REAL(n_split*flagstruct%k_split), &
1077 & neststruct%pt_bc, bctype=neststruct&
1081 IF (hydrostatic)
THEN 1082 CALL geopk_tlm(ptop, pe, pe_tl, peln, peln_tl, delp, delp_tl, &
1083 & pkc, pkc_tl, gz, gz_tl, phis, pt, pt_tl, q_con, pkz, &
1084 & pkz_tl, npz, akap, .false., gridstruct%nested, .true., &
1085 & npx, npy, flagstruct%a2b_ord, bd)
1088 CALL update_dz_d_tlm(nord_v, damp_vt, flagstruct%hord_tm, is, ie&
1089 & , js, je, npz, ng, npx, npy, gridstruct%area, &
1090 & gridstruct%rarea, dp_ref, zs, zh, zh_tl, crx, &
1091 & crx_tl, cry, cry_tl, xfx, xfx_tl, yfx, yfx_tl, &
1092 & delz, ws, ws_tl, rdt, gridstruct, bd, flagstructp&
1095 IF (flagstruct%fv_debug)
THEN 1096 IF (.NOT.flagstruct%hydrostatic)
CALL prt_mxm(
'delz updated', &
1097 & delz, is, ie, js, je, &
1099 & gridstruct%area_64, &
1102 IF (idiag%id_ws .GT. 0 .AND. last_step) used =
send_data(idiag%&
1107 & npz, ng, isd, ied, jsd, jed, akap, cappa, cp, &
1108 & ptop, zs, q_con, w, w_tl, delz, delz_tl, pt, &
1109 & pt_tl, delp, delp_tl, zh, zh_tl, pe, pe_tl, pkc&
1110 & , pkc_tl, pk3, pk3_tl, pk, pk_tl, peln, peln_tl&
1111 & , ws, ws_tl, flagstruct%scale_z, flagstruct%&
1112 & p_fac, flagstruct%a_imp, flagstruct%use_logp, &
1113 & remap_step, beta .LT. -0.1)
1116 IF (gridstruct%square_domain)
THEN 1119 & domain, whalo=2, ehalo=2, shalo=2, &
1123 & , complete=.true.)
1125 & domain, complete=.true.)
1128 IF (remap_step)
CALL pe_halo_tlm(is, ie, js, je, isd, ied, jsd, &
1129 & jed, npz, ptop, pe, pe_tl, delp, &
1131 IF (flagstruct%use_logp)
THEN 1132 CALL pln_halo_tlm(is, ie, js, je, isd, ied, jsd, jed, npz, &
1133 & ptop, pk3, pk3_tl, delp, delp_tl)
1135 CALL pk3_halo_tlm(is, ie, js, je, isd, ied, jsd, jed, npz, &
1136 & ptop, akap, pk3, pk3_tl, delp, delp_tl)
1138 IF (gridstruct%nested)
THEN 1140 & npy, npz, bd, split_timestep_bc +&
1141 & 1.,
REAL(n_split*flagstruct%&
& k_split), neststruct%delz_bc, &
1142 & bctype=neststruct%nestbctype)
1144 CALL nest_halo_nh_tlm(ptop, grav, akap, cp, delp, delp_tl, &
1145 & delz, delz_tl, pt, pt_tl, phis, pkc, pkc_tl, &
1146 & gz, gz_tl, pk3, pk3_tl, npx, npy, npz, &
1147 & gridstruct%nested, .true., .true., .true., bd)
1150 CALL complete_group_halo_update(i_pack(4), domain)
1156 gz_tl(i, j, k) = grav*zh_tl(i, j, k)
1157 gz(i, j, k) = zh(i, j, k)*grav
1161 IF (gridstruct%square_domain)
THEN 1163 CALL complete_group_halo_update(i_pack(5), domain)
1167 IF (remap_step .AND. hydrostatic)
THEN 1172 pk_tl(i, j, k) = pkc_tl(i, j, k)
1173 pk(i, j, k) = pkc(i, j, k)
1182 IF (hydrostatic)
THEN 1183 IF (beta .GT. 0.)
THEN 1185 & , pkc_tl, gz, gz_tl, du, du_tl, dv, dv_tl, &
1186 & dt, ng, gridstruct, bd, npx, npy, npz, ptop&
1187 & , beta_d, flagstruct%a2b_ord)
1190 & divg2, divg2_tl, delp, delp_tl, dt, ng, &
1191 & gridstruct, bd, npx, npy, npz, ptop, hydrostatic&
1192 & , flagstruct%a2b_ord, flagstruct%d_ext)
1194 ELSE IF (beta .GT. 0.)
THEN 1196 & du, du_tl, dv, dv_tl, delp, delp_tl, pk3, pk3_tl&
1197 & , beta_d, dt, ng, gridstruct, bd, npx, npy, npz&
1198 & , flagstruct%use_logp)
1199 ELSE IF (beta .LT. -0.1)
THEN 1201 & divg2, divg2_tl, delp, delp_tl, dt, ng, gridstruct&
1202 & , bd, npx, npy, npz, ptop, hydrostatic, flagstruct&
1203 & %a2b_ord, flagstruct%d_ext)
1205 CALL nh_p_grad_tlm(u, u_tl, v, v_tl, pkc, pkc_tl, gz, gz_tl, &
1206 & delp, delp_tl, pk3, pk3_tl, dt, ng, gridstruct, bd&
1207 & , npx, npy, npz, flagstruct%use_logp)
1212 IF (flagstruct%breed_vortex_inline)
THEN 1213 IF (.NOT.hydrostatic)
THEN 1219 arg1_tl = (rdg*delp_tl(i, j, k)*delz(i, j, k)-rdg*delp(i&
1220 & , j, k)*delz_tl(i, j, k))*pt(i, j, k)/delz(i, j, k)**2&
1221 & + rdg*delp(i, j, k)*pt_tl(i, j, k)/delz(i, j, k)
1222 arg1 = rdg*delp(i, j, k)/delz(i, j, k)*pt(i, j, k)
1223 arg2_tl = k1k*arg1_tl/arg1
1224 arg2 = k1k*log(arg1)
1225 pkz_tl(i, j, k) = arg2_tl*exp(arg2)
1226 pkz(i, j, k) = exp(arg2)
1232 & pkz, delp, u, v, pt, q, flagstruct%nwat, zvir, &
1233 & gridstruct, ks, domain, bd, hydrostatic)
1237 IF (it .EQ. n_split .AND. gridstruct%grid_type .LT. 4 .AND. (.NOT.&
1238 & gridstruct%nested))
THEN 1241 & ebuffer, ebuffery_tl=ebuffer_tl, nbufferx=&
1242 & nbuffer, nbufferx_tl=nbuffer_tl, gridtype=&
1247 u_tl(i, je+1, k) = nbuffer_tl(i-is+1, k)
1248 u(i, je+1, k) = nbuffer(i-is+1, k)
1251 v_tl(ie+1, j, k) = ebuffer_tl(j-js+1, k)
1252 v(ie+1, j, k) = ebuffer(j-js+1, k)
1257 & , u_tl, v, v_tl, &
1258 & domain, gridtype=&
1261 IF (gridstruct%nested) neststruct%nest_timestep = neststruct%&
1263 IF (hydrostatic .AND. last_step)
THEN 1264 IF (flagstruct%use_old_omega)
THEN 1269 omga_tl(i, j, k) = rdt*(pe_tl(i, k+1, j)-pem_tl(i, k+1, &
1271 omga(i, j, k) = (pe(i, k+1, j)-pem(i, k+1, j))*rdt
1278 CALL adv_pe_tlm(ua, ua_tl, va, va_tl, pem, pem_tl, omga, &
1279 & omga_tl, gridstruct, bd, npx, npy, npz, ng)
1285 om2d_tl(i, k) = omga_tl(i, j, k)
1286 om2d(i, k) = omga(i, j, k)
1291 om2d_tl(i, k) = om2d_tl(i, k-1) + omga_tl(i, j, k)
1292 om2d(i, k) = om2d(i, k-1) + omga(i, j, k)
1297 omga_tl(i, j, k) = om2d_tl(i, k)
1298 omga(i, j, k) = om2d(i, k)
1303 IF (idiag%id_ws .GT. 0 .AND. hydrostatic)
THEN 1307 ws_tl(i, j) = (delz_tl(i, j, npz)*delp(i, j, npz)-delz(i, &
1308 & j, npz)*delp_tl(i, j, npz))*omga(i, j, npz)/delp(i, j, &
1309 & npz)**2 + delz(i, j, npz)*omga_tl(i, j, npz)/delp(i, j, &
1311 ws(i, j) = delz(i, j, npz)/delp(i, j, npz)*omga(i, j, npz)
1317 IF (gridstruct%nested)
THEN 1322 & split_timestep_bc&
1323 & + 1,
REAL(&
& n_split*&
& flagstruct%&
& k_split), &
1329 & , bd, split_timestep_bc + 1, REAL(&
1330 & n_split*flagstruct%k_split), &
1331 & neststruct%u_bc, bctype=neststruct%&
1334 & , bd, split_timestep_bc + 1, REAL(&
1335 & n_split*flagstruct%k_split), &
1336 & neststruct%v_bc, bctype=neststruct%&
1343 IF (nq .GT. 0 .AND. (.NOT.flagstruct%inline_q))
THEN 1350 IF (flagstruct%fv_debug)
THEN 1351 IF (is_master())
WRITE(*, *)
'End of n_split loop' 1353 IF (n_con .NE. 0 .AND. flagstruct%d_con .GT. 1.e-5)
THEN 1354 IF (3 .GT. flagstruct%nord + 1)
THEN 1355 nf_ke = flagstruct%nord + 1
1360 & gridstruct%da_min, gridstruct, domain, npx, npy, npz&
1363 IF (hydrostatic)
THEN 1374 pt_tl(i, j, k) = pt_tl(i, j, k) + (heat_source_tl(i, j, &
1375 & k)*
cp_air*delp(i, j, k)*pkz(i, j, k)-heat_source(i, j&
1376 & , k)*
cp_air*(delp_tl(i, j, k)*pkz(i, j, k)+delp(i, j, &
1377 & k)*pkz_tl(i, j, k)))/(
cp_air*delp(i, j, k)*pkz(i, j, k&
1379 pt(i, j, k) = pt(i, j, k) + heat_source(i, j, k)/(
cp_air&
1380 & *delp(i, j, k)*pkz(i, j, k))
1384 dtmp_tl = (heat_source_tl(i, j, k)*
cp_air*delp(i, j, k)-&
1385 & heat_source(i, j, k)*
cp_air*delp_tl(i, j, k))/(
cp_air*&
1387 dtmp = heat_source(i, j, k)/(
cp_air*delp(i, j, k))
1388 IF (bdt .GE. 0.)
THEN 1393 x1 = abs0*flagstruct%delt_max
1394 IF (dtmp .GE. 0.)
THEN 1401 IF (x1 .GT. y1)
THEN 1408 pt_tl(i, j, k) = pt_tl(i, j, k) + (min1_tl*sign(1.d0, &
1409 & min1*dtmp)*pkz(i, j, k)-sign(min1, dtmp)*pkz_tl(i, j, &
1410 & k))/pkz(i, j, k)**2
1411 pt(i, j, k) = pt(i, j, k) + sign(min1, dtmp)/pkz(i, j, k&
1422 IF (bdt*flagstruct%delt_max .GE. 0.)
THEN 1423 delt = bdt*flagstruct%delt_max
1425 delt = -(bdt*flagstruct%delt_max)
1432 arg1_tl = (rdg*delp_tl(i, j, k)*delz(i, j, k)-rdg*delp(i, &
1433 & j, k)*delz_tl(i, j, k))*pt(i, j, k)/delz(i, j, k)**2 + &
1434 & rdg*delp(i, j, k)*pt_tl(i, j, k)/delz(i, j, k)
1435 arg1 = rdg*delp(i, j, k)/delz(i, j, k)*pt(i, j, k)
1436 arg2_tl = k1k*arg1_tl/arg1
1437 arg2 = k1k*log(arg1)
1438 pkz_tl(i, j, k) = arg2_tl*exp(arg2)
1439 pkz(i, j, k) = exp(arg2)
1440 dtmp_tl = (heat_source_tl(i, j, k)*cv_air*delp(i, j, k)-&
1441 & heat_source(i, j, k)*cv_air*delp_tl(i, j, k))/(cv_air*&
1443 dtmp = heat_source(i, j, k)/(cv_air*delp(i, j, k))
1444 IF (dtmp .GE. 0.)
THEN 1451 IF (delt .GT. y2)
THEN 1458 pt_tl(i, j, k) = pt_tl(i, j, k) + (min2_tl*sign(1.d0, min2&
1459 & *dtmp)*pkz(i, j, k)-sign(min2, dtmp)*pkz_tl(i, j, k))/&
1461 pt(i, j, k) = pt(i, j, k) + sign(min2, dtmp)/pkz(i, j, k)
1471 SUBROUTINE dyn_core(npx, npy, npz, ng, sphum, nq, bdt, n_split, zvir, &
1472 & cp, akap, cappa, grav, hydrostatic, u, v, w, delz, pt, q, delp, pe, &
1473 & pk, phis, ws, omga, ptop, pfull, ua, va, uc, vc, mfx, mfy, cx, cy, &
1474 & pkz, peln, q_con, ak, bk, dpx, ks, gridstruct, flagstruct, &
1475 & flagstructp, neststruct, idiag, bd, domain, init_step, i_pack, &
1476 & end_step, gz, pkc, ptc, crx, xfx, cry, yfx, divgd, delpc, ut, vt, zh&
1477 & , pk3, du, dv, time_total)
1520 INTEGER,
INTENT(IN) :: npx
1521 INTEGER,
INTENT(IN) :: npy
1522 INTEGER,
INTENT(IN) :: npz
1523 INTEGER,
INTENT(IN) :: ng, nq, sphum
1524 INTEGER,
INTENT(IN) :: n_split
1525 REAL,
INTENT(IN) :: bdt
1526 REAL,
INTENT(IN) :: zvir, cp, akap, grav
1527 REAL,
INTENT(IN) :: ptop
1528 LOGICAL,
INTENT(IN) :: hydrostatic
1529 LOGICAL,
INTENT(IN) :: init_step, end_step
1530 REAL,
INTENT(IN) :: pfull(npz)
1531 REAL,
DIMENSION(npz+1),
INTENT(IN) :: ak, bk
1532 INTEGER,
INTENT(IN) :: ks
1533 TYPE(group_halo_update_type),
INTENT(INOUT) :: i_pack(*)
1536 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz),
INTENT(INOUT) &
1539 REAL,
DIMENSION(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz),
INTENT(INOUT) &
1542 REAL,
INTENT(INOUT) :: w(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1544 REAL,
INTENT(INOUT) :: delz(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1546 REAL,
INTENT(INOUT) :: cappa(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1548 REAL,
INTENT(INOUT) :: pt(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1550 REAL,
INTENT(INOUT) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1552 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed, npz, nq)
1554 REAL,
INTENT(IN),
OPTIONAL :: time_total
1561 REAL,
INTENT(INOUT) :: phis(bd%isd:bd%ied, bd%jsd:bd%jed)
1563 REAL,
INTENT(INOUT) :: pe(bd%is-1:bd%ie+1, npz+1, bd%js-1:bd%je+1)
1565 REAL,
INTENT(INOUT) :: peln(bd%is:bd%ie, npz+1, bd%js:bd%je)
1567 REAL,
INTENT(INOUT) :: pk(bd%is:bd%ie, bd%js:bd%je, npz+1)
1568 REAL(kind=8),
INTENT(INOUT) :: dpx(bd%is:bd%ie, bd%js:bd%je)
1571 REAL,
PARAMETER :: near0=1.e-8
1572 REAL,
PARAMETER :: huge_r=1.e8
1575 REAL,
INTENT(OUT) :: ws(bd%is:bd%ie, bd%js:bd%je)
1577 REAL,
INTENT(INOUT) :: omga(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1579 REAL,
INTENT(INOUT) :: uc(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
1580 REAL,
INTENT(INOUT) :: vc(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
1581 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, npz),
INTENT(INOUT) ::&
1583 REAL,
INTENT(INOUT) :: q_con(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1585 REAL,
INTENT(INOUT) :: mfx(bd%is:bd%ie+1, bd%js:bd%je, npz)
1586 REAL,
INTENT(INOUT) :: mfy(bd%is:bd%ie, bd%js:bd%je+1, npz)
1588 REAL,
INTENT(INOUT) :: cx(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
1589 REAL,
INTENT(INOUT) :: cy(bd%isd:bd%ied, bd%js:bd%je+1, npz)
1590 REAL,
DIMENSION(bd%is:bd%ie, bd%js:bd%je, npz),
INTENT(INOUT) :: pkz
1591 TYPE(
fv_grid_type),
INTENT(INOUT),
TARGET :: gridstruct
1596 TYPE(
domain2d),
INTENT(INOUT) :: domain
1598 REAL :: pem(bd%is-1:bd%ie+1, npz+1, bd%js-1:bd%je+1), heat_source(bd&
1599 & %isd:bd%ied, bd%jsd:bd%jed, npz)
1601 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed) :: ws3, z_rat
1604 REAL :: zs(bd%isd:bd%ied, bd%jsd:bd%jed)
1605 REAL :: p1d(bd%is:bd%ie)
1606 REAL :: om2d(bd%is:bd%ie, npz)
1607 REAL :: wbuffer(npy+2, npz)
1608 REAL :: ebuffer(npy+2, npz)
1609 REAL :: nbuffer(npx+2, npz)
1610 REAL :: sbuffer(npx+2, npz)
1612 REAL :: divg2(bd%is:bd%ie+1, bd%js:bd%je+1)
1613 REAL :: wk(bd%isd:bd%ied, bd%jsd:bd%jed)
1614 REAL :: fz(bd%is:bd%ie+1, bd%js:bd%je+1)
1615 REAL :: heat_s(bd%is:bd%ie, bd%js:bd%je)
1616 REAL :: damp_vt(npz+1)
1617 INTEGER :: nord_v(npz+1)
1619 INTEGER :: hord_m, hord_v, hord_t, hord_p
1620 INTEGER :: nord_k, nord_w, nord_t
1623 INTEGER :: hord_m_pert, hord_v_pert, hord_t_pert, hord_p_pert
1624 INTEGER :: nord_k_pert, nord_w_pert, nord_t_pert, nord_v_pert(npz+1)
1625 REAL :: d2_divg_pert, damp_vt_pert(npz+1), damp_w_pert, damp_t_pert
1627 INTEGER :: i, j, k, it, iq, n_con, nf_ke
1628 INTEGER :: iep1, jep1
1629 REAL :: beta, beta_d, d_con_k, damp_w, damp_t, kgb, cv_air
1630 REAL :: dt, dt2, rdt
1632 REAL :: k1k, rdg, dtmp, delt
1633 LOGICAL :: last_step, remap_step
1635 REAL :: split_timestep_bc
1636 INTEGER :: is, ie, js, je
1637 INTEGER :: isd, ied, jsd, jed
1638 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1639 REAL,
INTENT(INOUT) :: pkc(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1640 REAL,
INTENT(INOUT) :: ptc(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1641 REAL,
INTENT(INOUT) :: crx(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
1642 REAL,
INTENT(INOUT) :: xfx(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
1643 REAL,
INTENT(INOUT) :: cry(bd%isd:bd%ied, bd%js:bd%je+1, npz)
1644 REAL,
INTENT(INOUT) :: yfx(bd%isd:bd%ied, bd%js:bd%je+1, npz)
1645 REAL,
INTENT(INOUT) :: divgd(bd%isd:bd%ied+1, bd%jsd:bd%jed+1, npz)
1646 REAL,
INTENT(INOUT) :: delpc(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1647 REAL,
INTENT(INOUT) :: ut(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1648 REAL,
INTENT(INOUT) :: vt(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1649 REAL,
INTENT(INOUT) :: zh(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1650 REAL,
INTENT(INOUT) :: pk3(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1651 REAL,
INTENT(INOUT) :: du(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
1652 REAL,
INTENT(INOUT) :: dv(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
1680 dt = bdt/
REAL(n_split)
1683 IF (1 .LT. flagstruct%m_split/2)
THEN 1684 ms = flagstruct%m_split/2
1688 beta = flagstruct%beta
1694 IF (.NOT.hydrostatic)
THEN 1697 k1k = akap/(1.-akap)
1700 dp_ref(k) = ak(k+1) - ak(k) + (bk(k+1)-bk(k))*1.e5
1705 zs(i, j) = phis(i, j)*
rgrav 1722 IF (flagstruct%d_con .GT. 1.0e-5) heat_source = 0.0
1725 IF (flagstruct%convert_ke .OR. flagstruct%vtdm4 .GT. 1.e-4)
THEN 1727 ELSE IF (flagstruct%d2_bg_k1 .LT. 1.e-3)
THEN 1729 ELSE IF (flagstruct%d2_bg_k2 .LT. 1.e-3)
THEN 1737 IF (flagstruct%breed_vortex_inline .OR. it .EQ. n_split)
THEN 1740 remap_step = .false.
1742 IF (flagstruct%fv_debug)
THEN 1743 IF (is_master())
WRITE(*, *)
'n_split loop, it=', it
1744 IF (.NOT.flagstruct%hydrostatic)
CALL prt_mxm(
'delz', delz, is, &
1745 & ie, js, je, ng, npz, 1.&
1746 & , gridstruct%area_64, &
1748 CALL prt_mxm(
'PT', pt, is, ie, js, je, ng, npz, 1., gridstruct%&
1751 IF (gridstruct%nested) split_timestep_bc =
REAL(n_split*flagstruct&
1752 & %k_split + neststruct%nest_timestep)
1763 IF (.NOT.hydrostatic)
THEN 1768 IF (gridstruct%nested)
THEN 1772 gz(i, j, npz+1) = zs(i, j)
1776 gz(i, j, k) = gz(i, j, k+1) - delz(i, j, k)
1784 gz(i, j, npz+1) = zs(i, j)
1788 gz(i, j, k) = gz(i, j, k+1) - delz(i, j, k)
1800 CALL complete_group_halo_update(i_pack(1), domain)
1806 IF (it .EQ. n_split .AND. end_step)
THEN 1807 IF (flagstruct%use_old_omega)
THEN 1817 pem(i, k+1, j) = pem(i, k, j) + delp(i, j, k)
1827 CALL complete_group_halo_update(i_pack(8), domain)
1828 IF (.NOT.hydrostatic)
CALL complete_group_halo_update(i_pack(7), &
1836 CALL c_sw(delpc(isd:ied, jsd:jed, k), delp(isd:ied, jsd:jed, k)&
1837 & , ptc(isd:ied, jsd:jed, k), pt(isd:ied, jsd:jed, k), u(isd:&
1838 & ied, jsd:jed+1, k), v(isd:ied+1, jsd:jed, k), w(isd:ied, jsd&
1839 & :jed, k), uc(isd:ied+1, jsd:jed, k), vc(isd:ied, jsd:jed+1, &
1840 & k), ua(isd:ied, jsd:jed, k), va(isd:ied, jsd:jed, k), omga(&
1841 & isd:ied, jsd:jed, k), ut(isd:ied, jsd:jed, k), vt(isd:ied, &
1842 & jsd:jed, k), divgd(isd:ied+1, jsd:jed+1, k), flagstruct%nord&
1843 & , dt2, hydrostatic, .true., bd, gridstruct, flagstruct)
1846 IF (flagstruct%nord .GT. 0)
THEN 1852 IF (gridstruct%nested)
THEN 1853 CALL nested_grid_bc_apply_intt(delpc, 0, 0, npx, npy, npz, bd, &
1854 & split_timestep_bc + 0.5,
REAL(n_split*&
& flagstruct%k_split), neststruct%delp_bc&
1855 & , neststruct%nestbctype)
1856 call nested_grid_bc_apply_intt(ptc, 0, 0, npx, npy, npz, bd, &
1857 & split_timestep_bc + 0.5, REAL(n_split*&
1858 & flagstruct%k_split), neststruct%pt_bc, &
1859 & neststruct%nestbctype)
1862 IF (hydrostatic)
THEN 1863 CALL geopk(ptop, pe, peln, delpc, pkc, gz, phis, ptc, q_con, pkz&
1864 & , npz, akap, .true., gridstruct%nested, .false., npx, npy, &
1865 & flagstruct%a2b_ord, bd)
1869 CALL complete_group_halo_update(i_pack(5), domain)
1876 zh(i, j, k) = gz(i, j, k)
1885 gz(i, j, k) = zh(i, j, k)
1891 CALL update_dz_c(is, ie, js, je, npz, ng, dt2, dp_ref, zs, &
1892 & gridstruct%area, ut, vt, gz, ws3, npx, npy, &
1893 & gridstruct%sw_corner, gridstruct%se_corner, &
1894 & gridstruct%ne_corner, gridstruct%nw_corner, bd, &
1895 & gridstruct%grid_type)
1898 CALL riem_solver_c(ms, dt2, is, ie, js, je, npz, ng, akap, cappa&
1899 & , cp, ptop, phis, omga, ptc, q_con, delpc, gz, pkc&
1900 & , ws3, flagstruct%p_fac, flagstruct%a_imp, &
1901 & flagstruct%scale_z)
1903 IF (gridstruct%nested)
THEN 1904 CALL nested_grid_bc_apply_intt(delz, 0, 0, npx, npy, npz, bd, &
1905 & split_timestep_bc + 0.5,
REAL(n_split&
& *flagstruct%k_split), neststruct%&
1906 & delz_bc, neststruct%nestbctype)
1910 CALL nest_halo_nh(ptop, grav, akap, cp, delpc, delz, ptc, phis&
1911 & , pkc, gz, pk3, npx, npy, npz, gridstruct%nested, &
1912 & .false., .false., .false., bd)
1915 CALL p_grad_c(dt2, npz, delpc, pkc, gz, uc, vc, bd, gridstruct%&
1916 & rdxc, gridstruct%rdyc, hydrostatic)
1922 IF (flagstruct%inline_q .AND. nq .GT. 0)
CALL &
1923 & complete_group_halo_update(i_pack(10), domain)
1924 IF (flagstruct%nord .GT. 0)
CALL complete_group_halo_update(i_pack&
1926 CALL complete_group_halo_update(i_pack(9), domain)
1928 IF (gridstruct%nested)
THEN 1938 CALL nested_grid_bc_apply_intt(vc, 0, 1, npx, npy, npz, bd, &
1939 & split_timestep_bc + 0.5,
REAL(n_split*&
& flagstruct%k_split), neststruct%vc_bc, &
1940 & neststruct%nestbctype)
1941 call nested_grid_bc_apply_intt(uc, 1, 0, npx, npy, npz, bd, &
1942 & split_timestep_bc + 0.5, REAL(n_split*&
1943 & flagstruct%k_split), neststruct%uc_bc, &
1944 & neststruct%nestbctype)
1946 CALL nested_grid_bc_apply_intt(divgd, 1, 1, npx, npy, npz, bd, &
1947 & split_timestep_bc,
REAL(n_split*&
& flagstruct%k_split), neststruct%divg_bc&
1948 & , neststruct%nestbctype)
1954 IF (gridstruct%nested .AND. flagstruct%inline_q)
THEN 1956 CALL nested_grid_bc_apply_intt(q(isd:ied, jsd:jed, :, iq), 0, &
1957 & 0, npx, npy, npz, bd, &
1958 & split_timestep_bc + 1,
REAL(n_split*&
& flagstruct%k_split), neststruct%q_bc(&
1959 & iq), neststruct%nestbctype)
1971 hord_m = flagstruct%hord_mt
1972 hord_t = flagstruct%hord_tm
1973 hord_v = flagstruct%hord_vt
1974 hord_p = flagstruct%hord_dp
1975 nord_k = flagstruct%nord
1977 kgb = flagstruct%ke_bg
1978 IF (2 .GT. flagstruct%nord)
THEN 1979 nord_v(k) = flagstruct%nord
1983 IF (0.20 .GT. flagstruct%d2_bg)
THEN 1984 d2_divg = flagstruct%d2_bg
1988 IF (flagstruct%do_vort_damp)
THEN 1990 damp_vt(k) = flagstruct%vtdm4
1998 d_con_k = flagstruct%d_con
1999 IF (npz .EQ. 1 .OR. flagstruct%n_sponge .LT. 0)
THEN 2000 d2_divg = flagstruct%d2_bg
2001 ELSE IF (k .EQ. 1)
THEN 2006 IF (0.01 .LT. flagstruct%d2_bg)
THEN 2007 IF (flagstruct%d2_bg .LT. flagstruct%d2_bg_k1)
THEN 2008 d2_divg = flagstruct%d2_bg_k1
2010 d2_divg = flagstruct%d2_bg
2012 ELSE IF (0.01 .LT. flagstruct%d2_bg_k1)
THEN 2013 d2_divg = flagstruct%d2_bg_k1
2020 IF (flagstruct%do_vort_damp)
THEN 2023 damp_vt(k) = 0.5*d2_divg
2027 IF (2 .LT. flagstruct%n_sponge - 1)
THEN 2028 max1 = flagstruct%n_sponge - 1
2032 IF (k .EQ. max1 .AND. flagstruct%d2_bg_k2 .GT. 0.01)
THEN 2034 IF (flagstruct%d2_bg .LT. flagstruct%d2_bg_k2)
THEN 2035 d2_divg = flagstruct%d2_bg_k2
2037 d2_divg = flagstruct%d2_bg
2041 IF (flagstruct%do_vort_damp)
THEN 2043 damp_vt(k) = 0.5*d2_divg
2047 IF (3 .LT. flagstruct%n_sponge)
THEN 2048 max2 = flagstruct%n_sponge
2052 IF (k .EQ. max2 .AND. flagstruct%d2_bg_k2 .GT. 0.05)
THEN 2054 IF (flagstruct%d2_bg .LT. 0.2*flagstruct%d2_bg_k2)
THEN 2055 d2_divg = 0.2*flagstruct%d2_bg_k2
2057 d2_divg = flagstruct%d2_bg
2065 hord_m_pert = flagstructp%hord_mt_pert
2066 hord_t_pert = flagstructp%hord_tm_pert
2067 hord_v_pert = flagstructp%hord_vt_pert
2068 hord_p_pert = flagstructp%hord_dp_pert
2069 nord_k_pert = flagstructp%nord_pert
2070 IF (2 .GT. flagstructp%nord_pert)
THEN 2071 nord_v_pert(k) = flagstructp%nord_pert
2075 IF (0.20 .GT. flagstructp%d2_bg_pert)
THEN 2076 d2_divg_pert = flagstructp%d2_bg_pert
2080 IF (flagstructp%do_vort_damp_pert)
THEN 2082 damp_vt_pert(k) = flagstructp%vtdm4_pert
2084 damp_vt_pert(k) = 0.
2086 nord_w_pert = nord_v_pert(k)
2087 nord_t_pert = nord_v_pert(k)
2088 damp_w_pert = damp_vt_pert(k)
2089 damp_t_pert = damp_vt_pert(k)
2091 IF (k .LE. flagstructp%n_sponge_pert)
THEN 2092 IF (k .LE. flagstructp%n_sponge_pert - 1)
THEN 2093 IF (flagstructp%hord_ks_traj)
THEN 2094 hord_m = flagstructp%hord_mt_ks_traj
2095 hord_t = flagstructp%hord_tm_ks_traj
2096 hord_v = flagstructp%hord_vt_ks_traj
2097 hord_p = flagstructp%hord_dp_ks_traj
2099 IF (flagstructp%hord_ks_pert)
THEN 2100 hord_m_pert = flagstructp%hord_mt_ks_pert
2101 hord_t_pert = flagstructp%hord_tm_ks_pert
2102 hord_v_pert = flagstructp%hord_vt_ks_pert
2103 hord_p_pert = flagstructp%hord_dp_ks_pert
2108 IF (0.01 .LT. flagstructp%d2_bg_pert)
THEN 2109 IF (flagstructp%d2_bg_pert .LT. flagstructp%d2_bg_k1_pert&
2111 d2_divg_pert = flagstructp%d2_bg_k1_pert
2113 d2_divg_pert = flagstructp%d2_bg_pert
2115 ELSE IF (0.01 .LT. flagstructp%d2_bg_k1_pert)
THEN 2116 d2_divg_pert = flagstructp%d2_bg_k1_pert
2120 ELSE IF (k .EQ. 2)
THEN 2121 IF (0.01 .LT. flagstructp%d2_bg_pert)
THEN 2122 IF (flagstructp%d2_bg_pert .LT. flagstructp%d2_bg_k2_pert&
2124 d2_divg_pert = flagstructp%d2_bg_k2_pert
2126 d2_divg_pert = flagstructp%d2_bg_pert
2128 ELSE IF (0.01 .LT. flagstructp%d2_bg_k2_pert)
THEN 2129 d2_divg_pert = flagstructp%d2_bg_k2_pert
2133 ELSE IF (0.01 .LT. flagstructp%d2_bg_pert)
THEN 2134 IF (flagstructp%d2_bg_pert .LT. flagstructp%d2_bg_ks_pert) &
2136 d2_divg_pert = flagstructp%d2_bg_ks_pert
2138 d2_divg_pert = flagstructp%d2_bg_pert
2140 ELSE IF (0.01 .LT. flagstructp%d2_bg_ks_pert)
THEN 2141 d2_divg_pert = flagstructp%d2_bg_ks_pert
2146 damp_w_pert = d2_divg_pert
2147 IF (flagstructp%do_vort_damp_pert)
THEN 2149 damp_vt_pert(k) = 0.5*d2_divg_pert
2153 damp_vt(npz+1) = damp_vt(npz)
2154 damp_vt_pert(npz+1) = damp_vt_pert(npz)
2155 nord_v(npz+1) = nord_v(npz)
2156 nord_v_pert(npz+1) = nord_v_pert(npz)
2157 IF (hydrostatic .AND. (.NOT.flagstruct%use_old_omega) .AND. &
2162 omga(i, j, k) = delp(i, j, k)
2167 IF (flagstruct%d_ext .GT. 0.)
CALL a2b_ord2(delp(isd:ied, jsd:&
2168 & jed, k), wk, gridstruct, &
2169 & npx, npy, is, ie, js, je, &
2171 IF (.NOT.hydrostatic .AND. flagstruct%do_f3d)
THEN 2175 z_rat(i, j) = 1. + (zh(i, j, k)+zh(i, j, k+1))/
radius 2179 CALL d_sw(vt(isd:ied, jsd:jed, k), delp(isd:ied, jsd:jed, k), &
2180 & ptc(isd:ied, jsd:jed, k), pt(isd:ied, jsd:jed, k), u(isd:ied&
2181 & , jsd:jed+1, k), v(isd:ied+1, jsd:jed, k), w(isd:ied, jsd:&
2182 & jed, k), uc(isd:ied+1, jsd:jed, k), vc(isd:ied, jsd:jed+1, k&
2183 & ), ua(isd:ied, jsd:jed, k), va(isd:ied, jsd:jed, k), divgd(&
2184 & isd:ied+1, jsd:jed+1, k), mfx(is:ie+1, js:je, k), mfy(is:ie&
2185 & , js:je+1, k), cx(is:ie+1, jsd:jed, k), cy(isd:ied, js:je+1&
2186 & , k), crx(is:ie+1, jsd:jed, k), cry(isd:ied, js:je+1, k), &
2187 & xfx(is:ie+1, jsd:jed, k), yfx(isd:ied, js:je+1, k), q_con(&
2188 & isd:ied, jsd:jed, 1), z_rat(isd:ied, jsd:jed), kgb, heat_s, &
2189 & dpx, zvir, sphum, nq, q, k, npz, flagstruct%inline_q, dt, &
2190 & flagstruct%hord_tr, hord_m, hord_v, hord_t, hord_p, nord_k, &
2191 & nord_v(k), nord_w, nord_t, flagstruct%dddmp, d2_divg, &
2192 & flagstruct%d4_bg, damp_vt(k), damp_w, damp_t, d_con_k, &
2193 & hydrostatic, gridstruct, flagstruct, bd, flagstructp%&
2194 & hord_tr_pert, hord_m_pert, hord_v_pert, hord_t_pert, &
2195 & hord_p_pert, flagstructp%split_damp, nord_k_pert, &
2196 & nord_v_pert(k), nord_w_pert, nord_t_pert, flagstructp%&
2197 & dddmp_pert, d2_divg_pert, flagstructp%d4_bg_pert, &
2198 & damp_vt_pert(k), damp_w_pert, damp_t_pert)
2199 IF (hydrostatic .AND. (.NOT.flagstruct%use_old_omega) .AND. &
2204 omga(i, j, k) = omga(i, j, k)*(xfx(i, j, k)-xfx(i+1, j, k)&
2205 & +yfx(i, j, k)-yfx(i, j+1, k))*gridstruct%rarea(i, j)*rdt
2209 IF (flagstruct%d_ext .GT. 0.)
THEN 2213 ptc(i, j, k) = wk(i, j)
2217 IF (flagstruct%d_con .GT. 1.0e-5)
THEN 2221 heat_source(i, j, k) = heat_source(i, j, k) + heat_s(i, j)
2228 IF (flagstruct%fill_dp)
CALL mix_dp(hydrostatic, w, delp, pt, npz&
2229 & , ak, bk, .false., flagstruct%&
2237 IF (flagstruct%d_ext .GT. 0.)
THEN 2238 d2_divg = flagstruct%d_ext*gridstruct%da_min_c
2242 wk(i, j) = ptc(i, j, 1)
2243 divg2(i, j) = wk(i, j)*vt(i, j, 1)
2247 wk(i, j) = wk(i, j) + ptc(i, j, k)
2248 divg2(i, j) = divg2(i, j) + ptc(i, j, k)*vt(i, j, k)
2252 divg2(i, j) = d2_divg*divg2(i, j)/wk(i, j)
2259 CALL complete_group_halo_update(i_pack(1), domain)
2261 IF (flagstruct%fv_debug)
THEN 2262 IF (.NOT.flagstruct%hydrostatic)
CALL prt_mxm(
'delz', delz, is, &
2263 & ie, js, je, ng, npz, 1.&
2264 & , gridstruct%area_64, &
2268 IF (gridstruct%nested)
THEN 2269 CALL nested_grid_bc_apply_intt(delp, 0, 0, npx, npy, npz, bd, &
2270 & split_timestep_bc + 1,
REAL(n_split*&
& flagstruct%k_split), neststruct%delp_bc&
2271 & , neststruct%nestbctype)
2272 call nested_grid_bc_apply_intt(pt, 0, 0, npx, npy, npz, bd, &
2273 & split_timestep_bc + 1, REAL(n_split*&
2274 & flagstruct%k_split), neststruct%pt_bc, &
2275 & neststruct%nestbctype)
2278 IF (hydrostatic)
THEN 2279 CALL geopk(ptop, pe, peln, delp, pkc, gz, phis, pt, q_con, pkz, &
2280 & npz, akap, .false., gridstruct%nested, .true., npx, npy, &
2281 & flagstruct%a2b_ord, bd)
2284 CALL update_dz_d(nord_v, damp_vt, flagstruct%hord_tm, is, ie, js&
2285 & , je, npz, ng, npx, npy, gridstruct%area, gridstruct%&
2286 & rarea, dp_ref, zs, zh, crx, cry, xfx, yfx, delz, ws, &
2287 & rdt, gridstruct, bd, flagstructp%hord_tm_pert)
2289 IF (flagstruct%fv_debug)
THEN 2290 IF (.NOT.flagstruct%hydrostatic)
CALL prt_mxm(
'delz updated', &
2291 & delz, is, ie, js, je, &
2293 & gridstruct%area_64, &
2296 IF (idiag%id_ws .GT. 0 .AND. last_step) used =
send_data(idiag%&
2300 CALL riem_solver3(flagstruct%m_split, dt, is, ie, js, je, npz, &
2301 & ng, isd, ied, jsd, jed, akap, cappa, cp, ptop, zs, &
2302 & q_con, w, delz, pt, delp, zh, pe, pkc, pk3, pk, peln&
2303 & , ws, flagstruct%scale_z, flagstruct%p_fac, &
2304 & flagstruct%a_imp, flagstruct%use_logp, remap_step, &
2308 IF (gridstruct%square_domain)
THEN 2311 & ehalo=2, shalo=2, nhalo=2)
2319 IF (remap_step)
CALL pe_halo(is, ie, js, je, isd, ied, jsd, jed&
2320 & , npz, ptop, pe, delp)
2321 IF (flagstruct%use_logp)
THEN 2322 CALL pln_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, &
2325 CALL pk3_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, &
2328 IF (gridstruct%nested)
THEN 2329 CALL nested_grid_bc_apply_intt(delz, 0, 0, npx, npy, npz, bd, &
2330 & split_timestep_bc + 1.,
REAL(n_split*&
& flagstruct%k_split), neststruct%&
2331 & delz_bc, neststruct%nestbctype)
2333 CALL nest_halo_nh(ptop, grav, akap, cp, delp, delz, pt, phis, &
2334 & pkc, gz, pk3, npx, npy, npz, gridstruct%nested, &
2335 & .true., .true., .true., bd)
2338 CALL complete_group_halo_update(i_pack(4), domain)
2344 gz(i, j, k) = zh(i, j, k)*grav
2348 IF (gridstruct%square_domain)
THEN 2350 CALL complete_group_halo_update(i_pack(5), domain)
2354 IF (remap_step .AND. hydrostatic)
THEN 2359 pk(i, j, k) = pkc(i, j, k)
2368 IF (hydrostatic)
THEN 2369 IF (beta .GT. 0.)
THEN 2371 & gridstruct, bd, npx, npy, npz, ptop, beta_d, &
2372 & flagstruct%a2b_ord)
2374 CALL one_grad_p(u, v, pkc, gz, divg2, delp, dt, ng, gridstruct&
2375 & , bd, npx, npy, npz, ptop, hydrostatic, flagstruct%&
2376 & a2b_ord, flagstruct%d_ext)
2378 ELSE IF (beta .GT. 0.)
THEN 2379 CALL split_p_grad(u, v, pkc, gz, du, dv, delp, pk3, beta_d, dt, &
2380 & ng, gridstruct, bd, npx, npy, npz, flagstruct%&
2382 ELSE IF (beta .LT. -0.1)
THEN 2383 CALL one_grad_p(u, v, pkc, gz, divg2, delp, dt, ng, gridstruct, &
2384 & bd, npx, npy, npz, ptop, hydrostatic, flagstruct%&
2385 & a2b_ord, flagstruct%d_ext)
2387 CALL nh_p_grad(u, v, pkc, gz, delp, pk3, dt, ng, gridstruct, bd&
2388 & , npx, npy, npz, flagstruct%use_logp)
2393 IF (flagstruct%breed_vortex_inline)
THEN 2394 IF (.NOT.hydrostatic)
THEN 2400 arg1 = rdg*delp(i, j, k)/delz(i, j, k)*pt(i, j, k)
2401 arg2 = k1k*log(arg1)
2402 pkz(i, j, k) = exp(arg2)
2408 & pkz, delp, u, v, pt, q, flagstruct%nwat, zvir, &
2409 & gridstruct, ks, domain, bd, hydrostatic)
2413 IF (it .EQ. n_split .AND. gridstruct%grid_type .LT. 4 .AND. (.NOT.&
2414 & gridstruct%nested))
THEN 2417 & nbuffer, gridtype=dgrid_ne)
2421 u(i, je+1, k) = nbuffer(i-is+1, k)
2424 v(ie+1, j, k) = ebuffer(j-js+1, k)
2429 & , domain, gridtype=&
2432 IF (gridstruct%nested) neststruct%nest_timestep = neststruct%&
2434 IF (hydrostatic .AND. last_step)
THEN 2435 IF (flagstruct%use_old_omega)
THEN 2440 omga(i, j, k) = (pe(i, k+1, j)-pem(i, k+1, j))*rdt
2447 CALL adv_pe(ua, va, pem, omga, gridstruct, bd, npx, npy, npz, &
2454 om2d(i, k) = omga(i, j, k)
2459 om2d(i, k) = om2d(i, k-1) + omga(i, j, k)
2464 omga(i, j, k) = om2d(i, k)
2469 IF (idiag%id_ws .GT. 0 .AND. hydrostatic)
THEN 2473 ws(i, j) = delz(i, j, npz)/delp(i, j, npz)*omga(i, j, npz)
2479 IF (gridstruct%nested)
THEN 2480 IF (.NOT.hydrostatic)
CALL nested_grid_bc_apply_intt(w, 0, 0, &
2481 & npx, npy, npz, bd&
2483 & split_timestep_bc&
2484 & + 1,
REAL(n_split&
& *flagstruct%&
& k_split), &
2485 & neststruct%w_bc, &
2488 call nested_grid_bc_apply_intt(u, 0, 1, npx, npy, npz, bd, &
2489 & split_timestep_bc + 1, REAL(n_split*&
2490 & flagstruct%k_split), neststruct%u_bc, &
2491 & neststruct%nestbctype)
2492 call nested_grid_bc_apply_intt(v, 1, 0, npx, npy, npz, bd, &
2493 & split_timestep_bc + 1, REAL(n_split*&
2494 & flagstruct%k_split), neststruct%v_bc, &
2495 & neststruct%nestbctype)
2501 IF (nq .GT. 0 .AND. (.NOT.flagstruct%inline_q))
THEN 2508 IF (flagstruct%fv_debug)
THEN 2509 IF (is_master())
WRITE(*, *)
'End of n_split loop' 2511 IF (n_con .NE. 0 .AND. flagstruct%d_con .GT. 1.e-5)
THEN 2512 IF (3 .GT. flagstruct%nord + 1)
THEN 2513 nf_ke = flagstruct%nord + 1
2518 & gridstruct, domain, npx, npy, npz, nf_ke, bd)
2520 IF (hydrostatic)
THEN 2531 pt(i, j, k) = pt(i, j, k) + heat_source(i, j, k)/(
cp_air&
2532 & *delp(i, j, k)*pkz(i, j, k))
2536 dtmp = heat_source(i, j, k)/(
cp_air*delp(i, j, k))
2537 IF (bdt .GE. 0.)
THEN 2542 x1 = abs0*flagstruct%delt_max
2543 IF (dtmp .GE. 0.)
THEN 2548 IF (x1 .GT. y1)
THEN 2553 pt(i, j, k) = pt(i, j, k) + sign(min1, dtmp)/pkz(i, j, k&
2564 IF (bdt*flagstruct%delt_max .GE. 0.)
THEN 2565 delt = bdt*flagstruct%delt_max
2567 delt = -(bdt*flagstruct%delt_max)
2574 arg1 = rdg*delp(i, j, k)/delz(i, j, k)*pt(i, j, k)
2575 arg2 = k1k*log(arg1)
2576 pkz(i, j, k) = exp(arg2)
2577 dtmp = heat_source(i, j, k)/(cv_air*delp(i, j, k))
2578 IF (dtmp .GE. 0.)
THEN 2583 IF (delt .GT. y2)
THEN 2588 pt(i, j, k) = pt(i, j, k) + sign(min2, dtmp)/pkz(i, j, k)
2598 SUBROUTINE pk3_halo_tlm(is, ie, js, je, isd, ied, jsd, jed, npz, ptop&
2599 & , akap, pk3, pk3_tl, delp, delp_tl)
2601 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed, npz
2602 REAL,
INTENT(IN) :: ptop, akap
2603 REAL,
DIMENSION(isd:ied, jsd:jed, npz),
INTENT(IN) :: delp
2604 REAL,
DIMENSION(isd:ied, jsd:jed, npz),
INTENT(IN) :: delp_tl
2605 REAL,
DIMENSION(isd:ied, jsd:jed, npz+1),
INTENT(INOUT) :: pk3
2606 REAL,
DIMENSION(isd:ied, jsd:jed, npz+1),
INTENT(INOUT) :: pk3_tl
2608 REAL :: pei(isd:ied)
2609 REAL :: pei_tl(isd:ied)
2610 REAL :: pej(jsd:jed)
2611 REAL :: pej_tl(jsd:jed)
2626 pei_tl(is-2) = pei_tl(is-2) + delp_tl(is-2, j, k)
2627 pei(is-2) = pei(is-2) + delp(is-2, j, k)
2628 pei_tl(is-1) = pei_tl(is-1) + delp_tl(is-1, j, k)
2629 pei(is-1) = pei(is-1) + delp(is-1, j, k)
2630 arg1_tl = akap*pei_tl(is-2)/pei(is-2)
2631 arg1 = akap*log(pei(is-2))
2632 pk3_tl(is-2, j, k+1) = arg1_tl*exp(arg1)
2633 pk3(is-2, j, k+1) = exp(arg1)
2634 arg1_tl = akap*pei_tl(is-1)/pei(is-1)
2635 arg1 = akap*log(pei(is-1))
2636 pk3_tl(is-1, j, k+1) = arg1_tl*exp(arg1)
2637 pk3(is-1, j, k+1) = exp(arg1)
2644 pei_tl(ie+1) = pei_tl(ie+1) + delp_tl(ie+1, j, k)
2645 pei(ie+1) = pei(ie+1) + delp(ie+1, j, k)
2646 pei_tl(ie+2) = pei_tl(ie+2) + delp_tl(ie+2, j, k)
2647 pei(ie+2) = pei(ie+2) + delp(ie+2, j, k)
2648 arg1_tl = akap*pei_tl(ie+1)/pei(ie+1)
2649 arg1 = akap*log(pei(ie+1))
2650 pk3_tl(ie+1, j, k+1) = arg1_tl*exp(arg1)
2651 pk3(ie+1, j, k+1) = exp(arg1)
2652 arg1_tl = akap*pei_tl(ie+2)/pei(ie+2)
2653 arg1 = akap*log(pei(ie+2))
2654 pk3_tl(ie+2, j, k+1) = arg1_tl*exp(arg1)
2655 pk3(ie+2, j, k+1) = exp(arg1)
2667 pej_tl(js-2) = pej_tl(js-2) + delp_tl(i, js-2, k)
2668 pej(js-2) = pej(js-2) + delp(i, js-2, k)
2669 pej_tl(js-1) = pej_tl(js-1) + delp_tl(i, js-1, k)
2670 pej(js-1) = pej(js-1) + delp(i, js-1, k)
2671 arg1_tl = akap*pej_tl(js-2)/pej(js-2)
2672 arg1 = akap*log(pej(js-2))
2673 pk3_tl(i, js-2, k+1) = arg1_tl*exp(arg1)
2674 pk3(i, js-2, k+1) = exp(arg1)
2675 arg1_tl = akap*pej_tl(js-1)/pej(js-1)
2676 arg1 = akap*log(pej(js-1))
2677 pk3_tl(i, js-1, k+1) = arg1_tl*exp(arg1)
2678 pk3(i, js-1, k+1) = exp(arg1)
2685 pej_tl(je+1) = pej_tl(je+1) + delp_tl(i, je+1, k)
2686 pej(je+1) = pej(je+1) + delp(i, je+1, k)
2687 pej_tl(je+2) = pej_tl(je+2) + delp_tl(i, je+2, k)
2688 pej(je+2) = pej(je+2) + delp(i, je+2, k)
2689 arg1_tl = akap*pej_tl(je+1)/pej(je+1)
2690 arg1 = akap*log(pej(je+1))
2691 pk3_tl(i, je+1, k+1) = arg1_tl*exp(arg1)
2692 pk3(i, je+1, k+1) = exp(arg1)
2693 arg1_tl = akap*pej_tl(je+2)/pej(je+2)
2694 arg1 = akap*log(pej(je+2))
2695 pk3_tl(i, je+2, k+1) = arg1_tl*exp(arg1)
2696 pk3(i, je+2, k+1) = exp(arg1)
2700 SUBROUTINE pk3_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, &
2703 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed, npz
2704 REAL,
INTENT(IN) :: ptop, akap
2705 REAL,
DIMENSION(isd:ied, jsd:jed, npz),
INTENT(IN) :: delp
2706 REAL,
DIMENSION(isd:ied, jsd:jed, npz+1),
INTENT(INOUT) :: pk3
2708 REAL :: pei(isd:ied)
2709 REAL :: pej(jsd:jed)
2720 pei(is-2) = pei(is-2) + delp(is-2, j, k)
2721 pei(is-1) = pei(is-1) + delp(is-1, j, k)
2722 arg1 = akap*log(pei(is-2))
2723 pk3(is-2, j, k+1) = exp(arg1)
2724 arg1 = akap*log(pei(is-1))
2725 pk3(is-1, j, k+1) = exp(arg1)
2730 pei(ie+1) = pei(ie+1) + delp(ie+1, j, k)
2731 pei(ie+2) = pei(ie+2) + delp(ie+2, j, k)
2732 arg1 = akap*log(pei(ie+1))
2733 pk3(ie+1, j, k+1) = exp(arg1)
2734 arg1 = akap*log(pei(ie+2))
2735 pk3(ie+2, j, k+1) = exp(arg1)
2744 pej(js-2) = pej(js-2) + delp(i, js-2, k)
2745 pej(js-1) = pej(js-1) + delp(i, js-1, k)
2746 arg1 = akap*log(pej(js-2))
2747 pk3(i, js-2, k+1) = exp(arg1)
2748 arg1 = akap*log(pej(js-1))
2749 pk3(i, js-1, k+1) = exp(arg1)
2754 pej(je+1) = pej(je+1) + delp(i, je+1, k)
2755 pej(je+2) = pej(je+2) + delp(i, je+2, k)
2756 arg1 = akap*log(pej(je+1))
2757 pk3(i, je+1, k+1) = exp(arg1)
2758 arg1 = akap*log(pej(je+2))
2759 pk3(i, je+2, k+1) = exp(arg1)
2766 SUBROUTINE pln_halo_tlm(is, ie, js, je, isd, ied, jsd, jed, npz, ptop&
2767 & , pk3, pk3_tl, delp, delp_tl)
2769 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed, npz
2770 REAL,
INTENT(IN) :: ptop
2771 REAL,
DIMENSION(isd:ied, jsd:jed, npz),
INTENT(IN) :: delp
2772 REAL,
DIMENSION(isd:ied, jsd:jed, npz),
INTENT(IN) :: delp_tl
2773 REAL,
DIMENSION(isd:ied, jsd:jed, npz+1),
INTENT(INOUT) :: pk3
2774 REAL,
DIMENSION(isd:ied, jsd:jed, npz+1),
INTENT(INOUT) :: pk3_tl
2787 pet_tl = pet_tl + delp_tl(i, j, k)
2788 pet = pet + delp(i, j, k)
2789 pk3_tl(i, j, k+1) = pet_tl/pet
2790 pk3(i, j, k+1) = log(pet)
2797 pet_tl = pet_tl + delp_tl(i, j, k)
2798 pet = pet + delp(i, j, k)
2799 pk3_tl(i, j, k+1) = pet_tl/pet
2800 pk3(i, j, k+1) = log(pet)
2811 pet_tl = pet_tl + delp_tl(i, j, k)
2812 pet = pet + delp(i, j, k)
2813 pk3_tl(i, j, k+1) = pet_tl/pet
2814 pk3(i, j, k+1) = log(pet)
2821 pet_tl = pet_tl + delp_tl(i, j, k)
2822 pet = pet + delp(i, j, k)
2823 pk3_tl(i, j, k+1) = pet_tl/pet
2824 pk3(i, j, k+1) = log(pet)
2829 SUBROUTINE pln_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pk3&
2832 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed, npz
2833 REAL,
INTENT(IN) :: ptop
2834 REAL,
DIMENSION(isd:ied, jsd:jed, npz),
INTENT(IN) :: delp
2835 REAL,
DIMENSION(isd:ied, jsd:jed, npz+1),
INTENT(INOUT) :: pk3
2846 pet = pet + delp(i, j, k)
2847 pk3(i, j, k+1) = log(pet)
2853 pet = pet + delp(i, j, k)
2854 pk3(i, j, k+1) = log(pet)
2864 pet = pet + delp(i, j, k)
2865 pk3(i, j, k+1) = log(pet)
2871 pet = pet + delp(i, j, k)
2872 pk3(i, j, k+1) = log(pet)
2880 SUBROUTINE pe_halo_tlm(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, &
2881 & pe, pe_tl, delp, delp_tl)
2883 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed, npz
2884 REAL,
INTENT(IN) :: ptop
2885 REAL,
DIMENSION(isd:ied, jsd:jed, npz),
INTENT(IN) :: delp
2886 REAL,
DIMENSION(isd:ied, jsd:jed, npz),
INTENT(IN) :: delp_tl
2887 REAL,
DIMENSION(is-1:ie+1, npz+1, js-1:je+1),
INTENT(INOUT) :: pe
2888 REAL,
DIMENSION(is-1:ie+1, npz+1, js-1:je+1),
INTENT(INOUT) :: pe_tl
2893 pe_tl(is-1, 1, j) = 0.0
2894 pe(is-1, 1, j) = ptop
2895 pe_tl(ie+1, 1, j) = 0.0
2896 pe(ie+1, 1, j) = ptop
2898 pe_tl(is-1, k+1, j) = pe_tl(is-1, k, j) + delp_tl(is-1, j, k)
2899 pe(is-1, k+1, j) = pe(is-1, k, j) + delp(is-1, j, k)
2900 pe_tl(ie+1, k+1, j) = pe_tl(ie+1, k, j) + delp_tl(ie+1, j, k)
2901 pe(ie+1, k+1, j) = pe(ie+1, k, j) + delp(ie+1, j, k)
2906 pe_tl(i, 1, js-1) = 0.0
2907 pe(i, 1, js-1) = ptop
2908 pe_tl(i, 1, je+1) = 0.0
2909 pe(i, 1, je+1) = ptop
2911 pe_tl(i, k+1, js-1) = pe_tl(i, k, js-1) + delp_tl(i, js-1, k)
2912 pe(i, k+1, js-1) = pe(i, k, js-1) + delp(i, js-1, k)
2913 pe_tl(i, k+1, je+1) = pe_tl(i, k, je+1) + delp_tl(i, je+1, k)
2914 pe(i, k+1, je+1) = pe(i, k, je+1) + delp(i, je+1, k)
2918 SUBROUTINE pe_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pe, &
2921 INTEGER,
INTENT(IN) :: is, ie, js, je, isd, ied, jsd, jed, npz
2922 REAL,
INTENT(IN) :: ptop
2923 REAL,
DIMENSION(isd:ied, jsd:jed, npz),
INTENT(IN) :: delp
2924 REAL,
DIMENSION(is-1:ie+1, npz+1, js-1:je+1),
INTENT(INOUT) :: pe
2929 pe(is-1, 1, j) = ptop
2930 pe(ie+1, 1, j) = ptop
2932 pe(is-1, k+1, j) = pe(is-1, k, j) + delp(is-1, j, k)
2933 pe(ie+1, k+1, j) = pe(ie+1, k, j) + delp(ie+1, j, k)
2938 pe(i, 1, js-1) = ptop
2939 pe(i, 1, je+1) = ptop
2941 pe(i, k+1, js-1) = pe(i, k, js-1) + delp(i, js-1, k)
2942 pe(i, k+1, je+1) = pe(i, k, je+1) + delp(i, je+1, k)
2949 SUBROUTINE adv_pe_tlm(ua, ua_tl, va, va_tl, pem, pem_tl, om, om_tl, &
2950 & gridstruct, bd, npx, npy, npz, ng)
2952 INTEGER,
INTENT(IN) :: npx, npy, npz, ng
2953 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
2955 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, npz),
INTENT(IN) :: ua&
2957 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, npz),
INTENT(IN) :: &
2960 REAL,
INTENT(IN) :: pem(bd%is-1:bd%ie+1, npz+1, bd%js-1:bd%je+1)
2961 REAL,
INTENT(IN) :: pem_tl(bd%is-1:bd%ie+1, npz+1, bd%js-1:bd%je+1)
2962 REAL,
INTENT(INOUT) :: om(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
2963 REAL,
INTENT(INOUT) :: om_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
2964 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
2966 REAL,
DIMENSION(bd%is:bd%ie, bd%js:bd%je) :: up, vp
2967 REAL,
DIMENSION(bd%is:bd%ie, bd%js:bd%je) :: up_tl, vp_tl
2968 REAL :: v3(3, bd%is:bd%ie, bd%js:bd%je)
2969 REAL :: v3_tl(3, bd%is:bd%ie, bd%js:bd%je)
2970 REAL :: pin(bd%isd:bd%ied, bd%jsd:bd%jed)
2971 REAL :: pin_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
2972 REAL :: pb(bd%isd:bd%ied, bd%jsd:bd%jed)
2973 REAL :: pb_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
2974 REAL :: grad(3, bd%is:bd%ie, bd%js:bd%je)
2975 REAL :: grad_tl(3, bd%is:bd%ie, bd%js:bd%je)
2976 REAL :: pdx(3, bd%is:bd%ie, bd%js:bd%je+1)
2977 REAL :: pdx_tl(3, bd%is:bd%ie, bd%js:bd%je+1)
2978 REAL :: pdy(3, bd%is:bd%ie+1, bd%js:bd%je)
2979 REAL :: pdy_tl(3, bd%is:bd%ie+1, bd%js:bd%je)
2980 INTEGER :: i, j, k, n
2981 INTEGER :: is, ie, js, je
2997 IF (k .EQ. npz)
THEN 3000 up_tl(i, j) = ua_tl(i, j, npz)
3001 up(i, j) = ua(i, j, npz)
3002 vp_tl(i, j) = va_tl(i, j, npz)
3003 vp(i, j) = va(i, j, npz)
3009 up_tl(i, j) = 0.5*(ua_tl(i, j, k)+ua_tl(i, j, k+1))
3010 up(i, j) = 0.5*(ua(i, j, k)+ua(i, j, k+1))
3011 vp_tl(i, j) = 0.5*(va_tl(i, j, k)+va_tl(i, j, k+1))
3012 vp(i, j) = 0.5*(va(i, j, k)+va(i, j, k+1))
3020 v3_tl(n, i, j) = gridstruct%ec1(n, i, j)*up_tl(i, j) + &
3021 & gridstruct%ec2(n, i, j)*vp_tl(i, j)
3022 v3(n, i, j) = up(i, j)*gridstruct%ec1(n, i, j) + vp(i, j)*&
3023 & gridstruct%ec2(n, i, j)
3029 pin_tl(i, j) = pem_tl(i, k+1, j)
3030 pin(i, j) = pem(i, k+1, j)
3034 CALL a2b_ord2_tlm(pin, pin_tl, pb, pb_tl, gridstruct, npx, npy, is&
3039 pdx_tl(n, i, j) = gridstruct%dx(i, j)*gridstruct%en1(n, i, j&
3040 & )*(pb_tl(i, j)+pb_tl(i+1, j))
3041 pdx(n, i, j) = (pb(i, j)+pb(i+1, j))*gridstruct%dx(i, j)*&
3042 & gridstruct%en1(n, i, j)
3049 pdy_tl(n, i, j) = gridstruct%dy(i, j)*gridstruct%en2(n, i, j&
3050 & )*(pb_tl(i, j)+pb_tl(i, j+1))
3051 pdy(n, i, j) = (pb(i, j)+pb(i, j+1))*gridstruct%dy(i, j)*&
3052 & gridstruct%en2(n, i, j)
3060 grad_tl(n, i, j) = pdx_tl(n, i, j+1) - pdx_tl(n, i, j) - &
3061 & pdy_tl(n, i, j) + pdy_tl(n, i+1, j)
3062 grad(n, i, j) = pdx(n, i, j+1) - pdx(n, i, j) - pdy(n, i, j)&
3070 om_tl(i, j, k) = om_tl(i, j, k) + 0.5*gridstruct%rarea(i, j)*(&
3071 & v3_tl(1, i, j)*grad(1, i, j)+v3(1, i, j)*grad_tl(1, i, j)+&
3072 & v3_tl(2, i, j)*grad(2, i, j)+v3(2, i, j)*grad_tl(2, i, j)+&
3073 & v3_tl(3, i, j)*grad(3, i, j)+v3(3, i, j)*grad_tl(3, i, j))
3074 om(i, j, k) = om(i, j, k) + 0.5*gridstruct%rarea(i, j)*(v3(1, &
3075 & i, j)*grad(1, i, j)+v3(2, i, j)*grad(2, i, j)+v3(3, i, j)*&
3081 SUBROUTINE adv_pe(ua, va, pem, om, gridstruct, bd, npx, npy, npz, ng)
3083 INTEGER,
INTENT(IN) :: npx, npy, npz, ng
3084 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
3086 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, npz),
INTENT(IN) :: ua&
3089 REAL,
INTENT(IN) :: pem(bd%is-1:bd%ie+1, npz+1, bd%js-1:bd%je+1)
3090 REAL,
INTENT(INOUT) :: om(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
3091 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
3093 REAL,
DIMENSION(bd%is:bd%ie, bd%js:bd%je) :: up, vp
3094 REAL :: v3(3, bd%is:bd%ie, bd%js:bd%je)
3095 REAL :: pin(bd%isd:bd%ied, bd%jsd:bd%jed)
3096 REAL :: pb(bd%isd:bd%ied, bd%jsd:bd%jed)
3097 REAL :: grad(3, bd%is:bd%ie, bd%js:bd%je)
3098 REAL :: pdx(3, bd%is:bd%ie, bd%js:bd%je+1)
3099 REAL :: pdy(3, bd%is:bd%ie+1, bd%js:bd%je)
3100 INTEGER :: i, j, k, n
3101 INTEGER :: is, ie, js, je
3109 IF (k .EQ. npz)
THEN 3112 up(i, j) = ua(i, j, npz)
3113 vp(i, j) = va(i, j, npz)
3119 up(i, j) = 0.5*(ua(i, j, k)+ua(i, j, k+1))
3120 vp(i, j) = 0.5*(va(i, j, k)+va(i, j, k+1))
3128 v3(n, i, j) = up(i, j)*gridstruct%ec1(n, i, j) + vp(i, j)*&
3129 & gridstruct%ec2(n, i, j)
3135 pin(i, j) = pem(i, k+1, j)
3139 CALL a2b_ord2(pin, pb, gridstruct, npx, npy, is, ie, js, je, ng)
3143 pdx(n, i, j) = (pb(i, j)+pb(i+1, j))*gridstruct%dx(i, j)*&
3144 & gridstruct%en1(n, i, j)
3151 pdy(n, i, j) = (pb(i, j)+pb(i, j+1))*gridstruct%dy(i, j)*&
3152 & gridstruct%en2(n, i, j)
3160 grad(n, i, j) = pdx(n, i, j+1) - pdx(n, i, j) - pdy(n, i, j)&
3168 om(i, j, k) = om(i, j, k) + 0.5*gridstruct%rarea(i, j)*(v3(1, &
3169 & i, j)*grad(1, i, j)+v3(2, i, j)*grad(2, i, j)+v3(3, i, j)*&
3178 SUBROUTINE p_grad_c_tlm(dt2, npz, delpc, delpc_tl, pkc, pkc_tl, gz, &
3179 & gz_tl, uc, uc_tl, vc, vc_tl, bd, rdxc, rdyc, hydrostatic)
3181 INTEGER,
INTENT(IN) :: npz
3182 REAL,
INTENT(IN) :: dt2
3183 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
3184 REAL,
DIMENSION(bd%isd:, bd%jsd:, :),
INTENT(IN) :: delpc
3185 REAL,
DIMENSION(bd%isd:, bd%jsd:, :),
INTENT(IN) :: delpc_tl
3188 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1),
INTENT(IN) :: &
3190 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1),
INTENT(IN) :: &
3192 REAL,
INTENT(INOUT) :: uc(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3193 REAL,
INTENT(INOUT) :: uc_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3194 REAL,
INTENT(INOUT) :: vc(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3195 REAL,
INTENT(INOUT) :: vc_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3196 REAL,
INTENT(IN) :: rdxc(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
3197 REAL,
INTENT(IN) :: rdyc(bd%isd:bd%ied, bd%jsd:bd%jed)
3198 LOGICAL,
INTENT(IN) :: hydrostatic
3200 REAL :: wk(bd%is-1:bd%ie+1, bd%js-1:bd%je+1)
3201 REAL :: wk_tl(bd%is-1:bd%ie+1, bd%js-1:bd%je+1)
3203 INTEGER :: is, ie, js, je
3212 IF (hydrostatic)
THEN 3215 wk_tl(i, j) = pkc_tl(i, j, k+1) - pkc_tl(i, j, k)
3216 wk(i, j) = pkc(i, j, k+1) - pkc(i, j, k)
3222 wk_tl(i, j) = delpc_tl(i, j, k)
3223 wk(i, j) = delpc(i, j, k)
3229 uc_tl(i, j, k) = uc_tl(i, j, k) + dt2*rdxc(i, j)*((gz_tl(i-1, &
3230 & j, k+1)-gz_tl(i, j, k))*(pkc(i, j, k+1)-pkc(i-1, j, k))+(gz(&
3231 & i-1, j, k+1)-gz(i, j, k))*(pkc_tl(i, j, k+1)-pkc_tl(i-1, j, &
3232 & k))+(gz_tl(i-1, j, k)-gz_tl(i, j, k+1))*(pkc(i-1, j, k+1)-&
3233 & pkc(i, j, k))+(gz(i-1, j, k)-gz(i, j, k+1))*(pkc_tl(i-1, j, &
3234 & k+1)-pkc_tl(i, j, k)))/(wk(i-1, j)+wk(i, j)) - dt2*rdxc(i, j&
3235 & )*(wk_tl(i-1, j)+wk_tl(i, j))*((gz(i-1, j, k+1)-gz(i, j, k))&
3236 & *(pkc(i, j, k+1)-pkc(i-1, j, k))+(gz(i-1, j, k)-gz(i, j, k+1&
3237 & ))*(pkc(i-1, j, k+1)-pkc(i, j, k)))/(wk(i-1, j)+wk(i, j))**2
3238 uc(i, j, k) = uc(i, j, k) + dt2*rdxc(i, j)/(wk(i-1, j)+wk(i, j&
3239 & ))*((gz(i-1, j, k+1)-gz(i, j, k))*(pkc(i, j, k+1)-pkc(i-1, j&
3240 & , k))+(gz(i-1, j, k)-gz(i, j, k+1))*(pkc(i-1, j, k+1)-pkc(i&
3246 vc_tl(i, j, k) = vc_tl(i, j, k) + dt2*rdyc(i, j)*((gz_tl(i, j-&
3247 & 1, k+1)-gz_tl(i, j, k))*(pkc(i, j, k+1)-pkc(i, j-1, k))+(gz(&
3248 & i, j-1, k+1)-gz(i, j, k))*(pkc_tl(i, j, k+1)-pkc_tl(i, j-1, &
3249 & k))+(gz_tl(i, j-1, k)-gz_tl(i, j, k+1))*(pkc(i, j-1, k+1)-&
3250 & pkc(i, j, k))+(gz(i, j-1, k)-gz(i, j, k+1))*(pkc_tl(i, j-1, &
3251 & k+1)-pkc_tl(i, j, k)))/(wk(i, j-1)+wk(i, j)) - dt2*rdyc(i, j&
3252 & )*(wk_tl(i, j-1)+wk_tl(i, j))*((gz(i, j-1, k+1)-gz(i, j, k))&
3253 & *(pkc(i, j, k+1)-pkc(i, j-1, k))+(gz(i, j-1, k)-gz(i, j, k+1&
3254 & ))*(pkc(i, j-1, k+1)-pkc(i, j, k)))/(wk(i, j-1)+wk(i, j))**2
3255 vc(i, j, k) = vc(i, j, k) + dt2*rdyc(i, j)/(wk(i, j-1)+wk(i, j&
3256 & ))*((gz(i, j-1, k+1)-gz(i, j, k))*(pkc(i, j, k+1)-pkc(i, j-1&
3257 & , k))+(gz(i, j-1, k)-gz(i, j, k+1))*(pkc(i, j-1, k+1)-pkc(i&
3263 SUBROUTINE p_grad_c(dt2, npz, delpc, pkc, gz, uc, vc, bd, rdxc, rdyc, &
3266 INTEGER,
INTENT(IN) :: npz
3267 REAL,
INTENT(IN) :: dt2
3268 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
3269 REAL,
DIMENSION(bd%isd:, bd%jsd:, :),
INTENT(IN) :: delpc
3272 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1),
INTENT(IN) :: &
3274 REAL,
INTENT(INOUT) :: uc(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3275 REAL,
INTENT(INOUT) :: vc(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3276 REAL,
INTENT(IN) :: rdxc(bd%isd:bd%ied+1, bd%jsd:bd%jed+1)
3277 REAL,
INTENT(IN) :: rdyc(bd%isd:bd%ied, bd%jsd:bd%jed)
3278 LOGICAL,
INTENT(IN) :: hydrostatic
3280 REAL :: wk(bd%is-1:bd%ie+1, bd%js-1:bd%je+1)
3282 INTEGER :: is, ie, js, je
3290 IF (hydrostatic)
THEN 3293 wk(i, j) = pkc(i, j, k+1) - pkc(i, j, k)
3299 wk(i, j) = delpc(i, j, k)
3305 uc(i, j, k) = uc(i, j, k) + dt2*rdxc(i, j)/(wk(i-1, j)+wk(i, j&
3306 & ))*((gz(i-1, j, k+1)-gz(i, j, k))*(pkc(i, j, k+1)-pkc(i-1, j&
3307 & , k))+(gz(i-1, j, k)-gz(i, j, k+1))*(pkc(i-1, j, k+1)-pkc(i&
3313 vc(i, j, k) = vc(i, j, k) + dt2*rdyc(i, j)/(wk(i, j-1)+wk(i, j&
3314 & ))*((gz(i, j-1, k+1)-gz(i, j, k))*(pkc(i, j, k+1)-pkc(i, j-1&
3315 & , k))+(gz(i, j-1, k)-gz(i, j, k+1))*(pkc(i, j-1, k+1)-pkc(i&
3324 SUBROUTINE nh_p_grad_tlm(u, u_tl, v, v_tl, pp, pp_tl, gz, gz_tl, delp&
3325 & , delp_tl, pk, pk_tl, dt, ng, gridstruct, bd, npx, npy, npz, &
3329 INTEGER,
INTENT(IN) :: ng, npx, npy, npz
3330 REAL,
INTENT(IN) :: dt
3331 LOGICAL,
INTENT(IN) :: use_logp
3332 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
3333 REAL,
INTENT(INOUT) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
3334 REAL,
INTENT(INOUT) :: delp_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
3336 REAL,
INTENT(INOUT) :: pp(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3337 REAL,
INTENT(INOUT) :: pp_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3339 REAL,
INTENT(INOUT) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3340 REAL,
INTENT(INOUT) :: pk_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3342 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3343 REAL,
INTENT(INOUT) :: gz_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3344 REAL,
INTENT(INOUT) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3345 REAL,
INTENT(INOUT) :: u_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3346 REAL,
INTENT(INOUT) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3347 REAL,
INTENT(INOUT) :: v_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3348 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
3350 REAL :: wk1(bd%isd:bd%ied, bd%jsd:bd%jed)
3351 REAL :: wk1_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
3352 REAL :: wk(bd%is:bd%ie+1, bd%js:bd%je+1)
3353 REAL :: wk_tl(bd%is:bd%ie+1, bd%js:bd%je+1)
3354 REAL :: du1, dv1, top_value
3355 REAL :: du1_tl, dv1_tl
3357 INTEGER :: is, ie, js, je
3358 INTEGER :: isd, ied, jsd, jed
3376 pp_tl(i, j, 1) = 0.0
3378 pk_tl(i, j, 1) = 0.0
3379 pk(i, j, 1) = top_value
3387 CALL a2b_ord4_tlm(pp(isd:ied, jsd:jed, k), pp_tl(isd:ied, jsd&
3388 & :jed, k), wk1, wk1_tl, gridstruct, npx, npy, is, &
3389 & ie, js, je, ng, .true.)
3390 CALL a2b_ord4_tlm(pk(isd:ied, jsd:jed, k), pk_tl(isd:ied, jsd&
3391 & :jed, k), wk1, wk1_tl, gridstruct, npx, npy, is, &
3392 & ie, js, je, ng, .true.)
3394 CALL a2b_ord4_tlm(gz(isd:ied, jsd:jed, k), gz_tl(isd:ied, jsd:&
3395 & jed, k), wk1, wk1_tl, gridstruct, npx, npy, is, ie&
3396 & , js, je, ng, .true.)
3403 CALL a2b_ord4_tlm(delp(isd:ied, jsd:jed, k), delp_tl(isd:ied, &
3404 & jsd:jed, k), wk1, wk1_tl, gridstruct, npx, npy, is&
3408 wk_tl(i, j) = pk_tl(i, j, k+1) - pk_tl(i, j, k)
3409 wk(i, j) = pk(i, j, k+1) - pk(i, j, k)
3416 du1_tl = dt*((gz_tl(i, j, k+1)-gz_tl(i+1, j, k))*(pk(i+1, j, k&
3417 & +1)-pk(i, j, k))+(gz(i, j, k+1)-gz(i+1, j, k))*(pk_tl(i+1, j&
3418 & , k+1)-pk_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i+1, j, k+1))*(&
3419 & pk(i, j, k+1)-pk(i+1, j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*(&
3420 & pk_tl(i, j, k+1)-pk_tl(i+1, j, k)))/(wk(i, j)+wk(i+1, j)) - &
3421 & dt*(wk_tl(i, j)+wk_tl(i+1, j))*((gz(i, j, k+1)-gz(i+1, j, k)&
3422 & )*(pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, j, k+1)&
3423 & )*(pk(i, j, k+1)-pk(i+1, j, k)))/(wk(i, j)+wk(i+1, j))**2
3424 du1 = dt/(wk(i, j)+wk(i+1, j))*((gz(i, j, k+1)-gz(i+1, j, k))*&
3425 & (pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*&
3426 & (pk(i, j, k+1)-pk(i+1, j, k)))
3428 u_tl(i, j, k) = gridstruct%rdx(i, j)*(u_tl(i, j, k)+du1_tl+dt*&
3429 & ((gz_tl(i, j, k+1)-gz_tl(i+1, j, k))*(pp(i+1, j, k+1)-pp(i, &
3430 & j, k))+(gz(i, j, k+1)-gz(i+1, j, k))*(pp_tl(i+1, j, k+1)-&
3431 & pp_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i+1, j, k+1))*(pp(i, j&
3432 & , k+1)-pp(i+1, j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*(pp_tl(i&
3433 & , j, k+1)-pp_tl(i+1, j, k)))/(wk1(i, j)+wk1(i+1, j))-dt*(&
3434 & wk1_tl(i, j)+wk1_tl(i+1, j))*((gz(i, j, k+1)-gz(i+1, j, k))*&
3435 & (pp(i+1, j, k+1)-pp(i, j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*&
3436 & (pp(i, j, k+1)-pp(i+1, j, k)))/(wk1(i, j)+wk1(i+1, j))**2)
3437 u(i, j, k) = (u(i, j, k)+du1+dt/(wk1(i, j)+wk1(i+1, j))*((gz(i&
3438 & , j, k+1)-gz(i+1, j, k))*(pp(i+1, j, k+1)-pp(i, j, k))+(gz(i&
3439 & , j, k)-gz(i+1, j, k+1))*(pp(i, j, k+1)-pp(i+1, j, k))))*&
3440 & gridstruct%rdx(i, j)
3446 dv1_tl = dt*((gz_tl(i, j, k+1)-gz_tl(i, j+1, k))*(pk(i, j+1, k&
3447 & +1)-pk(i, j, k))+(gz(i, j, k+1)-gz(i, j+1, k))*(pk_tl(i, j+1&
3448 & , k+1)-pk_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i, j+1, k+1))*(&
3449 & pk(i, j, k+1)-pk(i, j+1, k))+(gz(i, j, k)-gz(i, j+1, k+1))*(&
3450 & pk_tl(i, j, k+1)-pk_tl(i, j+1, k)))/(wk(i, j)+wk(i, j+1)) - &
3451 & dt*(wk_tl(i, j)+wk_tl(i, j+1))*((gz(i, j, k+1)-gz(i, j+1, k)&
3452 & )*(pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1, k+1)&
3453 & )*(pk(i, j, k+1)-pk(i, j+1, k)))/(wk(i, j)+wk(i, j+1))**2
3454 dv1 = dt/(wk(i, j)+wk(i, j+1))*((gz(i, j, k+1)-gz(i, j+1, k))*&
3455 & (pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1, k+1))*&
3456 & (pk(i, j, k+1)-pk(i, j+1, k)))
3458 v_tl(i, j, k) = gridstruct%rdy(i, j)*(v_tl(i, j, k)+dv1_tl+dt*&
3459 & ((gz_tl(i, j, k+1)-gz_tl(i, j+1, k))*(pp(i, j+1, k+1)-pp(i, &
3460 & j, k))+(gz(i, j, k+1)-gz(i, j+1, k))*(pp_tl(i, j+1, k+1)-&
3461 & pp_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i, j+1, k+1))*(pp(i, j&
3462 & , k+1)-pp(i, j+1, k))+(gz(i, j, k)-gz(i, j+1, k+1))*(pp_tl(i&
3463 & , j, k+1)-pp_tl(i, j+1, k)))/(wk1(i, j)+wk1(i, j+1))-dt*(&
3464 & wk1_tl(i, j)+wk1_tl(i, j+1))*((gz(i, j, k+1)-gz(i, j+1, k))*&
3465 & (pp(i, j+1, k+1)-pp(i, j, k))+(gz(i, j, k)-gz(i, j+1, k+1))*&
3466 & (pp(i, j, k+1)-pp(i, j+1, k)))/(wk1(i, j)+wk1(i, j+1))**2)
3467 v(i, j, k) = (v(i, j, k)+dv1+dt/(wk1(i, j)+wk1(i, j+1))*((gz(i&
3468 & , j, k+1)-gz(i, j+1, k))*(pp(i, j+1, k+1)-pp(i, j, k))+(gz(i&
3469 & , j, k)-gz(i, j+1, k+1))*(pp(i, j, k+1)-pp(i, j+1, k))))*&
3470 & gridstruct%rdy(i, j)
3475 SUBROUTINE nh_p_grad(u, v, pp, gz, delp, pk, dt, ng, gridstruct, bd, &
3476 & npx, npy, npz, use_logp)
3479 INTEGER,
INTENT(IN) :: ng, npx, npy, npz
3480 REAL,
INTENT(IN) :: dt
3481 LOGICAL,
INTENT(IN) :: use_logp
3482 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
3483 REAL,
INTENT(INOUT) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
3485 REAL,
INTENT(INOUT) :: pp(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3487 REAL,
INTENT(INOUT) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3489 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3490 REAL,
INTENT(INOUT) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3491 REAL,
INTENT(INOUT) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3492 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
3494 REAL :: wk1(bd%isd:bd%ied, bd%jsd:bd%jed)
3495 REAL :: wk(bd%is:bd%ie+1, bd%js:bd%je+1)
3496 REAL :: du1, dv1, top_value
3498 INTEGER :: is, ie, js, je
3499 INTEGER :: isd, ied, jsd, jed
3518 pk(i, j, 1) = top_value
3525 CALL a2b_ord4(pp(isd:ied, jsd:jed, k), wk1, gridstruct, npx, &
3526 & npy, is, ie, js, je, ng, .true.)
3527 CALL a2b_ord4(pk(isd:ied, jsd:jed, k), wk1, gridstruct, npx, &
3528 & npy, is, ie, js, je, ng, .true.)
3530 CALL a2b_ord4(gz(isd:ied, jsd:jed, k), wk1, gridstruct, npx, &
3531 & npy, is, ie, js, je, ng, .true.)
3537 CALL a2b_ord4(delp(isd:ied, jsd:jed, k), wk1, gridstruct, npx, &
3538 & npy, is, ie, js, je, ng)
3541 wk(i, j) = pk(i, j, k+1) - pk(i, j, k)
3548 du1 = dt/(wk(i, j)+wk(i+1, j))*((gz(i, j, k+1)-gz(i+1, j, k))*&
3549 & (pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*&
3550 & (pk(i, j, k+1)-pk(i+1, j, k)))
3552 u(i, j, k) = (u(i, j, k)+du1+dt/(wk1(i, j)+wk1(i+1, j))*((gz(i&
3553 & , j, k+1)-gz(i+1, j, k))*(pp(i+1, j, k+1)-pp(i, j, k))+(gz(i&
3554 & , j, k)-gz(i+1, j, k+1))*(pp(i, j, k+1)-pp(i+1, j, k))))*&
3555 & gridstruct%rdx(i, j)
3561 dv1 = dt/(wk(i, j)+wk(i, j+1))*((gz(i, j, k+1)-gz(i, j+1, k))*&
3562 & (pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1, k+1))*&
3563 & (pk(i, j, k+1)-pk(i, j+1, k)))
3565 v(i, j, k) = (v(i, j, k)+dv1+dt/(wk1(i, j)+wk1(i, j+1))*((gz(i&
3566 & , j, k+1)-gz(i, j+1, k))*(pp(i, j+1, k+1)-pp(i, j, k))+(gz(i&
3567 & , j, k)-gz(i, j+1, k+1))*(pp(i, j, k+1)-pp(i, j+1, k))))*&
3568 & gridstruct%rdy(i, j)
3577 & , du_tl, dv, dv_tl, delp, delp_tl, pk, pk_tl, beta, dt, ng, &
3578 & gridstruct, bd, npx, npy, npz, use_logp)
3581 INTEGER,
INTENT(IN) :: ng, npx, npy, npz
3582 REAL,
INTENT(IN) :: beta, dt
3583 LOGICAL,
INTENT(IN) :: use_logp
3584 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
3585 REAL,
INTENT(INOUT) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
3586 REAL,
INTENT(INOUT) :: delp_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
3588 REAL,
INTENT(INOUT) :: pp(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3589 REAL,
INTENT(INOUT) :: pp_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3591 REAL,
INTENT(INOUT) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3592 REAL,
INTENT(INOUT) :: pk_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3594 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3595 REAL,
INTENT(INOUT) :: gz_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3596 REAL,
INTENT(INOUT) :: du(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3597 REAL,
INTENT(INOUT) :: du_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3598 REAL,
INTENT(INOUT) :: dv(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3599 REAL,
INTENT(INOUT) :: dv_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3600 REAL,
INTENT(INOUT) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3601 REAL,
INTENT(INOUT) :: u_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3602 REAL,
INTENT(INOUT) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3603 REAL,
INTENT(INOUT) :: v_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3604 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
3606 REAL :: wk1(bd%isd:bd%ied, bd%jsd:bd%jed)
3607 REAL :: wk1_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
3608 REAL :: wk(bd%is:bd%ie+1, bd%js:bd%je+1)
3609 REAL :: wk_tl(bd%is:bd%ie+1, bd%js:bd%je+1)
3610 REAL :: alpha, top_value
3612 INTEGER :: is, ie, js, je
3613 INTEGER :: isd, ied, jsd, jed
3631 pp_tl(i, j, 1) = 0.0
3633 pk_tl(i, j, 1) = 0.0
3634 pk(i, j, 1) = top_value
3642 CALL a2b_ord4_tlm(pp(isd:ied, jsd:jed, k), pp_tl(isd:ied, jsd&
3643 & :jed, k), wk1, wk1_tl, gridstruct, npx, npy, is, &
3644 & ie, js, je, ng, .true.)
3645 CALL a2b_ord4_tlm(pk(isd:ied, jsd:jed, k), pk_tl(isd:ied, jsd&
3646 & :jed, k), wk1, wk1_tl, gridstruct, npx, npy, is, &
3647 & ie, js, je, ng, .true.)
3649 CALL a2b_ord4_tlm(gz(isd:ied, jsd:jed, k), gz_tl(isd:ied, jsd:&
3650 & jed, k), wk1, wk1_tl, gridstruct, npx, npy, is, ie&
3651 & , js, je, ng, .true.)
3658 CALL a2b_ord4_tlm(delp(isd:ied, jsd:jed, k), delp_tl(isd:ied, &
3659 & jsd:jed, k), wk1, wk1_tl, gridstruct, npx, npy, is&
3663 wk_tl(i, j) = pk_tl(i, j, k+1) - pk_tl(i, j, k)
3664 wk(i, j) = pk(i, j, k+1) - pk(i, j, k)
3669 u_tl(i, j, k) = u_tl(i, j, k) + beta*du_tl(i, j, k)
3670 u(i, j, k) = u(i, j, k) + beta*du(i, j, k)
3674 du_tl(i, j, k) = dt*((gz_tl(i, j, k+1)-gz_tl(i+1, j, k))*(pk(i&
3675 & +1, j, k+1)-pk(i, j, k))+(gz(i, j, k+1)-gz(i+1, j, k))*(&
3676 & pk_tl(i+1, j, k+1)-pk_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i+1&
3677 & , j, k+1))*(pk(i, j, k+1)-pk(i+1, j, k))+(gz(i, j, k)-gz(i+1&
3678 & , j, k+1))*(pk_tl(i, j, k+1)-pk_tl(i+1, j, k)))/(wk(i, j)+wk&
3679 & (i+1, j)) - dt*(wk_tl(i, j)+wk_tl(i+1, j))*((gz(i, j, k+1)-&
3680 & gz(i+1, j, k))*(pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz&
3681 & (i+1, j, k+1))*(pk(i, j, k+1)-pk(i+1, j, k)))/(wk(i, j)+wk(i&
3683 du(i, j, k) = dt/(wk(i, j)+wk(i+1, j))*((gz(i, j, k+1)-gz(i+1&
3684 & , j, k))*(pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, &
3685 & j, k+1))*(pk(i, j, k+1)-pk(i+1, j, k)))
3688 u_tl(i, j, k) = gridstruct%rdx(i, j)*(u_tl(i, j, k)+alpha*&
3689 & du_tl(i, j, k)+dt*((gz_tl(i, j, k+1)-gz_tl(i+1, j, k))*(pp(i&
3690 & +1, j, k+1)-pp(i, j, k))+(gz(i, j, k+1)-gz(i+1, j, k))*(&
3691 & pp_tl(i+1, j, k+1)-pp_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i+1&
3692 & , j, k+1))*(pp(i, j, k+1)-pp(i+1, j, k))+(gz(i, j, k)-gz(i+1&
3693 & , j, k+1))*(pp_tl(i, j, k+1)-pp_tl(i+1, j, k)))/(wk1(i, j)+&
3694 & wk1(i+1, j))-dt*(wk1_tl(i, j)+wk1_tl(i+1, j))*((gz(i, j, k+1&
3695 & )-gz(i+1, j, k))*(pp(i+1, j, k+1)-pp(i, j, k))+(gz(i, j, k)-&
3696 & gz(i+1, j, k+1))*(pp(i, j, k+1)-pp(i+1, j, k)))/(wk1(i, j)+&
3698 u(i, j, k) = (u(i, j, k)+alpha*du(i, j, k)+dt/(wk1(i, j)+wk1(i&
3699 & +1, j))*((gz(i, j, k+1)-gz(i+1, j, k))*(pp(i+1, j, k+1)-pp(i&
3700 & , j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*(pp(i, j, k+1)-pp(i+1&
3701 & , j, k))))*gridstruct%rdx(i, j)
3706 v_tl(i, j, k) = v_tl(i, j, k) + beta*dv_tl(i, j, k)
3707 v(i, j, k) = v(i, j, k) + beta*dv(i, j, k)
3710 dv_tl(i, j, k) = dt*((gz_tl(i, j, k+1)-gz_tl(i, j+1, k))*(pk(i&
3711 & , j+1, k+1)-pk(i, j, k))+(gz(i, j, k+1)-gz(i, j+1, k))*(&
3712 & pk_tl(i, j+1, k+1)-pk_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i, &
3713 & j+1, k+1))*(pk(i, j, k+1)-pk(i, j+1, k))+(gz(i, j, k)-gz(i, &
3714 & j+1, k+1))*(pk_tl(i, j, k+1)-pk_tl(i, j+1, k)))/(wk(i, j)+wk&
3715 & (i, j+1)) - dt*(wk_tl(i, j)+wk_tl(i, j+1))*((gz(i, j, k+1)-&
3716 & gz(i, j+1, k))*(pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz&
3717 & (i, j+1, k+1))*(pk(i, j, k+1)-pk(i, j+1, k)))/(wk(i, j)+wk(i&
3719 dv(i, j, k) = dt/(wk(i, j)+wk(i, j+1))*((gz(i, j, k+1)-gz(i, j&
3720 & +1, k))*(pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1&
3721 & , k+1))*(pk(i, j, k+1)-pk(i, j+1, k)))
3724 v_tl(i, j, k) = gridstruct%rdy(i, j)*(v_tl(i, j, k)+alpha*&
3725 & dv_tl(i, j, k)+dt*((gz_tl(i, j, k+1)-gz_tl(i, j+1, k))*(pp(i&
3726 & , j+1, k+1)-pp(i, j, k))+(gz(i, j, k+1)-gz(i, j+1, k))*(&
3727 & pp_tl(i, j+1, k+1)-pp_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i, &
3728 & j+1, k+1))*(pp(i, j, k+1)-pp(i, j+1, k))+(gz(i, j, k)-gz(i, &
3729 & j+1, k+1))*(pp_tl(i, j, k+1)-pp_tl(i, j+1, k)))/(wk1(i, j)+&
3730 & wk1(i, j+1))-dt*(wk1_tl(i, j)+wk1_tl(i, j+1))*((gz(i, j, k+1&
3731 & )-gz(i, j+1, k))*(pp(i, j+1, k+1)-pp(i, j, k))+(gz(i, j, k)-&
3732 & gz(i, j+1, k+1))*(pp(i, j, k+1)-pp(i, j+1, k)))/(wk1(i, j)+&
3734 v(i, j, k) = (v(i, j, k)+alpha*dv(i, j, k)+dt/(wk1(i, j)+wk1(i&
3735 & , j+1))*((gz(i, j, k+1)-gz(i, j+1, k))*(pp(i, j+1, k+1)-pp(i&
3736 & , j, k))+(gz(i, j, k)-gz(i, j+1, k+1))*(pp(i, j, k+1)-pp(i, &
3737 & j+1, k))))*gridstruct%rdy(i, j)
3742 SUBROUTINE split_p_grad(u, v, pp, gz, du, dv, delp, pk, beta, dt, ng, &
3743 & gridstruct, bd, npx, npy, npz, use_logp)
3746 INTEGER,
INTENT(IN) :: ng, npx, npy, npz
3747 REAL,
INTENT(IN) :: beta, dt
3748 LOGICAL,
INTENT(IN) :: use_logp
3749 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
3750 REAL,
INTENT(INOUT) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
3752 REAL,
INTENT(INOUT) :: pp(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3754 REAL,
INTENT(INOUT) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3756 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3757 REAL,
INTENT(INOUT) :: du(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3758 REAL,
INTENT(INOUT) :: dv(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3759 REAL,
INTENT(INOUT) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3760 REAL,
INTENT(INOUT) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3761 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
3763 REAL :: wk1(bd%isd:bd%ied, bd%jsd:bd%jed)
3764 REAL :: wk(bd%is:bd%ie+1, bd%js:bd%je+1)
3765 REAL :: alpha, top_value
3767 INTEGER :: is, ie, js, je
3768 INTEGER :: isd, ied, jsd, jed
3787 pk(i, j, 1) = top_value
3794 CALL a2b_ord4(pp(isd:ied, jsd:jed, k), wk1, gridstruct, npx, &
3795 & npy, is, ie, js, je, ng, .true.)
3796 CALL a2b_ord4(pk(isd:ied, jsd:jed, k), wk1, gridstruct, npx, &
3797 & npy, is, ie, js, je, ng, .true.)
3799 CALL a2b_ord4(gz(isd:ied, jsd:jed, k), wk1, gridstruct, npx, &
3800 & npy, is, ie, js, je, ng, .true.)
3806 CALL a2b_ord4(delp(isd:ied, jsd:jed, k), wk1, gridstruct, npx, &
3807 & npy, is, ie, js, je, ng)
3810 wk(i, j) = pk(i, j, k+1) - pk(i, j, k)
3815 u(i, j, k) = u(i, j, k) + beta*du(i, j, k)
3819 du(i, j, k) = dt/(wk(i, j)+wk(i+1, j))*((gz(i, j, k+1)-gz(i+1&
3820 & , j, k))*(pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, &
3821 & j, k+1))*(pk(i, j, k+1)-pk(i+1, j, k)))
3824 u(i, j, k) = (u(i, j, k)+alpha*du(i, j, k)+dt/(wk1(i, j)+wk1(i&
3825 & +1, j))*((gz(i, j, k+1)-gz(i+1, j, k))*(pp(i+1, j, k+1)-pp(i&
3826 & , j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*(pp(i, j, k+1)-pp(i+1&
3827 & , j, k))))*gridstruct%rdx(i, j)
3832 v(i, j, k) = v(i, j, k) + beta*dv(i, j, k)
3835 dv(i, j, k) = dt/(wk(i, j)+wk(i, j+1))*((gz(i, j, k+1)-gz(i, j&
3836 & +1, k))*(pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1&
3837 & , k+1))*(pk(i, j, k+1)-pk(i, j+1, k)))
3840 v(i, j, k) = (v(i, j, k)+alpha*dv(i, j, k)+dt/(wk1(i, j)+wk1(i&
3841 & , j+1))*((gz(i, j, k+1)-gz(i, j+1, k))*(pp(i, j+1, k+1)-pp(i&
3842 & , j, k))+(gz(i, j, k)-gz(i, j+1, k+1))*(pp(i, j, k+1)-pp(i, &
3843 & j+1, k))))*gridstruct%rdy(i, j)
3851 SUBROUTINE one_grad_p_tlm(u, u_tl, v, v_tl, pk, pk_tl, gz, gz_tl, &
3852 & divg2, divg2_tl, delp, delp_tl, dt, ng, gridstruct, bd, npx, npy, &
3853 & npz, ptop, hydrostatic, a2b_ord, d_ext)
3856 INTEGER,
INTENT(IN) :: ng, npx, npy, npz, a2b_ord
3857 REAL,
INTENT(IN) :: dt, ptop, d_ext
3858 LOGICAL,
INTENT(IN) :: hydrostatic
3859 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
3860 REAL,
INTENT(IN) :: divg2(bd%is:bd%ie+1, bd%js:bd%je+1)
3861 REAL,
INTENT(IN) :: divg2_tl(bd%is:bd%ie+1, bd%js:bd%je+1)
3862 REAL,
INTENT(INOUT) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3863 REAL,
INTENT(INOUT) :: pk_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3864 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3865 REAL,
INTENT(INOUT) :: gz_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
3866 REAL,
INTENT(INOUT) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
3867 REAL,
INTENT(INOUT) :: delp_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
3868 REAL,
INTENT(INOUT) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3869 REAL,
INTENT(INOUT) :: u_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
3870 REAL,
INTENT(INOUT) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3871 REAL,
INTENT(INOUT) :: v_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
3872 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
3874 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed) :: wk
3875 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed) :: wk_tl
3876 REAL :: wk1(bd%is:bd%ie+1, bd%js:bd%je+1)
3877 REAL :: wk1_tl(bd%is:bd%ie+1, bd%js:bd%je+1)
3878 REAL :: wk2(bd%is:bd%ie, bd%js:bd%je+1)
3879 REAL :: wk2_tl(bd%is:bd%ie, bd%js:bd%je+1)
3882 INTEGER :: is, ie, js, je
3883 INTEGER :: isd, ied, jsd, jed
3892 IF (hydrostatic)
THEN 3902 pk_tl(i, j, 1) = 0.0
3903 pk(i, j, 1) = top_value
3910 IF (a2b_ord .EQ. 4)
THEN 3911 CALL a2b_ord4_tlm(pk(isd:ied, jsd:jed, k), pk_tl(isd:ied, jsd&
3912 & :jed, k), wk, wk_tl, gridstruct, npx, npy, is, ie&
3913 & , js, je, ng, .true.)
3915 CALL a2b_ord2_tlm(pk(isd:ied, jsd:jed, k), pk_tl(isd:ied, jsd:&
3916 & jed, k), wk, wk_tl, gridstruct, npx, npy, is, ie, js&
3923 IF (a2b_ord .EQ. 4)
THEN 3924 CALL a2b_ord4_tlm(gz(isd:ied, jsd:jed, k), gz_tl(isd:ied, jsd&
3925 & :jed, k), wk, wk_tl, gridstruct, npx, npy, is, ie&
3926 & , js, je, ng, .true.)
3928 CALL a2b_ord2_tlm(gz(isd:ied, jsd:jed, k), gz_tl(isd:ied, jsd:&
3929 & jed, k), wk, wk_tl, gridstruct, npx, npy, is, ie, js&
3933 IF (d_ext .GT. 0.)
THEN 3938 wk2_tl(i, j) = divg2_tl(i, j) - divg2_tl(i+1, j)
3939 wk2(i, j) = divg2(i, j) - divg2(i+1, j)
3946 wk1_tl(i, j) = divg2_tl(i, j) - divg2_tl(i, j+1)
3947 wk1(i, j) = divg2(i, j) - divg2(i, j+1)
3967 IF (hydrostatic)
THEN 3970 wk_tl(i, j) = pk_tl(i, j, k+1) - pk_tl(i, j, k)
3971 wk(i, j) = pk(i, j, k+1) - pk(i, j, k)
3974 ELSE IF (a2b_ord .EQ. 4)
THEN 3975 CALL a2b_ord4_tlm(delp(isd:ied, jsd:jed, k), delp_tl(isd:ied&
3976 & , jsd:jed, k), wk, wk_tl, gridstruct, npx, npy, &
3977 & is, ie, js, je, ng)
3979 CALL a2b_ord2_tlm(delp(isd:ied, jsd:jed, k), delp_tl(isd:ied, &
3980 & jsd:jed, k), wk, wk_tl, gridstruct, npx, npy, is, ie&
3985 u_tl(i, j, k) = gridstruct%rdx(i, j)*(wk2_tl(i, j)+u_tl(i, j, &
3986 & k)+dt*((gz_tl(i, j, k+1)-gz_tl(i+1, j, k))*(pk(i+1, j, k+1)-&
3987 & pk(i, j, k))+(gz(i, j, k+1)-gz(i+1, j, k))*(pk_tl(i+1, j, k+&
3988 & 1)-pk_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i+1, j, k+1))*(pk(i&
3989 & , j, k+1)-pk(i+1, j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*(&
3990 & pk_tl(i, j, k+1)-pk_tl(i+1, j, k)))/(wk(i, j)+wk(i+1, j))-dt&
3991 & *(wk_tl(i, j)+wk_tl(i+1, j))*((gz(i, j, k+1)-gz(i+1, j, k))*&
3992 & (pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*&
3993 & (pk(i, j, k+1)-pk(i+1, j, k)))/(wk(i, j)+wk(i+1, j))**2)
3994 u(i, j, k) = gridstruct%rdx(i, j)*(wk2(i, j)+u(i, j, k)+dt/(wk&
3995 & (i, j)+wk(i+1, j))*((gz(i, j, k+1)-gz(i+1, j, k))*(pk(i+1, j&
3996 & , k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*(pk(i, j, &
3997 & k+1)-pk(i+1, j, k))))
4002 v_tl(i, j, k) = gridstruct%rdy(i, j)*(wk1_tl(i, j)+v_tl(i, j, &
4003 & k)+dt*((gz_tl(i, j, k+1)-gz_tl(i, j+1, k))*(pk(i, j+1, k+1)-&
4004 & pk(i, j, k))+(gz(i, j, k+1)-gz(i, j+1, k))*(pk_tl(i, j+1, k+&
4005 & 1)-pk_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i, j+1, k+1))*(pk(i&
4006 & , j, k+1)-pk(i, j+1, k))+(gz(i, j, k)-gz(i, j+1, k+1))*(&
4007 & pk_tl(i, j, k+1)-pk_tl(i, j+1, k)))/(wk(i, j)+wk(i, j+1))-dt&
4008 & *(wk_tl(i, j)+wk_tl(i, j+1))*((gz(i, j, k+1)-gz(i, j+1, k))*&
4009 & (pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1, k+1))*&
4010 & (pk(i, j, k+1)-pk(i, j+1, k)))/(wk(i, j)+wk(i, j+1))**2)
4011 v(i, j, k) = gridstruct%rdy(i, j)*(wk1(i, j)+v(i, j, k)+dt/(wk&
4012 & (i, j)+wk(i, j+1))*((gz(i, j, k+1)-gz(i, j+1, k))*(pk(i, j+1&
4013 & , k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1, k+1))*(pk(i, j, &
4014 & k+1)-pk(i, j+1, k))))
4019 SUBROUTINE one_grad_p(u, v, pk, gz, divg2, delp, dt, ng, gridstruct, &
4020 & bd, npx, npy, npz, ptop, hydrostatic, a2b_ord, d_ext)
4023 INTEGER,
INTENT(IN) :: ng, npx, npy, npz, a2b_ord
4024 REAL,
INTENT(IN) :: dt, ptop, d_ext
4025 LOGICAL,
INTENT(IN) :: hydrostatic
4026 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
4027 REAL,
INTENT(IN) :: divg2(bd%is:bd%ie+1, bd%js:bd%je+1)
4028 REAL,
INTENT(INOUT) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
4029 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
4030 REAL,
INTENT(INOUT) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
4031 REAL,
INTENT(INOUT) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
4032 REAL,
INTENT(INOUT) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
4033 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
4035 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed) :: wk
4036 REAL :: wk1(bd%is:bd%ie+1, bd%js:bd%je+1)
4037 REAL :: wk2(bd%is:bd%ie, bd%js:bd%je+1)
4040 INTEGER :: is, ie, js, je
4041 INTEGER :: isd, ied, jsd, jed
4050 IF (hydrostatic)
THEN 4060 pk(i, j, 1) = top_value
4066 IF (a2b_ord .EQ. 4)
THEN 4067 CALL a2b_ord4(pk(isd:ied, jsd:jed, k), wk, gridstruct, npx, &
4068 & npy, is, ie, js, je, ng, .true.)
4070 CALL a2b_ord2(pk(isd:ied, jsd:jed, k), wk, gridstruct, npx, npy&
4071 & , is, ie, js, je, ng, .true.)
4077 IF (a2b_ord .EQ. 4)
THEN 4078 CALL a2b_ord4(gz(isd:ied, jsd:jed, k), wk, gridstruct, npx, &
4079 & npy, is, ie, js, je, ng, .true.)
4081 CALL a2b_ord2(gz(isd:ied, jsd:jed, k), wk, gridstruct, npx, npy&
4082 & , is, ie, js, je, ng, .true.)
4085 IF (d_ext .GT. 0.)
THEN 4089 wk2(i, j) = divg2(i, j) - divg2(i+1, j)
4095 wk1(i, j) = divg2(i, j) - divg2(i, j+1)
4113 IF (hydrostatic)
THEN 4116 wk(i, j) = pk(i, j, k+1) - pk(i, j, k)
4119 ELSE IF (a2b_ord .EQ. 4)
THEN 4120 CALL a2b_ord4(delp(isd:ied, jsd:jed, k), wk, gridstruct, npx&
4121 & , npy, is, ie, js, je, ng)
4123 CALL a2b_ord2(delp(isd:ied, jsd:jed, k), wk, gridstruct, npx, &
4124 & npy, is, ie, js, je, ng)
4128 u(i, j, k) = gridstruct%rdx(i, j)*(wk2(i, j)+u(i, j, k)+dt/(wk&
4129 & (i, j)+wk(i+1, j))*((gz(i, j, k+1)-gz(i+1, j, k))*(pk(i+1, j&
4130 & , k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, j, k+1))*(pk(i, j, &
4131 & k+1)-pk(i+1, j, k))))
4136 v(i, j, k) = gridstruct%rdy(i, j)*(wk1(i, j)+v(i, j, k)+dt/(wk&
4137 & (i, j)+wk(i, j+1))*((gz(i, j, k+1)-gz(i, j+1, k))*(pk(i, j+1&
4138 & , k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1, k+1))*(pk(i, j, &
4139 & k+1)-pk(i, j+1, k))))
4148 & pk_tl, gz, gz_tl, du, du_tl, dv, dv_tl, dt, ng, gridstruct, bd, npx&
4149 & , npy, npz, ptop, beta, a2b_ord)
4152 INTEGER,
INTENT(IN) :: ng, npx, npy, npz, a2b_ord
4153 REAL,
INTENT(IN) :: dt, ptop, beta
4154 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
4155 REAL,
INTENT(IN) :: divg2(bd%is:bd%ie+1, bd%js:bd%je+1)
4156 REAL,
INTENT(IN) :: divg2_tl(bd%is:bd%ie+1, bd%js:bd%je+1)
4157 REAL,
INTENT(INOUT) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
4158 REAL,
INTENT(INOUT) :: pk_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
4159 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
4160 REAL,
INTENT(INOUT) :: gz_tl(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
4161 REAL,
INTENT(INOUT) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
4162 REAL,
INTENT(INOUT) :: u_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
4163 REAL,
INTENT(INOUT) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
4164 REAL,
INTENT(INOUT) :: v_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
4165 REAL,
INTENT(INOUT) :: du(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
4166 REAL,
INTENT(INOUT) :: du_tl(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
4167 REAL,
INTENT(INOUT) :: dv(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
4168 REAL,
INTENT(INOUT) :: dv_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
4169 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
4171 REAL :: wk(bd%isd:bd%ied, bd%jsd:bd%jed)
4172 REAL :: wk_tl(bd%isd:bd%ied, bd%jsd:bd%jed)
4173 REAL :: top_value, alpha
4175 INTEGER :: is, ie, js, je
4176 INTEGER :: isd, ied, jsd, jed
4191 pk_tl(i, j, 1) = 0.0
4192 pk(i, j, 1) = top_value
4199 IF (a2b_ord .EQ. 4)
THEN 4200 CALL a2b_ord4_tlm(pk(isd:ied, jsd:jed, k), pk_tl(isd:ied, jsd&
4201 & :jed, k), wk, wk_tl, gridstruct, npx, npy, is, ie&
4202 & , js, je, ng, .true.)
4204 CALL a2b_ord2_tlm(pk(isd:ied, jsd:jed, k), pk_tl(isd:ied, jsd:&
4205 & jed, k), wk, wk_tl, gridstruct, npx, npy, is, ie, js&
4212 IF (a2b_ord .EQ. 4)
THEN 4213 CALL a2b_ord4_tlm(gz(isd:ied, jsd:jed, k), gz_tl(isd:ied, jsd&
4214 & :jed, k), wk, wk_tl, gridstruct, npx, npy, is, ie&
4215 & , js, je, ng, .true.)
4217 CALL a2b_ord2_tlm(gz(isd:ied, jsd:jed, k), gz_tl(isd:ied, jsd:&
4218 & jed, k), wk, wk_tl, gridstruct, npx, npy, is, ie, js&
4228 wk_tl(i, j) = pk_tl(i, j, k+1) - pk_tl(i, j, k)
4229 wk(i, j) = pk(i, j, k+1) - pk(i, j, k)
4234 u_tl(i, j, k) = u_tl(i, j, k) + beta*du_tl(i, j, k)
4235 u(i, j, k) = u(i, j, k) + beta*du(i, j, k)
4236 du_tl(i, j, k) = dt*((gz_tl(i, j, k+1)-gz_tl(i+1, j, k))*(pk(i&
4237 & +1, j, k+1)-pk(i, j, k))+(gz(i, j, k+1)-gz(i+1, j, k))*(&
4238 & pk_tl(i+1, j, k+1)-pk_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i+1&
4239 & , j, k+1))*(pk(i, j, k+1)-pk(i+1, j, k))+(gz(i, j, k)-gz(i+1&
4240 & , j, k+1))*(pk_tl(i, j, k+1)-pk_tl(i+1, j, k)))/(wk(i, j)+wk&
4241 & (i+1, j)) - dt*(wk_tl(i, j)+wk_tl(i+1, j))*((gz(i, j, k+1)-&
4242 & gz(i+1, j, k))*(pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz&
4243 & (i+1, j, k+1))*(pk(i, j, k+1)-pk(i+1, j, k)))/(wk(i, j)+wk(i&
4245 du(i, j, k) = dt/(wk(i, j)+wk(i+1, j))*((gz(i, j, k+1)-gz(i+1&
4246 & , j, k))*(pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, &
4247 & j, k+1))*(pk(i, j, k+1)-pk(i+1, j, k)))
4248 u_tl(i, j, k) = gridstruct%rdx(i, j)*(u_tl(i, j, k)+divg2_tl(i&
4249 & , j)-divg2_tl(i+1, j)+alpha*du_tl(i, j, k))
4250 u(i, j, k) = (u(i, j, k)+divg2(i, j)-divg2(i+1, j)+alpha*du(i&
4251 & , j, k))*gridstruct%rdx(i, j)
4256 v_tl(i, j, k) = v_tl(i, j, k) + beta*dv_tl(i, j, k)
4257 v(i, j, k) = v(i, j, k) + beta*dv(i, j, k)
4258 dv_tl(i, j, k) = dt*((gz_tl(i, j, k+1)-gz_tl(i, j+1, k))*(pk(i&
4259 & , j+1, k+1)-pk(i, j, k))+(gz(i, j, k+1)-gz(i, j+1, k))*(&
4260 & pk_tl(i, j+1, k+1)-pk_tl(i, j, k))+(gz_tl(i, j, k)-gz_tl(i, &
4261 & j+1, k+1))*(pk(i, j, k+1)-pk(i, j+1, k))+(gz(i, j, k)-gz(i, &
4262 & j+1, k+1))*(pk_tl(i, j, k+1)-pk_tl(i, j+1, k)))/(wk(i, j)+wk&
4263 & (i, j+1)) - dt*(wk_tl(i, j)+wk_tl(i, j+1))*((gz(i, j, k+1)-&
4264 & gz(i, j+1, k))*(pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz&
4265 & (i, j+1, k+1))*(pk(i, j, k+1)-pk(i, j+1, k)))/(wk(i, j)+wk(i&
4267 dv(i, j, k) = dt/(wk(i, j)+wk(i, j+1))*((gz(i, j, k+1)-gz(i, j&
4268 & +1, k))*(pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1&
4269 & , k+1))*(pk(i, j, k+1)-pk(i, j+1, k)))
4270 v_tl(i, j, k) = gridstruct%rdy(i, j)*(v_tl(i, j, k)+divg2_tl(i&
4271 & , j)-divg2_tl(i, j+1)+alpha*dv_tl(i, j, k))
4272 v(i, j, k) = (v(i, j, k)+divg2(i, j)-divg2(i, j+1)+alpha*dv(i&
4273 & , j, k))*gridstruct%rdy(i, j)
4279 & gridstruct, bd, npx, npy, npz, ptop, beta, a2b_ord)
4282 INTEGER,
INTENT(IN) :: ng, npx, npy, npz, a2b_ord
4283 REAL,
INTENT(IN) :: dt, ptop, beta
4284 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
4285 REAL,
INTENT(IN) :: divg2(bd%is:bd%ie+1, bd%js:bd%je+1)
4286 REAL,
INTENT(INOUT) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
4287 REAL,
INTENT(INOUT) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
4288 REAL,
INTENT(INOUT) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
4289 REAL,
INTENT(INOUT) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
4290 REAL,
INTENT(INOUT) :: du(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
4291 REAL,
INTENT(INOUT) :: dv(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
4292 TYPE(FV_GRID_TYPE),
INTENT(INOUT),
TARGET :: gridstruct
4294 REAL :: wk(bd%isd:bd%ied, bd%jsd:bd%jed)
4295 REAL :: top_value, alpha
4297 INTEGER :: is, ie, js, je
4298 INTEGER :: isd, ied, jsd, jed
4313 pk(i, j, 1) = top_value
4319 IF (a2b_ord .EQ. 4)
THEN 4320 CALL a2b_ord4(pk(isd:ied, jsd:jed, k), wk, gridstruct, npx, &
4321 & npy, is, ie, js, je, ng, .true.)
4323 CALL a2b_ord2(pk(isd:ied, jsd:jed, k), wk, gridstruct, npx, npy&
4324 & , is, ie, js, je, ng, .true.)
4330 IF (a2b_ord .EQ. 4)
THEN 4331 CALL a2b_ord4(gz(isd:ied, jsd:jed, k), wk, gridstruct, npx, &
4332 & npy, is, ie, js, je, ng, .true.)
4334 CALL a2b_ord2(gz(isd:ied, jsd:jed, k), wk, gridstruct, npx, npy&
4335 & , is, ie, js, je, ng, .true.)
4344 wk(i, j) = pk(i, j, k+1) - pk(i, j, k)
4349 u(i, j, k) = u(i, j, k) + beta*du(i, j, k)
4350 du(i, j, k) = dt/(wk(i, j)+wk(i+1, j))*((gz(i, j, k+1)-gz(i+1&
4351 & , j, k))*(pk(i+1, j, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i+1, &
4352 & j, k+1))*(pk(i, j, k+1)-pk(i+1, j, k)))
4353 u(i, j, k) = (u(i, j, k)+divg2(i, j)-divg2(i+1, j)+alpha*du(i&
4354 & , j, k))*gridstruct%rdx(i, j)
4359 v(i, j, k) = v(i, j, k) + beta*dv(i, j, k)
4360 dv(i, j, k) = dt/(wk(i, j)+wk(i, j+1))*((gz(i, j, k+1)-gz(i, j&
4361 & +1, k))*(pk(i, j+1, k+1)-pk(i, j, k))+(gz(i, j, k)-gz(i, j+1&
4362 & , k+1))*(pk(i, j, k+1)-pk(i, j+1, k)))
4363 v(i, j, k) = (v(i, j, k)+divg2(i, j)-divg2(i, j+1)+alpha*dv(i&
4364 & , j, k))*gridstruct%rdy(i, j)
4372 SUBROUTINE mix_dp_tlm(hydrostatic, w, w_tl, delp, delp_tl, pt, pt_tl, &
4373 & km, ak, bk, cg, fv_debug, bd)
4376 INTEGER,
INTENT(IN) :: km
4377 REAL,
INTENT(IN) :: ak(km+1), bk(km+1)
4378 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
4379 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(INOUT) :: &
4381 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(INOUT) :: &
4383 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(INOUT) :: &
4385 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(INOUT) :: &
4387 LOGICAL,
INTENT(IN) :: hydrostatic, cg, fv_debug
4391 INTEGER :: i, j, k, ip
4392 INTEGER :: ifirst, ilast
4393 INTEGER :: jfirst, jlast
4394 INTEGER :: is, ie, js, je
4395 INTEGER :: isd, ied, jsd, jed
4421 dpmin = 0.01*(ak(k+1)-ak(k)+(bk(k+1)-bk(k))*1.e5)
4423 IF (delp(i, j, k) .LT. dpmin)
THEN 4426 dp_tl = -delp_tl(i, j, k)
4427 dp = dpmin - delp(i, j, k)
4428 pt_tl(i, j, k) = (pt_tl(i, j, k)*delp(i, j, k)+pt(i, j, k)*&
4429 & delp_tl(i, j, k)+pt_tl(i, j, k+1)*dp+pt(i, j, k+1)*dp_tl)/&
4431 pt(i, j, k) = (pt(i, j, k)*delp(i, j, k)+pt(i, j, k+1)*dp)/&
4433 IF (.NOT.hydrostatic)
THEN 4434 w_tl(i, j, k) = (w_tl(i, j, k)*delp(i, j, k)+w(i, j, k)*&
4435 & delp_tl(i, j, k)+w_tl(i, j, k+1)*dp+w(i, j, k+1)*dp_tl)/&
4437 w(i, j, k) = (w(i, j, k)*delp(i, j, k)+w(i, j, k+1)*dp)/&
4440 delp_tl(i, j, k) = 0.0
4441 delp(i, j, k) = dpmin
4442 delp_tl(i, j, k+1) = delp_tl(i, j, k+1) - dp_tl
4443 delp(i, j, k+1) = delp(i, j, k+1) - dp
4449 dpmin = 0.01*(ak(km+1)-ak(km)+(bk(km+1)-bk(km))*1.e5)
4451 IF (delp(i, j, km) .LT. dpmin)
THEN 4454 dp_tl = -delp_tl(i, j, km)
4455 dp = dpmin - delp(i, j, km)
4456 pt_tl(i, j, km) = (pt_tl(i, j, km)*delp(i, j, km)+pt(i, j, km)&
4457 & *delp_tl(i, j, km)+pt_tl(i, j, km-1)*dp+pt(i, j, km-1)*dp_tl&
4459 pt(i, j, km) = (pt(i, j, km)*delp(i, j, km)+pt(i, j, km-1)*dp)&
4461 IF (.NOT.hydrostatic)
THEN 4462 w_tl(i, j, km) = (w_tl(i, j, km)*delp(i, j, km)+w(i, j, km)*&
4463 & delp_tl(i, j, km)+w_tl(i, j, km-1)*dp+w(i, j, km-1)*dp_tl)&
4465 w(i, j, km) = (w(i, j, km)*delp(i, j, km)+w(i, j, km-1)*dp)/&
4468 delp_tl(i, j, km) = 0.0
4469 delp(i, j, km) = dpmin
4470 delp_tl(i, j, km-1) = delp_tl(i, j, km-1) - dp_tl
4471 delp(i, j, km-1) = delp(i, j, km-1) - dp
4475 IF (fv_debug .AND. ip .NE. 0)
WRITE(*, *)
'Warning: Mix_dp', &
4479 SUBROUTINE mix_dp(hydrostatic, w, delp, pt, km, ak, bk, cg, fv_debug, &
4483 INTEGER,
INTENT(IN) :: km
4484 REAL,
INTENT(IN) :: ak(km+1), bk(km+1)
4485 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
4486 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(INOUT) :: &
4488 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(INOUT) :: &
4490 LOGICAL,
INTENT(IN) :: hydrostatic, cg, fv_debug
4493 INTEGER :: i, j, k, ip
4494 INTEGER :: ifirst, ilast
4495 INTEGER :: jfirst, jlast
4496 INTEGER :: is, ie, js, je
4497 INTEGER :: isd, ied, jsd, jed
4523 dpmin = 0.01*(ak(k+1)-ak(k)+(bk(k+1)-bk(k))*1.e5)
4525 IF (delp(i, j, k) .LT. dpmin)
THEN 4528 dp = dpmin - delp(i, j, k)
4529 pt(i, j, k) = (pt(i, j, k)*delp(i, j, k)+pt(i, j, k+1)*dp)/&
4531 IF (.NOT.hydrostatic) w(i, j, k) = (w(i, j, k)*delp(i, j, k)&
4532 & +w(i, j, k+1)*dp)/dpmin
4533 delp(i, j, k) = dpmin
4534 delp(i, j, k+1) = delp(i, j, k+1) - dp
4540 dpmin = 0.01*(ak(km+1)-ak(km)+(bk(km+1)-bk(km))*1.e5)
4542 IF (delp(i, j, km) .LT. dpmin)
THEN 4545 dp = dpmin - delp(i, j, km)
4546 pt(i, j, km) = (pt(i, j, km)*delp(i, j, km)+pt(i, j, km-1)*dp)&
4548 IF (.NOT.hydrostatic) w(i, j, km) = (w(i, j, km)*delp(i, j, km&
4549 & )+w(i, j, km-1)*dp)/dpmin
4550 delp(i, j, km) = dpmin
4551 delp(i, j, km-1) = delp(i, j, km-1) - dp
4555 IF (fv_debug .AND. ip .NE. 0)
WRITE(*, *)
'Warning: Mix_dp', &
4562 SUBROUTINE geopk_tlm(ptop, pe, pe_tl, peln, peln_tl, delp, delp_tl, pk&
4563 & , pk_tl, gz, gz_tl, hs, pt, pt_tl, q_con, pkz, pkz_tl, km, akap, cg&
4564 & , nested, computehalo, npx, npy, a2b_ord, bd)
4566 INTEGER,
INTENT(IN) :: km, npx, npy, a2b_ord
4567 REAL,
INTENT(IN) :: akap, ptop
4568 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
4569 REAL,
INTENT(IN) :: hs(bd%isd:bd%ied, bd%jsd:bd%jed)
4570 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(IN) :: pt&
4572 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(IN) :: &
4574 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(IN) :: &
4576 LOGICAL,
INTENT(IN) :: cg, nested, computehalo
4578 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km+1),
INTENT(OUT) :: &
4580 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km+1),
INTENT(OUT) :: &
4582 REAL,
INTENT(OUT) :: pe(bd%is-1:bd%ie+1, km+1, bd%js-1:bd%je+1)
4583 REAL,
INTENT(OUT) :: pe_tl(bd%is-1:bd%ie+1, km+1, bd%js-1:bd%je+1)
4585 REAL,
INTENT(OUT) :: peln(bd%is:bd%ie, km+1, bd%js:bd%je)
4586 REAL,
INTENT(OUT) :: peln_tl(bd%is:bd%ie, km+1, bd%js:bd%je)
4587 REAL,
INTENT(OUT) :: pkz(bd%is:bd%ie, bd%js:bd%je, km)
4588 REAL,
INTENT(OUT) :: pkz_tl(bd%is:bd%ie, bd%js:bd%je, km)
4592 REAL :: peg(bd%isd:bd%ied, km+1)
4593 REAL :: pkg(bd%isd:bd%ied, km+1)
4594 REAL(kind=8) :: p1d(bd%isd:bd%ied)
4595 REAL(kind=8) :: p1d_tl(bd%isd:bd%ied)
4596 REAL(kind=8) :: g1d(bd%isd:bd%ied)
4597 REAL(kind=8) :: g1d_tl(bd%isd:bd%ied)
4598 REAL :: logp(bd%isd:bd%ied)
4599 REAL :: logp_tl(bd%isd:bd%ied)
4601 INTEGER :: ifirst, ilast
4602 INTEGER :: jfirst, jlast
4603 INTEGER :: is, ie, js, je
4604 INTEGER :: isd, ied, jsd, jed
4621 IF ((.NOT.cg .AND. a2b_ord .EQ. 4) .OR. (nested .AND. (.NOT.cg))) &
4634 IF (nested .AND. computehalo)
THEN 4635 IF (is .EQ. 1) ifirst = isd
4636 IF (ie .EQ. npx - 1) ilast = ied
4637 IF (js .EQ. 1) jfirst = jsd
4638 IF (je .EQ. npy - 1)
THEN 4660 pk_tl(i, j, 1) = 0.0
4664 gz_tl(i, j, km+1) = 0.0
4665 gz(i, j, km+1) = hs(i, j)
4667 IF (j .GE. js .AND. j .LE. je)
THEN 4669 peln_tl(i, 1, j) = 0.0
4670 peln(i, 1, j) =
peln1 4673 IF (j .GT. js - 2 .AND. j .LT. je + 2)
THEN 4674 IF (ifirst .LT. is - 1)
THEN 4679 IF (ilast .GT. ie + 1)
THEN 4685 pe_tl(i, 1, j) = 0.0
4692 p1d_tl(i) = p1d_tl(i) + delp_tl(i, j, k-1)
4693 p1d(i) = p1d(i) + delp(i, j, k-1)
4694 logp_tl(i) = p1d_tl(i)/p1d(i)
4695 logp(i) = log(p1d(i))
4696 pk_tl(i, j, k) = akap*logp_tl(i)*exp(akap*logp(i))
4697 pk(i, j, k) = exp(akap*logp(i))
4699 IF (j .GT. js - 2 .AND. j .LT. je + 2)
THEN 4700 IF (ifirst .LT. is - 1)
THEN 4705 IF (ilast .GT. ie + 1)
THEN 4711 pe_tl(i, k, j) = p1d_tl(i)
4712 pe(i, k, j) = p1d(i)
4714 IF (j .GE. js .AND. j .LE. je)
THEN 4716 peln_tl(i, k, j) = logp_tl(i)
4717 peln(i, k, j) = logp(i)
4725 g1d_tl(i) = g1d_tl(i) +
cp_air*(pt_tl(i, j, k)*(pk(i, j, k+1)-&
4726 & pk(i, j, k))+pt(i, j, k)*(pk_tl(i, j, k+1)-pk_tl(i, j, k)))
4727 g1d(i) = g1d(i) +
cp_air*pt(i, j, k)*(pk(i, j, k+1)-pk(i, j, k&
4729 gz_tl(i, j, k) = g1d_tl(i)
4730 gz(i, j, k) = g1d(i)
4733 IF (.NOT.cg .AND. j .GE. js .AND. j .LE. je)
THEN 4736 pkz_tl(i, j, k) = ((pk_tl(i, j, k+1)-pk_tl(i, j, k))*akap*(&
4737 & peln(i, k+1, j)-peln(i, k, j))-(pk(i, j, k+1)-pk(i, j, k))&
4738 & *akap*(peln_tl(i, k+1, j)-peln_tl(i, k, j)))/(akap*(peln(i&
4739 & , k+1, j)-peln(i, k, j)))**2
4740 pkz(i, j, k) = (pk(i, j, k+1)-pk(i, j, k))/(akap*(peln(i, k+&
4741 & 1, j)-peln(i, k, j)))
4747 SUBROUTINE geopk(ptop, pe, peln, delp, pk, gz, hs, pt, q_con, pkz, km&
4748 & , akap, cg, nested, computehalo, npx, npy, a2b_ord, bd)
4750 INTEGER,
INTENT(IN) :: km, npx, npy, a2b_ord
4751 REAL,
INTENT(IN) :: akap, ptop
4752 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
4753 REAL,
INTENT(IN) :: hs(bd%isd:bd%ied, bd%jsd:bd%jed)
4754 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(IN) :: pt&
4756 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km),
INTENT(IN) :: &
4758 LOGICAL,
INTENT(IN) :: cg, nested, computehalo
4760 REAL,
DIMENSION(bd%isd:bd%ied, bd%jsd:bd%jed, km+1),
INTENT(OUT) :: &
4762 REAL,
INTENT(OUT) :: pe(bd%is-1:bd%ie+1, km+1, bd%js-1:bd%je+1)
4764 REAL,
INTENT(OUT) :: peln(bd%is:bd%ie, km+1, bd%js:bd%je)
4765 REAL,
INTENT(OUT) :: pkz(bd%is:bd%ie, bd%js:bd%je, km)
4769 REAL :: peg(bd%isd:bd%ied, km+1)
4770 REAL :: pkg(bd%isd:bd%ied, km+1)
4771 REAL(kind=8) :: p1d(bd%isd:bd%ied)
4772 REAL(kind=8) :: g1d(bd%isd:bd%ied)
4773 REAL :: logp(bd%isd:bd%ied)
4775 INTEGER :: ifirst, ilast
4776 INTEGER :: jfirst, jlast
4777 INTEGER :: is, ie, js, je
4778 INTEGER :: isd, ied, jsd, jed
4795 IF ((.NOT.cg .AND. a2b_ord .EQ. 4) .OR. (nested .AND. (.NOT.cg))) &
4808 IF (nested .AND. computehalo)
THEN 4809 IF (is .EQ. 1) ifirst = isd
4810 IF (ie .EQ. npx - 1) ilast = ied
4811 IF (js .EQ. 1) jfirst = jsd
4812 IF (je .EQ. npy - 1) jlast = jed
4822 gz(i, j, km+1) = hs(i, j)
4824 IF (j .GE. js .AND. j .LE. je)
THEN 4826 peln(i, 1, j) =
peln1 4829 IF (j .GT. js - 2 .AND. j .LT. je + 2)
THEN 4830 IF (ifirst .LT. is - 1)
THEN 4835 IF (ilast .GT. ie + 1)
THEN 4847 p1d(i) = p1d(i) + delp(i, j, k-1)
4848 logp(i) = log(p1d(i))
4849 pk(i, j, k) = exp(akap*logp(i))
4851 IF (j .GT. js - 2 .AND. j .LT. je + 2)
THEN 4852 IF (ifirst .LT. is - 1)
THEN 4857 IF (ilast .GT. ie + 1)
THEN 4863 pe(i, k, j) = p1d(i)
4865 IF (j .GE. js .AND. j .LE. je)
THEN 4867 peln(i, k, j) = logp(i)
4875 g1d(i) = g1d(i) +
cp_air*pt(i, j, k)*(pk(i, j, k+1)-pk(i, j, k&
4877 gz(i, j, k) = g1d(i)
4880 IF (.NOT.cg .AND. j .GE. js .AND. j .LE. je)
THEN 4883 pkz(i, j, k) = (pk(i, j, k+1)-pk(i, j, k))/(akap*(peln(i, k+&
4884 & 1, j)-peln(i, k, j)))
4889 END SUBROUTINE geopk 4893 SUBROUTINE del2_cubed_tlm(q, q_tl, cd, gridstruct, domain, npx, npy, &
4899 INTEGER,
INTENT(IN) :: npx, npy, km, nmax
4901 REAL(kind=r_grid),
INTENT(IN) :: cd
4902 TYPE(FV_GRID_BOUNDS_TYPE),
INTENT(IN) :: bd
4903 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed, km)
4904 REAL,
INTENT(INOUT) :: q_tl(bd%isd:bd%ied, bd%jsd:bd%jed, km)
4905 TYPE(FV_GRID_TYPE),
INTENT(IN),
TARGET :: gridstruct
4906 TYPE(DOMAIN2D),
INTENT(INOUT) :: domain
4907 REAL,
PARAMETER :: r3=1./3.
4908 REAL :: fx(bd%isd:bd%ied+1, bd%jsd:bd%jed), fy(bd%isd:bd%ied, bd%jsd&
4910 REAL :: fx_tl(bd%isd:bd%ied+1, bd%jsd:bd%jed), fy_tl(bd%isd:bd%ied, &
4912 REAL :: q2(bd%isd:bd%ied, bd%jsd:bd%jed)
4913 INTEGER :: i, j, k, n, nt, ntimes
4914 INTEGER :: is, ie, js, je
4915 INTEGER :: isd, ied, jsd, jed
4929 IF (3 .GT. nmax)
THEN 4946 IF (gridstruct%sw_corner)
THEN 4947 q_tl(1, 1, k) = r3*(q_tl(1, 1, k)+q_tl(0, 1, k)+q_tl(1, 0, k))
4948 q(1, 1, k) = (q(1, 1, k)+q(0, 1, k)+q(1, 0, k))*r3
4949 q_tl(0, 1, k) = q_tl(1, 1, k)
4950 q(0, 1, k) = q(1, 1, k)
4951 q_tl(1, 0, k) = q_tl(1, 1, k)
4952 q(1, 0, k) = q(1, 1, k)
4954 IF (gridstruct%se_corner)
THEN 4955 q_tl(ie, 1, k) = r3*(q_tl(ie, 1, k)+q_tl(npx, 1, k)+q_tl(ie, 0&
4957 q(ie, 1, k) = (q(ie, 1, k)+q(npx, 1, k)+q(ie, 0, k))*r3
4958 q_tl(npx, 1, k) = q_tl(ie, 1, k)
4959 q(npx, 1, k) = q(ie, 1, k)
4960 q_tl(ie, 0, k) = q_tl(ie, 1, k)
4961 q(ie, 0, k) = q(ie, 1, k)
4963 IF (gridstruct%ne_corner)
THEN 4964 q_tl(ie, je, k) = r3*(q_tl(ie, je, k)+q_tl(npx, je, k)+q_tl(ie&
4966 q(ie, je, k) = (q(ie, je, k)+q(npx, je, k)+q(ie, npy, k))*r3
4967 q_tl(npx, je, k) = q_tl(ie, je, k)
4968 q(npx, je, k) = q(ie, je, k)
4969 q_tl(ie, npy, k) = q_tl(ie, je, k)
4970 q(ie, npy, k) = q(ie, je, k)
4972 IF (gridstruct%nw_corner)
THEN 4973 q_tl(1, je, k) = r3*(q_tl(1, je, k)+q_tl(0, je, k)+q_tl(1, npy&
4975 q(1, je, k) = (q(1, je, k)+q(0, je, k)+q(1, npy, k))*r3
4976 q_tl(0, je, k) = q_tl(1, je, k)
4977 q(0, je, k) = q(1, je, k)
4978 q_tl(1, npy, k) = q_tl(1, je, k)
4979 q(1, npy, k) = q(1, je, k)
4982 & q_tl(isd:ied, jsd:jed, k), npx, &
4983 & npy, 1, gridstruct%nested, bd, &
4984 & gridstruct%sw_corner, gridstruct%&
4985 & se_corner, gridstruct%nw_corner, &
4986 & gridstruct%ne_corner)
4989 fx_tl(i, j) = gridstruct%del6_v(i, j)*(q_tl(i-1, j, k)-q_tl(&
4991 fx(i, j) = gridstruct%del6_v(i, j)*(q(i-1, j, k)-q(i, j, k))
4995 & q_tl(isd:ied, jsd:jed, k), npx, &
4996 & npy, 2, gridstruct%nested, bd, &
4997 & gridstruct%sw_corner, gridstruct%&
4998 & se_corner, gridstruct%nw_corner, &
4999 & gridstruct%ne_corner)
5002 fy_tl(i, j) = gridstruct%del6_u(i, j)*(q_tl(i, j-1, k)-q_tl(&
5004 fy(i, j) = gridstruct%del6_u(i, j)*(q(i, j-1, k)-q(i, j, k))
5009 q_tl(i, j, k) = q_tl(i, j, k) + cd*gridstruct%rarea(i, j)*(&
5010 & fx_tl(i, j)-fx_tl(i+1, j)+fy_tl(i, j)-fy_tl(i, j+1))
5011 q(i, j, k) = q(i, j, k) + cd*gridstruct%rarea(i, j)*(fx(i, j&
5012 & )-fx(i+1, j)+fy(i, j)-fy(i, j+1))
5018 SUBROUTINE del2_cubed(q, cd, gridstruct, domain, npx, npy, km, nmax, &
5024 INTEGER,
INTENT(IN) :: npx, npy, km, nmax
5026 REAL(kind=r_grid),
INTENT(IN) :: cd
5028 REAL,
INTENT(INOUT) :: q(bd%isd:bd%ied, bd%jsd:bd%jed, km)
5030 TYPE(
domain2d),
INTENT(INOUT) :: domain
5031 REAL,
PARAMETER :: r3=1./3.
5032 REAL :: fx(bd%isd:bd%ied+1, bd%jsd:bd%jed), fy(bd%isd:bd%ied, bd%jsd&
5034 REAL :: q2(bd%isd:bd%ied, bd%jsd:bd%jed)
5035 INTEGER :: i, j, k, n, nt, ntimes
5036 INTEGER :: is, ie, js, je
5037 INTEGER :: isd, ied, jsd, jed
5051 IF (3 .GT. nmax)
THEN 5066 IF (gridstruct%sw_corner)
THEN 5067 q(1, 1, k) = (q(1, 1, k)+q(0, 1, k)+q(1, 0, k))*r3
5068 q(0, 1, k) = q(1, 1, k)
5069 q(1, 0, k) = q(1, 1, k)
5071 IF (gridstruct%se_corner)
THEN 5072 q(ie, 1, k) = (q(ie, 1, k)+q(npx, 1, k)+q(ie, 0, k))*r3
5073 q(npx, 1, k) = q(ie, 1, k)
5074 q(ie, 0, k) = q(ie, 1, k)
5076 IF (gridstruct%ne_corner)
THEN 5077 q(ie, je, k) = (q(ie, je, k)+q(npx, je, k)+q(ie, npy, k))*r3
5078 q(npx, je, k) = q(ie, je, k)
5079 q(ie, npy, k) = q(ie, je, k)
5081 IF (gridstruct%nw_corner)
THEN 5082 q(1, je, k) = (q(1, je, k)+q(0, je, k)+q(1, npy, k))*r3
5083 q(0, je, k) = q(1, je, k)
5084 q(1, npy, k) = q(1, je, k)
5086 IF (nt .GT. 0)
CALL copy_corners(q(isd:ied, jsd:jed, k), npx, &
5087 & npy, 1, gridstruct%nested, bd, &
5088 & gridstruct%sw_corner, gridstruct%&
5089 & se_corner, gridstruct%nw_corner, &
5090 & gridstruct%ne_corner)
5093 fx(i, j) = gridstruct%del6_v(i, j)*(q(i-1, j, k)-q(i, j, k))
5096 IF (nt .GT. 0)
CALL copy_corners(q(isd:ied, jsd:jed, k), npx, &
5097 & npy, 2, gridstruct%nested, bd, &
5098 & gridstruct%sw_corner, gridstruct%&
5099 & se_corner, gridstruct%nw_corner, &
5100 & gridstruct%ne_corner)
5103 fy(i, j) = gridstruct%del6_u(i, j)*(q(i, j-1, k)-q(i, j, k))
5108 q(i, j, k) = q(i, j, k) + cd*gridstruct%rarea(i, j)*(fx(i, j&
5109 & )-fx(i+1, j)+fy(i, j)-fy(i, j+1))
5115 SUBROUTINE init_ijk_mem(i1, i2, j1, j2, km, array, var)
5117 INTEGER,
INTENT(IN) :: i1, i2, j1, j2, km
5118 REAL,
INTENT(INOUT) :: array(i1:i2, j1:j2, km)
5119 REAL,
INTENT(IN) :: var
5125 array(i, j, k) = var
5130 SUBROUTINE rayleigh_fast(dt, npx, npy, npz, pfull, tau, u, v, w, ptop&
5131 & , hydrostatic, rf_cutoff, bd)
5134 REAL,
INTENT(IN) :: dt
5136 REAL,
INTENT(IN) :: tau
5137 REAL,
INTENT(IN) :: ptop, rf_cutoff
5138 INTEGER,
INTENT(IN) :: npx, npy, npz
5139 REAL,
DIMENSION(npz),
INTENT(IN) :: pfull
5140 LOGICAL,
INTENT(IN) :: hydrostatic
5143 REAL,
INTENT(INOUT) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1, npz)
5145 REAL,
INTENT(INOUT) :: v(bd%isd:bd%ied+1, bd%jsd:bd%jed, npz)
5147 REAL,
INTENT(INOUT) :: w(bd%isd:, bd%jsd:, :)
5149 REAL(kind=r_grid) :: rff(npz)
5150 REAL,
PARAMETER :: sday=86400.
5153 INTEGER :: is, ie, js, je
5154 INTEGER :: isd, ied, jsd, jed
5171 IF (is_master())
WRITE(6, *) &
5172 &
'Fast Rayleigh friction E-folding time (days):' 5174 IF (pfull(k) .LT. rf_cutoff)
THEN 5175 arg1 = 0.5*
pi*log(rf_cutoff/pfull(k))/log(rf_cutoff/ptop)
5176 rff(k) = dt/tau0*sin(arg1)**2
5180 rff(k) = 1.d0/(1.0d0+rff(k))
5190 IF (pfull(k) .LT. rf_cutoff)
THEN 5193 u(i, j, k) = rf(k)*u(i, j, k)
5198 v(i, j, k) = rf(k)*v(i, j, k)
5201 IF (.NOT.hydrostatic)
THEN 5204 w(i, j, k) = rf(k)*w(i, j, k)
5213 subroutine grad1_p_update_tlm(divg2, divg2_tl, u, u_tl, v, v_tl, pk, pk_tl, gz, gz_tl, du, du_tl, dv, dv_tl, dt, ng, gridstruct, bd, npx, npy, npz, ptop, beta, a2b_ord)
real, parameter, public radius
Radius of the Earth [m].
subroutine pe_halo_tlm(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pe, pe_tl, delp, delp_tl)
subroutine, public nested_grid_bc_apply_intt(var_nest, istag, jstag, npx, npy, npz, bd, step, split, bc, bctype)
subroutine, public case9_forcing1(phis, time_since_start)
subroutine p_grad_c(dt2, npz, delpc, pkc, gz, uc, vc, bd, rdxc, rdyc, hydrostatic)
integer, parameter, public corner
subroutine, public case9_forcing2(phis)
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, flagstructp, neststruct, idiag, bd, domain, init_step, i_pack, end_step, gz, pkc, ptc, crx, xfx, cry, yfx, divgd, delpc, ut, vt, zh, pk3, du, dv, time_total)
subroutine, public a2b_ord4(qin, qout, gridstruct, npx, npy, is, ie, js, je, ng, replace)
subroutine pk3_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, akap, pk3, delp)
subroutine pe_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pe, delp)
subroutine, public del2_cubed(q, cd, gridstruct, domain, npx, npy, km, nmax, bd)
real, parameter, public rdgas
Gas constant for dry air [J/kg/deg].
subroutine, public del2_cubed_tlm(q, q_tl, cd, gridstruct, domain, npx, npy, km, nmax, bd)
void a2b_ord2(int nx, int ny, const double *qin, const double *edge_w, const double *edge_e, const double *edge_s, const double *edge_n, double *qout, int on_west_edge, int on_east_edge, int on_south_edge, int on_north_edge)
subroutine, public complete_group_halo_update(group, group_tl, domain)
subroutine, public d_sw(delpc, delp, ptc, pt, u, v, w, uc, vc, ua, va, divg_d, xflux, yflux, cx, cy, crx_adv, cry_adv, xfx_adv, yfx_adv, q_con, z_rat, kgb, heat_source, dpx, zvir, sphum, nq, q, k, km, inline_q, dt, hord_tr, hord_mt, hord_vt, hord_tm, hord_dp, nord, nord_v, nord_w, nord_t, dddmp, d2_bg, d4_bg, damp_v, damp_w, damp_t, d_con, hydrostatic, gridstruct, flagstruct, bd, hord_tr_pert, hord_mt_pert, hord_vt_pert, hord_tm_pert, hord_dp_pert, split_damp, nord_pert, nord_v_pert, nord_w_pert, nord_t_pert, dddmp_pert, d2_bg_pert, d4_bg_pert, damp_v_pert, damp_w_pert, damp_t_pert)
l_size ! loop over number of fields ke do je do ie to je n if(.NOT. d_comm%R_do_buf(list)) cycle from_pe
subroutine split_p_grad_tlm(u, u_tl, v, v_tl, pp, pp_tl, gz, gz_tl, du, du_tl, dv, dv_tl, delp, delp_tl, pk, pk_tl, beta, dt, ng, gridstruct, bd, npx, npy, npz, use_logp)
subroutine grad1_p_update(divg2, u, v, pk, gz, du, dv, dt, ng, gridstruct, bd, npx, npy, npz, ptop, beta, a2b_ord)
subroutine, public breed_slp_inline(nstep, dt, npz, ak, bk, phis, pe, pk, peln, pkz, delp, u, v, pt, q, nwat, zvir, gridstruct, ks, domain_local, bd, hydrostatic)
subroutine rayleigh_fast(dt, npx, npy, npz, pfull, tau, u, v, w, ptop, hydrostatic, rf_cutoff, bd)
subroutine geopk(ptop, pe, peln, delp, pk, gz, hs, pt, q_con, pkz, km, akap, cg, nested, computehalo, npx, npy, a2b_ord, bd)
real, parameter, public pi
Ratio of circle circumference to diameter [N/A].
subroutine one_grad_p(u, v, pk, gz, divg2, delp, dt, ng, gridstruct, bd, npx, npy, npz, ptop, hydrostatic, a2b_ord, d_ext)
subroutine one_grad_p_tlm(u, u_tl, v, v_tl, pk, pk_tl, gz, gz_tl, divg2, divg2_tl, delp, delp_tl, dt, ng, gridstruct, bd, npx, npy, npz, ptop, hydrostatic, a2b_ord, d_ext)
subroutine pln_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pk3, delp)
subroutine, public dyn_core_tlm(npx, npy, npz, ng, sphum, nq, bdt, n_split, zvir, cp, akap, cappa, grav, hydrostatic, u, u_tl, v, v_tl, w, w_tl, delz, delz_tl, pt, pt_tl, q, q_tl, delp, delp_tl, pe, pe_tl, pk, pk_tl, phis, ws, ws_tl, omga, omga_tl, ptop, pfull, ua, ua_tl, va, va_tl, uc, uc_tl, vc, vc_tl, mfx, mfx_tl, mfy, mfy_tl, cx, cx_tl, cy, cy_tl, pkz, pkz_tl, peln, peln_tl, q_con, ak, bk, dpx, dpx_tl, ks, gridstruct, flagstruct, flagstructp, neststruct, idiag, bd, domain, init_step, i_pack, end_step, gz, gz_tl, pkc, pkc_tl, ptc, ptc_tl, crx, crx_tl, xfx, xfx_tl, cry, cry_tl, yfx, yfx_tl, divgd, divgd_tl, delpc, delpc_tl, ut, ut_tl, vt, vt_tl, zh, zh_tl, pk3, pk3_tl, du, du_tl, dv, dv_tl, time_total)
real(kind=r_grid), parameter cnst_0p20
subroutine, public riem_solver3(ms, dt, is, ie, js, je, km, ng, isd, ied, jsd, jed, akap, cappa, cp, ptop, zs, q_con, w, delz, pt, delp, zh, pe, ppe, pk3, pk, peln, ws, scale_m, p_fac, a_imp, use_logp, last_call, fp_out)
subroutine p_grad_c_tlm(dt2, npz, delpc, delpc_tl, pkc, pkc_tl, gz, gz_tl, uc, uc_tl, vc, vc_tl, bd, rdxc, rdyc, hydrostatic)
subroutine split_p_grad(u, v, pp, gz, du, dv, delp, pk, beta, dt, ng, gridstruct, bd, npx, npy, npz, use_logp)
subroutine timing_on(blk_name)
subroutine, public c_sw_tlm(delpc, delpc_tl, delp, delp_tl, ptc, ptc_tl, pt, pt_tl, u, u_tl, v, v_tl, w, w_tl, uc, uc_tl, vc, vc_tl, ua, ua_tl, va, va_tl, wc, wc_tl, ut, ut_tl, vt, vt_tl, divg_d, divg_d_tl, nord, dt2, hydrostatic, dord4, bd, gridstruct, flagstruct)
real, parameter, public cp_air
Specific heat capacity of dry air at constant pressure [J/kg/deg].
subroutine pln_halo_tlm(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pk3, pk3_tl, delp, delp_tl)
subroutine, public copy_corners(q, npx, npy, dir, nested, bd, sw_corner, se_corner, nw_corner, ne_corner)
integer, parameter, public r_grid
logical, public do_adiabatic_init
subroutine pk3_halo_tlm(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, akap, pk3, pk3_tl, delp, delp_tl)
subroutine, public init_ijk_mem(i1, i2, j1, j2, km, array, var)
subroutine nh_p_grad(u, v, pp, gz, delp, pk, dt, ng, gridstruct, bd, npx, npy, npz, use_logp)
subroutine mix_dp_tlm(hydrostatic, w, w_tl, delp, delp_tl, pt, pt_tl, km, ak, bk, cg, fv_debug, bd)
subroutine, public a2b_ord4_tlm(qin, qin_tl, qout, qout_tl, gridstruct, npx, npy, is, ie, js, je, ng, replace)
subroutine, public nested_grid_bc_apply_intt_tlm(var_nest, var_nest_tl, istag, jstag, npx, npy, npz, bd, step, split, bc, bctype)
subroutine nh_p_grad_tlm(u, u_tl, v, v_tl, pp, pp_tl, gz, gz_tl, delp, delp_tl, pk, pk_tl, dt, ng, gridstruct, bd, npx, npy, npz, use_logp)
subroutine, public extrapolation_bc(q, istag, jstag, npx, npy, bd, pd_in, debug_in)
subroutine update_dwinds_phys(is, ie, js, je, isd, ied, jsd, jed, dt, u_dt, v_dt, u, v, gridstruct, npx, npy, npz, domain)
subroutine, public prt_mxm(qname, q, is, ie, js, je, n_g, km, fac, area, domain)
subroutine adv_pe(ua, va, pem, om, gridstruct, bd, npx, npy, npz, ng)
subroutine, public prt_maxmin(qname, q, is, ie, js, je, n_g, km, fac)
integer, public test_case
subroutine adv_pe_tlm(ua, ua_tl, va, va_tl, pem, pem_tl, om, om_tl, gridstruct, bd, npx, npy, npz, ng)
subroutine, public riem_solver3_tlm(ms, dt, is, ie, js, je, km, ng, isd, ied, jsd, jed, akap, cappa, cp, ptop, zs, q_con, w, w_tl, delz, delz_tl, pt, pt_tl, delp, delp_tl, zh, zh_tl, pe, pe_tl, ppe, ppe_tl, pk3, pk3_tl, pk, pk_tl, peln, peln_tl, ws, ws_tl, scale_m, p_fac, a_imp, use_logp, last_call, fp_out)
subroutine, public c_sw(delpc, delp, ptc, pt, u, v, w, uc, vc, ua, va, wc, ut, vt, divg_d, nord, dt2, hydrostatic, dord4, bd, gridstruct, flagstruct)
subroutine, public d_sw_tlm(delpc, delpc_tl, delp, delp_tl, ptc, ptc_tl, pt, pt_tl, u, u_tl, v, v_tl, w, w_tl, uc, uc_tl, vc, vc_tl, ua, ua_tl, va, va_tl, divg_d, divg_d_tl, xflux, xflux_tl, yflux, yflux_tl, cx, cx_tl, cy, cy_tl, crx_adv, crx_adv_tl, cry_adv, cry_adv_tl, xfx_adv, xfx_adv_tl, yfx_adv, yfx_adv_tl, q_con, z_rat, z_rat_tl, kgb, heat_source, heat_source_tl, dpx, dpx_tl, zvir, sphum, nq, q, q_tl, k, km, inline_q, dt, hord_tr, hord_mt, hord_vt, hord_tm, hord_dp, nord, nord_v, nord_w, nord_t, dddmp, d2_bg, d4_bg, damp_v, damp_w, damp_t, d_con, hydrostatic, gridstruct, flagstruct, bd, hord_tr_pert, hord_mt_pert, hord_vt_pert, hord_tm_pert, hord_dp_pert, split_damp, nord_pert, nord_v_pert, nord_w_pert, nord_t_pert, dddmp_pert, d2_bg_pert, d4_bg_pert, damp_v_pert, damp_w_pert, damp_t_pert)
subroutine, public copy_corners_tlm(q, q_tl, npx, npy, dir, nested, bd, sw_corner, se_corner, nw_corner, ne_corner)
subroutine mix_dp(hydrostatic, w, delp, pt, km, ak, bk, cg, fv_debug, bd)
type(time_type), public fv_time
subroutine geopk_tlm(ptop, pe, pe_tl, peln, peln_tl, delp, delp_tl, pk, pk_tl, gz, gz_tl, hs, pt, pt_tl, q_con, pkz, pkz_tl, km, akap, cg, nested, computehalo, npx, npy, a2b_ord, bd)
subroutine, public a2b_ord2_tlm(qin, qin_tl, qout, qout_tl, gridstruct, npx, npy, is, ie, js, je, ng, replace)
subroutine timing_off(blk_name)