105 use mpp_domains_mod
, only: mpp_update_domains
106 use mpp_domains_mod
, only: mpp_global_field
107 use field_manager_mod
, only: model_atmos
108 use tracer_manager_mod
, only: get_tracer_index
110 use mpp_domains_mod
, only: mpp_get_data_domain, mpp_get_compute_domain, mpp_get_global_domain
111 use mpp_domains_mod
, only: agrid, cgrid_ne, dgrid_ne, mpp_update_domains, domain2d
112 use mpp_mod
, only: mpp_sync_self, mpp_sync, mpp_send, mpp_recv, mpp_error, fatal, mpp_pe, warning, note
113 use mpp_domains_mod
, only: mpp_global_sum, bitwise_efp_sum, bitwise_exact_sum
121 use constants_mod
, only: grav, pi=>pi_8, radius, hlv, rdgas, cp_air, rvgas, cp_vapor, kappa
125 use fv_mp_mod, only: mp_reduce_sum, global_nest_domain
128 use time_manager_mod
, only: time_type
133 real,
allocatable ::
rf(:),
rw(:)
141 type(
fv_nest_bc_type_3d) ::
u_buf,
v_buf,
uc_buf,
vc_buf,
delp_buf,
delz_buf,
pt_buf,
w_buf,
divg_buf,
pe_u_buf,
pe_v_buf,
pe_b_buf 154 u, v, w, pt, delp, delz,q, uc, vc, &
161 nested, inline_q, make_nh, ng, &
162 gridstruct, flagstruct, neststruct, &
163 nest_timestep, tracer_nest_timestep, &
164 domain, parent_grid, bd, nwat, ak, bk)
168 real,
intent(IN) :: zvir
170 integer,
intent(IN) :: npx, npy, npz
171 integer,
intent(IN) :: ncnst, ng, nwat
172 logical,
intent(IN) :: inline_q, make_nh,nested
173 real,
intent(IN),
dimension(npz) :: ak, bk
175 real,
intent(inout),
dimension(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz) :: u
176 real,
intent(inout),
dimension(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz) :: v
177 real,
intent(inout) :: w( bd%isd: ,bd%jsd: ,1:)
178 real,
intent(inout) :: pt( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
179 real,
intent(inout) :: delp(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
180 real,
intent(inout) :: delz(bd%is: ,bd%js: ,1:)
181 real,
intent(inout) :: q( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz, ncnst)
182 real,
intent(inout) :: uc(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz)
183 real,
intent(inout) :: vc(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
185 real,
intent(inout) :: q_con( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
187 real,
intent(inout) :: cappa( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
190 integer,
intent(INOUT) :: nest_timestep, tracer_nest_timestep
196 type(domain2d),
intent(INOUT) :: domain
197 real :: divg(bd%isd:bd%ied+1,bd%jsd:bd%jed+1, npz)
198 real :: ua(bd%isd:bd%ied,bd%jsd:bd%jed)
199 real :: va(bd%isd:bd%ied,bd%jsd:bd%jed)
200 real :: pe_ustag(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz+1)
201 real :: pe_vstag(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz+1)
202 real :: pe_bstag(bd%isd:bd%ied+1,bd%jsd:bd%jed+1,npz+1)
203 real,
parameter :: a13 = 1./3.
205 integer :: i,j,k,n,p, sphum, npz_coarse, nnest
214 logical,
pointer :: child_grids(:)
216 integer :: is, ie, js, je
217 integer :: isd, ied, jsd, jed
228 child_grids => neststruct%child_grids
236 if (.not. inline_q) tracer_nest_timestep = 0
239 if (neststruct%nested .and. (.not. (neststruct%first_step) .or. make_nh) )
then 241 call set_bcs_t0(ncnst, flagstruct%hydrostatic, neststruct)
249 if (any(neststruct%child_grids))
then 253 call mpp_update_domains(delp, domain)
254 call mpp_update_domains(u, v, &
255 domain, gridtype=dgrid_ne, complete=.true.)
261 call d2c_setup(u(isd,jsd,k), v(isd,jsd,k), &
263 uc(isd,jsd,k), vc(isd,jsd,k), flagstruct%nord>0, &
264 isd,ied,jsd,jed, is,ie,js,je, npx,npy, &
265 gridstruct%grid_type, gridstruct%bounded_domain, &
266 gridstruct%se_corner, gridstruct%sw_corner, &
267 gridstruct%ne_corner, gridstruct%nw_corner, &
268 gridstruct%rsin_u, gridstruct%rsin_v, &
269 gridstruct%cosa_s, gridstruct%rsin2 )
271 call divergence_corner_nest(u(isd,jsd,k), v(isd,jsd,k), ua, va, divg(isd,jsd,k), gridstruct, flagstruct, bd)
273 call divergence_corner(u(isd,jsd,k), v(isd,jsd,k), ua, va, divg(isd,jsd,k), gridstruct, flagstruct, bd)
278 nnest = flagstruct%grid_number - 1
281 if (neststruct%nested)
then 283 npz_coarse = neststruct%parent_grid%npz
285 if (.not.
allocated(
q_buf))
then 286 allocate(
q_buf(ncnst))
299 if (.not. flagstruct%hydrostatic)
then 306 if (neststruct%do_remap_BC(flagstruct%grid_number))
then 324 do p=1,
size(child_grids)
325 if (child_grids(p))
then 333 if (.not. flagstruct%hydrostatic)
then 339 if (neststruct%do_remap_BC(p))
then 347 pe_ustag(i,j,1) = ak(1)
351 pe_ustag(i,j,k+1) = pe_ustag(i,j,k) + 0.5*(delp(i,j,k)+delp(i,j-1,k))
361 pe_vstag(i,j,1) = ak(1)
365 pe_vstag(i,j,k+1) = pe_vstag(i,j,k) + 0.5*(delp(i,j,k)+delp(i-1,j,k))
376 pe_bstag(i,j,1) = ak(1)
380 if (is == 1 .and. js == 1)
then 382 delp(0,0,k) = a13*(delp(1,1,k) + delp(0,1,k) + delp(1,0,k))
385 if (ie == npx-1 .and. js == 1)
then 387 delp(npx,0,k) = a13*(delp(npx-1,1,k) + delp(npx,1,k) + delp(npx-1,0,k))
390 if (is == 1 .and. je == npy-1)
then 392 delp(0,npy,k) = a13*(delp(1,npy-1,k) + delp(0,npy-1,k) + delp(1,npy,k))
395 if (ie == npx-1 .and. je == npy-1)
then 397 delp(npx,npy,k) = a13*(delp(npx-1,npy-1,k) + delp(npx,npy-1,k) + delp(npx-1,npy,k))
406 pe_bstag(i,j,k+1) = pe_bstag(i,j,k) + &
407 0.25*(delp(i,j,k)+delp(i-1,j,k)+delp(i,j-1,k)+delp(i-1,j-1,k))
427 if (neststruct%do_remap_BC(flagstruct%grid_number))
then 429 call allocate_fv_nest_bc_type(delp_lag_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse,ng,0,0,0,.false.)
430 call allocate_fv_nest_bc_type(lag_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse,ng,0,0,0,.false.)
431 call allocate_fv_nest_bc_type(pe_lag_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse+1,ng,0,0,0,.false.)
432 call allocate_fv_nest_bc_type(pe_eul_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz+1,ng,0,0,0,.false.)
434 call nested_grid_bc_save_proc(global_nest_domain, &
435 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
438 call setup_eul_delp_bc(delp_lag_bc, neststruct%delp_BC, pe_lag_bc, pe_eul_bc, ak, bk, npx, npy, npz, npz_coarse, parent_grid%ptop, bd)
441 call nested_grid_bc_save_proc(global_nest_domain, &
442 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
443 neststruct%delp_BC,
delp_buf, pd_in=do_pd)
454 if (neststruct%do_remap_BC(flagstruct%grid_number))
then 456 call nested_grid_bc_save_proc(global_nest_domain, &
457 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
460 call remap_bc(pe_lag_bc, pe_eul_bc, lag_bc, neststruct%pt_BC, npx, npy, npz, npz_coarse, bd, 0, 0, 1, abs(flagstruct%kord_tm),
'pt', do_log_pe=.true.)
463 call nested_grid_bc_save_proc(global_nest_domain, &
464 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
470 if (neststruct%do_remap_BC(flagstruct%grid_number))
then 472 call nested_grid_bc_save_proc(global_nest_domain, &
473 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
474 lag_bc,
q_buf(n), pd_in=do_pd)
475 call remap_bc(pe_lag_bc, pe_eul_bc, lag_bc, neststruct%q_BC(n), npx, npy, npz, npz_coarse, bd, 0, 0, 0, flagstruct%kord_tr,
'q2')
479 call nested_grid_bc_save_proc(global_nest_domain, &
480 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
481 neststruct%q_BC(n),
q_buf(n), pd_in=do_pd)
485 sphum = get_tracer_index(model_atmos,
'sphum')
486 if (flagstruct%hydrostatic)
then 487 call setup_pt_bc(neststruct%pt_BC, pe_eul_bc, neststruct%q_BC(sphum), npx, npy, npz, zvir, bd)
489 if (neststruct%do_remap_BC(flagstruct%grid_number))
then 491 call nested_grid_bc_save_proc(global_nest_domain, &
492 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
494 call remap_bc(pe_lag_bc, pe_eul_bc, lag_bc, neststruct%w_BC, npx, npy, npz, npz_coarse, bd, 0, 0, -1, flagstruct%kord_wz,
'w')
495 call nested_grid_bc_save_proc(global_nest_domain, &
496 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
498 call remap_delz_bc(pe_lag_bc, pe_eul_bc, delp_lag_bc, lag_bc, neststruct%delp_BC, neststruct%delz_BC, npx, npy, npz, npz_coarse, bd, 0, 0, 1, flagstruct%kord_wz)
501 call nested_grid_bc_save_proc(global_nest_domain, &
502 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
503 neststruct%w_BC,
w_buf)
504 call nested_grid_bc_save_proc(global_nest_domain, &
505 neststruct%ind_h, neststruct%wt_h, 0, 0, npx, npy, npz_coarse, bd, &
509 call setup_pt_nh_bc(neststruct%pt_BC, neststruct%delp_BC, neststruct%delz_BC, &
510 neststruct%q_BC(sphum), neststruct%q_BC, ncnst, &
512 neststruct%q_con_BC, &
514 neststruct%cappa_BC, &
517 npx, npy, npz, zvir, bd)
524 if (neststruct%do_remap_BC(flagstruct%grid_number))
then 527 call allocate_fv_nest_bc_type(pe_u_lag_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse+1,ng,0,0,1,.false.)
528 call allocate_fv_nest_bc_type(pe_u_eul_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz+1 ,ng,0,0,1,.false.)
529 call allocate_fv_nest_bc_type(lag_u_bc, is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse ,ng,0,0,1,.false.)
530 call allocate_fv_nest_bc_type(pe_v_lag_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse+1,ng,0,1,0,.false.)
531 call allocate_fv_nest_bc_type(pe_v_eul_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz+1 ,ng,0,1,0,.false.)
532 call allocate_fv_nest_bc_type(lag_v_bc, is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse ,ng,0,1,0,.false.)
533 call allocate_fv_nest_bc_type(pe_b_lag_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse+1,ng,0,1,1,.false.)
534 call allocate_fv_nest_bc_type(pe_b_eul_bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz+1 ,ng,0,1,1,.false.)
535 call allocate_fv_nest_bc_type(lag_b_bc, is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse ,ng,0,1,1,.false.)
537 call nested_grid_bc_save_proc(global_nest_domain, &
538 neststruct%ind_u, neststruct%wt_u, 0, 1, npx, npy, npz_coarse+1, bd, &
540 call setup_eul_pe_bc(pe_u_lag_bc, pe_u_eul_bc, ak, bk, npx, npy, npz, npz_coarse, 0, 1, bd)
541 call nested_grid_bc_save_proc(global_nest_domain, &
542 neststruct%ind_v, neststruct%wt_v, 1, 0, npx, npy, npz_coarse+1, bd, &
544 call setup_eul_pe_bc(pe_v_lag_bc, pe_v_eul_bc, ak, bk, npx, npy, npz, npz_coarse, 1, 0, bd)
545 call nested_grid_bc_save_proc(global_nest_domain, &
546 neststruct%ind_b, neststruct%wt_b, 1, 1, npx, npy, npz_coarse+1, bd, &
548 call setup_eul_pe_bc(pe_b_lag_bc, pe_b_eul_bc, ak, bk, npx, npy, npz, npz_coarse, 1, 1, bd)
550 call nested_grid_bc_save_proc(global_nest_domain, &
551 neststruct%ind_u, neststruct%wt_u, 0, 1, npx, npy, npz_coarse, bd, &
553 call remap_bc(pe_u_lag_bc, pe_u_eul_bc, lag_u_bc, neststruct%u_BC, npx, npy, npz, npz_coarse, bd, 0, 1, -1, flagstruct%kord_mt,
'u')
554 call nested_grid_bc_save_proc(global_nest_domain, &
555 neststruct%ind_u, neststruct%wt_u, 0, 1, npx, npy, npz_coarse, bd, &
557 call remap_bc(pe_u_lag_bc, pe_u_eul_bc, lag_u_bc, neststruct%vc_BC, npx, npy, npz, npz_coarse, bd, 0, 1, -1, flagstruct%kord_mt,
'vc')
558 call nested_grid_bc_save_proc(global_nest_domain, &
559 neststruct%ind_v, neststruct%wt_v, 1, 0, npx, npy, npz_coarse, bd, &
561 call remap_bc(pe_v_lag_bc, pe_v_eul_bc, lag_v_bc, neststruct%v_BC, npx, npy, npz, npz_coarse, bd, 1, 0, -1, flagstruct%kord_mt,
'v')
562 call nested_grid_bc_save_proc(global_nest_domain, &
563 neststruct%ind_v, neststruct%wt_v, 1, 0, npx, npy, npz_coarse, bd, &
565 call remap_bc(pe_v_lag_bc, pe_v_eul_bc, lag_v_bc, neststruct%uc_BC, npx, npy, npz, npz_coarse, bd, 1, 0, -1, flagstruct%kord_mt,
'uc')
566 call nested_grid_bc_save_proc(global_nest_domain, &
567 neststruct%ind_b, neststruct%wt_b, 1, 1, npx, npy, npz_coarse, bd, &
569 call remap_bc(pe_b_lag_bc, pe_b_eul_bc, lag_b_bc, neststruct%divg_BC, npx, npy, npz, npz_coarse, bd, 1, 1, -1, flagstruct%kord_mt,
'divg')
588 call nested_grid_bc_save_proc(global_nest_domain, &
589 neststruct%ind_u, neststruct%wt_u, 0, 1, npx, npy, npz_coarse, bd, &
590 neststruct%u_BC,
u_buf)
591 call nested_grid_bc_save_proc(global_nest_domain, &
592 neststruct%ind_u, neststruct%wt_u, 0, 1, npx, npy, npz_coarse, bd, &
594 call nested_grid_bc_save_proc(global_nest_domain, &
595 neststruct%ind_v, neststruct%wt_v, 1, 0, npx, npy, npz_coarse, bd, &
596 neststruct%v_BC,
v_buf)
597 call nested_grid_bc_save_proc(global_nest_domain, &
598 neststruct%ind_v, neststruct%wt_v, 1, 0, npx, npy, npz_coarse, bd, &
600 call nested_grid_bc_save_proc(global_nest_domain, &
601 neststruct%ind_b, neststruct%wt_b, 1, 1, npx, npy, npz_coarse, bd, &
608 0, 0, npx, npy, npz, bd, 1., 1., &
609 neststruct%delp_BC, bctype=neststruct%nestbctype )
612 0, 0, npx, npy, npz, bd, 1., 1., &
613 neststruct%q_BC(n), bctype=neststruct%nestbctype )
617 0, 0, npx, npy, npz, bd, 1., 1., &
618 neststruct%pt_BC, bctype=neststruct%nestbctype )
619 if (.not. flagstruct%hydrostatic)
then 621 0, 0, npx, npy, npz, bd, 1., 1., &
622 neststruct%w_BC, bctype=neststruct%nestbctype )
630 0, 0, npx, npy, npz, bd, 1., 1., &
631 neststruct%q_con_BC, bctype=neststruct%nestbctype )
634 0, 0, npx, npy, npz, bd, 1., 1., &
635 neststruct%cappa_BC, bctype=neststruct%nestbctype )
640 0, 1, npx, npy, npz, bd, 1., 1., &
641 neststruct%u_BC, bctype=neststruct%nestbctype )
643 0, 1, npx, npy, npz, bd, 1., 1., &
644 neststruct%vc_BC, bctype=neststruct%nestbctype )
646 1, 0, npx, npy, npz, bd, 1., 1., &
647 neststruct%v_BC, bctype=neststruct%nestbctype )
649 1, 0, npx, npy, npz, bd, 1., 1., &
650 neststruct%uc_BC, bctype=neststruct%nestbctype )
658 if (.not. flagstruct%hydrostatic)
call mpp_update_domains(w, domain)
659 call mpp_update_domains(u, v, domain, gridtype=dgrid_ne, complete=.true.)
663 if (neststruct%first_step)
then 664 if (neststruct%nested)
call set_bcs_t0(ncnst, flagstruct%hydrostatic, neststruct)
665 neststruct%first_step = .false.
666 if (.not. flagstruct%hydrostatic) flagstruct%make_nh= .false.
667 else if (flagstruct%make_nh)
then 669 flagstruct%make_nh= .false.
686 subroutine set_physics_bcs(ps, u_dt, v_dt, flagstruct, gridstruct, neststruct, npx, npy, npz, ng, ak, bk, bd)
692 integer,
intent(IN) :: npx, npy, npz, ng
693 real,
intent(IN),
dimension(npz+1) :: ak, bk
694 real,
intent(INOUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed) :: ps
695 real,
intent(INOUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz) :: u_dt, v_dt
696 real,
dimension(1,1) :: parent_ps
699 integer :: n, npz_coarse, nnest
700 integer :: is, ie, js, je
701 integer :: isd, ied, jsd, jed
713 nnest = flagstruct%grid_number - 1
715 if (gridstruct%nested)
then 717 if (neststruct%do_remap_BC(flagstruct%grid_number))
then 719 npz_coarse = neststruct%parent_grid%npz
724 call nested_grid_bc(ps, parent_ps, global_nest_domain, neststruct%ind_h, neststruct%wt_h, 0, 0, &
725 npx, npy, bd, 1, npx-1, 1, npy-1)
726 call nested_grid_bc_recv(global_nest_domain, npz_coarse, bd, u_dt_buf, v_dt_buf, nnest, gridtype=agrid)
728 call allocate_fv_nest_bc_type(pe_src_bc, is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz_coarse+1,ng,0,0,0,.false.)
729 call allocate_fv_nest_bc_type(pe_dst_bc, is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz+1,ng,0,0,0,.false.)
731 call copy_ps_bc(ps, pe_src_bc, npx, npy, npz_coarse, 0, 0, bd)
732 call setup_eul_pe_bc(pe_src_bc, pe_dst_bc, ak, bk, npx, npy, npz, npz_coarse, 0, 0, bd, &
733 make_src_in=.true., ak_src=neststruct%parent_grid%ak, bk_src=neststruct%parent_grid%bk)
737 call set_bc_direct( pe_src_bc, pe_dst_bc, u_dt_buf, u_dt, neststruct, npx, npy, npz, npz_coarse, ng, bd, 0, 0, 1, flagstruct%kord_mt)
738 call set_bc_direct( pe_src_bc, pe_dst_bc, v_dt_buf, v_dt, neststruct, npx, npy, npz, npz_coarse, ng, bd, 0, 0, 1, flagstruct%kord_mt)
744 call nested_grid_bc(u_dt, v_dt, dum, dum, global_nest_domain, neststruct%ind_h, neststruct%ind_h, &
745 neststruct%wt_h, neststruct%wt_h, 0, 0, 0, 0, npx, npy, npz, bd, 1, npx-1, 1, npy-1, nnest, gridtype=agrid)
749 do n=1,
size(neststruct%child_grids)
750 if (neststruct%child_grids(n))
then 751 if (neststruct%do_remap_BC(n)) &
760 subroutine set_bc_direct( pe_src_BC, pe_dst_BC, buf, var, neststruct, npx, npy, npz, npz_coarse, ng, bd, istag, jstag, iv, kord)
764 integer,
intent(IN) :: npx, npy, npz, npz_coarse, ng, istag, jstag, iv, kord
765 real,
intent(INOUT),
dimension(bd%isd:bd%ied+istag,bd%jsd:bd%jed+jstag,npz) :: var
770 call allocate_fv_nest_bc_type(var_bc,bd%is,bd%ie,bd%js,bd%je,bd%isd,bd%ied,bd%jsd,bd%jed,npx,npy,npz_coarse,ng,0,istag,jstag,.false.)
772 call nested_grid_bc_save_proc(global_nest_domain, neststruct%ind_h, neststruct%wt_h, istag, jstag, &
773 npx, npy, npz_coarse, bd, var_bc, buf)
774 call remap_bc_direct(pe_src_bc, pe_dst_bc, var_bc, var, npx, npy, npz, npz_coarse, bd, istag, jstag, iv, kord)
781 subroutine setup_pt_bc(pt_BC, pe_eul_BC, sphum_BC, npx, npy, npz, zvir, bd)
786 integer,
intent(IN) :: npx, npy, npz
787 real,
intent(IN) :: zvir
789 integer :: istart, iend
791 integer :: is, ie, js, je
792 integer :: isd, ied, jsd, jed
804 call setup_pt_bc_k(pt_bc%west_t1, sphum_bc%west_t1, pe_eul_bc%west_t1, zvir, isd, ied, isd, 0, jsd, jed, npz)
813 if (ie == npx-1)
then 819 call setup_pt_bc_k(pt_bc%south_t1, sphum_bc%south_t1, pe_eul_bc%south_t1, zvir, isd, ied, istart, iend, jsd, 0, npz)
823 if (ie == npx-1)
then 824 call setup_pt_bc_k(pt_bc%east_t1, sphum_bc%east_t1, pe_eul_bc%east_t1, zvir, isd, ied, npx, ied, jsd, jed, npz)
827 if (je == npy-1)
then 833 if (ie == npx-1)
then 839 call setup_pt_bc_k(pt_bc%north_t1, sphum_bc%north_t1, pe_eul_bc%north_t1, zvir, isd, ied, istart, iend, npy, jed, npz)
850 subroutine setup_pt_bc_k(ptBC, sphumBC, peBC, zvir, isd_BC, ied_BC, istart, iend, jstart, jend, npz)
852 integer,
intent(IN) :: isd_BC, ied_BC, istart, iend, jstart, jend, npz
853 real,
intent(IN) :: zvir
854 real,
intent(INOUT),
dimension(isd_BC:ied_BC,jstart:jend,npz) :: ptBC
855 real,
intent(IN),
dimension(isd_BC:ied_BC,jstart:jend,npz) :: sphumBC
856 real,
intent(IN),
dimension(isd_BC:ied_BC,jstart:jend,npz+1) :: peBC
859 real :: pealn, pebln, rpkz
868 pealn = log(pebc(i,j,k))
869 pebln = log(pebc(i,j,k+1))
871 rpkz = kappa*(pebln - pealn)/(exp(kappa*pebln)-exp(kappa*pealn) )
873 ptbc(i,j,k) = ptbc(i,j,k)*rpkz * &
874 (1.+zvir*sphumbc(i,j,k))
881 subroutine setup_eul_delp_bc(delp_lag_BC, delp_eul_BC, pe_lag_BC, pe_eul_BC, ak_dst, bk_dst, npx, npy, npz, npz_coarse, ptop_src, bd)
886 integer,
intent(IN) :: npx, npy, npz, npz_coarse
887 real,
intent(IN),
dimension(npz+1) :: ak_dst, bk_dst
888 real,
intent(IN) :: ptop_src
890 integer :: i,j,k, istart, iend
892 integer :: is, ie, js, je
893 integer :: isd, ied, jsd, jed
905 call setup_eul_delp_bc_k(delp_lag_bc%west_t1, delp_eul_bc%west_t1, pe_lag_bc%west_t1, pe_eul_bc%west_t1, &
906 ptop_src, ak_dst, bk_dst, isd, 0, isd, 0, jsd, jed, npz, npz_coarse)
909 if (ie == npx-1)
then 910 call setup_eul_delp_bc_k(delp_lag_bc%east_t1, delp_eul_bc%east_t1, pe_lag_bc%east_t1, pe_eul_bc%east_t1, &
911 ptop_src, ak_dst, bk_dst, npx, ied, npx, ied, jsd, jed, npz, npz_coarse)
919 if (ie == npx-1)
then 926 call setup_eul_delp_bc_k(delp_lag_bc%south_t1, delp_eul_bc%south_t1, pe_lag_bc%south_t1, pe_eul_bc%south_t1, &
927 ptop_src, ak_dst, bk_dst, isd, ied, istart, iend, jsd, 0, npz, npz_coarse)
930 if (je == npy-1)
then 931 call setup_eul_delp_bc_k(delp_lag_bc%north_t1, delp_eul_bc%north_t1, pe_lag_bc%north_t1, pe_eul_bc%north_t1, &
932 ptop_src, ak_dst, bk_dst, isd, ied, istart, iend, npy, jed, npz, npz_coarse)
937 subroutine setup_eul_delp_bc_k(delplagBC, delpeulBC, pelagBC, peeulBC, ptop_src, ak_dst, bk_dst, isd_BC, ied_BC, istart, iend, jstart, jend, npz, npz_coarse)
939 integer,
intent(IN) :: isd_BC, ied_BC, istart, iend, jstart, jend, npz, npz_coarse
940 real,
intent(INOUT) :: delplagBC(isd_bc:ied_bc,jstart:jend,npz_coarse), pelagBC(isd_bc:ied_bc,jstart:jend,npz_coarse+1)
941 real,
intent(INOUT) :: delpeulBC(isd_bc:ied_bc,jstart:jend,npz), peeulBC(isd_bc:ied_bc,jstart:jend,npz+1)
942 real,
intent(IN) :: ptop_src, ak_dst(npz+1), bk_dst(npz+1)
946 character(len=120) :: errstring
952 pelagbc(i,j,1) = ptop_src
959 pelagbc(i,j,k+1) = pelagbc(i,j,k) + delplagbc(i,j,k)
967 peeulbc(i,j,k) = ak_dst(k) + pelagbc(i,j,npz_coarse+1)*bk_dst(k)
975 delpeulbc(i,j,k) = peeulbc(i,j,k+1) - peeulbc(i,j,k)
999 subroutine copy_ps_bc(ps, pe_BC, npx, npy, npz, istag, jstag, bd)
1001 integer,
intent(IN) :: npx, npy, npz, istag, jstag
1003 real,
intent(IN) :: ps(bd%isd:bd%ied+istag,bd%jsd:bd%jed+jstag)
1006 integer :: i,j,k, istart, iend
1008 integer :: is, ie, js, je
1009 integer :: isd, ied, jsd, jed
1024 pe_bc%west_t1(i,j,npz+1) = ps(i,j)
1029 if (ie == npx-1)
then 1032 do i=npx+istag,ied+istag
1033 pe_bc%east_t1(i,j,npz+1) = ps(i,j)
1043 if (ie == npx-1)
then 1053 pe_bc%south_t1(i,j,npz+1) = ps(i,j)
1058 if (je == npy-1)
then 1060 do j=npy+jstag,jed+jstag
1062 pe_bc%north_t1(i,j,npz+1) = ps(i,j)
1070 subroutine setup_eul_pe_bc(pe_src_BC, pe_eul_BC, ak_dst, bk_dst, npx, npy, npz, npz_src, istag, jstag, bd, make_src_in, ak_src, bk_src)
1074 integer,
intent(IN) :: npx, npy, npz, npz_src, istag, jstag
1075 real,
intent(IN),
dimension(npz+1) :: ak_dst, bk_dst
1076 logical,
intent(IN),
OPTIONAL :: make_src_in
1077 real,
intent(IN),
OPTIONAL :: ak_src(npz_src), bk_src(npz_src)
1081 integer :: i,j,k, istart, iend
1083 integer :: is, ie, js, je
1084 integer :: isd, ied, jsd, jed
1096 if (
present(make_src_in)) make_src = make_src_in
1099 call setup_eul_pe_bc_k(pe_src_bc%west_t1, pe_eul_bc%west_t1, ak_dst, bk_dst, isd, 0, isd, 0, jsd, jed+jstag, npz, npz_src, &
1100 make_src, ak_src, bk_src)
1103 if (ie == npx-1)
then 1104 call setup_eul_pe_bc_k(pe_src_bc%east_t1, pe_eul_bc%east_t1, ak_dst, bk_dst, npx+istag, ied+istag, npx+istag, ied+istag, jsd, jed+jstag, npz, npz_src, &
1105 make_src, ak_src, bk_src)
1113 if (ie == npx-1)
then 1120 call setup_eul_pe_bc_k(pe_src_bc%south_t1, pe_eul_bc%south_t1, ak_dst, bk_dst, isd, ied+istag, istart, iend+istag, jsd, 0, npz, npz_src, &
1121 make_src, ak_src, bk_src)
1124 if (je == npy-1)
then 1125 call setup_eul_pe_bc_k(pe_src_bc%north_t1, pe_eul_bc%north_t1, ak_dst, bk_dst, isd, ied+istag, istart, iend+istag, npy+jstag, jed+jstag, npz, npz_src, &
1126 make_src, ak_src, bk_src)
1131 subroutine setup_eul_pe_bc_k(pesrcBC, peeulBC, ak_dst, bk_dst, isd_BC, ied_BC, istart, iend, jstart, jend, npz, npz_src, make_src, ak_src, bk_src)
1133 integer,
intent(IN) :: isd_BC, ied_BC, istart, iend, jstart, jend, npz, npz_src
1134 real,
intent(INOUT) :: pesrcBC(isd_bc:ied_bc,jstart:jend,npz_src+1)
1135 real,
intent(INOUT) :: peeulBC(isd_bc:ied_bc,jstart:jend,npz+1)
1136 real,
intent(IN) :: ak_dst(npz+1), bk_dst(npz+1)
1137 logical,
intent(IN) :: make_src
1138 real,
intent(IN) :: ak_src(npz_src+1), bk_src(npz_src+1)
1142 character(len=120) :: errstring
1148 peeulbc(i,j,k) = ak_dst(k) + pesrcbc(i,j,npz_src+1)*bk_dst(k)
1158 pesrcbc(i,j,k) = ak_src(k) + pesrcbc(i,j,npz_src+1)*bk_src(k)
1167 subroutine remap_bc(pe_lag_BC, pe_eul_BC, var_lag_BC, var_eul_BC, npx, npy, npz, npz_coarse, bd, istag, jstag, iv, kord, varname, do_log_pe)
1172 integer,
intent(IN) :: npx, npy, npz, npz_coarse, istag, jstag, iv, kord
1173 character(len=*),
intent(IN) :: varname
1174 logical,
intent(IN),
OPTIONAL :: do_log_pe
1176 logical :: log_pe = .false.
1178 integer :: i,j,k, istart, iend
1180 integer :: is, ie, js, je
1181 integer :: isd, ied, jsd, jed
1192 if (
present(do_log_pe)) log_pe = do_log_pe
1195 call remap_bc_k(pe_lag_bc%west_t1, pe_eul_bc%west_t1, var_lag_bc%west_t1, var_eul_bc%west_t1, isd, 0, isd, 0, jsd, jed+jstag, npz, npz_coarse, iv, kord, log_pe)
1198 if (ie == npx-1)
then 1199 call remap_bc_k(pe_lag_bc%east_t1, pe_eul_bc%east_t1, var_lag_bc%east_t1, var_eul_bc%east_t1, npx+istag, ied+istag, npx+istag, ied+istag, jsd, jed+jstag, npz, npz_coarse, iv, kord, log_pe)
1207 if (ie == npx-1)
then 1214 call remap_bc_k(pe_lag_bc%south_t1, pe_eul_bc%south_t1, var_lag_bc%south_t1, var_eul_bc%south_t1, isd, ied+istag, istart, iend+istag, jsd, 0, npz, npz_coarse, iv, kord, log_pe)
1217 if (je == npy-1)
then 1218 call remap_bc_k(pe_lag_bc%north_t1, pe_eul_bc%north_t1, var_lag_bc%north_t1, var_eul_bc%north_t1, isd, ied+istag, istart, iend+istag, npy+jstag, jed+jstag, npz, npz_coarse, iv, kord, log_pe)
1223 subroutine remap_bc_direct(pe_lag_BC, pe_eul_BC, var_lag_BC, var, npx, npy, npz, npz_coarse, bd, istag, jstag, iv, kord, do_log_pe)
1226 integer,
intent(IN) :: npx, npy, npz, npz_coarse, istag, jstag, iv, kord
1229 real,
intent(INOUT) :: var(bd%isd:bd%ied+istag,bd%jsd:bd%jed+jstag,npz)
1230 logical,
intent(IN),
OPTIONAL :: do_log_pe
1232 logical :: log_pe = .false.
1234 integer :: i,j,k, istart, iend
1236 integer :: is, ie, js, je
1237 integer :: isd, ied, jsd, jed
1248 if (
present(do_log_pe)) log_pe = do_log_pe
1253 call remap_bc_k(pe_lag_bc%west_t1, pe_eul_bc%west_t1, var_lag_bc%west_t1, var(isd:0,jsd:jed+jstag,:), isd, 0, isd, 0, jsd, jed+jstag, npz, npz_coarse, iv, kord, log_pe)
1256 if (ie == npx-1)
then 1257 call remap_bc_k(pe_lag_bc%east_t1, pe_eul_bc%east_t1, var_lag_bc%east_t1, var(npx+istag:ied+istag,jsd:jed+jstag,:), npx+istag, ied+istag, npx+istag, ied+istag, jsd, jed+jstag, npz, npz_coarse, iv, kord, log_pe)
1265 if (ie == npx-1)
then 1272 call remap_bc_k(pe_lag_bc%south_t1, pe_eul_bc%south_t1, var_lag_bc%south_t1, var(isd:ied+istag,jsd:0,:), isd, ied+istag, istart, iend+istag, jsd, 0, npz, npz_coarse, iv, kord, log_pe)
1275 if (je == npy-1)
then 1276 call remap_bc_k(pe_lag_bc%north_t1, pe_eul_bc%north_t1, var_lag_bc%north_t1, var(isd:ied+istag,npy+jstag:jed+jstag,:), isd, ied+istag, istart, iend+istag, npy+jstag, jed+jstag, npz, npz_coarse, iv, kord, log_pe)
1281 subroutine remap_bc_k(pe_lagBC, pe_eulBC, var_lagBC, var_eulBC, isd_BC, ied_BC, istart, iend, jstart, jend, npz, npz_coarse, iv, kord, log_pe)
1283 integer,
intent(IN) :: isd_BC, ied_BC, istart, iend, jstart, jend, npz, npz_coarse, iv, kord
1284 logical,
intent(IN) :: log_pe
1285 real,
intent(INOUT) :: pe_lagBC(isd_bc:ied_bc,jstart:jend,npz_coarse+1), var_lagBC(isd_bc:ied_bc,jstart:jend,npz_coarse)
1286 real,
intent(INOUT) :: pe_eulBC(isd_bc:ied_bc,jstart:jend,npz+1), var_eulBC(isd_bc:ied_bc,jstart:jend,npz)
1289 real peln_lag(istart:iend,npz_coarse+1)
1290 real peln_eul(istart:iend,npz+1)
1291 character(120) :: errstring
1307 peln_lag(i,k) = log(pe_lagbc(i,j,k))
1319 peln_eul(i,k) = log(pe_eulbc(i,j,k))
1323 call mappm(npz_coarse, peln_lag, var_lagbc(istart:iend,j:j,:), &
1324 npz, peln_eul, var_eulbc(istart:iend,j:j,:), &
1325 istart, iend, iv, kord, pe_eulbc(istart,j,1))
1334 call mappm(npz_coarse, pe_lagbc(istart:iend,j:j,:), var_lagbc(istart:iend,j:j,:), &
1335 npz, pe_eulbc(istart:iend,j:j,:), var_eulbc(istart:iend,j:j,:), &
1336 istart, iend, iv, kord, pe_eulbc(istart,j,1))
1344 subroutine remap_delz_bc(pe_lag_BC, pe_eul_BC, delp_lag_BC, delz_lag_BC, delp_eul_BC, delz_eul_BC, npx, npy, npz, npz_coarse, bd, istag, jstag, iv, kord)
1347 type(
fv_nest_bc_type_3d),
intent(INOUT),
target :: pe_lag_BC, delp_lag_BC, delz_lag_BC
1348 type(
fv_nest_bc_type_3d),
intent(INOUT),
target :: pe_eul_BC, delp_eul_BC, delz_eul_BC
1349 integer,
intent(IN) :: npx, npy, npz, npz_coarse, istag, jstag, iv, kord
1351 integer :: i,j,k, istart, iend
1353 integer :: is, ie, js, je
1354 integer :: isd, ied, jsd, jed
1367 call remap_bc_k(pe_lag_bc%west_t1, pe_eul_bc%west_t1, delz_lag_bc%west_t1, delz_eul_bc%west_t1, isd, 0, isd, 0, jsd, jed+jstag, &
1368 npz, npz_coarse, iv, kord, log_pe=.false.)
1369 call compute_delz_bc_k(delp_eul_bc%west_t1, delz_eul_bc%west_t1, isd, 0, isd, 0, jsd, jed, npz)
1372 if (ie == npx-1)
then 1373 call compute_specific_volume_bc_k(delp_lag_bc%east_t1, delz_lag_bc%east_t1, npx+istag, ied+istag, npx+istag, ied+istag, jsd, jed+jstag, npz_coarse)
1374 call remap_bc_k(pe_lag_bc%east_t1, pe_eul_bc%east_t1, delz_lag_bc%east_t1, delz_eul_bc%east_t1, npx+istag, ied+istag, npx+istag, ied+istag, jsd, jed+jstag, &
1375 npz, npz_coarse, iv, kord, log_pe=.false.)
1376 call compute_delz_bc_k(delp_eul_bc%east_t1, delz_eul_bc%east_t1, npx+istag, ied+istag, npx+istag, ied+istag, jsd, jed+jstag, npz)
1384 if (ie == npx-1)
then 1392 call remap_bc_k(pe_lag_bc%south_t1, pe_eul_bc%south_t1, delz_lag_bc%south_t1, delz_eul_bc%south_t1, isd, ied+istag, istart, iend+istag, jsd, 0, npz, npz_coarse, &
1393 iv, kord, log_pe=.false.)
1394 call compute_delz_bc_k(delp_eul_bc%south_t1, delz_eul_bc%south_t1, isd, ied+istag, istart, iend+istag, jsd, 0, npz)
1397 if (je == npy-1)
then 1398 call compute_specific_volume_bc_k(delp_lag_bc%north_t1, delz_lag_bc%north_t1, isd, ied+istag, istart, iend+istag, npy+jstag, jed+jstag, npz_coarse)
1399 call remap_bc_k(pe_lag_bc%north_t1, pe_eul_bc%north_t1, delz_lag_bc%north_t1, delz_eul_bc%north_t1, &
1400 isd, ied+istag, istart, iend+istag, npy+jstag, jed+jstag, npz, npz_coarse, iv, kord, log_pe=.false.)
1401 call compute_delz_bc_k(delp_eul_bc%north_t1, delz_eul_bc%north_t1, isd, ied+istag, istart, iend+istag, npy+jstag, jed+jstag, npz)
1408 integer,
intent(IN) :: isd_BC, ied_BC, istart, iend, jstart, jend, npz
1409 real,
intent(IN) :: delpBC(isd_bc:ied_bc,jstart:jend,npz)
1410 real,
intent(INOUT) :: delzBC(isd_bc:ied_bc,jstart:jend,npz)
1412 character(len=120) :: errstring
1419 delzbc(i,j,k) = -delzbc(i,j,k)/delpbc(i,j,k)
1432 subroutine compute_delz_bc_k(delpBC, delzBC, isd_BC, ied_BC, istart, iend, jstart, jend, npz)
1434 integer,
intent(IN) :: isd_BC, ied_BC, istart, iend, jstart, jend, npz
1435 real,
intent(IN) :: delpBC(isd_bc:ied_bc,jstart:jend,npz)
1436 real,
intent(INOUT) :: delzBC(isd_bc:ied_bc,jstart:jend,npz)
1438 character(len=120) :: errstring
1445 delzbc(i,j,k) = -delzbc(i,j,k)*delpbc(i,j,k)
1459 subroutine setup_pt_nh_bc(pt_BC, delp_BC, delz_BC, sphum_BC, q_BC, nq, &
1466 npx, npy, npz, zvir, bd)
1471 integer,
intent(IN) :: nq
1479 integer,
intent(IN) :: npx, npy, npz
1480 real,
intent(IN) :: zvir
1482 real,
parameter:: c_liq = 4185.5
1483 real,
parameter:: c_ice = 1972.
1484 real,
parameter:: cv_vap = cp_vapor - rvgas
1486 real,
dimension(:,:,:),
pointer :: liq_watBC_west, ice_watBC_west, rainwatBC_west, snowwatBC_west, graupelBC_west
1487 real,
dimension(:,:,:),
pointer :: liq_watBC_east, ice_watBC_east, rainwatBC_east, snowwatBC_east, graupelBC_east
1488 real,
dimension(:,:,:),
pointer :: liq_watBC_north, ice_watBC_north, rainwatBC_north, snowwatBC_north, graupelBC_north
1489 real,
dimension(:,:,:),
pointer :: liq_watBC_south, ice_watBC_south, rainwatBC_south, snowwatBC_south, graupelBC_south
1491 real :: dp1, q_liq, q_sol, q_con = 0., cvm, pkz, rdg, cv_air
1493 integer :: i,j,k, istart, iend
1494 integer :: liq_wat, ice_wat, rainwat, snowwat, graupel
1495 real,
parameter:: tice = 273.16
1496 real,
parameter:: t_i0 = 15.
1498 integer :: is, ie, js, je
1499 integer :: isd, ied, jsd, jed
1511 cv_air = cp_air - rdgas
1513 liq_wat = get_tracer_index(model_atmos,
'liq_wat')
1514 ice_wat = get_tracer_index(model_atmos,
'ice_wat')
1515 rainwat = get_tracer_index(model_atmos,
'rainwat')
1516 snowwat = get_tracer_index(model_atmos,
'snowwat')
1517 graupel = get_tracer_index(model_atmos,
'graupel')
1520 if (.not.
allocated(
dum_west))
then 1521 allocate(
dum_west(isd:0,jsd:jed,npz))
1545 if (ie == npx-1)
then 1546 if (.not.
allocated(
dum_east))
then 1547 allocate(
dum_east(npx:ied,jsd:jed,npz))
1558 if (je == npy-1)
then 1560 allocate(
dum_north(isd:ied,npy:jed,npz))
1572 if (liq_wat > 0)
then 1573 liq_watbc_west => q_bc(liq_wat)%west_t1
1574 liq_watbc_east => q_bc(liq_wat)%east_t1
1575 liq_watbc_north => q_bc(liq_wat)%north_t1
1576 liq_watbc_south => q_bc(liq_wat)%south_t1
1583 if (ice_wat > 0)
then 1584 ice_watbc_west => q_bc(ice_wat)%west_t1
1585 ice_watbc_east => q_bc(ice_wat)%east_t1
1586 ice_watbc_north => q_bc(ice_wat)%north_t1
1587 ice_watbc_south => q_bc(ice_wat)%south_t1
1594 if (rainwat > 0)
then 1595 rainwatbc_west => q_bc(rainwat)%west_t1
1596 rainwatbc_east => q_bc(rainwat)%east_t1
1597 rainwatbc_north => q_bc(rainwat)%north_t1
1598 rainwatbc_south => q_bc(rainwat)%south_t1
1605 if (snowwat > 0)
then 1606 snowwatbc_west => q_bc(snowwat)%west_t1
1607 snowwatbc_east => q_bc(snowwat)%east_t1
1608 snowwatbc_north => q_bc(snowwat)%north_t1
1609 snowwatbc_south => q_bc(snowwat)%south_t1
1616 if (graupel > 0)
then 1617 graupelbc_west => q_bc(graupel)%west_t1
1618 graupelbc_east => q_bc(graupel)%east_t1
1619 graupelbc_north => q_bc(graupel)%north_t1
1620 graupelbc_south => q_bc(graupel)%south_t1
1630 call setup_pt_nh_bc_k(pt_bc%west_t1, sphum_bc%west_t1, delp_bc%west_t1, delz_bc%west_t1, &
1631 liq_watbc_west, rainwatbc_west, ice_watbc_west, snowwatbc_west, graupelbc_west, &
1638 zvir, isd, 0, isd, 0, jsd, jed, npz)
1648 if (ie == npx-1)
then 1654 call setup_pt_nh_bc_k(pt_bc%south_t1, sphum_bc%south_t1, delp_bc%south_t1, delz_bc%south_t1, &
1655 liq_watbc_south, rainwatbc_south, ice_watbc_south, snowwatbc_south, graupelbc_south, &
1657 q_con_bc%south_t1, &
1659 cappa_bc%south_t1, &
1662 zvir, isd, ied, istart, iend, jsd, 0, npz)
1666 if (ie == npx-1)
then 1668 call setup_pt_nh_bc_k(pt_bc%east_t1, sphum_bc%east_t1, delp_bc%east_t1, delz_bc%east_t1, &
1669 liq_watbc_east, rainwatbc_east, ice_watbc_east, snowwatbc_east, graupelbc_east, &
1676 zvir, npx, ied, npx, ied, jsd, jed, npz)
1679 if (je == npy-1)
then 1685 if (ie == npx-1)
then 1691 call setup_pt_nh_bc_k(pt_bc%north_t1, sphum_bc%north_t1, delp_bc%north_t1, delz_bc%north_t1, &
1692 liq_watbc_north, rainwatbc_north, ice_watbc_north, snowwatbc_north, graupelbc_north, &
1694 q_con_bc%north_t1, &
1696 cappa_bc%north_t1, &
1699 zvir, isd, ied, istart, iend, npy, jed, npz)
1706 liq_watBC,rainwatBC,ice_watBC,snowwatBC,graupelBC, &
1713 zvir, isd_BC, ied_BC, istart, iend, jstart, jend, npz)
1715 integer,
intent(IN) :: isd_BC, ied_BC, istart, iend, jstart, jend, npz
1716 real,
intent(OUT),
dimension(isd_BC:ied_BC,jstart:jend,npz) :: ptBC
1717 real,
intent(IN),
dimension(isd_BC:ied_BC,jstart:jend,npz) :: sphumBC, delpBC, delzBC
1718 real,
intent(IN),
dimension(isd_BC:ied_BC,jstart:jend,npz) :: liq_watBC,rainwatBC,ice_watBC,snowwatBC,graupelBC
1720 real,
intent(OUT),
dimension(isd_BC:ied_BC,jstart:jend,npz) :: q_conBC
1722 real,
intent(OUT),
dimension(isd_BC:ied_BC,jstart:jend,npz) :: cappaBC
1725 real,
intent(IN) :: zvir
1728 real :: dp1, q_con, q_sol, q_liq, cvm, pkz, rdg, cv_air
1730 real,
parameter:: c_liq = 4185.5
1731 real,
parameter:: c_ice = 1972.
1732 real,
parameter:: cv_vap = cp_vapor - rvgas
1733 real,
parameter:: tice = 273.16
1734 real,
parameter:: t_i0 = 15.
1737 cv_air = cp_air - rdgas
1755 dp1 = zvir*sphumbc(i,j,k)
1757 q_liq = liq_watbc(i,j,k) + rainwatbc(i,j,k)
1758 q_sol = ice_watbc(i,j,k) + snowwatbc(i,j,k) + graupelbc(i,j,k)
1759 q_con = q_liq + q_sol
1760 q_conbc(i,j,k) = q_con
1762 cvm = (1.-(sphumbc(i,j,k)+q_con))*cv_air+sphumbc(i,j,k)*cv_vap+q_liq*c_liq+q_sol*c_ice
1763 cappabc(i,j,k) = rdgas/(rdgas + cvm/(1.+dp1))
1764 pkz = exp( cappabc(i,j,k)*log(rdg*delpbc(i,j,k)*ptbc(i,j,k) * &
1765 (1.+dp1)*(1.-q_con)/delzbc(i,j,k)))
1767 pkz = exp( kappa*log(rdg*delpbc(i,j,k)*ptbc(i,j,k) * &
1768 (1.+dp1)*(1.-q_con)/delzbc(i,j,k)))
1770 ptbc(i,j,k) = ptbc(i,j,k)*(1.+dp1)*(1.-q_con)/pkz
1772 pkz = exp( kappa*log(rdg*delpbc(i,j,k)*ptbc(i,j,k) * &
1773 (1.+dp1)/delzbc(i,j,k)))
1774 ptbc(i,j,k) = ptbc(i,j,k)*(1.+dp1)/pkz
1787 neststruct%delz_BC%east_t0 = neststruct%delz_BC%east_t1
1788 neststruct%delz_BC%west_t0 = neststruct%delz_BC%west_t1
1789 neststruct%delz_BC%north_t0 = neststruct%delz_BC%north_t1
1790 neststruct%delz_BC%south_t0 = neststruct%delz_BC%south_t1
1792 neststruct%w_BC%east_t0 = neststruct%w_BC%east_t1
1793 neststruct%w_BC%west_t0 = neststruct%w_BC%west_t1
1794 neststruct%w_BC%north_t0 = neststruct%w_BC%north_t1
1795 neststruct%w_BC%south_t0 = neststruct%w_BC%south_t1
1800 subroutine set_bcs_t0(ncnst, hydrostatic, neststruct)
1802 integer,
intent(IN) :: ncnst
1803 logical,
intent(IN) :: hydrostatic
1808 neststruct%delp_BC%east_t0 = neststruct%delp_BC%east_t1
1809 neststruct%delp_BC%west_t0 = neststruct%delp_BC%west_t1
1810 neststruct%delp_BC%north_t0 = neststruct%delp_BC%north_t1
1811 neststruct%delp_BC%south_t0 = neststruct%delp_BC%south_t1
1813 neststruct%q_BC(n)%east_t0 = neststruct%q_BC(n)%east_t1
1814 neststruct%q_BC(n)%west_t0 = neststruct%q_BC(n)%west_t1
1815 neststruct%q_BC(n)%north_t0 = neststruct%q_BC(n)%north_t1
1816 neststruct%q_BC(n)%south_t0 = neststruct%q_BC(n)%south_t1
1819 neststruct%pt_BC%east_t0 = neststruct%pt_BC%east_t1
1820 neststruct%pt_BC%west_t0 = neststruct%pt_BC%west_t1
1821 neststruct%pt_BC%north_t0 = neststruct%pt_BC%north_t1
1822 neststruct%pt_BC%south_t0 = neststruct%pt_BC%south_t1
1823 neststruct%pt_BC%east_t0 = neststruct%pt_BC%east_t1
1824 neststruct%pt_BC%west_t0 = neststruct%pt_BC%west_t1
1825 neststruct%pt_BC%north_t0 = neststruct%pt_BC%north_t1
1826 neststruct%pt_BC%south_t0 = neststruct%pt_BC%south_t1
1829 neststruct%q_con_BC%east_t0 = neststruct%q_con_BC%east_t1
1830 neststruct%q_con_BC%west_t0 = neststruct%q_con_BC%west_t1
1831 neststruct%q_con_BC%north_t0 = neststruct%q_con_BC%north_t1
1832 neststruct%q_con_BC%south_t0 = neststruct%q_con_BC%south_t1
1834 neststruct%cappa_BC%east_t0 = neststruct%cappa_BC%east_t1
1835 neststruct%cappa_BC%west_t0 = neststruct%cappa_BC%west_t1
1836 neststruct%cappa_BC%north_t0 = neststruct%cappa_BC%north_t1
1837 neststruct%cappa_BC%south_t0 = neststruct%cappa_BC%south_t1
1841 if (.not. hydrostatic)
then 1845 neststruct%u_BC%east_t0 = neststruct%u_BC%east_t1
1846 neststruct%u_BC%west_t0 = neststruct%u_BC%west_t1
1847 neststruct%u_BC%north_t0 = neststruct%u_BC%north_t1
1848 neststruct%u_BC%south_t0 = neststruct%u_BC%south_t1
1849 neststruct%v_BC%east_t0 = neststruct%v_BC%east_t1
1850 neststruct%v_BC%west_t0 = neststruct%v_BC%west_t1
1851 neststruct%v_BC%north_t0 = neststruct%v_BC%north_t1
1852 neststruct%v_BC%south_t0 = neststruct%v_BC%south_t1
1855 neststruct%vc_BC%east_t0 = neststruct%vc_BC%east_t1
1856 neststruct%vc_BC%west_t0 = neststruct%vc_BC%west_t1
1857 neststruct%vc_BC%north_t0 = neststruct%vc_BC%north_t1
1858 neststruct%vc_BC%south_t0 = neststruct%vc_BC%south_t1
1859 neststruct%uc_BC%east_t0 = neststruct%uc_BC%east_t1
1860 neststruct%uc_BC%west_t0 = neststruct%uc_BC%west_t1
1861 neststruct%uc_BC%north_t0 = neststruct%uc_BC%north_t1
1862 neststruct%uc_BC%south_t0 = neststruct%uc_BC%south_t1
1864 neststruct%divg_BC%east_t0 = neststruct%divg_BC%east_t1
1865 neststruct%divg_BC%west_t0 = neststruct%divg_BC%west_t1
1866 neststruct%divg_BC%north_t0 = neststruct%divg_BC%north_t1
1867 neststruct%divg_BC%south_t0 = neststruct%divg_BC%south_t1
1874 isd,ied,jsd,jed, is,ie,js,je, npx,npy, &
1875 grid_type, bounded_domain, &
1876 se_corner, sw_corner, ne_corner, nw_corner, &
1877 rsin_u,rsin_v,cosa_s,rsin2 )
1879 logical,
intent(in):: dord4
1880 real,
intent(in) :: u(isd:ied,jsd:jed+1)
1881 real,
intent(in) :: v(isd:ied+1,jsd:jed)
1882 real,
intent(out),
dimension(isd:ied ,jsd:jed ):: ua
1883 real,
intent(out),
dimension(isd:ied ,jsd:jed ):: va
1884 real,
intent(out),
dimension(isd:ied+1,jsd:jed ):: uc
1885 real,
intent(out),
dimension(isd:ied ,jsd:jed+1):: vc
1886 integer,
intent(in) :: isd,ied,jsd,jed, is,ie,js,je, npx,npy,grid_type
1887 logical,
intent(in) :: bounded_domain, se_corner, sw_corner, ne_corner, nw_corner
1888 real,
intent(in) :: rsin_u(isd:ied+1,jsd:jed)
1889 real,
intent(in) :: rsin_v(isd:ied,jsd:jed+1)
1890 real,
intent(in) :: cosa_s(isd:ied,jsd:jed)
1891 real,
intent(in) :: rsin2(isd:ied,jsd:jed)
1894 real,
dimension(isd:ied,jsd:jed):: utmp, vtmp
1895 real,
parameter:: t11=27./28., t12=-13./28., t13=3./7., t14=6./7., t15=3./28.
1896 real,
parameter:: a1 = 0.5625
1897 real,
parameter:: a2 = -0.0625
1898 real,
parameter:: c1 = -2./14.
1899 real,
parameter:: c2 = 11./14.
1900 real,
parameter:: c3 = 5./14.
1901 integer npt, i, j, ifirst, ilast, id
1910 if (grid_type < 3 .and. .not. bounded_domain)
then 1916 if ( bounded_domain)
then 1920 utmp(i,j) = a2*(u(i,j-1)+u(i,j+2)) + a1*(u(i,j)+u(i,j+1))
1925 utmp(i,j) = 0.5*(u(i,j)+u(i,j+1))
1927 utmp(i,j) = 0.5*(u(i,j)+u(i,j+1))
1932 vtmp(i,j) = a2*(v(i-1,j)+v(i+2,j)) + a1*(v(i,j)+v(i+1,j))
1935 vtmp(i,j) = 0.5*(v(i,j)+v(i+1,j))
1937 vtmp(i,j) = 0.5*(v(i,j)+v(i+1,j))
1942 ua(i,j) = (utmp(i,j)-vtmp(i,j)*cosa_s(i,j)) * rsin2(i,j)
1943 va(i,j) = (vtmp(i,j)-utmp(i,j)*cosa_s(i,j)) * rsin2(i,j)
1956 do j=max(npt,js-1),min(npy-npt,je+1)
1957 do i=max(npt,isd),min(npx-npt,ied)
1958 utmp(i,j) = a2*(u(i,j-1)+u(i,j+2)) + a1*(u(i,j)+u(i,j+1))
1961 do j=max(npt,jsd),min(npy-npt,jed)
1962 do i=max(npt,is-1),min(npx-npt,ie+1)
1963 vtmp(i,j) = a2*(v(i-1,j)+v(i+2,j)) + a1*(v(i,j)+v(i+1,j))
1970 if (grid_type < 3)
then 1972 if ( js==1 .or. jsd<npt)
then 1975 utmp(i,j) = 0.5*(u(i,j) + u(i,j+1))
1976 vtmp(i,j) = 0.5*(v(i,j) + v(i+1,j))
1981 if ( (je+1)==npy .or. jed>=(npy-npt))
then 1984 utmp(i,j) = 0.5*(u(i,j) + u(i,j+1))
1985 vtmp(i,j) = 0.5*(v(i,j) + v(i+1,j))
1990 if ( is==1 .or. isd<npt )
then 1991 do j=max(npt,jsd),min(npy-npt,jed)
1993 utmp(i,j) = 0.5*(u(i,j) + u(i,j+1))
1994 vtmp(i,j) = 0.5*(v(i,j) + v(i+1,j))
1999 if ( (ie+1)==npx .or. ied>=(npx-npt))
then 2000 do j=max(npt,jsd),min(npy-npt,jed)
2002 utmp(i,j) = 0.5*(u(i,j) + u(i,j+1))
2003 vtmp(i,j) = 0.5*(v(i,j) + v(i+1,j))
2009 do j=js-1-id,je+1+id
2010 do i=is-1-id,ie+1+id
2011 ua(i,j) = (utmp(i,j)-vtmp(i,j)*cosa_s(i,j)) * rsin2(i,j)
2012 va(i,j) = (vtmp(i,j)-utmp(i,j)*cosa_s(i,j)) * rsin2(i,j)
2023 if( sw_corner )
then 2025 utmp(i,0) = -vtmp(0,1-i)
2028 if( se_corner )
then 2030 utmp(npx+i,0) = vtmp(npx,i+1)
2033 if( ne_corner )
then 2035 utmp(npx+i,npy) = -vtmp(npx,je-i)
2038 if( nw_corner )
then 2040 utmp(i,npy) = vtmp(0,je+i)
2044 if (grid_type < 3 .and. .not. bounded_domain)
then 2045 ifirst = max(3, is-1)
2046 ilast = min(npx-2,ie+2)
2056 uc(i,j) = a1*(utmp(i-1,j)+utmp(i,j))+a2*(utmp(i-2,j)+utmp(i+1,j))
2060 if (grid_type < 3)
then 2062 if( is==1 .and. .not. bounded_domain )
then 2064 uc(0,j) = c1*utmp(-2,j) + c2*utmp(-1,j) + c3*utmp(0,j)
2065 uc(1,j) = ( t14*(utmp( 0,j)+utmp(1,j)) &
2066 + t12*(utmp(-1,j)+utmp(2,j)) &
2067 + t15*(utmp(-2,j)+utmp(3,j)) )*rsin_u(1,j)
2068 uc(2,j) = c1*utmp(3,j) + c2*utmp(2,j) + c3*utmp(1,j)
2072 if( (ie+1)==npx .and. .not. bounded_domain )
then 2074 uc(npx-1,j) = c1*utmp(npx-3,j)+c2*utmp(npx-2,j)+c3*utmp(npx-1,j)
2075 uc(npx,j) = (t14*(utmp(npx-1,j)+utmp(npx,j))+ &
2076 t12*(utmp(npx-2,j)+utmp(npx+1,j)) &
2077 + t15*(utmp(npx-3,j)+utmp(npx+2,j)))*rsin_u(npx,j)
2078 uc(npx+1,j) = c3*utmp(npx,j)+c2*utmp(npx+1,j)+c1*utmp(npx+2,j)
2087 if( sw_corner )
then 2089 vtmp(0,j) = -utmp(1-j,0)
2092 if( nw_corner )
then 2094 vtmp(0,npy+j) = utmp(j+1,npy)
2097 if( se_corner )
then 2099 vtmp(npx,j) = utmp(ie+j,0)
2102 if( ne_corner )
then 2104 vtmp(npx,npy+j) = -utmp(ie-j,npy)
2108 if (grid_type < 3)
then 2111 if ( j==1 .and. .not. bounded_domain)
then 2113 vc(i,1) = (t14*(vtmp(i, 0)+vtmp(i,1)) &
2114 + t12*(vtmp(i,-1)+vtmp(i,2)) &
2115 + t15*(vtmp(i,-2)+vtmp(i,3)))*rsin_v(i,1)
2117 elseif ( (j==0 .or. j==(npy-1)) .and. .not. bounded_domain)
then 2119 vc(i,j) = c1*vtmp(i,j-2) + c2*vtmp(i,j-1) + c3*vtmp(i,j)
2121 elseif ( (j==2 .or. j==(npy+1)) .and. .not. bounded_domain)
then 2123 vc(i,j) = c1*vtmp(i,j+1) + c2*vtmp(i,j) + c3*vtmp(i,j-1)
2125 elseif ( j==npy .and. .not. bounded_domain)
then 2127 vc(i,npy) = (t14*(vtmp(i,npy-1)+vtmp(i,npy)) &
2128 + t12*(vtmp(i,npy-2)+vtmp(i,npy+1)) &
2129 + t15*(vtmp(i,npy-3)+vtmp(i,npy+2)))*rsin_v(i,npy)
2134 vc(i,j) = a2*(vtmp(i,j-2)+vtmp(i,j+1))+a1*(vtmp(i,j-1)+vtmp(i,j))
2142 vc(i,j) = a2*(vtmp(i,j-2)+vtmp(i,j+1))+a1*(vtmp(i,j-1)+vtmp(i,j))
2149 subroutine d2a_setup(u, v, ua, va, dord4, &
2150 isd,ied,jsd,jed, is,ie,js,je, npx,npy, &
2151 grid_type, bounded_domain, &
2154 logical,
intent(in):: dord4
2155 real,
intent(in) :: u(isd:ied,jsd:jed+1)
2156 real,
intent(in) :: v(isd:ied+1,jsd:jed)
2157 real,
intent(out),
dimension(isd:ied ,jsd:jed ):: ua
2158 real,
intent(out),
dimension(isd:ied ,jsd:jed ):: va
2159 integer,
intent(in) :: isd,ied,jsd,jed, is,ie,js,je, npx,npy,grid_type
2160 real,
intent(in) :: cosa_s(isd:ied,jsd:jed)
2161 real,
intent(in) :: rsin2(isd:ied,jsd:jed)
2162 logical,
intent(in) :: bounded_domain
2165 real,
dimension(isd:ied,jsd:jed):: utmp, vtmp
2166 real,
parameter:: t11=27./28., t12=-13./28., t13=3./7., t14=6./7., t15=3./28.
2167 real,
parameter:: a1 = 0.5625
2168 real,
parameter:: a2 = -0.0625
2169 real,
parameter:: c1 = -2./14.
2170 real,
parameter:: c2 = 11./14.
2171 real,
parameter:: c3 = 5./14.
2172 integer npt, i, j, ifirst, ilast, id
2181 if (grid_type < 3 .and. .not. bounded_domain)
then 2187 if ( bounded_domain)
then 2191 utmp(i,j) = a2*(u(i,j-1)+u(i,j+2)) + a1*(u(i,j)+u(i,j+1))
2196 utmp(i,j) = 0.5*(u(i,j)+u(i,j+1))
2198 utmp(i,j) = 0.5*(u(i,j)+u(i,j+1))
2203 vtmp(i,j) = a2*(v(i-1,j)+v(i+2,j)) + a1*(v(i,j)+v(i+1,j))
2206 vtmp(i,j) = 0.5*(v(i,j)+v(i+1,j))
2208 vtmp(i,j) = 0.5*(v(i,j)+v(i+1,j))
2217 do j=max(npt,js-1),min(npy-npt,je+1)
2218 do i=max(npt,isd),min(npx-npt,ied)
2219 utmp(i,j) = a2*(u(i,j-1)+u(i,j+2)) + a1*(u(i,j)+u(i,j+1))
2222 do j=max(npt,jsd),min(npy-npt,jed)
2223 do i=max(npt,is-1),min(npx-npt,ie+1)
2224 vtmp(i,j) = a2*(v(i-1,j)+v(i+2,j)) + a1*(v(i,j)+v(i+1,j))
2231 if (grid_type < 3)
then 2233 if ( js==1 .or. jsd<npt)
then 2236 utmp(i,j) = 0.5*(u(i,j) + u(i,j+1))
2237 vtmp(i,j) = 0.5*(v(i,j) + v(i+1,j))
2242 if ( (je+1)==npy .or. jed>=(npy-npt))
then 2245 utmp(i,j) = 0.5*(u(i,j) + u(i,j+1))
2246 vtmp(i,j) = 0.5*(v(i,j) + v(i+1,j))
2251 if ( is==1 .or. isd<npt )
then 2252 do j=max(npt,jsd),min(npy-npt,jed)
2254 utmp(i,j) = 0.5*(u(i,j) + u(i,j+1))
2255 vtmp(i,j) = 0.5*(v(i,j) + v(i+1,j))
2260 if ( (ie+1)==npx .or. ied>=(npx-npt))
then 2261 do j=max(npt,jsd),min(npy-npt,jed)
2263 utmp(i,j) = 0.5*(u(i,j) + u(i,j+1))
2264 vtmp(i,j) = 0.5*(v(i,j) + v(i+1,j))
2275 do j=js-1-id,je+1+id
2276 do i=is-1-id,ie+1+id
2277 ua(i,j) = (utmp(i,j)-vtmp(i,j)*cosa_s(i,j)) * rsin2(i,j)
2278 va(i,j) = (vtmp(i,j)-utmp(i,j)*cosa_s(i,j)) * rsin2(i,j)
2311 subroutine twoway_nesting(Atm, ngrids, grids_on_this_pe, zvir, Time, this_grid)
2314 integer,
intent(IN) :: ngrids, this_grid
2315 logical,
intent(IN) :: grids_on_this_pe(ngrids)
2316 real,
intent(IN) :: zvir
2317 type(time_type),
intent(IN) :: Time
2319 integer :: n, p, sphum
2322 if (ngrids > 1)
then 2326 call p_var(atm(this_grid)%npz, atm(this_grid)%bd%is, atm(this_grid)%bd%ie, atm(this_grid)%bd%js, atm(this_grid)%bd%je, &
2327 atm(this_grid)%ptop,
ptop_min, atm(this_grid)%delp, atm(this_grid)%delz, atm(this_grid)%pt, &
2328 atm(this_grid)%ps, atm(this_grid)%pe, atm(this_grid)%peln, atm(this_grid)%pk, atm(this_grid)%pkz, kappa, &
2329 atm(this_grid)%q, atm(this_grid)%ng, atm(this_grid)%flagstruct%ncnst, atm(this_grid)%gridstruct%area_64, 0., &
2331 atm(this_grid)%flagstruct%moist_phys, atm(this_grid)%flagstruct%hydrostatic, &
2332 atm(this_grid)%flagstruct%nwat, atm(this_grid)%domain, atm(this_grid)%flagstruct%adiabatic, .false.)
2337 if (atm(n)%neststruct%twowaynest )
then 2339 if (n==this_grid .or. atm(n)%parent_grid%grid_number==this_grid)
then 2340 sphum = get_tracer_index(model_atmos,
'sphum')
2342 atm(n)%ncnst, sphum, atm(n)%u, atm(n)%v, atm(n)%w, &
2343 atm(n)%pt, atm(n)%delp, atm(n)%q, &
2344 atm(n)%pe, atm(n)%pkz, atm(n)%delz, atm(n)%ps, atm(n)%ptop, atm(n)%ak, atm(n)%bk, &
2345 atm(n)%gridstruct, atm(n)%flagstruct, atm(n)%neststruct, atm(n)%domain, &
2346 atm(n)%parent_grid, atm(n)%bd, n, .false.)
2353 if (atm(this_grid)%neststruct%parent_of_twoway .and. grids_on_this_pe(n))
then 2355 atm(this_grid)%ng, atm(this_grid)%ncnst, &
2356 atm(this_grid)%u, atm(this_grid)%v, atm(this_grid)%w, atm(this_grid)%delz, &
2357 atm(this_grid)%pt, atm(this_grid)%delp, atm(this_grid)%q, &
2358 atm(this_grid)%ps, atm(this_grid)%pe, atm(this_grid)%pk, atm(this_grid)%peln, atm(this_grid)%pkz, &
2359 atm(this_grid)%phis, atm(this_grid)%ua, atm(this_grid)%va, &
2360 atm(this_grid)%ptop, atm(this_grid)%gridstruct, atm(this_grid)%flagstruct, &
2361 atm(this_grid)%domain, atm(this_grid)%bd, time)
2375 u, v, w, pt, delp, q, &
2376 pe, pkz, delz, ps, ptop, ak, bk, &
2377 gridstruct, flagstruct, neststruct, &
2378 domain, parent_grid, bd, grid_number, conv_theta_in)
2380 real,
intent(IN) :: zvir, ptop, ak(npz+1), bk(npz+1)
2382 integer,
intent(IN) :: npx, npy, npz
2383 integer,
intent(IN) :: ncnst, sphum, grid_number
2384 logical,
intent(IN),
OPTIONAL :: conv_theta_in
2387 real,
intent(inout),
dimension(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz) :: u
2388 real,
intent(inout),
dimension(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz) :: v
2389 real,
intent(inout) :: w( bd%isd: ,bd%jsd: ,1: )
2391 real,
intent(inout) :: pt( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
2392 real,
intent(inout) :: delp(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
2393 real,
intent(inout) :: q( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz, ncnst)
2395 real,
intent(inout) :: pe (bd%is-1:bd%ie+1,npz+1,bd%js-1:bd%je+1)
2396 real,
intent(inout) :: pkz (bd%is:bd%ie,bd%js:bd%je,npz)
2397 real,
intent(inout) :: delz(bd%isd: ,bd%jsd: ,1: )
2398 real,
intent(inout) :: ps (bd%isd:bd%ied ,bd%jsd:bd%jed)
2403 type(domain2d),
intent(INOUT) :: domain
2407 real,
allocatable :: t_nest(:,:,:), ps0(:,:)
2409 integer :: isd_p, ied_p, jsd_p, jed_p, isc_p, iec_p, jsc_p, jec_p
2410 integer :: isg, ieg, jsg,jeg, npx_p, npy_p
2411 integer :: istart, iend
2412 real :: qmass_b, qmass_a, fix = 1.
2413 logical :: used, conv_theta=.true.
2415 real :: qdp( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
2416 real,
allocatable,
dimension(:,:,:) :: qdp_coarse
2417 real,
allocatable,
dimension(:,:,:) :: var_src
2418 real,
allocatable,
dimension(:,:,:) :: pt_src, w_src, u_src, v_src
2419 real(kind=f_p),
allocatable :: q_diff(:,:,:)
2420 real :: L_sum_b(npz), L_sum_a(npz), blend_wt(parent_grid%npz)
2421 real :: pfull, ph1, ph2, rfcut, sgcut
2424 integer :: is, ie, js, je
2425 integer :: isd, ied, jsd, jed
2426 integer :: isu, ieu, jsu, jeu
2427 logical,
SAVE :: first_timestep = .true.
2437 isu = neststruct%isu
2438 ieu = neststruct%ieu
2439 jsu = neststruct%jsu
2440 jeu = neststruct%jeu
2442 upoff = neststruct%upoff
2446 if (
present(conv_theta_in)) conv_theta = conv_theta_in
2448 if ((.not. parent_grid%neststruct%parent_proc) .and. (.not. neststruct%child_proc))
return 2450 call mpp_get_data_domain( parent_grid%domain, &
2451 isd_p, ied_p, jsd_p, jed_p )
2452 call mpp_get_compute_domain( parent_grid%domain, &
2453 isc_p, iec_p, jsc_p, jec_p )
2455 ph2 = parent_grid%ak(1)
2456 rfcut = max(flagstruct%rf_cutoff, parent_grid%flagstruct%rf_cutoff)
2457 sgcut = ak(flagstruct%n_sponge+1) + bk(flagstruct%n_sponge+1)*flagstruct%p_ref
2458 sgcut = max(sgcut, parent_grid%ak(parent_grid%flagstruct%n_sponge+1) + parent_grid%bk(parent_grid%flagstruct%n_sponge+1)*parent_grid%flagstruct%p_ref)
2459 rfcut = max(rfcut, sgcut)
2460 do k=1,parent_grid%npz
2462 ph2 = parent_grid%ak(k+1) + parent_grid%bk(k+1)*parent_grid%flagstruct%p_ref
2463 pfull = (ph2 - ph1) / log(ph2/ph1)
2465 if ( pfull <= ak(3) .or. k <= 2 )
then 2469 elseif (pfull <= rfcut)
then 2473 blend_wt(k) = neststruct%update_blend
2477 if (parent_grid%neststruct%parent_proc .and. is_master() .and. first_timestep)
then 2478 print*,
' TWO-WAY BLENDING WEIGHTS' 2479 ph2 = parent_grid%ak(1)
2480 do k=1,parent_grid%npz
2482 ph2 = parent_grid%ak(k+1) + parent_grid%bk(k+1)*parent_grid%flagstruct%p_ref
2483 pfull = (ph2 - ph1) / log(ph2/ph1)
2484 print*, k, pfull, blend_wt(k)
2486 first_timestep = .false.
2490 if (neststruct%nestupdate /= 3 .and. neststruct%nestupdate /= 8)
then 2492 if (neststruct%child_proc)
then 2493 call mpp_update_domains(ps, domain, complete=.true.)
2494 if (.not. flagstruct%hydrostatic)
call mpp_update_domains(w, domain)
2496 call mpp_update_domains(u, v, domain, gridtype=dgrid_ne)
2498 allocate(pt_src(isd_p:ied_p,jsd_p:jed_p,npz))
2501 if (conv_theta)
then 2503 if (neststruct%child_proc)
then 2507 allocate(t_nest(isd:ied,jsd:jed,1:npz))
2512 t_nest(i,j,k) = pt(i,j,k)*pkz(i,j,k)/(1.+zvir*q(i,j,k,sphum))
2516 call mpp_update_domains(t_nest, domain, complete=.true.)
2520 t_nest, global_nest_domain, &
2521 gridstruct%dx, gridstruct%dy, gridstruct%area, &
2522 bd, isd_p, ied_p, jsd_p, jed_p, isd, ied, jsd, jed, &
2523 neststruct%isu, neststruct%ieu, neststruct%jsu, neststruct%jeu, &
2524 npx, npy, npz, 0, 0, &
2525 neststruct%refinement, neststruct%nestupdate, upoff, 0, &
2526 parent_grid%neststruct%parent_proc, neststruct%child_proc, parent_grid, grid_number-1)
2527 if (neststruct%child_proc)
deallocate(t_nest)
2529 if (neststruct%child_proc)
call mpp_update_domains(pt, domain, complete=.true.)
2532 pt, global_nest_domain, &
2533 gridstruct%dx, gridstruct%dy, gridstruct%area, &
2534 bd, isd_p, ied_p, jsd_p, jed_p, isd, ied, jsd, jed, &
2535 neststruct%isu, neststruct%ieu, neststruct%jsu, neststruct%jeu, &
2536 npx, npy, npz, 0, 0, &
2537 neststruct%refinement, neststruct%nestupdate, upoff, 0, &
2538 parent_grid%neststruct%parent_proc, neststruct%child_proc, parent_grid, grid_number-1)
2548 if ( (neststruct%child_proc .and. .not. flagstruct%hydrostatic) .or. &
2549 (parent_grid%neststruct%parent_proc .and. .not. parent_grid%flagstruct%hydrostatic) )
then 2551 allocate(w_src(isd_p:ied_p,jsd_p:jed_p,npz))
2554 gridstruct%dx, gridstruct%dy, gridstruct%area, &
2555 bd, isd_p, ied_p, jsd_p, jed_p, isd, ied, jsd, jed, &
2556 neststruct%isu, neststruct%ieu, neststruct%jsu, neststruct%jeu, &
2557 npx, npy, npz, 0, 0, &
2558 neststruct%refinement, neststruct%nestupdate, upoff, 0, &
2559 parent_grid%neststruct%parent_proc, neststruct%child_proc, parent_grid, grid_number-1)
2575 allocate(u_src(isd_p:ied_p, jsd_p:jed_p+1,npz))
2576 allocate(v_src(isd_p:ied_p+1,jsd_p:jed_p,npz))
2580 gridstruct%dx, gridstruct%dy, gridstruct%area, &
2581 bd, isd_p, ied_p, jsd_p, jed_p, isd, ied, jsd, jed, &
2582 neststruct%isu, neststruct%ieu, neststruct%jsu, neststruct%jeu, &
2583 npx, npy, npz, 0, 1, 1, 0, &
2584 neststruct%refinement, neststruct%nestupdate, upoff, 0, &
2585 parent_grid%neststruct%parent_proc, neststruct%child_proc, parent_grid, grid_number-1, gridtype=dgrid_ne)
2590 if (neststruct%nestupdate >= 5 .and. npz > 4)
then 2597 allocate(ps0(isd_p:ied_p,jsd_p:jed_p))
2598 if (parent_grid%neststruct%parent_proc)
then 2600 parent_grid%ps = parent_grid%ptop
2603 do k=1,parent_grid%npz
2605 parent_grid%ps(i,j) = parent_grid%ps(i,j) + &
2606 parent_grid%delp(i,j,k)
2611 ps0 = parent_grid%ps
2614 if (neststruct%child_proc)
then 2621 ps(i,j) = ps(i,j) + delp(i,j,k)
2628 gridstruct%dx, gridstruct%dy, gridstruct%area, &
2629 bd, isd_p, ied_p, jsd_p, jed_p, isd, ied, jsd, jed, &
2630 neststruct%isu, neststruct%ieu, neststruct%jsu, neststruct%jeu, &
2632 neststruct%refinement, neststruct%nestupdate, upoff, 0, parent_grid%neststruct%parent_proc, neststruct%child_proc, parent_grid, grid_number-1)
2638 if (parent_grid%neststruct%parent_proc)
then 2639 call mpp_update_domains(parent_grid%ps, parent_grid%domain, complete=.false.)
2640 call mpp_update_domains(ps0, parent_grid%domain, complete=.true.)
2645 if (parent_grid%global_tile == neststruct%parent_tile)
then 2647 if (parent_grid%neststruct%parent_proc)
then 2653 if (.not. parent_grid%flagstruct%remap_t)
then 2655 do k=1,parent_grid%npz
2658 parent_grid%pt(i,j,k) = &
2659 parent_grid%pt(i,j,k)/parent_grid%pkz(i,j,k)*&
2660 (1.+zvir*parent_grid%q(i,j,k,sphum))
2677 parent_grid%pt, parent_grid%q, parent_grid%w, &
2678 parent_grid%flagstruct%hydrostatic, &
2679 npz, ps0, ak, bk, pt_src, w_src, &
2680 zvir, parent_grid%ptop, ncnst, &
2681 parent_grid%flagstruct%kord_tm, parent_grid%flagstruct%kord_tr, &
2682 parent_grid%flagstruct%kord_wz, &
2683 isc_p, iec_p, jsc_p, jec_p, isd_p, ied_p, jsd_p, jed_p, .false., &
2684 neststruct%isu, neststruct%ieu, neststruct%jsu, neststruct%jeu, blend_wt)
2685 if (.not. parent_grid%flagstruct%remap_t)
then 2687 do k=1,parent_grid%npz
2690 parent_grid%pt(i,j,k) = &
2691 parent_grid%pt(i,j,k)*parent_grid%pkz(i,j,k) / &
2692 (1.+zvir*parent_grid%q(i,j,k,sphum))
2698 call update_remap_uv(parent_grid%npz, parent_grid%ak, parent_grid%bk, &
2699 parent_grid%ps, parent_grid%u, parent_grid%v, &
2700 npz, ak, bk, ps0, u_src, v_src, &
2701 parent_grid%flagstruct%kord_mt, &
2702 isc_p, iec_p, jsc_p, jec_p, isd_p, ied_p, jsd_p, jed_p, parent_grid%ptop, &
2703 neststruct%isu, neststruct%ieu, neststruct%jsu, neststruct%jeu, blend_wt)
2709 if (
allocated(ps0))
deallocate(ps0)
2725 subroutine level_sum(q, area, domain, bd, npz, L_sum)
2727 integer,
intent(IN) :: npz
2729 real,
intent(in) :: area( bd%isd:bd%ied ,bd%jsd:bd%jed)
2730 real,
intent(in) :: q( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
2731 real,
intent(OUT) :: L_sum( npz )
2732 type(domain2d),
intent(IN) :: domain
2734 integer :: i, j, k, n
2742 qa = qa + q(i,j,k)*area(i,j)
2745 call mp_reduce_sum(qa)
2756 subroutine remap_up_k(ps_src, ps_dst, ak_src, bk_src, ak_dst, bk_dst, var_src, var_dst, &
2757 bd, istart, iend, jstart, jend, istag, jstag, npz_src, npz_dst, iv, kord, blend_wt, log_pe)
2761 integer,
intent(IN) :: istart, iend, jstart, jend, npz_dst, npz_src, iv, kord, istag, jstag
2762 logical,
intent(IN) :: log_pe
2763 real,
intent(INOUT) :: ps_src(bd%isd:bd%ied,bd%jsd:bd%jed), var_src(bd%isd:bd%ied+istag,bd%jsd:bd%jed+jstag,npz_src)
2764 real,
intent(INOUT) :: ps_dst(bd%isd:bd%ied,bd%jsd:bd%jed), var_dst(bd%isd:bd%ied+istag,bd%jsd:bd%jed+jstag,npz_dst)
2765 real,
intent(IN) :: blend_wt(npz_dst), ak_src(npz_src+1), bk_src(npz_src+1), ak_dst(npz_dst+1), bk_dst(npz_dst+1)
2768 real pe_src(istart:iend,npz_src+1)
2769 real pe_dst(istart:iend,npz_dst+1)
2770 real peln_src(istart:iend,npz_src+1)
2771 real peln_dst(istart:iend,npz_dst+1)
2772 character(120) :: errstring
2773 real var_dst_unblend(istart:iend,npz_dst)
2776 if (iend < istart)
return 2777 if (jend < jstart)
return 2793 pe_src(i,k) = ak_src(k) + 0.5*(ps_src(i,j)+ps_src(i-1,j))*bk_src(k)
2798 pe_dst(i,k) = ak_dst(k) + 0.5*(ps_dst(i,j)+ps_dst(i-1,j))*bk_dst(k)
2802 elseif (jstag > 0)
then 2807 pe_src(i,k) = ak_src(k) + 0.5*(ps_src(i,j)+ps_src(i,j-1))*bk_src(k)
2812 pe_dst(i,k) = ak_dst(k) + 0.5*(ps_dst(i,j)+ps_dst(i,j-1))*bk_dst(k)
2821 pe_src(i,k) = ak_src(k) + ps_src(i,j)*bk_src(k)
2826 pe_dst(i,k) = ak_dst(k) + ps_dst(i,j)*bk_dst(k)
2840 peln_src(i,k) = log(pe_src(i,k))
2846 peln_dst(i,k) = log(pe_dst(i,k))
2851 call mappm(npz_src, peln_src, var_src(istart:iend,j:j,:), &
2852 npz_dst, peln_dst, var_dst_unblend, &
2853 istart, iend, iv, kord, peln_dst(istart,1))
2859 var_dst(i,j,k) = var_dst(i,j,k)*bw2 + var_dst_unblend(i,k)*bw1
2870 call mappm(npz_src, pe_src, var_src(istart:iend,j:j,:), &
2871 npz_dst, pe_dst, var_dst_unblend, &
2872 istart, iend, iv, kord, pe_dst(istart,1))
2878 var_dst(i,j,k) = var_dst(i,j,k)*bw2 + var_dst_unblend(i,k)*bw1
2888 u, v, w, delz, pt, delp, q, &
2889 ps, pe, pk, peln, pkz, phis, ua, va, &
2890 ptop, gridstruct, flagstruct, &
2894 real,
intent(IN) :: ptop
2896 integer,
intent(IN) :: ng, npx, npy, npz
2897 integer,
intent(IN) :: ncnst
2899 real,
intent(inout),
dimension(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz) :: u
2900 real,
intent(inout),
dimension(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz) :: v
2901 real,
intent(inout) :: w( bd%isd: ,bd%jsd: ,1: )
2902 real,
intent(inout) :: pt( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
2903 real,
intent(inout) :: delp(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
2904 real,
intent(inout) :: q( bd%isd:bd%ied ,bd%jsd:bd%jed ,npz, ncnst)
2905 real,
intent(inout) :: delz(bd%is: ,bd%js: ,1: )
2912 real,
intent(inout) :: ps (bd%isd:bd%ied ,bd%jsd:bd%jed)
2913 real,
intent(inout) :: pe (bd%is-1:bd%ie+1, npz+1,bd%js-1:bd%je+1)
2914 real,
intent(inout) :: pk (bd%is:bd%ie,bd%js:bd%je, npz+1)
2915 real,
intent(inout) :: peln(bd%is:bd%ie,npz+1,bd%js:bd%je)
2916 real,
intent(inout) :: pkz (bd%is:bd%ie,bd%js:bd%je,npz)
2921 real,
intent(inout) :: phis(bd%isd:bd%ied,bd%jsd:bd%jed)
2923 real,
intent(inout),
dimension(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz):: ua, va
2926 type(domain2d),
intent(INOUT) :: domain
2927 type(time_type),
intent(IN) :: Time
2929 logical :: bad_range
2931 integer :: is, ie, js, je
2932 integer :: isd, ied, jsd, jed
2944 gridstruct, npx, npy, npz, &
2945 1, gridstruct%grid_type, domain, &
2946 gridstruct%bounded_domain, flagstruct%c2l_ord, bd)
2960 q, ng, flagstruct%ncnst, gridstruct%area_64, 0., &
2962 flagstruct%moist_phys, flagstruct%hydrostatic, &
2963 flagstruct%nwat, domain, flagstruct%adiabatic, .false.)
2967 if (flagstruct%range_warn)
then 2968 call range_check(
'TA update', pt, is, ie, js, je, ng, npz, gridstruct%agrid, 130., 350., bad_range, time)
2969 call range_check(
'UA update', ua, is, ie, js, je, ng, npz, gridstruct%agrid, -220., 250., bad_range, time)
2970 call range_check(
'VA update', va, is, ie, js, je, ng, npz, gridstruct%agrid, -220., 220., bad_range, time)
2971 if (.not. flagstruct%hydrostatic)
then 2972 call range_check(
'W update', w, is, ie, js, je, ng, npz, gridstruct%agrid, -50., 100., bad_range, time)
2984 subroutine update_remap_tqw( npz, ak_dst, bk_dst, ps_dst, t_dst, q_dst, w_dst, &
2986 kmd, ps_src, ak_src, bk_src, t_src, w_src, &
2987 zvir, ptop, nq, kord_tm, kord_tr, kord_wz, &
2988 is, ie, js, je, isd, ied, jsd, jed, do_q, &
2989 istart, iend, jstart, jend, blend_wt)
2990 integer,
intent(in):: npz, kmd, nq, kord_tm, kord_tr, kord_wz
2991 real,
intent(in):: zvir, ptop
2992 real,
intent(in):: ak_src(kmd+1), bk_src(kmd+1)
2993 real,
intent(in):: ak_dst(npz+1), bk_dst(npz+1), blend_wt(npz)
2994 real,
intent(in),
dimension(isd:ied,jsd:jed):: ps_src
2995 real,
intent(in),
dimension(isd:ied,jsd:jed):: ps_dst
2996 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz):: t_dst, w_dst
2997 real,
intent(inout),
dimension(isd:ied,jsd:jed,npz,nq):: q_dst
2998 real,
intent(in),
dimension(isd:ied,jsd:jed,kmd):: t_src, w_src
2999 integer,
intent(in) :: is, ie, js, je, isd, ied, jsd, jed, istart, iend, jstart, jend
3000 logical,
intent(in) :: hydrostatic, do_q
3002 real,
dimension(is:ie,kmd):: tp, qp
3003 real,
dimension(is:ie,kmd+1):: pe0, pn0
3004 real,
dimension(is:ie,npz):: qn1
3005 real,
dimension(is:ie,npz+1):: pe1, pn1
3009 if (do_q)
call mpp_error(fatal,
' update_remap_tqw: q remapping not yet supported')
3015 if (istart > iend .or. jstart > jend)
return 3020 do 5000 j=jstart,jend
3024 pe0(i,k) = ak_src(k) + bk_src(k)*ps_src(i,j)
3025 pn0(i,k) = log(pe0(i,k))
3030 pe1(i,k) = ak_dst(k) + bk_dst(k)*ps_dst(i,j)
3031 pn1(i,k) = log(pe1(i,k))
3038 qp(i,k) = q_dst(i,j,k,iq)
3041 call mappm(kmd, pe0, qp, npz, pe1, qn1, is,ie, 0, kord_tr, ptop)
3044 q_dst(i,j,k,iq) = qn1(i,k)
3052 tp(i,k) = t_src(i,j,k)
3056 call mappm(kmd, pn0(istart:iend,:), tp(istart:iend,:), npz, pn1(istart:iend,:), qn1(istart:iend,:), istart,iend, 1, abs(kord_tm), ptop)
3062 t_dst(i,j,k) = qn1(i,k)*wt1 + t_dst(i,j,k)*wt2
3066 if (.not. hydrostatic)
then 3069 tp(i,k) = w_src(i,j,k)
3074 call mappm(kmd, pe0(istart:iend,:), tp(istart:iend,:), npz, pe1(istart:iend,:), qn1(istart:iend,:), istart,iend, -1, kord_wz, ptop)
3080 w_dst(i,j,k) = qn1(i,k)*wt1 + w_dst(i,j,k)*wt2
3090 subroutine update_remap_uv(npz, ak_dst, bk_dst, ps_dst, u_dst, v_dst, &
3091 kmd, ak_src, bk_src, ps_src, u_src, v_src, &
3093 is, ie, js, je, isd, ied, jsd, jed, ptop, &
3094 istart, iend, jstart, jend, blend_wt)
3095 integer,
intent(in):: npz
3096 real,
intent(in):: ak_dst(npz+1), bk_dst(npz+1), blend_wt(npz)
3097 real,
intent(in):: ps_dst(isd:ied,jsd:jed)
3098 real,
intent(inout),
dimension(isd:ied,jsd:jed+1,npz):: u_dst
3099 real,
intent(inout),
dimension(isd:ied+1,jsd:jed,npz):: v_dst
3100 integer,
intent(in):: kmd
3101 real,
intent(in):: ak_src(kmd+1), bk_src(kmd+1)
3102 real,
intent(in):: ps_src(isd:ied,jsd:jed)
3103 real,
intent(inout),
dimension(isd:ied,jsd:jed+1,kmd):: u_src
3104 real,
intent(inout),
dimension(isd:ied+1,jsd:jed,kmd):: v_src
3106 integer,
intent(in):: kord_mt
3107 real,
intent(IN) :: ptop
3108 integer,
intent(in) :: is, ie, js, je, isd, ied, jsd, jed
3109 integer,
intent(IN) :: istart, iend, jstart, jend
3112 real,
dimension(is:ie+1,kmd+1):: pe0
3113 real,
dimension(is:ie+1,npz+1):: pe1
3114 real,
dimension(is:ie+1,kmd):: qt
3115 real,
dimension(is:ie+1,npz):: qn1
3122 if (istart > iend .or. jstart > jend)
return 3135 pe0(i,k) = ak_src(k) + bk_src(k)*0.5*(ps_src(i,j)+ps_src(i,j-1))
3143 pe1(i,k) = ak_dst(k) + bk_dst(k)*0.5*(ps_dst(i,j)+ps_dst(i,j-1))
3152 qt(i,k) = u_src(i,j,k)
3156 call mappm(kmd, pe0(istart:iend,:), qt(istart:iend,:), npz, pe1(istart:iend,:), qn1(istart:iend,:), istart,iend, -1, kord_mt, ptop)
3161 u_dst(i,j,k) = qn1(i,k)*wt1 + u_dst(i,j,k)*wt2
3178 pe0(i,k) = ak_src(k) + bk_src(k)*0.5*(ps_src(i,j)+ps_src(i-1,j))
3186 pe1(i,k) = ak_dst(k) + bk_dst(k)*0.5*(ps_dst(i,j)+ps_dst(i-1,j))
3195 qt(i,k) = v_src(i,j,k)
3199 call mappm(kmd, pe0(istart:iend+1,:), qt(istart:iend+1,:), npz, pe1(istart:iend+1,:), qn1(istart:iend+1,:), istart,iend+1, -1, 8, ptop)
3204 v_dst(i,j,k) = qn1(i,k)*wt1 + v_dst(i,j,k)*wt2
subroutine remap_bc_direct(pe_lag_BC, pe_eul_BC, var_lag_BC, var, npx, npy, npz, npz_coarse, bd, istag, jstag, iv, kord, do_log_pe)
subroutine, public twoway_nesting(Atm, ngrids, grids_on_this_pe, zvir, Time, this_grid)
The subroutine'twoway_nesting' performs a two-way update of nested-grid data onto the parent grid...
real, dimension(:,:,:), allocatable, target dum_east
subroutine, public divergence_corner_nest(u, v, ua, va, divg_d, gridstruct, flagstruct, bd)
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.
subroutine after_twoway_nest_update(npx, npy, npz, ng, ncnst, u, v, w, delz, pt, delp, q, ps, pe, pk, peln, pkz, phis, ua, va, ptop, gridstruct, flagstruct, domain, bd, Time)
type(fv_nest_bc_type_3d) divg_buf
The type 'fv_grid_type' is made up of grid-dependent information from fv_grid_tools and fv_grid_utils...
real, dimension(:,:,:), allocatable, target dum_south
subroutine setup_pt_nh_bc_k(ptBC, sphumBC, delpBC, delzBC, liq_watBC, rainwatBC, ice_watBC, snowwatBC, graupelBC, zvir, isd_BC, ied_BC, istart, iend, jstart, jend, npz)
subroutine, public neg_adj3(is, ie, js, je, ng, kbot, hydrostatic, peln, delz, pt, dp, qv, ql, qr, qi, qs, qg, qa, check_negative)
type(fv_nest_bc_type_3d) pe_u_buf
type(fv_nest_bc_type_3d) delz_buf
The interface'update_coarse_grid_mpp'contains subroutines that fetch data from the nested grid and in...
subroutine set_nh_bcs_t0(neststruct)
type(fv_nest_bc_type_3d) vc_buf
subroutine set_bcs_t0(ncnst, hydrostatic, neststruct)
subroutine, public mappm(km, pe1, q1, kn, pe2, q2, i1, i2, iv, kord, ptop)
The subroutine 'mappm' is a general-purpose routine for remapping one set of vertical levels to anoth...
real, public sphum_ll_fix
subroutine, public setup_nested_grid_bcs(npx, npy, npz, zvir, ncnst, u, v, w, pt, delp, delz, q, uc, vc, nested, inline_q, make_nh, ng, gridstruct, flagstruct, neststruct, nest_timestep, tracer_nest_timestep, domain, parent_grid, bd, nwat, ak, bk)
The subroutine 'setup_nested_grid_BCs' fetches data from the coarse grid to set up the nested-grid bo...
subroutine set_bc_direct(pe_src_BC, pe_dst_BC, buf, var, neststruct, npx, npy, npz, npz_coarse, ng, bd, istag, jstag, iv, kord)
subroutine setup_eul_pe_bc(pe_src_BC, pe_eul_BC, ak_dst, bk_dst, npx, npy, npz, npz_src, istag, jstag, bd, make_src_in, ak_src, bk_src)
The module 'sw_core' advances the forward step of the Lagrangian dynamics as described by ...
subroutine setup_pt_bc_k(ptBC, sphumBC, peBC, zvir, isd_BC, ied_BC, istart, iend, jstart, jend, npz)
type(fv_nest_bc_type_3d) uc_buf
subroutine, public p_var(km, ifirst, ilast, jfirst, jlast, ptop, ptop_min, delp, delz, pt, ps, pe, peln, pk, pkz, cappa, q, ng, nq, area, dry_mass, adjust_dry_mass, mountain, moist_phys, hydrostatic, nwat, domain, adiabatic, make_nh)
the subroutine 'p_var' computes auxiliary pressure variables for a hydrostatic state.
subroutine, public divergence_corner(u, v, ua, va, divg_d, gridstruct, flagstruct, bd)
The subroutine 'divergence_corner' computes the cell-mean divergence on the "dual grid"...
subroutine setup_pt_nh_bc(pt_BC, delp_BC, delz_BC, sphum_BC, q_BC, nq, npx, npy, npz, zvir, bd)
real function, public g_sum(domain, p, ifirst, ilast, jfirst, jlast, ngc, area, mode, reproduce)
The function 'g_sum' is the fast version of 'globalsum'.
The module 'fv_sg' performs FV sub-grid mixing.
'allocate_fv_nest_BC_type' is an interface to subroutines that allocate the 'fv_nest_BC_type' structu...
type(fv_nest_bc_type_3d) v_buf
subroutine remap_bc_k(pe_lagBC, pe_eulBC, var_lagBC, var_eulBC, isd_BC, ied_BC, istart, iend, jstart, jend, npz, npz_coarse, iv, kord, log_pe)
subroutine, public remap_2d(km, pe1, q1, kn, pe2, q2, i1, i2, iv, kord)
subroutine setup_eul_pe_bc_k(pesrcBC, peeulBC, ak_dst, bk_dst, isd_BC, ied_BC, istart, iend, jstart, jend, npz, npz_src, make_src, ak_src, bk_src)
type(fv_nest_bc_type_3d) delp_buf
The module 'fv_timing' contains FV3 timers.
The module 'boundary' contains utility routines for grid nesting and boundary conditions.
'deallocate_fv_nest_BC_type' is an interface to a subroutine that deallocates the 'fv_nest_BC_type' s...
type(fv_nest_bc_type_3d) pe_v_buf
real, parameter, public ptop_min
integer, parameter, public f_p
subroutine d2a_setup(u, v, ua, va, dord4, isd, ied, jsd, jed, is, ie, js, je, npx, npy, grid_type, bounded_domain, cosa_s, rsin2)
subroutine setup_eul_delp_bc(delp_lag_BC, delp_eul_BC, pe_lag_BC, pe_eul_BC, ak_dst, bk_dst, npx, npy, npz, npz_coarse, ptop_src, bd)
The module 'fv_mapz' contains the vertical mapping routines .
real, dimension(:,:,:), allocatable, target dum_west
type(fv_nest_bc_type_3d) w_buf
subroutine remap_delz_bc(pe_lag_BC, pe_eul_BC, delp_lag_BC, delz_lag_BC, delp_eul_BC, delz_eul_BC, npx, npy, npz, npz_coarse, bd, istag, jstag, iv, kord)
subroutine d2c_setup(u, v, ua, va, uc, vc, dord4, isd, ied, jsd, jed, is, ie, js, je, npx, npy, grid_type, bounded_domain, se_corner, sw_corner, ne_corner, nw_corner, rsin_u, rsin_v, cosa_s, rsin2)
subroutine, public cubed_to_latlon(u, v, ua, va, gridstruct, npx, npy, km, mode, grid_type, domain, bounded_domain, c2l_ord, bd)
The module 'fv_arrays' contains the 'fv_atmos_type' and associated datatypes.
interface 'nested_grid_BC' includes subroutines 'nested_grid_BC_2d' and 'nested_grid_BC_3d' that fetc...
type(fv_nest_bc_type_3d), dimension(:), allocatable q_buf
subroutine setup_eul_delp_bc_k(delplagBC, delpeulBC, pelagBC, peeulBC, ptop_src, ak_dst, bk_dst, isd_BC, ied_BC, istart, iend, jstart, jend, npz, npz_coarse)
real, dimension(:), allocatable rw
type(fv_nest_bc_type_3d) pe_b_buf
subroutine update_remap_tqw(npz, ak_dst, bk_dst, ps_dst, t_dst, q_dst, w_dst, hydrostatic, kmd, ps_src, ak_src, bk_src, t_src, w_src, zvir, ptop, nq, kord_tm, kord_tr, kord_wz, is, ie, js, je, isd, ied, jsd, jed, do_q, istart, iend, jstart, jend, blend_wt)
The subroutine 'update_remap_tqw' remaps (interpolated) nested-grid data to the coarse-grid's vertica...
type(fv_nest_bc_type_3d) pt_buf
subroutine, public set_physics_bcs(ps, u_dt, v_dt, flagstruct, gridstruct, neststruct, npx, npy, npz, ng, ak, bk, bd)
subroutine timing_on(blk_name)
The subroutine 'timing_on' starts a timer.
subroutine copy_ps_bc(ps, pe_BC, npx, npy, npz, istag, jstag, bd)
subroutine setup_pt_bc(pt_BC, pe_eul_BC, sphum_BC, npx, npy, npz, zvir, bd)
@ The module 'fv_diagnostics' contains routines to compute diagnosic fields.
subroutine twoway_nest_update(npx, npy, npz, zvir, ncnst, sphum, u, v, w, pt, delp, q, pe, pkz, delz, ps, ptop, ak, bk, gridstruct, flagstruct, neststruct, domain, parent_grid, bd, grid_number, conv_theta_in)
The module 'fv_grid_utils' contains routines for setting up and computing grid-related quantities...
real, dimension(:,:,:), allocatable, target dum_north
subroutine compute_specific_volume_bc_k(delpBC, delzBC, isd_BC, ied_BC, istart, iend, jstart, jend, npz)
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...
subroutine level_sum(q, area, domain, bd, npz, L_sum)
subroutine, public nested_grid_bc_save_proc(nest_domain, ind, wt, istag, jstag, npx, npy, npz, bd, nest_BC, nest_BC_buffers, pd_in)
The subroutine 'nested_grid_BC_save_proc' saves data received by 'nested_grid_BC_recv' into the datat...
real, dimension(:,:), allocatable te_2d_coarse
subroutine remap_bc(pe_lag_BC, pe_eul_BC, var_lag_BC, var_eul_BC, npx, npy, npz, npz_coarse, bd, istag, jstag, iv, kord, varname, do_log_pe)
real, dimension(:), allocatable rf
subroutine remap_up_k(ps_src, ps_dst, ak_src, bk_src, ak_dst, bk_dst, var_src, var_dst, bd, istart, iend, jstart, jend, istag, jstag, npz_src, npz_dst, iv, kord, blend_wt, log_pe)
subroutine update_remap_uv(npz, ak_dst, bk_dst, ps_dst, u_dst, v_dst, kmd, ak_src, bk_src, ps_src, u_src, v_src, kord_mt, is, ie, js, je, isd, ied, jsd, jed, ptop, istart, iend, jstart, jend, blend_wt)
subroutine compute_delz_bc_k(delpBC, delzBC, isd_BC, ied_BC, istart, iend, jstart, jend, npz)
real, dimension(:,:,:), allocatable dp1_coarse
The module 'fv_nesting' is a collection of routines pertaining to grid nesting .
type(fv_nest_bc_type_3d) u_buf