107 use constants_mod
, only: rdgas, radius, cp_air, pi
108 use mpp_mod
, only: mpp_pe
109 use mpp_domains_mod
, only: cgrid_ne, dgrid_ne, mpp_get_boundary, mpp_update_domains, &
111 use mpp_parameter_mod
, only: corner
113 use fv_mp_mod, only: start_group_halo_update, complete_group_halo_update
114 use fv_mp_mod, only: group_halo_update_type
124 #if defined (ADA_NUDGE) 125 use fv_ada_nudge_mod
, only: breed_slp_inline_ada
129 use diag_manager_mod
, only: send_data
154 real,
allocatable,
dimension(:,:,:) ::
ut,
vt,
crx,
cry,
xfx,
yfx,
divgd, &
160 real,
allocatable ::
rf(:)
172 subroutine dyn_core(npx, npy, npz, ng, sphum, nq, bdt, n_map, n_split, zvir, cp, akap, cappa, &
177 u, v, w, delz, pt, q, delp, pe, pk, phis, ws, omga, ptop, pfull, ua, va, &
178 uc, vc, mfx, mfy, cx, cy, pkz, peln, q_con, ak, bk, &
179 ks, gridstruct, flagstruct, neststruct, idiag, bd, domain, &
180 init_step, i_pack, end_step, diss_est,time_total)
182 integer,
intent(IN) :: npx
183 integer,
intent(IN) :: npy
184 integer,
intent(IN) :: npz
185 integer,
intent(IN) :: ng, nq, sphum
186 integer,
intent(IN) :: n_map, n_split
187 real ,
intent(IN) :: bdt
188 real ,
intent(IN) :: zvir, cp, akap, grav
189 real ,
intent(IN) :: ptop
190 logical,
intent(IN) :: hydrostatic
191 logical,
intent(IN) :: init_step, end_step
192 real,
intent(in) :: pfull(npz)
193 real,
intent(in),
dimension(npz+1) :: ak, bk
194 integer,
intent(IN) :: ks
195 type(group_halo_update_type),
intent(inout) :: i_pack(*)
197 real,
intent(inout),
dimension(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz):: u
198 real,
intent(inout),
dimension(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz):: v
199 real,
intent(inout) :: w( bd%isd:,bd%jsd:,1:)
200 real,
intent(inout) :: delz(bd%is:,bd%js:,1:)
201 real,
intent(inout) :: cappa(bd%isd:,bd%jsd:,1:)
203 real,
intent(inout) :: kapad(bd%isd:bd%ied,bd%jsd:bd%jed,1:npz)
205 real,
intent(inout) :: pt( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
206 real,
intent(inout) :: delp(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
207 real,
intent(inout) :: q( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz, nq)
208 real,
intent(in),
optional:: time_total
209 real,
intent(inout) :: diss_est(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
216 real,
intent(inout):: phis(bd%isd:bd%ied,bd%jsd:bd%jed)
217 real,
intent(inout):: pe(bd%is-1:bd%ie+1, npz+1,bd%js-1:bd%je+1)
218 real,
intent(inout):: peln(bd%is:bd%ie,npz+1,bd%js:bd%je)
219 real,
intent(inout):: pk(bd%is:bd%ie,bd%js:bd%je, npz+1)
223 real,
parameter:: near0 = 1.e-8
225 real,
parameter:: huge_r = 1.e8
227 real,
parameter:: huge_r = 1.e40
230 real,
intent(out ):: ws(bd%is:bd%ie,bd%js:bd%je)
231 real,
intent(inout):: omga(bd%isd:bd%ied,bd%jsd:bd%jed,npz)
232 real,
intent(inout):: uc(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz)
233 real,
intent(inout):: vc(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
234 real,
intent(inout),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: ua, va
235 real,
intent(inout):: q_con(bd%isd:, bd%jsd:, 1:)
238 real,
intent(inout):: mfx(bd%is:bd%ie+1, bd%js:bd%je, npz)
239 real,
intent(inout):: mfy(bd%is:bd%ie , bd%js:bd%je+1, npz)
241 real,
intent(inout):: cx(bd%is:bd%ie+1, bd%jsd:bd%jed, npz)
242 real,
intent(inout):: cy(bd%isd:bd%ied ,bd%js:bd%je+1, npz)
243 real,
intent(inout),
dimension(bd%is:bd%ie,bd%js:bd%je,npz):: pkz
249 type(domain2d),
intent(INOUT) :: domain
251 real,
allocatable,
dimension(:,:,:):: pem, heat_source
253 real,
dimension(bd%isd:bd%ied,bd%jsd:bd%jed):: ws3, z_rat
255 real:: zs(bd%isd:bd%ied,bd%jsd:bd%jed)
256 real:: p1d(bd%is:bd%ie)
257 real:: om2d(bd%is:bd%ie,npz)
258 real wbuffer(npy+2,npz)
259 real ebuffer(npy+2,npz)
260 real nbuffer(npx+2,npz)
261 real sbuffer(npx+2,npz)
263 real divg2(bd%is:bd%ie+1,bd%js:bd%je+1)
264 real wk(bd%isd:bd%ied,bd%jsd:bd%jed)
265 real fz(bd%is: bd%ie+1,bd%js: bd%je+1)
266 real heat_s(bd%is:bd%ie,bd%js:bd%je)
268 real diss_e(bd%is:bd%ie,bd%js:bd%je)
270 integer nord_v(npz+1)
272 integer :: hord_m, hord_v, hord_t, hord_p
273 integer :: nord_k, nord_w, nord_t
276 integer :: i,j,k, it, iq, n_con, nf_ke
277 integer :: iep1, jep1
278 real :: beta, beta_d, d_con_k, damp_w, damp_t, kgb, cv_air
281 real :: k1k, rdg, dtmp, delt
282 real :: recip_k_split_n_split
283 real :: reg_bc_update_time
284 logical :: last_step, remap_step
286 real :: split_timestep_bc
288 integer :: is, ie, js, je
289 integer :: isd, ied, jsd, jed
306 dt = bdt /
real(n_split)
309 ms = max(1, flagstruct%m_split/2)
310 beta = flagstruct%beta
312 cv_air = cp_air - rdgas
313 recip_k_split_n_split=1./
real(flagstruct%k_split*n_split)
319 if ( .not.hydrostatic )
then 322 k1k = akap / (1.-akap)
326 dp_ref(k) = ak(k+1)-ak(k) + (bk(k+1)-bk(k))*1.e5
332 zs(i,j) = phis(i,j) *
rgrav 338 if ( init_step )
then 340 allocate(
gz(isd:ied, jsd:jed ,npz+1) )
342 allocate(
pkc(isd:ied, jsd:jed ,npz+1) )
343 allocate(
ptc(isd:ied, jsd:jed ,npz ) )
344 allocate(
crx(is :ie+1, jsd:jed, npz) )
345 allocate(
xfx(is :ie+1, jsd:jed, npz) )
346 allocate(
cry(isd:ied, js :je+1, npz) )
347 allocate(
yfx(isd:ied, js :je+1, npz) )
348 allocate(
divgd(isd:ied+1,jsd:jed+1,npz) )
349 allocate(
delpc(isd:ied, jsd:jed ,npz ) )
351 allocate(
ut(isd:ied, jsd:jed, npz) )
353 allocate(
vt(isd:ied, jsd:jed, npz) )
356 if ( .not. hydrostatic )
then 357 allocate(
zh(isd:ied, jsd:jed, npz+1) )
359 allocate (
pk3(isd:ied,jsd:jed,npz+1) )
362 if ( beta > near0 )
then 363 allocate(
du(isd:ied, jsd:jed+1,npz) )
365 allocate(
dv(isd:ied+1,jsd:jed, npz) )
384 if ( flagstruct%d_con > 1.0e-5 )
then 385 allocate( heat_source(isd:ied, jsd:jed, npz) )
386 call init_ijk_mem(isd, ied, jsd, jed, npz, heat_source, 0.)
389 if ( flagstruct%convert_ke .or. flagstruct%vtdm4> 1.e-4 )
then 392 if ( flagstruct%d2_bg_k1 < 1.e-3 )
then 395 if ( flagstruct%d2_bg_k2 < 1.e-3 )
then 408 call start_group_halo_update(i_pack(8), u, v, domain, gridtype=dgrid_ne)
410 if ( flagstruct%breed_vortex_inline .or. it==n_split )
then 416 if ( flagstruct%fv_debug )
then 417 if(is_master())
write(*,*)
'n_split loop, it=', it
418 if ( .not. flagstruct%hydrostatic ) &
419 call prt_mxm(
'delz', delz, is, ie, js, je, 0, npz, 1., gridstruct%area_64, domain)
422 if (gridstruct%nested)
then 425 split_timestep_bc =
real(n_split*flagstruct%k_split+neststruct%nest_timestep)
431 if ( flagstruct%inline_q )
then 432 call start_group_halo_update(i_pack(10), q, domain)
438 if ( .not. hydrostatic )
then 440 call start_group_halo_update(i_pack(7), w, domain)
444 if (gridstruct%bounded_domain)
then 448 gz(i,j,npz+1) = zs(i,j)
451 if (gridstruct%nested)
then 452 call gz_bc(
gz,neststruct%delz_BC,bd,npx,npy,npz,split_timestep_bc,
real(n_split*flagstruct%k_split))
454 if (gridstruct%regional)
then 455 reg_bc_update_time=current_time_in_seconds+bdt*(n_map-1)+(it-1)*dt
456 if (is_master() .and. flagstruct%fv_debug) print*,
' REG_BC_UPDATE_TIME: ', it, current_time_in_seconds+bdt*(n_map-1)+(it-1)*dt
457 call gz_bc(
gz, delz_regbc,bd,npx,npy,npz,mod(reg_bc_update_time,bc_time_interval*3600.), bc_time_interval*3600.)
463 gz(i,j,npz+1) = zs(i,j)
472 gz(i,j,k) =
gz(i,j,k+1) - delz(i,j,k)
477 call start_group_halo_update(i_pack(5),
gz, domain)
493 call complete_group_halo_update(i_pack(1), domain)
500 if ( it==n_split .and. end_step )
then 501 if ( flagstruct%use_old_omega )
then 502 allocate ( pem(is-1:ie+1,npz+1,js-1:je+1) )
510 pem(i,k+1,j) = pem(i,k,j) + delp(i,j,k)
521 call complete_group_halo_update(i_pack(8), domain)
522 if( .not. hydrostatic ) &
523 call complete_group_halo_update(i_pack(7), domain)
531 call c_sw(
delpc(isd,jsd,k), delp(isd,jsd,k),
ptc(isd,jsd,k), &
532 pt(isd,jsd,k), u(isd,jsd,k), v(isd,jsd,k), &
533 w(isd:,jsd:,k), uc(isd,jsd,k), vc(isd,jsd,k), &
534 ua(isd,jsd,k), va(isd,jsd,k), omga(isd,jsd,k), &
535 ut(isd,jsd,k),
vt(isd,jsd,k),
divgd(isd,jsd,k), &
536 flagstruct%nord, dt2, hydrostatic, .true., bd, &
537 gridstruct, flagstruct)
540 if ( flagstruct%nord > 0 )
then 542 call start_group_halo_update(i_pack(3),
divgd, domain, position=corner)
546 if (gridstruct%nested)
then 548 0, 0, npx, npy, npz, bd, split_timestep_bc+0.5,
real(n_split*flagstruct%k_split), &
549 neststruct%delp_BC, bctype=neststruct%nestbctype)
552 0, 0, npx, npy, npz, bd, split_timestep_bc+0.5,
real(n_split*flagstruct%k_split), &
553 neststruct%pt_BC, bctype=neststruct%nestbctype )
557 if (flagstruct%regional)
then 559 reg_bc_update_time=current_time_in_seconds+bdt*(n_map-1)+(0.5+(it-1))*dt
560 call regional_boundary_update(
delpc,
'delp', &
561 isd, ied, jsd, jed, npz, &
563 isd, ied, jsd, jed, &
565 call mpp_update_domains(
delpc, domain, complete=.true.)
567 call regional_boundary_update(
ptc,
'pt', &
568 isd, ied, jsd, jed, npz, &
570 isd, ied, jsd, jed, &
572 call mpp_update_domains(
ptc, domain, complete=.true.)
577 if ( hydrostatic )
then 582 q_con, pkz, npz, akap, .true., &
583 gridstruct%bounded_domain, .false., npx, npy, flagstruct%a2b_ord, bd)
589 call complete_group_halo_update(i_pack(5), domain)
597 zh(i,j,k) =
gz(i,j,k)
604 if (gridstruct%bounded_domain)
then 605 if (gridstruct%nested)
then 606 call gz_bc(
gz,neststruct%delz_BC,bd,npx,npy,npz,split_timestep_bc,
real(n_split*flagstruct%k_split))
608 if (gridstruct%regional)
then 609 reg_bc_update_time=current_time_in_seconds+bdt*(n_map-1)+(it-1)*dt
610 if (is_master() .and. flagstruct%fv_debug) print*,
' REG_BC_UPDATE_TIME: ', it, current_time_in_seconds+bdt*(n_map-1)+(it-1)*dt
611 call gz_bc(
gz, delz_regbc,bd,npx,npy,npz,mod(reg_bc_update_time,bc_time_interval*3600.), bc_time_interval*3600.)
619 gz(i,j,k) =
zh(i,j,k)
626 call update_dz_c(is, ie, js, je, npz, ng, dt2, dp_ref, zs, gridstruct%area,
ut,
vt,
gz, ws3, &
627 npx, npy, gridstruct%sw_corner, gridstruct%se_corner, &
628 gridstruct%ne_corner, gridstruct%nw_corner, bd, gridstruct%grid_type)
632 call riem_solver_c( ms, dt2, is, ie, js, je, npz, ng, &
637 ptop, phis, omga,
ptc, &
638 q_con,
delpc,
gz,
pkc, ws3, flagstruct%p_fac, &
639 flagstruct%a_imp, flagstruct%scale_z )
642 if (gridstruct%nested)
then 643 call nh_bc(ptop, grav, akap, cp,
delpc, neststruct%delz_BC,
ptc, phis, &
654 split_timestep_bc+0.5,
real(n_split*flagstruct%k_split), &
655 npx, npy, npz, gridstruct%bounded_domain, .false., .false., .false., bd)
658 if (flagstruct%regional)
then 660 reg_bc_update_time=current_time_in_seconds+bdt*(n_map-1)+(0.5+(it-1))*dt
661 call nh_bc(ptop, grav, akap, cp,
delpc, delz_regbc,
ptc, phis, &
672 mod(reg_bc_update_time,bc_time_interval*3600.), bc_time_interval*3600., &
673 npx, npy, npz, gridstruct%bounded_domain, .false., .false., .false., bd)
681 call p_grad_c(dt2, npz,
delpc,
pkc,
gz, uc, vc, bd, gridstruct%rdxc, gridstruct%rdyc, hydrostatic)
684 call start_group_halo_update(i_pack(9), uc, vc, domain, gridtype=cgrid_ne)
694 if (flagstruct%inline_q .and. nq>0)
call complete_group_halo_update(i_pack(10), domain)
695 if (flagstruct%nord > 0)
call complete_group_halo_update(i_pack(3), domain)
696 call complete_group_halo_update(i_pack(9), domain)
699 if (gridstruct%nested)
then 712 0, 1, npx, npy, npz, bd, split_timestep_bc+0.5,
real(n_split*flagstruct%k_split), &
713 neststruct%vc_BC, bctype=neststruct%nestbctype )
715 1, 0, npx, npy, npz, bd, split_timestep_bc+0.5,
real(n_split*flagstruct%k_split), &
716 neststruct%uc_BC, bctype=neststruct%nestbctype )
719 1, 1, npx, npy, npz, bd, split_timestep_bc,
real(n_split*flagstruct%k_split), &
720 neststruct%divg_BC, bctype=neststruct%nestbctype )
724 if (flagstruct%regional)
then 726 call mpp_update_domains(uc, vc, domain, gridtype=cgrid_ne)
727 reg_bc_update_time=current_time_in_seconds+bdt*(n_map-1)+(0.5+(it-1))*dt
728 call regional_boundary_update(vc,
'vc', &
729 isd, ied, jsd, jed+1, npz, &
731 isd, ied, jsd, jed, &
733 call regional_boundary_update(uc,
'uc', &
734 isd, ied+1, jsd, jed, npz, &
736 isd, ied, jsd, jed, &
738 call mpp_update_domains(uc, vc, domain, gridtype=cgrid_ne)
753 if ( flagstruct%inline_q )
then 754 if ( gridstruct%nested )
then 757 0, 0, npx, npy, npz, bd, split_timestep_bc+1,
real(n_split*flagstruct%k_split), &
758 neststruct%q_BC(iq), bctype=neststruct%nestbctype )
761 if (flagstruct%regional)
then 762 reg_bc_update_time=current_time_in_seconds+bdt*(n_map-1)+(it-1)*dt
764 call regional_boundary_update(q(:,:,:,iq),
'q', &
765 isd, ied, jsd, jed, npz, &
767 isd, ied, jsd, jed, &
784 hord_m = flagstruct%hord_mt
785 hord_t = flagstruct%hord_tm
786 hord_v = flagstruct%hord_vt
787 hord_p = flagstruct%hord_dp
788 nord_k = flagstruct%nord
791 kgb = flagstruct%ke_bg
796 nord_v(k) = min(2, flagstruct%nord)
798 d2_divg = min(0.20, flagstruct%d2_bg)
800 if ( flagstruct%do_vort_damp )
then 801 damp_vt(k) = flagstruct%vtdm4
810 d_con_k = flagstruct%d_con
812 if ( npz==1 .or. flagstruct%n_sponge<0 )
then 813 d2_divg = flagstruct%d2_bg
819 if (flagstruct%d2_bg_k2 > 0)
then 823 nord_k=0; d2_divg = max(0.01, flagstruct%d2_bg, flagstruct%d2_bg_k1)
825 nord_w=0; damp_w = d2_divg
826 if ( flagstruct%do_vort_damp )
then 830 damp_vt(k) = 0.5*d2_divg
834 elseif ( k==2 .and. flagstruct%d2_bg_k2>0.01 )
then 835 nord_k=0; d2_divg = max(flagstruct%d2_bg, flagstruct%d2_bg_k2)
836 nord_w=0; damp_w = d2_divg
837 if ( flagstruct%do_vort_damp )
then 840 damp_vt(k) = 0.5*d2_divg
844 elseif ( k==3 .and. flagstruct%d2_bg_k2>0.05 )
then 845 nord_k=0; d2_divg = max(flagstruct%d2_bg, 0.2*flagstruct%d2_bg_k2)
846 nord_w=0; damp_w = d2_divg
850 if ( pfull(k) < flagstruct%rf_cutoff )
then 852 d2_divg = max(flagstruct%d2_bg, flagstruct%d2_bg_k1* &
853 sin(0.5*pi*log(flagstruct%rf_cutoff/pfull(k))/log(flagstruct%rf_cutoff/ptop))**2)
854 if (
first_call .and. is_master() .and. last_step)
write(6,*) k, 0.01*pfull(k), d2_divg
856 if ( flagstruct%do_vort_damp )
then 859 damp_vt(k) = 0.5*d2_divg
866 if( hydrostatic .and. (.not.flagstruct%use_old_omega) .and. last_step )
then 870 omga(i,j,k) = delp(i,j,k)
876 if ( flagstruct%d_ext > 0. ) &
877 call a2b_ord2(delp(isd,jsd,k), wk, gridstruct, npx, npy, is, &
878 ie, js, je, ng, .false.)
880 if ( .not.hydrostatic .and. flagstruct%do_f3d )
then 884 z_rat(i,j) = 1. + (
zh(i,j,k)+
zh(i,j,k+1))/radius
889 call d_sw(
vt(isd,jsd,k), delp(isd,jsd,k),
ptc(isd,jsd,k), pt(isd,jsd,k), &
890 u(isd,jsd,k), v(isd,jsd,k), w(isd:,jsd:,k), uc(isd,jsd,k), &
891 vc(isd,jsd,k), ua(isd,jsd,k), va(isd,jsd,k),
divgd(isd,jsd,k), &
892 mfx(is, js, k), mfy(is, js, k), cx(is, jsd,k), cy(isd,js, k), &
893 crx(is, jsd,k),
cry(isd,js, k),
xfx(is, jsd,k),
yfx(isd,js, k), &
895 q_con(isd:,jsd:,k), z_rat(isd,jsd), &
897 q_con(isd:,jsd:,1), z_rat(isd,jsd), &
899 kgb, heat_s, diss_e,zvir, sphum, nq, q, k, npz, flagstruct%inline_q, dt, &
900 flagstruct%hord_tr, hord_m, hord_v, hord_t, hord_p, &
901 nord_k, nord_v(k), nord_w, nord_t, flagstruct%dddmp, d2_divg, flagstruct%d4_bg, &
902 damp_vt(k), damp_w, damp_t, d_con_k, hydrostatic, gridstruct, flagstruct, bd)
904 if( hydrostatic .and. (.not.flagstruct%use_old_omega) .and. last_step )
then 908 omga(i,j,k) = omga(i,j,k)*(
xfx(i,j,k)-
xfx(i+1,j,k)+
yfx(i,j,k)-
yfx(i,j+1,k))*gridstruct%rarea(i,j)*rdt
913 if ( flagstruct%d_ext > 0. )
then 920 if ( flagstruct%d_con > 1.0e-5 .OR. flagstruct%do_skeb )
then 925 heat_source(i,j,k) = heat_source(i,j,k) + heat_s(i,j)
926 diss_est(i,j,k) = diss_est(i,j,k) + diss_e(i,j)
932 if (flagstruct%regional)
then 933 call mpp_update_domains(uc, vc, domain, gridtype=cgrid_ne)
934 call mpp_update_domains(u , v , domain, gridtype=dgrid_ne)
938 if( flagstruct%fill_dp )
call mix_dp(hydrostatic, w, delp, pt, npz, ak, bk, .false., flagstruct%fv_debug, bd)
941 call start_group_halo_update(i_pack(1), delp, domain, complete=.false.)
942 call start_group_halo_update(i_pack(1), pt, domain, complete=.true.)
944 call start_group_halo_update(i_pack(11), q_con, domain)
948 if ( flagstruct%d_ext > 0. )
then 949 d2_divg = flagstruct%d_ext * gridstruct%da_min_c
954 divg2(i,j) = wk(i,j)*
vt(i,j,1)
958 wk(i,j) = wk(i,j) +
ptc(i,j,k)
959 divg2(i,j) = divg2(i,j) +
ptc(i,j,k)*
vt(i,j,k)
963 divg2(i,j) = d2_divg*divg2(i,j)/wk(i,j)
971 call complete_group_halo_update(i_pack(1), domain)
973 call complete_group_halo_update(i_pack(11), domain)
976 if ( flagstruct%fv_debug )
then 977 if ( .not. flagstruct%hydrostatic ) &
978 call prt_mxm(
'delz', delz, is, ie, js, je, 0, npz, 1., gridstruct%area_64, domain)
982 if (gridstruct%nested)
then 984 0, 0, npx, npy, npz, bd, split_timestep_bc+1,
real(n_split*flagstruct%k_split), &
985 neststruct%delp_BC, bctype=neststruct%nestbctype )
990 0, 0, npx, npy, npz, bd, split_timestep_bc+1,
real(n_split*flagstruct%k_split), &
991 neststruct%pt_BC, bctype=neststruct%nestbctype )
995 0, 0, npx, npy, npz, bd, split_timestep_bc+1,
real(n_split*flagstruct%k_split), &
996 neststruct%q_con_BC, bctype=neststruct%nestbctype )
1003 if (flagstruct%regional)
then 1005 reg_bc_update_time=current_time_in_seconds+bdt*(n_map-1)+(it-1)*dt
1006 call regional_boundary_update(delp,
'delp', &
1007 isd, ied, jsd, jed, npz, &
1009 isd, ied, jsd, jed, &
1010 reg_bc_update_time )
1011 call mpp_update_domains(delp, domain, complete=.true.)
1013 call regional_boundary_update(pt,
'pt', &
1014 isd, ied, jsd, jed, npz, &
1016 isd, ied, jsd, jed, &
1017 reg_bc_update_time )
1018 call mpp_update_domains(pt, domain, complete=.true.)
1020 call regional_boundary_update(q_con,
'q_con', &
1021 isd, ied, jsd, jed, npz, &
1023 isd, ied, jsd, jed, &
1024 reg_bc_update_time )
1025 call mpp_update_domains(q_con, domain, complete=.true.)
1031 if ( hydrostatic )
then 1032 call geopk(ptop, pe, peln, delp,
pkc,
gz, phis, pt, &
1036 q_con, pkz, npz, akap, .false., &
1037 gridstruct%bounded_domain, .true., npx, npy, flagstruct%a2b_ord, bd)
1041 call update_dz_d(nord_v, damp_vt, flagstruct%hord_tm, is, ie, js, je, npz, ng, npx, npy, gridstruct%area, &
1042 gridstruct%rarea, dp_ref, zs,
zh,
crx,
cry,
xfx,
yfx, ws, rdt, gridstruct, bd, flagstruct%lim_fac)
1044 if ( flagstruct%fv_debug )
then 1045 if ( .not. flagstruct%hydrostatic ) &
1046 call prt_mxm(
'delz updated', delz, is, ie, js, je, 0, npz, 1., gridstruct%area_64, domain)
1049 if (idiag%id_ws>0 .and. last_step)
then 1051 used=send_data(idiag%id_ws, ws,
fv_time)
1055 call riem_solver3(flagstruct%m_split, dt, is, ie, js, je, npz, ng, &
1056 isd, ied, jsd, jed, &
1061 ptop, zs, q_con, w, delz, pt, delp,
zh, &
1062 pe,
pkc,
pk3, pk, peln, ws, &
1063 flagstruct%scale_z, flagstruct%p_fac, flagstruct%a_imp, &
1064 flagstruct%use_logp, remap_step, beta<-0.1)
1068 if ( gridstruct%square_domain )
then 1069 call start_group_halo_update(i_pack(4),
zh , domain)
1070 call start_group_halo_update(i_pack(5),
pkc, domain, whalo=2, ehalo=2, shalo=2, nhalo=2)
1072 call start_group_halo_update(i_pack(4),
zh , domain, complete=.false.)
1073 call start_group_halo_update(i_pack(4),
pkc, domain, complete=.true.)
1077 call pe_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pe, delp)
1079 if ( flagstruct%use_logp )
then 1080 call pln_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop,
pk3, delp)
1082 call pk3_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, akap,
pk3, delp)
1085 if (gridstruct%nested)
then 1086 call nh_bc(ptop, grav, akap, cp, delp, neststruct%delz_BC, pt, phis, &
1097 split_timestep_bc+1.,
real(n_split*flagstruct%k_split), &
1098 npx, npy, npz, gridstruct%bounded_domain, .true., .true., .true., bd)
1101 if (flagstruct%regional)
then 1102 reg_bc_update_time=current_time_in_seconds+bdt*(n_map-1)+it*dt
1103 call nh_bc(ptop, grav, akap, cp, delp, delz_regbc, pt, phis, &
1114 mod(reg_bc_update_time,bc_time_interval*3600.), bc_time_interval*3600., &
1115 npx, npy, npz, gridstruct%bounded_domain, .true., .true., .true., bd)
1120 call complete_group_halo_update(i_pack(4), domain)
1126 gz(i,j,k) =
zh(i,j,k)*grav
1130 if ( gridstruct%square_domain )
then 1132 call complete_group_halo_update(i_pack(5), domain)
1141 if ( remap_step .and. hydrostatic )
then 1146 pk(i,j,k) =
pkc(i,j,k)
1157 if ( hydrostatic )
then 1158 if ( beta > 0. )
then 1159 call grad1_p_update(divg2, u, v,
pkc,
gz, dt, ng, gridstruct, bd, npx, npy, npz, ptop, beta_d, flagstruct%a2b_ord)
1161 call one_grad_p(u, v,
pkc,
gz, divg2, delp, dt, ng, gridstruct, bd, npx, npy, npz, ptop, hydrostatic, flagstruct%a2b_ord, flagstruct%d_ext)
1167 if ( beta > 0. )
then 1168 call split_p_grad( u, v,
pkc,
gz, delp,
pk3, beta_d, dt, ng, gridstruct, bd, npx, npy, npz, flagstruct%use_logp)
1169 elseif ( beta < -0.1 )
then 1170 call one_grad_p(u, v,
pkc,
gz, divg2, delp, dt, ng, gridstruct, bd, npx, npy, npz, ptop, hydrostatic, flagstruct%a2b_ord, flagstruct%d_ext)
1172 call nh_p_grad(u, v,
pkc,
gz, delp,
pk3, dt, ng, gridstruct, bd, npx, npy, npz, flagstruct%use_logp)
1176 if ( flagstruct%do_f3d )
then 1181 ua(i,j,k) = -gridstruct%w00(i,j)*w(i,j,k)
1190 call mpp_update_domains(ua, domain, complete=.true.)
1191 call update_dwinds_phys(is, ie, js, je, isd, ied, jsd, jed, dt, ua, va, u, v, gridstruct, npx, npy, npz, domain)
1198 if( flagstruct%RF_fast .and. flagstruct%tau > 0. ) &
1199 call ray_fast(abs(dt), npx, npy, npz, pfull, flagstruct%tau, u, v, w, &
1200 ks, dp_ref, ptop, hydrostatic, flagstruct%rf_cutoff, bd)
1203 if ( flagstruct%breed_vortex_inline )
then 1204 if ( .not. hydrostatic )
then 1211 pkz(i,j,k) = exp(cappa(i,j,k)/(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)) )
1214 pkz(i,j,k) = exp( k1k*
virqd(q(i,j,k,:))/
vicvqd(q(i,j,k,:))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)) )
1216 pkz(i,j,k) = exp( k1k*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)) )
1223 #if defined (ADA_NUDGE) 1224 call breed_slp_inline_ada( it, dt, npz, ak, bk, phis, pe, pk, peln, pkz, &
1225 delp, u, v, pt, q, flagstruct%nwat, zvir, gridstruct, ks, domain, bd )
1227 call breed_slp_inline( it, dt, npz, ak, bk, phis, pe, pk, peln, pkz, delp, u, v, pt, q, &
1228 flagstruct%nwat, zvir, gridstruct, ks, domain, bd, hydrostatic )
1234 if( it==n_split .and. gridstruct%grid_type<4 .and. .not. gridstruct%bounded_domain)
then 1236 call mpp_get_boundary(u, v, domain, ebuffery=ebuffer, &
1237 nbufferx=nbuffer, gridtype=dgrid_ne )
1241 u(i,je+1,k) = nbuffer(i-is+1,k)
1244 v(ie+1,j,k) = ebuffer(j-js+1,k)
1251 if (.not. flagstruct%regional .and. it/=n_split) &
1252 call start_group_halo_update(i_pack(8), u, v, domain, gridtype=dgrid_ne)
1259 if ( gridstruct%nested )
then 1260 neststruct%nest_timestep = neststruct%nest_timestep + 1
1265 if ( hydrostatic .and. last_step )
then 1266 if ( flagstruct%use_old_omega )
then 1271 omga(i,j,k) = (pe(i,k+1,j) - pem(i,k+1,j)) * rdt
1278 call adv_pe(ua, va, pem, omga, gridstruct, bd, npx, npy, npz, ng)
1284 om2d(i,k) = omga(i,j,k)
1289 om2d(i,k) = om2d(i,k-1) + omga(i,j,k)
1294 omga(i,j,k) = om2d(i,k)
1299 if (idiag%id_ws>0 .and. hydrostatic)
then 1303 ws(i,j) = delz(i,j,npz)/delp(i,j,npz) * omga(i,j,npz)
1306 used=send_data(idiag%id_ws, ws,
fv_time)
1311 if (gridstruct%nested)
then 1316 if (.not. hydrostatic)
then 1318 0, 0, npx, npy, npz, bd, split_timestep_bc+1,
real(n_split*flagstruct%k_split), &
1319 neststruct%w_BC, bctype=neststruct%nestbctype )
1323 0, 1, npx, npy, npz, bd, split_timestep_bc+1,
real(n_split*flagstruct%k_split), &
1324 neststruct%u_BC, bctype=neststruct%nestbctype )
1326 1, 0, npx, npy, npz, bd, split_timestep_bc+1,
real(n_split*flagstruct%k_split), &
1327 neststruct%v_BC, bctype=neststruct%nestbctype )
1331 if (flagstruct%regional)
then 1334 if (.not. hydrostatic)
then 1335 reg_bc_update_time=current_time_in_seconds+bdt*(n_map-1)+it*dt
1336 call regional_boundary_update(w,
'w', &
1337 isd, ied, jsd, jed, ubound(w,3), &
1339 isd, ied, jsd, jed, &
1340 reg_bc_update_time )
1344 call regional_boundary_update(u,
'u', &
1345 isd, ied, jsd, jed+1, npz, &
1347 isd, ied, jsd, jed, &
1348 reg_bc_update_time )
1349 call regional_boundary_update(v,
'v', &
1350 isd, ied+1, jsd, jed, npz, &
1352 isd, ied, jsd, jed, &
1353 reg_bc_update_time )
1354 call mpp_update_domains(u, v, domain, gridtype=dgrid_ne)
1357 call start_group_halo_update(i_pack(8), u, v, domain, gridtype=dgrid_ne)
1366 if ( nq > 0 .and. .not. flagstruct%inline_q )
then 1369 call start_group_halo_update(i_pack(10), q, domain)
1374 if ( flagstruct%fv_debug )
then 1375 if(is_master())
write(*,*)
'End of n_split loop' 1379 if ( n_con/=0 .and. flagstruct%d_con > 1.e-5 )
then 1380 nf_ke = min(3, flagstruct%nord+1)
1381 call del2_cubed(heat_source,
cnst_0p20*gridstruct%da_min, gridstruct, domain, npx, npy, npz, nf_ke, bd)
1384 if ( hydrostatic )
then 1394 pt(i,j,k) = pt(i,j,k) + heat_source(i,j,k)/(cp_air*delp(i,j,k)*pkz(i,j,k))
1398 dtmp = heat_source(i,j,k) / (cp_air*delp(i,j,k))
1399 pt(i,j,k) = pt(i,j,k) + sign(min(abs(bdt)*flagstruct%delt_max,abs(dtmp)), dtmp)/pkz(i,j,k)
1409 delt = abs(bdt*flagstruct%delt_max)
1411 if ( k == 1 ) delt = 0.1*delt
1412 if ( k == 2 ) delt = 0.5*delt
1416 pkz(i,j,k) = exp( cappa(i,j,k)/(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)) )
1419 pkz(i,j,k) = exp( k1k*
virqd(q(i,j,k,:))/
vicvqd(q(i,j,k,:))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)) )
1421 pkz(i,j,k) = exp( k1k*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)) )
1424 dtmp = heat_source(i,j,k) / (cv_air*delp(i,j,k))
1425 pt(i,j,k) = pt(i,j,k) + sign(min(delt, abs(dtmp)),dtmp) / pkz(i,j,k)
1432 if (
allocated(heat_source))
deallocate( heat_source )
1434 if ( end_step )
then 1445 if(
allocated(
ut))
deallocate(
ut )
1446 if(
allocated(
vt))
deallocate(
vt )
1447 if (
allocated (
du) )
deallocate(
du )
1448 if (
allocated (
dv) )
deallocate(
dv )
1449 if ( .not. hydrostatic )
then 1451 if(
allocated(
pk3) )
deallocate (
pk3 )
1455 if(
allocated(pem) )
deallocate ( pem )
1459 subroutine pk3_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, akap, pk3, delp)
1460 integer,
intent(in):: is, ie, js, je, isd, ied, jsd, jed, npz
1461 real,
intent(in):: ptop, akap
1462 real,
intent(in ),
dimension(isd:ied,jsd:jed,npz):: delp
1463 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz+1):: pk3
1475 pei(is-2) = pei(is-2) + delp(is-2,j,k)
1476 pei(is-1) = pei(is-1) + delp(is-1,j,k)
1477 pk3(is-2,j,k+1) = exp(akap*log(pei(is-2)))
1478 pk3(is-1,j,k+1) = exp(akap*log(pei(is-1)))
1483 pei(ie+1) = pei(ie+1) + delp(ie+1,j,k)
1484 pei(ie+2) = pei(ie+2) + delp(ie+2,j,k)
1485 pk3(ie+1,j,k+1) = exp(akap*log(pei(ie+1)))
1486 pk3(ie+2,j,k+1) = exp(akap*log(pei(ie+2)))
1496 pej(js-2) = pej(js-2) + delp(i,js-2,k)
1497 pej(js-1) = pej(js-1) + delp(i,js-1,k)
1498 pk3(i,js-2,k+1) = exp(akap*log(pej(js-2)))
1499 pk3(i,js-1,k+1) = exp(akap*log(pej(js-1)))
1504 pej(je+1) = pej(je+1) + delp(i,je+1,k)
1505 pej(je+2) = pej(je+2) + delp(i,je+2,k)
1506 pk3(i,je+1,k+1) = exp(akap*log(pej(je+1)))
1507 pk3(i,je+2,k+1) = exp(akap*log(pej(je+2)))
1513 subroutine pln_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pk3, delp)
1514 integer,
intent(in):: is, ie, js, je, isd, ied, jsd, jed, npz
1515 real,
intent(in):: ptop
1516 real,
intent(in ),
dimension(isd:ied,jsd:jed,npz):: delp
1517 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz+1):: pk3
1528 pet = pet + delp(i,j,k)
1529 pk3(i,j,k+1) = log(pet)
1535 pet = pet + delp(i,j,k)
1536 pk3(i,j,k+1) = log(pet)
1547 pet = pet + delp(i,j,k)
1548 pk3(i,j,k+1) = log(pet)
1554 pet = pet + delp(i,j,k)
1555 pk3(i,j,k+1) = log(pet)
1562 subroutine pe_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pe, delp)
1563 integer,
intent(in):: is, ie, js, je, isd, ied, jsd, jed, npz
1564 real,
intent(in):: ptop
1565 real,
intent(in ),
dimension(isd:ied,jsd:jed,npz):: delp
1566 real,
intent(inout),
dimension(is-1:ie+1,npz+1,js-1:je+1):: pe
1575 pe(is-1,k+1,j) = pe(is-1,k,j) + delp(is-1,j,k)
1576 pe(ie+1,k+1,j) = pe(ie+1,k,j) + delp(ie+1,j,k)
1585 pe(i,k+1,js-1) = pe(i,k,js-1) + delp(i,js-1,k)
1586 pe(i,k+1,je+1) = pe(i,k,je+1) + delp(i,je+1,k)
1593 subroutine adv_pe(ua, va, pem, om, gridstruct, bd, npx, npy, npz, ng)
1595 integer,
intent(in) :: npx, npy, npz, ng
1598 real,
intent(in),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: ua, va
1600 real,
intent(in) :: pem(bd%is-1:bd%ie+1,1:npz+1,bd%js-1:bd%je+1)
1601 real,
intent(inout) :: om(bd%isd:bd%ied,bd%jsd:bd%jed,npz)
1602 type(
fv_grid_type),
intent(INOUT),
target :: gridstruct
1605 real,
dimension(bd%is:bd%ie,bd%js:bd%je):: up, vp
1606 real v3(3,bd%is:bd%ie,bd%js:bd%je)
1608 real pin(bd%isd:bd%ied,bd%jsd:bd%jed)
1609 real pb(bd%isd:bd%ied,bd%jsd:bd%jed)
1611 real grad(3,bd%is:bd%ie,bd%js:bd%je)
1612 real pdx(3,bd%is:bd%ie,bd%js:bd%je+1)
1613 real pdy(3,bd%is:bd%ie+1,bd%js:bd%je)
1616 integer :: is, ie, js, je
1629 up(i,j) = ua(i,j,npz)
1630 vp(i,j) = va(i,j,npz)
1636 up(i,j) = 0.5*(ua(i,j,k)+ua(i,j,k+1))
1637 vp(i,j) = 0.5*(va(i,j,k)+va(i,j,k+1))
1646 v3(n,i,j) = up(i,j)*gridstruct%ec1(n,i,j) + vp(i,j)*gridstruct%ec2(n,i,j)
1653 pin(i,j) = pem(i,k+1,j)
1658 call a2b_ord2(pin, pb, gridstruct, npx, npy, is, ie, js, je, ng)
1664 pdx(n,i,j) = (pb(i,j)+pb(i+1,j))*gridstruct%dx(i,j)*gridstruct%en1(n,i,j)
1671 pdy(n,i,j) = (pb(i,j)+pb(i,j+1))*gridstruct%dy(i,j)*gridstruct%en2(n,i,j)
1680 grad(n,i,j) = pdx(n,i,j+1) - pdx(n,i,j) - pdy(n,i,j) + pdy(n,i+1,j)
1688 om(i,j,k) = om(i,j,k) + 0.5*gridstruct%rarea(i,j)*(v3(1,i,j)*grad(1,i,j) + &
1689 v3(2,i,j)*grad(2,i,j) + v3(3,i,j)*grad(3,i,j))
1699 subroutine p_grad_c(dt2, npz, delpc, pkc, gz, uc, vc, bd, rdxc, rdyc, hydrostatic)
1701 integer,
intent(in):: npz
1702 real,
intent(in):: dt2
1704 real,
intent(in),
dimension(bd%isd:, bd%jsd: ,: ):: delpc
1707 real,
intent(in),
dimension(bd%isd:bd%ied, bd%jsd:bd%jed ,npz+1):: pkc, gz
1708 real,
intent(inout):: uc(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz)
1709 real,
intent(inout):: vc(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
1710 real,
intent(IN) :: rdxc(bd%isd:bd%ied+1,bd%jsd:bd%jed+1)
1711 real,
intent(IN) :: rdyc(bd%isd:bd%ied ,bd%jsd:bd%jed)
1712 logical,
intent(in):: hydrostatic
1714 real:: wk(bd%is-1:bd%ie+1,bd%js-1:bd%je+1)
1717 integer :: is, ie, js, je
1728 if ( hydrostatic )
then 1731 wk(i,j) = pkc(i,j,k+1) - pkc(i,j,k)
1737 wk(i,j) = delpc(i,j,k)
1744 uc(i,j,k) = uc(i,j,k) + dt2*rdxc(i,j) / (wk(i-1,j)+wk(i,j)) * &
1745 ( (gz(i-1,j,k+1)-gz(i,j,k ))*(pkc(i,j,k+1)-pkc(i-1,j,k)) &
1746 + (gz(i-1,j,k) - gz(i,j,k+1))*(pkc(i-1,j,k+1)-pkc(i,j,k)) )
1751 vc(i,j,k) = vc(i,j,k) + dt2*rdyc(i,j) / (wk(i,j-1)+wk(i,j)) * &
1752 ( (gz(i,j-1,k+1)-gz(i,j,k ))*(pkc(i,j,k+1)-pkc(i,j-1,k)) &
1753 + (gz(i,j-1,k) - gz(i,j,k+1))*(pkc(i,j-1,k+1)-pkc(i,j,k)) )
1761 subroutine nh_p_grad(u, v, pp, gz, delp, pk, dt, ng, gridstruct, bd, npx, npy, npz, use_logp)
1762 integer,
intent(IN) :: ng, npx, npy, npz
1763 real,
intent(IN) :: dt
1764 logical,
intent(in) :: use_logp
1766 real,
intent(inout) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1767 real,
intent(inout) :: pp(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1768 real,
intent(inout) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1769 real,
intent(inout) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1770 real,
intent(inout) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1,npz)
1771 real,
intent(inout) :: v(bd%isd:bd%ied+1,bd%jsd:bd%jed, npz)
1772 type(
fv_grid_type),
intent(INOUT),
target :: gridstruct
1774 real wk1(bd%isd:bd%ied, bd%jsd:bd%jed)
1775 real wk(bd%is: bd%ie+1,bd%js: bd%je+1)
1776 real du1, dv1, top_value
1778 integer :: is, ie, js, je
1779 integer :: isd, ied, jsd, jed
1790 if ( use_logp )
then 1803 pk(i,j,1) = top_value
1807 call a2b_ord4(pp(isd,jsd,k), wk1, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
1808 call a2b_ord4(pk(isd,jsd,k), wk1, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
1810 call a2b_ord4( gz(isd,jsd,k), wk1, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
1817 call a2b_ord4(delp(isd,jsd,k), wk1, gridstruct, npx, npy, is, ie, js, je, ng)
1820 wk(i,j) = pk(i,j,k+1) - pk(i,j,k)
1827 du1 = dt / (wk(i,j)+wk(i+1,j)) * &
1828 ( (gz(i,j,k+1)-gz(i+1,j,k))*(pk(i+1,j,k+1)-pk(i,j,k)) + &
1829 (gz(i,j,k)-gz(i+1,j,k+1))*(pk(i,j,k+1)-pk(i+1,j,k)) )
1831 dul = (1.-0.5*(q_con(i,j-1,k)+q_con(i,j,k)))*
du 1834 u(i,j,k) = (u(i,j,k) + du1 + dt/(wk1(i,j)+wk1(i+1,j)) * &
1835 ((gz(i,j,k+1)-gz(i+1,j,k))*(pp(i+1,j,k+1)-pp(i,j,k)) &
1836 + (gz(i,j,k)-gz(i+1,j,k+1))*(pp(i,j,k+1)-pp(i+1,j,k))))*gridstruct%rdx(i,j)
1842 dv1 = dt / (wk(i,j)+wk(i,j+1)) * &
1843 ((gz(i,j,k+1)-gz(i,j+1,k))*(pk(i,j+1,k+1)-pk(i,j,k)) + &
1844 (gz(i,j,k)-gz(i,j+1,k+1))*(pk(i,j,k+1)-pk(i,j+1,k)))
1846 dvl = (1.-0.5*(q_con(i-1,j,k)+q_con(i,j,k)))*
dv 1849 v(i,j,k) = (v(i,j,k) + dv1 + dt/(wk1(i,j)+wk1(i,j+1)) * &
1850 ((gz(i,j,k+1)-gz(i,j+1,k))*(pp(i,j+1,k+1)-pp(i,j,k)) &
1851 + (gz(i,j,k)-gz(i,j+1,k+1))*(pp(i,j,k+1)-pp(i,j+1,k))))*gridstruct%rdy(i,j)
1859 subroutine split_p_grad( u, v, pp, gz, delp, pk, beta, dt, ng, gridstruct, bd, npx, npy, npz, use_logp)
1860 integer,
intent(IN) :: ng, npx, npy, npz
1861 real,
intent(IN) :: beta, dt
1862 logical,
intent(in):: use_logp
1864 real,
intent(inout) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed, npz)
1865 real,
intent(inout) :: pp(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1866 real,
intent(inout) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1867 real,
intent(inout) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed, npz+1)
1870 real,
intent(inout) :: u(bd%isd:bd%ied, bd%jsd:bd%jed+1,npz)
1871 real,
intent(inout) :: v(bd%isd:bd%ied+1,bd%jsd:bd%jed, npz)
1872 type(
fv_grid_type),
intent(INOUT),
target :: gridstruct
1874 real wk1(bd%isd:bd%ied, bd%jsd:bd%jed)
1875 real wk(bd%is: bd%ie+1,bd%js: bd%je+1)
1876 real alpha, top_value
1878 integer :: is, ie, js, je
1879 integer :: isd, ied, jsd, jed
1890 if ( use_logp )
then 1902 pk(i,j,1) = top_value
1910 call a2b_ord4(pp(isd,jsd,k), wk1, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
1911 call a2b_ord4(pk(isd,jsd,k), wk1, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
1913 call a2b_ord4( gz(isd,jsd,k), wk1, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
1920 call a2b_ord4(delp(isd,jsd,k), wk1, gridstruct, npx, npy, is, ie, js, je, ng)
1924 wk(i,j) = pk(i,j,k+1) - pk(i,j,k)
1930 u(i,j,k) = u(i,j,k) + beta*
du(i,j,k)
1934 du(i,j,k) = dt / (wk(i,j)+wk(i+1,j)) * &
1935 ((gz(i,j,k+1)-gz(i+1,j,k))*(pk(i+1,j,k+1)-pk(i,j,k)) + &
1936 (gz(i,j,k)-gz(i+1,j,k+1))*(pk(i,j,k+1)-pk(i+1,j,k)))
1938 du = (1.-0.5*(q_con(i,j-1,k)+q_con(i,j,k)))*
du 1942 u(i,j,k) = (u(i,j,k) + alpha*
du(i,j,k) + dt/(wk1(i,j)+wk1(i+1,j)) * &
1943 ((gz(i,j,k+1)-gz(i+1,j,k))*(pp(i+1,j,k+1)-pp(i,j,k)) &
1944 + (gz(i,j,k)-gz(i+1,j,k+1))*(pp(i,j,k+1)-pp(i+1,j,k))))*gridstruct%rdx(i,j)
1949 v(i,j,k) = v(i,j,k) + beta*
dv(i,j,k)
1952 dv(i,j,k) = dt / (wk(i,j)+wk(i,j+1)) * &
1953 ((gz(i,j,k+1)-gz(i,j+1,k))*(pk(i,j+1,k+1)-pk(i,j,k)) + &
1954 (gz(i,j,k)-gz(i,j+1,k+1))*(pk(i,j,k+1)-pk(i,j+1,k)))
1956 dv = (1.-0.5*(q_con(i-1,j,k)+q_con(i,j,k)))*
dv 1960 v(i,j,k) = (v(i,j,k) + alpha*
dv(i,j,k) + dt/(wk1(i,j)+wk1(i,j+1)) * &
1961 ((gz(i,j,k+1)-gz(i,j+1,k))*(pp(i,j+1,k+1)-pp(i,j,k)) &
1962 + (gz(i,j,k)-gz(i,j+1,k+1))*(pp(i,j,k+1)-pp(i,j+1,k))))*gridstruct%rdy(i,j)
1973 subroutine one_grad_p(u, v, pk, gz, divg2, delp, dt, ng, gridstruct, bd, npx, npy, npz, &
1974 ptop, hydrostatic, a2b_ord, d_ext)
1976 integer,
intent(IN) :: ng, npx, npy, npz, a2b_ord
1977 real,
intent(IN) :: dt, ptop, d_ext
1978 logical,
intent(in) :: hydrostatic
1980 real,
intent(in) :: divg2(bd%is:bd%ie+1,bd%js:bd%je+1)
1981 real,
intent(inout) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed ,npz+1)
1982 real,
intent(inout) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed ,npz+1)
1983 real,
intent(inout) :: delp(bd%isd:bd%ied, bd%jsd:bd%jed ,npz)
1984 real,
intent(inout) :: u(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
1985 real,
intent(inout) :: v(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz)
1986 type(
fv_grid_type),
intent(INOUT),
target :: gridstruct
1988 real,
dimension(bd%isd:bd%ied,bd%jsd:bd%jed):: wk
1989 real:: wk1(bd%is:bd%ie+1,bd%js:bd%je+1)
1990 real:: wk2(bd%is:bd%ie,bd%js:bd%je+1)
1994 integer :: is, ie, js, je
1995 integer :: isd, ied, jsd, jed
2006 if ( hydrostatic )
then 2017 pk(i,j,1) = top_value
2024 if ( a2b_ord==4 )
then 2025 call a2b_ord4(pk(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
2027 call a2b_ord2(pk(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
2034 if ( a2b_ord==4 )
then 2035 call a2b_ord4( gz(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
2037 call a2b_ord2( gz(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
2041 if ( d_ext > 0. )
then 2046 wk2(i,j) = divg2(i,j)-divg2(i+1,j)
2053 wk1(i,j) = divg2(i,j)-divg2(i,j+1)
2076 if ( hydrostatic )
then 2079 wk(i,j) = pk(i,j,k+1) - pk(i,j,k)
2083 if ( a2b_ord==4 )
then 2084 call a2b_ord4(delp(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng)
2086 call a2b_ord2(delp(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng)
2092 u(i,j,k) = gridstruct%rdx(i,j)*(wk2(i,j)+u(i,j,k) + dt/(wk(i,j)+wk(i+1,j)) * &
2093 ((gz(i,j,k+1)-gz(i+1,j,k))*(pk(i+1,j,k+1)-pk(i,j,k)) &
2094 + (gz(i,j,k)-gz(i+1,j,k+1))*(pk(i,j,k+1)-pk(i+1,j,k))))
2099 v(i,j,k) = gridstruct%rdy(i,j)*(wk1(i,j)+v(i,j,k) + dt/(wk(i,j)+wk(i,j+1)) * &
2100 ((gz(i,j,k+1)-gz(i,j+1,k))*(pk(i,j+1,k+1)-pk(i,j,k)) &
2101 + (gz(i,j,k)-gz(i,j+1,k+1))*(pk(i,j,k+1)-pk(i,j+1,k))))
2109 subroutine grad1_p_update(divg2, u, v, pk, gz, dt, ng, gridstruct, bd, npx, npy, npz, ptop, beta, a2b_ord)
2111 integer,
intent(in) :: ng, npx, npy, npz, a2b_ord
2112 real,
intent(in) :: dt, ptop, beta
2114 real,
intent(in):: divg2(bd%is:bd%ie+1,bd%js:bd%je+1)
2115 real,
intent(inout) :: pk(bd%isd:bd%ied, bd%jsd:bd%jed ,npz+1)
2116 real,
intent(inout) :: gz(bd%isd:bd%ied, bd%jsd:bd%jed ,npz+1)
2117 real,
intent(inout) :: u(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
2118 real,
intent(inout) :: v(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz)
2119 type(
fv_grid_type),
intent(INOUT),
target :: gridstruct
2122 real:: wk(bd%isd:bd%ied,bd%jsd:bd%jed)
2123 real top_value, alpha
2126 integer :: is, ie, js, je
2127 integer :: isd, ied, jsd, jed
2146 pk(i,j,1) = top_value
2152 if ( a2b_ord==4 )
then 2153 call a2b_ord4(pk(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
2155 call a2b_ord2(pk(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
2162 if ( a2b_ord==4 )
then 2163 call a2b_ord4( gz(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
2165 call a2b_ord2( gz(isd,jsd,k), wk, gridstruct, npx, npy, is, ie, js, je, ng, .true.)
2176 wk(i,j) = pk(i,j,k+1) - pk(i,j,k)
2182 u(i,j,k) = u(i,j,k) + beta*
du(i,j,k)
2183 du(i,j,k) = dt/(wk(i,j)+wk(i+1,j)) * &
2184 ((gz(i,j,k+1)-gz(i+1,j,k))*(pk(i+1,j,k+1)-pk(i,j,k)) &
2185 + (gz(i,j,k)-gz(i+1,j,k+1))*(pk(i,j,k+1)-pk(i+1,j,k)))
2186 u(i,j,k) = (u(i,j,k) + divg2(i,j)-divg2(i+1,j) + alpha*
du(i,j,k))*gridstruct%rdx(i,j)
2191 v(i,j,k) = v(i,j,k) + beta*
dv(i,j,k)
2192 dv(i,j,k) = dt/(wk(i,j)+wk(i,j+1)) * &
2193 ((gz(i,j,k+1)-gz(i,j+1,k))*(pk(i,j+1,k+1)-pk(i,j,k)) &
2194 + (gz(i,j,k)-gz(i,j+1,k+1))*(pk(i,j,k+1)-pk(i,j+1,k)))
2195 v(i,j,k) = (v(i,j,k) + divg2(i,j)-divg2(i,j+1) + alpha*
dv(i,j,k))*gridstruct%rdy(i,j)
2203 subroutine mix_dp(hydrostatic, w, delp, pt, km, ak, bk, CG, fv_debug, bd)
2204 integer,
intent(IN) :: km
2205 real ,
intent(IN) :: ak(km+1), bk(km+1)
2207 real,
intent(INOUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,km):: pt, delp
2208 real,
intent(INOUT),
dimension(bd%isd:,bd%jsd:,1:):: w
2209 logical,
intent(IN) :: hydrostatic, CG, fv_debug
2213 integer ifirst, ilast
2214 integer jfirst, jlast
2216 integer :: is, ie, js, je
2217 integer :: isd, ied, jsd, jed
2230 ifirst = is-1; ilast = ie+1
2231 jfirst = js-1; jlast = je+1
2233 ifirst = is; ilast = ie
2234 jfirst = js; jlast = je
2241 do 1000 j=jfirst,jlast
2246 dpmin = 0.01 * ( ak(k+1)-ak(k) + (bk(k+1)-bk(k))*1.e5 )
2248 if(delp(i,j,k) < dpmin)
then 2249 if (fv_debug)
write(*,*)
'Mix_dp: ', i, j, k, mpp_pe(), delp(i,j,k), pt(i,j,k)
2251 dp = dpmin - delp(i,j,k)
2252 pt(i,j,k) = (pt(i,j,k)*delp(i,j,k) + pt(i,j,k+1)*dp) / dpmin
2253 if ( .not.hydrostatic ) w(i,j,k) = (w(i,j,k)*delp(i,j,k) + w(i,j,k+1)*dp) / dpmin
2255 delp(i,j,k+1) = delp(i,j,k+1) - dp
2262 dpmin = 0.01 * ( ak(km+1)-ak(km) + (bk(km+1)-bk(km))*1.e5 )
2264 if(delp(i,j,km) < dpmin)
then 2265 if (fv_debug)
write(*,*)
'Mix_dp: ', i, j, km, mpp_pe(), delp(i,j,km), pt(i,j,km)
2267 dp = dpmin - delp(i,j,km)
2268 pt(i,j,km) = (pt(i,j,km)*delp(i,j,km) + pt(i,j,km-1)*dp)/dpmin
2269 if ( .not.hydrostatic ) w(i,j,km) = (w(i,j,km)*delp(i,j,km) + w(i,j,km-1)*dp) / dpmin
2270 delp(i,j,km) = dpmin
2271 delp(i,j,km-1) = delp(i,j,km-1) - dp
2275 if ( fv_debug .and. ip/=0 )
write(*,*)
'Warning: Mix_dp', mpp_pe(), j, ip
2282 subroutine geopk(ptop, pe, peln, delp, pk, gz, hs, pt, &
2286 q_con, pkz, km, akap, CG, bounded_domain, computehalo, npx, npy, a2b_ord, bd)
2288 integer,
intent(IN) :: km, npx, npy, a2b_ord
2289 real ,
intent(IN) :: akap, ptop
2291 real ,
intent(IN) :: hs(bd%isd:bd%ied,bd%jsd:bd%jed)
2292 real,
intent(IN),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,km):: pt, delp
2294 real,
intent(IN) :: kapad(bd%isd:bd%ied,bd%jsd:bd%jed,km)
2296 real,
intent(IN),
dimension(bd%isd:,bd%jsd:,1:):: q_con
2297 logical,
intent(IN) :: CG, bounded_domain, computehalo
2299 real,
intent(OUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,km+1):: gz, pk
2300 real,
intent(OUT) :: pe(bd%is-1:bd%ie+1,km+1,bd%js-1:bd%je+1)
2301 real,
intent(out) :: peln(bd%is:bd%ie,km+1,bd%js:bd%je)
2302 real,
intent(out) :: pkz(bd%is:bd%ie,bd%js:bd%je,km)
2306 real peg(bd%isd:bd%ied,km+1)
2307 real pkg(bd%isd:bd%ied,km+1)
2308 real p1d(bd%isd:bd%ied)
2309 real logp(bd%isd:bd%ied)
2311 real pkx (bd%isd:bd%ied,km)
2312 real pkgx(bd%isd:bd%ied,km)
2317 integer ifirst, ilast
2318 integer jfirst, jlast
2320 integer :: is, ie, js, je
2321 integer :: isd, ied, jsd, jed
2332 if ( (.not. cg .and. a2b_ord==4) .or. (bounded_domain .and. .not. cg) )
then 2333 ifirst = is-2; ilast = ie+2
2334 jfirst = js-2; jlast = je+2
2336 ifirst = is-1; ilast = ie+1
2337 jfirst = js-1; jlast = je+1
2340 if (bounded_domain .and. computehalo)
then 2341 if (is == 1) ifirst = isd
2342 if (ie == npx-1) ilast = ied
2343 if (js == 1) jfirst = jsd
2344 if (je == npy-1) jlast = jed
2356 do 2000 j=jfirst,jlast
2361 gz(i,j,km+1) = hs(i,j)
2369 if( j>=js .and. j<=je)
then 2376 if( j>(js-2) .and. j<(je+2) )
then 2377 do i=max(ifirst,is-1), min(ilast,ie+1)
2385 p1d(i) = p1d(i) + delp(i,j,k-1)
2386 logp(i) = log(p1d(i))
2387 pk(i,j,k) = exp( akap*logp(i) )
2389 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
2390 pkg(i,k) = exp( akap*log(peg(i,k)) )
2394 if( j>(js-2) .and. j<(je+2) )
then 2395 do i=max(ifirst,is-1), min(ilast,ie+1)
2398 if( j>=js .and. j<=je)
then 2400 peln(i,k,j) = logp(i)
2409 akapx = (kapad(i,j,k)-akap)/akap
2411 pkgx(i,k) = (pkg(i,k+1)-pkg(i,k))/(akap*(log(peg(i,k+1))-log(peg(i,k))))
2412 pkgx(i,k) = exp( akapx*log(pkgx(i,k)) )
2414 pkx(i,k) = (pk(i,j,k+1)-pk(i,j,k))/(akap*(peln(i,k+1,j)-peln(i,k,j)))
2415 pkx(i,k) = exp( akapx*log(pkx(i,k)) )
2425 gz(i,j,k) = gz(i,j,k+1) + pt(i,j,k)*(pk(i,j,k+1)-pk(i,j,k))
2429 gz(i,j,k) = gz(i,j,k+1) + cp_air*pkgx(i,k)*pt(i,j,k)*(pkg(i,k+1)-pkg(i,k))
2431 gz(i,j,k) = gz(i,j,k+1) + cp_air*pt(i,j,k)*(pkg(i,k+1)-pkg(i,k))
2435 gz(i,j,k) = gz(i,j,k+1) + cp_air*pkx(i,k)*pt(i,j,k)*(pk(i,j,k+1)-pk(i,j,k))
2437 gz(i,j,k) = gz(i,j,k+1) + cp_air*pt(i,j,k)*(pk(i,j,k+1)-pk(i,j,k))
2444 if ( .not. cg .and. j .ge. js .and. j .le. je )
then 2447 pkz(i,j,k) = (pk(i,j,k+1)-pk(i,j,k))/(akap*(peln(i,k+1,j)-peln(i,k,j)))
2449 akapx = kapad(i,j,k) / akap
2450 pkz(i,j,k) = exp( akapx * log( pkz(i,j,k) ) )
2457 end subroutine geopk 2460 subroutine del2_cubed(q, cd, gridstruct, domain, npx, npy, km, nmax, bd)
2464 integer,
intent(in):: npx, npy, km, nmax
2465 real(kind=R_GRID),
intent(in):: cd
2467 real,
intent(inout):: q(bd%isd:bd%ied,bd%jsd:bd%jed,km)
2469 type(domain2d),
intent(INOUT) :: domain
2470 real,
parameter:: r3 = 1./3.
2471 real :: fx(bd%isd:bd%ied+1,bd%jsd:bd%jed), fy(bd%isd:bd%ied,bd%jsd:bd%jed+1)
2472 real :: q2(bd%isd:bd%ied,bd%jsd:bd%jed)
2473 integer i,j,k, n, nt, ntimes
2474 integer :: is, ie, js, je
2475 integer :: isd, ied, jsd, jed
2500 ntimes = min(3, nmax)
2503 call mpp_update_domains(q, domain, complete=.true.)
2516 if ( gridstruct%sw_corner )
then 2517 q(1,1,k) = (q(1,1,k)+q(0,1,k)+q(1,0,k)) * r3
2521 if ( gridstruct%se_corner )
then 2522 q(ie, 1,k) = (q(ie,1,k)+q(npx,1,k)+q(ie,0,k)) * r3
2523 q(npx,1,k) = q(ie,1,k)
2524 q(ie, 0,k) = q(ie,1,k)
2526 if ( gridstruct%ne_corner )
then 2527 q(ie, je,k) = (q(ie,je,k)+q(npx,je,k)+q(ie,npy,k)) * r3
2528 q(npx,je,k) = q(ie,je,k)
2529 q(ie,npy,k) = q(ie,je,k)
2531 if ( gridstruct%nw_corner )
then 2532 q(1, je,k) = (q(1,je,k)+q(0,je,k)+q(1,npy,k)) * r3
2533 q(0, je,k) = q(1,je,k)
2534 q(1,npy,k) = q(1,je,k)
2537 if(nt>0 .and. (.not. gridstruct%bounded_domain))
call copy_corners(q(isd,jsd,k), npx, npy, 1, gridstruct%bounded_domain, bd, &
2538 gridstruct%sw_corner, gridstruct%se_corner, gridstruct%nw_corner, gridstruct%ne_corner )
2542 fx(i,j) = gridstruct%dy(i,j)*gridstruct%sina_u(i,j)*(q(i-1,j,k)-q(i,j,k))*gridstruct%rdxc(i,j)
2544 fx(i,j) = gridstruct%del6_v(i,j)*(q(i-1,j,k)-q(i,j,k))
2549 if(nt>0 .and. (.not. gridstruct%bounded_domain))
call copy_corners(q(isd,jsd,k), npx, npy, 2, gridstruct%bounded_domain, bd, &
2550 gridstruct%sw_corner, gridstruct%se_corner, gridstruct%nw_corner, gridstruct%ne_corner)
2554 fy(i,j) = gridstruct%dx(i,j)*gridstruct%sina_v(i,j)*(q(i,j-1,k)-q(i,j,k))*gridstruct%rdyc(i,j)
2556 fy(i,j) = gridstruct%del6_u(i,j)*(q(i,j-1,k)-q(i,j,k))
2563 q(i,j,k) = q(i,j,k) + cd*gridstruct%rarea(i,j)*(fx(i,j)-fx(i+1,j)+fy(i,j)-fy(i,j+1))
2571 subroutine init_ijk_mem(i1, i2, j1, j2, km, array, var)
2572 integer,
intent(in):: i1, i2, j1, j2, km
2573 real,
intent(inout):: array(i1:i2,j1:j2,km)
2574 real,
intent(in):: var
2589 subroutine ray_fast(dt, npx, npy, npz, pfull, tau, u, v, w, &
2590 ks, dp, ptop, hydrostatic, rf_cutoff, bd)
2592 real,
intent(in):: dt
2593 real,
intent(in):: tau
2594 real,
intent(in):: ptop, rf_cutoff
2595 real,
intent(in),
dimension(npz):: pfull
2596 integer,
intent(in):: npx, npy, npz, ks
2597 logical,
intent(in):: hydrostatic
2599 real,
intent(inout):: u(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
2600 real,
intent(inout):: v(bd%isd:bd%ied+1,bd%jsd:bd%jed,npz)
2601 real,
intent(inout):: w(bd%isd: ,bd%jsd: ,1: )
2602 real,
intent(in):: dp(npz)
2604 real(kind=R_GRID):: rff(npz)
2605 real,
parameter:: sday = 86400.
2606 real,
dimension(bd%is:bd%ie+1):: dmv
2607 real,
dimension(bd%is:bd%ie):: dmu
2611 integer :: is, ie, js, je
2612 integer :: isd, ied, jsd, jed
2628 if( is_master() )
write(6,*)
'Fast Rayleigh friction E-folding time (days):' 2630 if ( pfull(k) < rf_cutoff )
then 2631 rff(k) = dt/tau0*sin(0.5*pi*log(rf_cutoff/pfull(k))/log(rf_cutoff/ptop))**2
2633 if( is_master() )
write(6,*) k, 0.01*pfull(k), dt/(rff(k)*sday)
2635 rff(k) = 1.d0 / (1.0d0+rff(k))
2643 if ( pfull(k) < rf_cutoff + min(100., 10.*ptop) )
then 2650 if( is_master() )
write(6,*)
'k_rf=',
k_rf, 0.01*pfull(
k_rf),
'dm=', dm
2667 dmu(i) = dmu(i) + (1.-
rf(k))*dp(k)*u(i,j,k)
2668 u(i,j,k) =
rf(k)*u(i,j,k)
2672 dmv(i) = dmv(i) + (1.-
rf(k))*dp(k)*v(i,j,k)
2673 v(i,j,k) =
rf(k)*v(i,j,k)
2675 if ( .not. hydrostatic )
then 2677 w(i,j,k) =
rf(k)*w(i,j,k)
2684 dmu(i) = dmu(i) / dm
2688 dmv(i) = dmv(i) / dm
2694 u(i,j,k) = u(i,j,k) + dmu(i)
2698 v(i,j,k) = v(i,j,k) + dmv(i)
2707 subroutine gz_bc(gz,delzBC,bd,npx,npy,npz,step,split)
2710 integer,
intent(IN) :: npx, npy, npz
2711 real,
intent(INOUT) :: gz(bd%isd:bd%ied,bd%jsd:bd%jed,npz+1)
2713 real,
intent(IN) :: step, split
2718 integer :: is, ie, js, je
2719 integer :: isd, ied, jsd, jed
2721 integer :: istart, iend
2732 a1 = (split-step)/split
2740 gz(i,j,k) = gz(i,j,k+1) - (delzbc%west_t1(i,j,k)*a2 + delzbc%west_t0(i,j,k)*a1)
2746 if (ie == npx-1)
then 2751 gz(i,j,k) = gz(i,j,k+1) - (delzbc%east_t1(i,j,k)*a2 + delzbc%east_t0(i,j,k)*a1)
2762 if (ie == npx-1)
then 2773 gz(i,j,k) = gz(i,j,k+1) - (delzbc%south_t1(i,j,k)*a2 + delzbc%south_t0(i,j,k)*a1)
2780 if (je == npy-1)
then 2785 gz(i,j,k) = gz(i,j,k+1) - (delzbc%north_t1(i,j,k)*a2 + delzbc%north_t0(i,j,k)*a1)
2792 end subroutine gz_bc subroutine, public init_ijk_mem(i1, i2, j1, j2, km, array, var)
real, dimension(:,:,:), allocatable vt
subroutine split_p_grad(u, v, pp, gz, delp, pk, beta, dt, ng, gridstruct, bd, npx, npy, npz, use_logp)
real, dimension(:,:,:), allocatable crx
real, dimension(:,:,:), allocatable delpc
logical, public do_adiabatic_init
subroutine, public regional_boundary_update(array, bc_vbl_name, lbnd_x, ubnd_x, lbnd_y, ubnd_y, ubnd_z, is, ie, js, je, isd, ied, jsd, jed, fcst_time, index4)
subroutine pe_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pe, delp)
real, public current_time_in_seconds
The module 'fv_mp_mod' is a single program multiple data (SPMD) parallel decompostion/communication m...
subroutine timing_off(blk_name)
The subroutine 'timing_off' stops a timer.
The type 'fv_grid_type' is made up of grid-dependent information from fv_grid_tools and fv_grid_utils...
subroutine pk3_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, akap, pk3, delp)
integer, parameter, public h_stagger
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)
The subroutine 'c_sw' performs a half-timestep advance of the C-grid winds.
The module 'sw_core' advances the forward step of the Lagrangian dynamics as described by ...
The module 'multi_gases' peforms multi constitutents computations.
subroutine, public a2b_ord2(qin, qout, gridstruct, npx, npy, is, ie, js, je, ng, replace)
subroutine nh_p_grad(u, v, pp, gz, delp, pk, dt, ng, gridstruct, bd, npx, npy, npz, use_logp)
integer, parameter, public r_grid
subroutine geopk(ptop, pe, peln, delp, pk, gz, hs, pt, ifdef MULTI_GASES
The subroutine 'geopk' calculates geopotential and pressure to the kappa.
pure real function, public virqd(q)
The module fv_nwp_nudge contains routines for nudging to input analyses. note This module is currentl...
subroutine, public prt_mxm(qname, q, is, ie, js, je, n_g, km, fac, area, domain)
integer, parameter, public bc_time_interval
real, dimension(:,:,:), allocatable divgd
The module 'fv_timing' contains FV3 timers.
The module 'boundary' contains utility routines for grid nesting and boundary conditions.
The module 'tp_core' is a collection of routines to support FV transport.
The module 'a2b_edge' performs FV-consistent interpolation of pressure to corners.
real, dimension(:,:,:), allocatable ptc
subroutine mix_dp(hydrostatic, w, delp, pt, km, ak, bk, CG, fv_debug, bd)
subroutine, public dyn_core(npx, npy, npz, ng, sphum, nq, bdt, n_map, 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, ks, gridstruct, flagstruct, neststruct, idiag, bd, domain, init_step, i_pack, end_step, diss_est, time_total)
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)
The subroutine 'breed_slp_inline' performs vortex breeding by nudging sea level pressure toward singl...
subroutine, public case9_forcing1(phis, time_since_start, isd, ied, jsd, jed)
real, dimension(:,:,:), allocatable zh
The module 'fv_arrays' contains the 'fv_atmos_type' and associated datatypes.
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)
real, dimension(:,:,:), allocatable xfx
subroutine grad1_p_update(divg2, u, v, pk, gz, dt, ng, gridstruct, bd, npx, npy, npz, ptop, beta, a2b_ord)
subroutine adv_pe(ua, va, pem, om, gridstruct, bd, npx, npy, npz, ng)
subroutine one_grad_p(u, v, pk, gz, divg2, delp, dt, ng, gridstruct, bd, npx, npy, npz, ptop, hydrostatic, a2b_ord, d_ext)
subroutine gz_bc(gz, delzBC, bd, npx, npy, npz, step, split)
subroutine, public del2_cubed(q, cd, gridstruct, domain, npx, npy, km, nmax, bd)
The subroutine 'del2-cubed' filters the omega field for the physics.
subroutine, public case9_forcing2(phis, isd, ied, jsd, jed)
type(time_type), public fv_time
subroutine, public update_dwinds_phys(is, ie, js, je, isd, ied, jsd, jed, dt, u_dt, v_dt, u, v, gridstruct, npx, npy, npz, domain)
The subroutine 'update_dwinds_phys' transforms the wind tendencies from the A grid to the D grid for ...
type(fv_nest_bc_type_3d), public delz_regbc
subroutine timing_on(blk_name)
The subroutine 'timing_on' starts a timer.
real, dimension(:,:,:), allocatable cry
subroutine pln_halo(is, ie, js, je, isd, ied, jsd, jed, npz, ptop, pk3, delp)
integer, parameter, public v_stagger
real, dimension(:,:,:), allocatable yfx
@ The module 'fv_diagnostics' contains routines to compute diagnosic fields.
The module 'fv_grid_utils' contains routines for setting up and computing grid-related quantities...
The module 'dyn_core' peforms the Lagrangian acoustic dynamics described by .
subroutine p_grad_c(dt2, npz, delpc, pkc, gz, uc, vc, bd, rdxc, rdyc, hydrostatic)
subroutine, public prt_maxmin(qname, q, is, ie, js, je, n_g, km, fac)
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, diss_est, 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)
The subroutine 'd_sw' peforms a full-timestep advance of the D-grid winds and other prognostic varaia...
real, dimension(:,:,:), allocatable ut
subroutine, public copy_corners(q, npx, npy, dir, bounded_domain, bd, sw_corner, se_corner, nw_corner, ne_corner)
real, dimension(:,:,:), allocatable pkc
subroutine ray_fast(dt, npx, npy, npz, pfull, tau, u, v, w, ks, dp, ptop, hydrostatic, rf_cutoff, bd)
The subroutine 'Ray_fast' computes a simple "inline" version of the Rayleigh friction (EXPERIMENTAL -...
real, dimension(:), allocatable rf
subroutine, public a2b_ord4(qin, qout, gridstruct, npx, npy, is, ie, js, je, ng, replace)
subroutine, public exch_uv(domain, bd, npz, u, v)
real, dimension(:,:,:), allocatable du
real, dimension(:,:,:), allocatable pk3
subroutine, public nested_grid_bc_apply_intt(var_nest, istag, jstag, npx, npy, npz, bd, step, split, BC, bctype)
The subroutine 'nested_grid_BC_apply_intT' performs linear interpolation or extrapolation in time for...
real, dimension(:,:,:), allocatable dv
The module 'nh_core' peforms non-hydrostatic computations include moisture effect in pt...
real, dimension(:,:,:), allocatable gz
pure real function, public vicvqd(q)
subroutine, public extrapolation_bc(q, istag, jstag, npx, npy, bd, pd_in, debug_in)
The subroutine 'extrapolation_BC' performs linear extrapolation into the halo region.
real(kind=r_grid), parameter cnst_0p20
integer, parameter, public u_stagger