21 #include <fms_platform.h> 29 use,
intrinsic :: iso_fortran_env, only: real64, real32
33 integer,
parameter ::
real4 = real32
34 integer,
parameter ::
real8 = real64
57 integer ::id_ps, id_slp, id_ua, id_va, id_pt, id_omga, id_vort, &
58 id_tm, id_pv, id_zsurf, id_oro, id_sgh, id_divg, id_w, &
59 id_ke, id_te, id_zs, id_ze, id_mq, id_vorts, id_us, id_vs, &
60 id_tq, id_rh, id_c15, id_c25, id_c35, id_c45, &
61 id_f15, id_f25, id_f35, id_f45, id_ctp, &
62 id_ppt, id_ts, id_tb, id_ctt, id_pmask, id_pmaskv2, &
63 id_delp, id_delz, id_zratio, id_ws, id_iw, id_lw, &
65 id_qn, id_qn200, id_qn500, id_qn850, id_qp, id_mdt, id_qdt, id_aam, id_amdt, &
66 id_acly, id_acl, id_acl2, id_dbz, id_maxdbz, id_basedbz, id_dbz4km
69 integer :: id_vort200, id_vort500, id_w500, id_w700
70 integer :: id_vort850, id_w850, id_x850, id_srh, id_srh25, id_srh01, &
71 id_uh03, id_uh25, id_theta_e, &
72 id_w200, id_s200, id_sl12, id_sl13, id_w5km, id_rain5km, id_w2500m
74 integer,
allocatable :: id_u(:), id_v(:), id_t(:), id_h(:), id_q(:), id_omg(:)
76 integer:: id_u_plev, id_v_plev, id_t_plev, id_h_plev, id_q_plev, id_omg_plev
78 integer :: id_rh10, id_rh50, id_rh100, id_rh200, id_rh250, id_rh300, &
79 id_rh500, id_rh700, id_rh850, id_rh925, id_rh1000
81 integer :: id_rh1000_cmip, id_rh925_cmip, id_rh850_cmip, id_rh700_cmip, id_rh500_cmip, &
82 id_rh300_cmip, id_rh250_cmip, id_rh100_cmip, id_rh50_cmip, id_rh10_cmip
85 integer :: id_u100m, id_v100m, id_w100m
88 integer ic_ps, ic_ua, ic_va, ic_ppt
90 integer,
allocatable :: id_tracer(:)
92 integer,
allocatable :: id_tracer_dmmr(:)
93 integer,
allocatable :: id_tracer_dvmr(:)
94 real,
allocatable :: w_mr(:)
96 real,
allocatable :: phalf(:)
97 real,
allocatable :: zsurf(:,:)
98 real,
allocatable :: zxg(:,:)
99 real,
allocatable :: pt1(:)
102 logical :: initialized = .false.
103 real sphum, liq_wat, ice_wat
104 real rainwat, snowwat, graupel
116 real(kind=R_GRID),
allocatable,
dimension(:,:,:) :: grid_64, agrid_64
117 real(kind=R_GRID),
allocatable,
dimension(:,:) :: area_64, area_c_64
118 real(kind=R_GRID),
allocatable,
dimension(:,:) :: sina_64, cosa_64
119 real(kind=R_GRID),
allocatable,
dimension(:,:) :: dx_64, dy_64
120 real(kind=R_GRID),
allocatable,
dimension(:,:) :: dxc_64, dyc_64
121 real(kind=R_GRID),
allocatable,
dimension(:,:) :: dxa_64, dya_64
123 real,
allocatable,
dimension(:,:,:) :: grid, agrid
124 real,
allocatable,
dimension(:,:) :: area, area_c
125 real,
allocatable,
dimension(:,:) :: rarea, rarea_c
127 real,
allocatable,
dimension(:,:) :: sina, cosa
128 real,
allocatable,
dimension(:,:,:) :: e1,e2
129 real,
allocatable,
dimension(:,:) :: dx, dy
130 real,
allocatable,
dimension(:,:) :: dxc, dyc
131 real,
allocatable,
dimension(:,:) :: dxa, dya
132 real,
allocatable,
dimension(:,:) :: rdx, rdy
133 real,
allocatable,
dimension(:,:) :: rdxc, rdyc
134 real,
allocatable,
dimension(:,:) :: rdxa, rdya
137 real(kind=R_GRID),
allocatable :: edge_s(:)
138 real(kind=R_GRID),
allocatable :: edge_n(:)
139 real(kind=R_GRID),
allocatable :: edge_w(:)
140 real(kind=R_GRID),
allocatable :: edge_e(:)
142 real(kind=R_GRID),
allocatable :: edge_vect_s(:)
143 real(kind=R_GRID),
allocatable :: edge_vect_n(:)
144 real(kind=R_GRID),
allocatable :: edge_vect_w(:)
145 real(kind=R_GRID),
allocatable :: edge_vect_e(:)
147 real(kind=R_GRID),
allocatable :: ex_s(:)
148 real(kind=R_GRID),
allocatable :: ex_n(:)
149 real(kind=R_GRID),
allocatable :: ex_w(:)
150 real(kind=R_GRID),
allocatable :: ex_e(:)
152 real,
allocatable :: l2c_u(:,:), l2c_v(:,:)
154 real,
allocatable :: divg_u(:,:), divg_v(:,:)
156 real,
allocatable :: del6_u(:,:), del6_v(:,:)
158 real,
allocatable :: a11(:,:)
159 real,
allocatable :: a12(:,:)
160 real,
allocatable :: a21(:,:)
161 real,
allocatable :: a22(:,:)
163 real,
allocatable :: z11(:,:)
164 real,
allocatable :: z12(:,:)
165 real,
allocatable :: z21(:,:)
166 real,
allocatable :: z22(:,:)
170 real,
allocatable :: cosa_u(:,:)
171 real,
allocatable :: cosa_v(:,:)
172 real,
allocatable :: cosa_s(:,:)
173 real,
allocatable :: sina_u(:,:)
174 real,
allocatable :: sina_v(:,:)
175 real,
allocatable :: rsin_u(:,:)
176 real,
allocatable :: rsin_v(:,:)
177 real,
allocatable :: rsina(:,:)
178 real,
allocatable :: rsin2(:,:)
179 real(kind=R_GRID),
allocatable :: ee1(:,:,:)
180 real(kind=R_GRID),
allocatable :: ee2(:,:,:)
181 real(kind=R_GRID),
allocatable :: ec1(:,:,:)
182 real(kind=R_GRID),
allocatable :: ec2(:,:,:)
183 real(kind=R_GRID),
allocatable :: ew(:,:,:,:)
184 real(kind=R_GRID),
allocatable :: es(:,:,:,:)
189 real,
allocatable :: sin_sg(:,:,:)
190 real,
allocatable :: cos_sg(:,:,:)
194 real(kind=R_GRID),
allocatable :: en1(:,:,:)
195 real(kind=R_GRID),
allocatable :: en2(:,:,:)
198 real,
allocatable :: eww(:,:)
199 real,
allocatable :: ess(:,:)
202 real(kind=R_GRID),
allocatable :: vlon(:,:,:), vlat(:,:,:)
203 real,
allocatable :: fc(:,:), f0(:,:)
205 integer,
dimension(:,:,:),
allocatable :: iinta, jinta, iintb, jintb
209 integer :: npx_g, npy_g, ntiles_g
211 real(kind=R_GRID) :: global_area
212 logical :: g_sum_initialized = .false.
213 logical:: sw_corner, se_corner, ne_corner, nw_corner
215 real(kind=R_GRID) :: da_min, da_max, da_min_c, da_max_c
220 logical :: latlon = .false.
221 logical :: cubed_sphere = .false.
222 logical :: have_south_pole = .false.
223 logical :: have_north_pole = .false.
224 logical :: stretched_grid = .false.
226 logical :: square_domain = .false.
232 logical,
pointer :: nested
252 character(len=80) :: grid_name =
'Gnomonic' 253 character(len=120):: grid_file =
'Inline' 264 integer :: hord_mt = 9
265 integer :: kord_mt = 8
266 integer :: kord_wz = 8
269 integer :: hord_vt = 9
272 integer :: hord_tm = 9
273 integer :: hord_dp = 9
274 integer :: kord_tm = 8
277 integer :: hord_tr = 12
281 integer :: kord_tr = 8
296 real :: d2_bg_k1 = 4.
297 real :: d2_bg_k2 = 2.
298 real :: d2_divg_max_k1 = 0.15
299 real :: d2_divg_max_k2 = 0.08
300 real :: damp_k_k1 = 0.2
301 real :: damp_k_k2 = 0.12
304 integer :: n_zs_filter=0
305 integer :: nord_zs_filter=4
306 logical :: full_zs_filter=.false.
308 logical :: consv_am = .false.
309 logical :: do_sat_adj= .false.
310 logical :: do_f3d = .false.
311 logical :: no_dycore = .false.
312 logical :: convert_ke = .false.
313 logical :: do_vort_damp = .false.
314 logical :: use_old_omega = .true.
318 integer :: n_zfilter = 0
319 integer :: n_sponge = 0
322 logical :: warm_start = .false.
323 logical :: inline_q = .true.
324 logical :: adiabatic = .true.
326 integer :: n_zfilter = 0
327 integer :: n_sponge = 1
330 logical :: warm_start = .true.
332 logical :: inline_q = .false.
333 logical :: adiabatic = .false.
338 real :: shift_fac = 18.
340 logical :: do_schmidt = .false.
341 real(kind=R_GRID) :: stretch_fac = 1.
342 real(kind=R_GRID) :: target_lat = -90.
343 real(kind=R_GRID) :: target_lon = 0.
355 logical :: reset_eta = .false.
358 integer :: n_split = 0
360 integer :: m_split = 0
361 integer :: k_split = 1
363 logical :: use_logp = .false.
379 integer :: q_split = 0
381 integer :: print_freq = 0
392 integer :: npz_rst = 0
397 integer :: ntiles = 1
399 integer :: nf_omega = 1
400 integer :: fv_sg_adj = -1
402 integer :: na_init = 0
404 real :: dry_mass = 98290.
405 integer :: nt_prog = 0
406 integer :: nt_phys = 0
409 real :: delt_max = 1.
414 real :: consv_te = 0.
416 real :: rf_cutoff = 30.e2
417 logical :: filter_phys = .false.
418 logical :: dwind_2d = .false.
419 logical :: breed_vortex_inline = .false.
420 logical :: range_warn = .false.
421 logical :: fill = .false.
422 logical :: fill_dp = .false.
423 logical :: fill_wz = .false.
424 logical :: check_negative = .false.
425 logical :: non_ortho = .true.
426 logical :: moist_phys = .true.
427 logical :: do_held_suarez = .false.
428 logical :: do_reed_physics = .false.
429 logical :: reed_cond_only = .false.
430 logical :: reproduce_sum = .true.
431 logical :: adjust_dry_mass = .false.
432 logical :: fv_debug = .false.
433 logical :: srf_init = .false.
434 logical :: mountain = .true.
435 integer :: remap_option = 0
436 logical :: z_tracer = .false.
440 logical :: old_divg_damp = .false.
451 logical :: fv_land = .false.
455 logical :: nudge = .false.
456 logical :: nudge_ic = .false.
457 logical :: ncep_ic = .false.
458 logical :: nggps_ic = .false.
459 logical :: ecmwf_ic = .false.
460 logical :: gfs_phil = .false.
461 logical :: agrid_vel_rst = .false.
462 logical :: use_new_ncep = .false.
463 logical :: use_ncep_phy = .false.
464 logical :: fv_diag_ic = .false.
465 logical :: external_ic = .false.
469 character(len=128) :: res_latlon_dynamics =
'INPUT/fv_rst.res.nc' 470 character(len=128) :: res_latlon_tracers =
'INPUT/atmos_tracers.res.nc' 476 logical :: hydrostatic = .true.
477 logical :: phys_hydrostatic = .true.
478 logical :: use_hydro_pressure = .false.
479 logical :: do_uni_zfull = .false.
480 logical :: hybrid_z = .false.
481 logical :: make_nh = .false.
482 logical :: make_hybrid_z = .false.
483 logical :: nudge_qv = .false.
484 real :: add_noise = -1.
486 integer :: a2b_ord = 4
487 integer :: c2l_ord = 4
489 real(kind=R_GRID) :: dx_const = 1000.
490 real(kind=R_GRID) :: dy_const = 1000.
491 real(kind=R_GRID) :: deglat=15.
493 real(kind=R_GRID) :: deglon_start = -30., deglon_stop = 30., &
494 deglat_start = -30., deglat_stop = 30.
497 integer,
pointer :: grid_number
500 logical :: adj_mass_vmr = .false.
512 real,
allocatable,
dimension(:,:,:) :: west_t1, east_t1, south_t1, north_t1
513 real,
allocatable,
dimension(:,:,:) :: west_t0, east_t0, south_t0, north_t0
515 integer :: istag, jstag
517 logical :: allocated = .false.
518 logical :: initialized = .false.
524 real,
allocatable,
dimension(:,:,:,:) :: west_t1, east_t1, south_t1, north_t1
525 real,
allocatable,
dimension(:,:,:,:) :: west_t0, east_t0, south_t0, north_t0
527 integer :: istag, jstag
529 logical :: allocated = .false.
530 logical :: initialized = .false.
538 integer :: refinement = 3
540 integer :: parent_tile = 1
541 logical :: nested = .false.
542 integer :: nestbctype = 1
543 integer :: nsponge = 0
544 integer :: nestupdate = 0
545 logical :: twowaynest = .false.
546 integer :: ioffset, joffset
548 integer :: nest_timestep = 0
549 integer :: tracer_nest_timestep = 0
550 real :: s_weight = 1.e-6
551 logical :: first_step = .true.
552 integer :: refinement_of_global = 1
553 integer :: npx_global
555 integer :: isu = -999, ieu = -1000, jsu = -999, jeu = -1000
561 integer,
allocatable,
dimension(:,:,:) :: ind_h, ind_u, ind_v, ind_b
562 real,
allocatable,
dimension(:,:,:) :: wt_h, wt_u, wt_v, wt_b
563 integer,
allocatable,
dimension(:,:,:) :: ind_update_h
568 logical,
allocatable,
dimension(:) :: child_grids
570 logical :: parent_proc, child_proc
571 logical :: parent_of_twoway = .false.
587 logical :: do_flux_bcs, do_2way_flux_bcs
603 integer :: is, ie, js, je
604 integer :: isd, ied, jsd, jed
605 integer :: isc, iec, jsc, jec
613 logical :: allocated = .false.
614 logical :: dummy = .false.
615 integer :: grid_number = 1
619 type(
time_type) :: time_init, time, run_length, time_end, time_step_atmos
623 real,
dimension(2048) :: fdiag = 0.
626 logical :: grid_active = .true.
647 real, _allocatable :: u(:,:,:) _null
648 real, _allocatable :: v(:,:,:) _null
649 real, _allocatable :: pt(:,:,:) _null
650 real, _allocatable :: delp(:,:,:) _null
651 real, _allocatable :: q(:,:,:,:) _null
652 real, _allocatable :: qdiag(:,:,:,:) _null
657 real, _allocatable :: w(:,:,:) _null
658 real, _allocatable :: delz(:,:,:) _null
659 real, _allocatable :: ze0(:,:,:) _null
660 real, _allocatable :: q_con(:,:,:) _null
667 real, _allocatable :: ps (:,:) _null
668 real, _allocatable :: pe (:,:,: ) _null
669 real, _allocatable :: pk (:,:,:) _null
670 real, _allocatable :: peln(:,:,:) _null
671 real, _allocatable :: pkz (:,:,:) _null
674 real, _allocatable :: u_srf(:,:) _null
675 real, _allocatable :: v_srf(:,:) _null
676 real, _allocatable :: sgh(:,:) _null
677 real, _allocatable :: oro(:,:) _null
678 real, _allocatable :: ts(:,:) _null
683 real, _allocatable :: phis(:,:) _null
684 real, _allocatable :: omga(:,:,:) _null
685 real, _allocatable :: ua(:,:,:) _null
686 real, _allocatable :: va(:,:,:) _null
687 real, _allocatable :: uc(:,:,:) _null
688 real, _allocatable :: vc(:,:,:) _null
690 real, _allocatable :: ak(:) _null
691 real, _allocatable :: bk(:) _null
696 real, _allocatable :: mfx(:,:,:) _null
697 real, _allocatable :: mfy(:,:,:) _null
699 real, _allocatable :: cx(:,:,:) _null
700 real, _allocatable :: cy(:,:,:) _null
705 integer,
pointer :: npx, npy, npz, ncnst, ng
707 integer,
allocatable,
dimension(:) :: pelist
714 type(
domain2d) :: domain_for_coupler
716 integer :: num_contact, npes_per_tile, tile, npes_this_grid
717 integer :: layout(2), io_layout(2) = (/ 1,1 /)
744 rsf_restart, mg_restart, lnd_restart, tra_restart
749 real(kind=R_GRID),
allocatable,
dimension(:,:,:,:) :: grid_global
751 integer :: atmos_axes(4)
759 npx_in, npy_in, npz_in, ndims_in, ncnst_in, nq_in, ng_in, dummy, alloc_2d, ngrids_in)
766 type(fv_atmos_type),
intent(INOUT),
target :: Atm
767 integer,
intent(IN) :: isd_in, ied_in, jsd_in, jed_in, is_in, ie_in, js_in, je_in
768 integer,
intent(IN) :: npx_in, npy_in, npz_in, ndims_in, ncnst_in, nq_in, ng_in
769 logical,
intent(IN) :: dummy, alloc_2d
770 integer,
intent(IN) :: ngrids_in
771 integer:: isd, ied, jsd, jed, is, ie, js, je
772 integer:: npx, npy, npz, ndims, ncnst, nq, ng
775 integer:: isd_2d, ied_2d, jsd_2d, jed_2d, is_2d, ie_2d, js_2d, je_2d
776 integer:: npx_2d, npy_2d, npz_2d, ndims_2d, ncnst_2d, nq_2d, ng_2d
778 integer :: i,j,k, ns, n
780 if (atm%allocated)
return 816 if ((.not. dummy) .or. alloc_2d)
then 869 atm%npx => atm%flagstruct%npx
870 atm%npy => atm%flagstruct%npy
871 atm%npz => atm%flagstruct%npz
872 atm%ncnst => atm%flagstruct%ncnst
879 atm%flagstruct%ndims = ndims_in
881 allocate ( atm%u(isd:ied ,jsd:jed+1,npz) )
882 allocate ( atm%v(isd:ied+1,jsd:jed ,npz) )
884 allocate ( atm%pt(isd:ied ,jsd:jed ,npz) )
885 allocate ( atm%delp(isd:ied ,jsd:jed ,npz) )
886 allocate ( atm%q(isd:ied ,jsd:jed ,npz, nq) )
887 allocate (atm%qdiag(isd:ied ,jsd:jed ,npz, nq+1:ncnst) )
890 allocate ( atm%ps(isd:ied ,jsd:jed) )
891 allocate ( atm%pe(is-1:ie+1, npz+1,js-1:je+1) )
892 allocate ( atm%pk(is:ie ,js:je , npz+1) )
893 allocate ( atm%peln(is:ie,npz+1,js:je) )
894 allocate ( atm%pkz(is:ie,js:je,npz) )
896 allocate ( atm%u_srf(is:ie,js:je) )
897 allocate ( atm%v_srf(is:ie,js:je) )
899 if ( atm%flagstruct%fv_land )
then 900 allocate ( atm%sgh(is:ie,js:je) )
901 allocate ( atm%oro(is:ie,js:je) )
903 allocate ( atm%oro(1,1) )
907 allocate ( atm%ts(is:ie,js:je) )
908 allocate ( atm%phis(isd:ied ,jsd:jed ) )
909 allocate ( atm%omga(isd:ied ,jsd:jed ,npz) ); atm%omga=0.
910 allocate ( atm%ua(isd:ied ,jsd:jed ,npz) )
911 allocate ( atm%va(isd:ied ,jsd:jed ,npz) )
912 allocate ( atm%uc(isd:ied+1,jsd:jed ,npz) )
913 allocate ( atm%vc(isd:ied ,jsd:jed+1,npz) )
915 allocate ( atm%mfx(is:ie+1, js:je, npz) )
916 allocate ( atm%mfy(is:ie , js:je+1,npz) )
917 allocate ( atm%cx(is:ie+1, jsd:jed, npz) )
918 allocate ( atm%cy(isd:ied ,js:je+1, npz) )
920 allocate ( atm%ak(npz_2d+1) )
921 allocate ( atm%bk(npz_2d+1) )
926 if ( atm%flagstruct%hydrostatic )
then 928 allocate ( atm%w(isd:isd, jsd:jsd ,1) )
929 allocate ( atm%delz(isd:isd, jsd:jsd ,1) )
930 allocate ( atm%ze0(is:is, js:js ,1) )
932 allocate ( atm%w(isd:ied, jsd:jed ,npz ) )
933 allocate ( atm%delz(isd:ied, jsd:jed ,npz) )
934 if( atm%flagstruct%hybrid_z )
then 935 allocate ( atm%ze0(is:ie, js:je ,npz+1) )
937 allocate ( atm%ze0(is:is, js:js ,1) )
943 allocate ( atm%q_con(isd:ied,jsd:jed,1:npz) )
945 allocate ( atm%q_con(isd:isd,jsd:jsd,1) )
974 if ( .not. atm%flagstruct%hydrostatic )
then 999 allocate ( atm%gridstruct% area(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1000 allocate ( atm%gridstruct% area_64(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1001 allocate ( atm%gridstruct%rarea(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1003 allocate ( atm%gridstruct% area_c(isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1004 allocate ( atm%gridstruct% area_c_64(isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1005 allocate ( atm%gridstruct%rarea_c(isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1007 atm%gridstruct% area = 0.0
1008 atm%gridstruct% area_64 = 0.0
1009 atm%gridstruct%rarea = 0.0
1011 atm%gridstruct% area_c = 0.0
1012 atm%gridstruct% area_c_64 = 0.0
1013 atm%gridstruct%rarea_c = 0.0
1015 allocate ( atm%gridstruct% dx(isd_2d:ied_2d ,jsd_2d:jed_2d+1) )
1016 allocate ( atm%gridstruct% dx_64(isd_2d:ied_2d ,jsd_2d:jed_2d+1) )
1017 allocate ( atm%gridstruct%rdx(isd_2d:ied_2d ,jsd_2d:jed_2d+1) )
1018 allocate ( atm%gridstruct% dy(isd_2d:ied_2d+1,jsd_2d:jed_2d ) )
1019 allocate ( atm%gridstruct% dy_64(isd_2d:ied_2d+1,jsd_2d:jed_2d ) )
1020 allocate ( atm%gridstruct%rdy(isd_2d:ied_2d+1,jsd_2d:jed_2d ) )
1022 allocate ( atm%gridstruct% dxc(isd_2d:ied_2d+1,jsd_2d:jed_2d ) )
1023 allocate ( atm%gridstruct% dxc_64(isd_2d:ied_2d+1,jsd_2d:jed_2d ) )
1024 allocate ( atm%gridstruct%rdxc(isd_2d:ied_2d+1,jsd_2d:jed_2d ) )
1025 allocate ( atm%gridstruct% dyc(isd_2d:ied_2d ,jsd_2d:jed_2d+1) )
1026 allocate ( atm%gridstruct% dyc_64(isd_2d:ied_2d ,jsd_2d:jed_2d+1) )
1027 allocate ( atm%gridstruct%rdyc(isd_2d:ied_2d ,jsd_2d:jed_2d+1) )
1029 allocate ( atm%gridstruct% dxa(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1030 allocate ( atm%gridstruct% dxa_64(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1031 allocate ( atm%gridstruct%rdxa(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1032 allocate ( atm%gridstruct% dya(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1033 allocate ( atm%gridstruct% dya_64(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1034 allocate ( atm%gridstruct%rdya(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1036 allocate ( atm%gridstruct%grid (isd_2d:ied_2d+1,jsd_2d:jed_2d+1,1:ndims_2d) )
1037 allocate ( atm%gridstruct%grid_64 (isd_2d:ied_2d+1,jsd_2d:jed_2d+1,1:ndims_2d) )
1038 allocate ( atm%gridstruct%agrid(isd_2d:ied_2d ,jsd_2d:jed_2d ,1:ndims_2d) )
1039 allocate ( atm%gridstruct%agrid_64(isd_2d:ied_2d ,jsd_2d:jed_2d ,1:ndims_2d) )
1040 allocate ( atm%gridstruct% sina(isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1041 allocate ( atm%gridstruct% sina_64(isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1042 allocate ( atm%gridstruct%rsina(is_2d:ie_2d+1,js_2d:je_2d+1) )
1043 allocate ( atm%gridstruct% cosa(isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1044 allocate ( atm%gridstruct% cosa_64(isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1046 allocate ( atm%gridstruct% e1(3,isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1047 allocate ( atm%gridstruct% e2(3,isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1049 allocate (atm%gridstruct%iinta(4, isd_2d:ied_2d ,jsd_2d:jed_2d), &
1050 atm%gridstruct%jinta(4, isd_2d:ied_2d ,jsd_2d:jed_2d), &
1051 atm%gridstruct%iintb(4, is_2d:ie_2d+1 ,js_2d:je_2d+1), &
1052 atm%gridstruct%jintb(4, is_2d:ie_2d+1 ,js_2d:je_2d+1) )
1054 allocate ( atm%gridstruct%edge_s(npx_2d) )
1055 allocate ( atm%gridstruct%edge_n(npx_2d) )
1056 allocate ( atm%gridstruct%edge_w(npy_2d) )
1057 allocate ( atm%gridstruct%edge_e(npy_2d) )
1059 allocate ( atm%gridstruct%edge_vect_s(isd_2d:ied_2d) )
1060 allocate ( atm%gridstruct%edge_vect_n(isd_2d:ied_2d) )
1061 allocate ( atm%gridstruct%edge_vect_w(jsd_2d:jed_2d) )
1062 allocate ( atm%gridstruct%edge_vect_e(jsd_2d:jed_2d) )
1064 allocate ( atm%gridstruct%ex_s(npx_2d) )
1065 allocate ( atm%gridstruct%ex_n(npx_2d) )
1066 allocate ( atm%gridstruct%ex_w(npy_2d) )
1067 allocate ( atm%gridstruct%ex_e(npy_2d) )
1070 allocate ( atm%gridstruct%l2c_u(is_2d:ie_2d, js_2d:je_2d+1) )
1071 allocate ( atm%gridstruct%l2c_v(is_2d:ie_2d+1,js_2d:je_2d) )
1074 allocate ( atm%gridstruct%divg_u(isd_2d:ied_2d, jsd_2d:jed_2d+1) )
1075 allocate ( atm%gridstruct%divg_v(isd_2d:ied_2d+1,jsd_2d:jed_2d) )
1077 allocate ( atm%gridstruct%del6_u(isd_2d:ied_2d, jsd_2d:jed_2d+1) )
1078 allocate ( atm%gridstruct%del6_v(isd_2d:ied_2d+1,jsd_2d:jed_2d) )
1080 allocate ( atm%gridstruct%z11(is_2d-1:ie_2d+1,js_2d-1:je_2d+1) )
1081 allocate ( atm%gridstruct%z12(is_2d-1:ie_2d+1,js_2d-1:je_2d+1) )
1082 allocate ( atm%gridstruct%z21(is_2d-1:ie_2d+1,js_2d-1:je_2d+1) )
1083 allocate ( atm%gridstruct%z22(is_2d-1:ie_2d+1,js_2d-1:je_2d+1) )
1088 allocate ( atm%gridstruct%a11(is_2d-1:ie_2d+1,js_2d-1:je_2d+1) )
1089 allocate ( atm%gridstruct%a12(is_2d-1:ie_2d+1,js_2d-1:je_2d+1) )
1090 allocate ( atm%gridstruct%a21(is_2d-1:ie_2d+1,js_2d-1:je_2d+1) )
1091 allocate ( atm%gridstruct%a22(is_2d-1:ie_2d+1,js_2d-1:je_2d+1) )
1092 allocate ( atm%gridstruct%vlon(is_2d-2:ie_2d+2,js_2d-2:je_2d+2,3) )
1093 allocate ( atm%gridstruct%vlat(is_2d-2:ie_2d+2,js_2d-2:je_2d+2,3) )
1095 allocate ( atm%gridstruct%f0(isd_2d:ied_2d ,jsd_2d:jed_2d ) )
1096 allocate ( atm%gridstruct%fC(isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1099 allocate( atm%gridstruct%ee1(3,isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1100 allocate( atm%gridstruct%ee2(3,isd_2d:ied_2d+1,jsd_2d:jed_2d+1) )
1103 allocate( atm%gridstruct%ec1(3,isd_2d:ied_2d,jsd_2d:jed_2d) )
1104 allocate( atm%gridstruct%ec2(3,isd_2d:ied_2d,jsd_2d:jed_2d) )
1107 allocate( atm%gridstruct%ew(3,isd_2d:ied_2d+1,jsd_2d:jed_2d, 2) )
1108 allocate( atm%gridstruct%es(3,isd_2d:ied_2d ,jsd_2d:jed_2d+1,2) )
1111 allocate( atm%gridstruct%en1(3,is_2d:ie_2d, js_2d:je_2d+1) )
1112 allocate( atm%gridstruct%en2(3,is_2d:ie_2d+1,js_2d:je_2d ) )
1114 allocate ( atm%gridstruct%cosa_u(isd_2d:ied_2d+1,jsd_2d:jed_2d) )
1115 allocate ( atm%gridstruct%sina_u(isd_2d:ied_2d+1,jsd_2d:jed_2d) )
1116 allocate ( atm%gridstruct%rsin_u(isd_2d:ied_2d+1,jsd_2d:jed_2d) )
1118 allocate ( atm%gridstruct%cosa_v(isd_2d:ied_2d,jsd_2d:jed_2d+1) )
1119 allocate ( atm%gridstruct%sina_v(isd_2d:ied_2d,jsd_2d:jed_2d+1) )
1120 allocate ( atm%gridstruct%rsin_v(isd_2d:ied_2d,jsd_2d:jed_2d+1) )
1122 allocate ( atm%gridstruct%cosa_s(isd_2d:ied_2d,jsd_2d:jed_2d) )
1124 allocate ( atm%gridstruct%rsin2(isd_2d:ied_2d,jsd_2d:jed_2d) )
1135 allocate ( atm%gridstruct%cos_sg(isd_2d:ied_2d,jsd_2d:jed_2d,9) )
1136 allocate ( atm%gridstruct%sin_sg(isd_2d:ied_2d,jsd_2d:jed_2d,9) )
1138 allocate( atm%gridstruct%eww(3,4) )
1139 allocate( atm%gridstruct%ess(3,4) )
1141 if (atm%neststruct%nested)
then 1143 allocate(atm%neststruct%ind_h(isd:ied,jsd:jed,4))
1144 allocate(atm%neststruct%ind_u(isd:ied,jsd:jed+1,4))
1145 allocate(atm%neststruct%ind_v(isd:ied+1,jsd:jed,4))
1147 allocate(atm%neststruct%wt_h(isd:ied, jsd:jed, 4))
1148 allocate(atm%neststruct%wt_u(isd:ied, jsd:jed+1,4))
1149 allocate(atm%neststruct%wt_v(isd:ied+1, jsd:jed, 4))
1150 allocate(atm%neststruct%ind_b(isd:ied+1,jsd:jed+1,4))
1151 allocate(atm%neststruct%wt_b(isd:ied+1, jsd:jed+1,4))
1153 ns = atm%neststruct%nsponge
1163 allocate(atm%neststruct%q_BC(ncnst))
1178 if (.not.atm%flagstruct%hydrostatic)
then 1185 if (atm%neststruct%twowaynest)
allocate(&
1186 atm%neststruct%ind_update_h( &
1187 atm%parent_grid%bd%isd:atm%parent_grid%bd%ied+1, &
1188 atm%parent_grid%bd%jsd:atm%parent_grid%bd%jed+1,2))
1193 if( ngrids_in > 1 )
then 1194 if (atm%flagstruct%grid_type < 4)
then 1195 if (atm%neststruct%nested)
then 1196 allocate(atm%grid_global(1-ng_2d:npx_2d +ng_2d,1-ng_2d:npy_2d +ng_2d,2,1))
1198 allocate(atm%grid_global(1-ng_2d:npx_2d +ng_2d,1-ng_2d:npy_2d +ng_2d,2,1:6))
1203 atm%allocated = .true.
1204 if (dummy) atm%dummy = .true.
1211 type(fv_atmos_type),
intent(INOUT) :: Atm
1215 if (.not.atm%allocated)
return 1217 deallocate ( atm%u )
1218 deallocate ( atm%v )
1219 deallocate ( atm%pt )
1220 deallocate ( atm%delp )
1221 deallocate ( atm%q )
1222 deallocate ( atm%qdiag )
1223 deallocate ( atm%ps )
1224 deallocate ( atm%pe )
1225 deallocate ( atm%pk )
1226 deallocate ( atm%peln )
1227 deallocate ( atm%pkz )
1228 deallocate ( atm%phis )
1229 deallocate ( atm%omga )
1230 deallocate ( atm%ua )
1231 deallocate ( atm%va )
1232 deallocate ( atm%uc )
1233 deallocate ( atm%vc )
1234 deallocate ( atm%mfx )
1235 deallocate ( atm%mfy )
1236 deallocate ( atm%cx )
1237 deallocate ( atm%cy )
1238 deallocate ( atm%ak )
1239 deallocate ( atm%bk )
1241 deallocate ( atm%u_srf )
1242 deallocate ( atm%v_srf )
1243 if( atm%flagstruct%fv_land )
deallocate ( atm%sgh )
1244 deallocate ( atm%oro )
1246 deallocate ( atm%w )
1247 deallocate ( atm%delz )
1248 deallocate ( atm%ze0 )
1249 deallocate ( atm%q_con )
1251 deallocate ( atm%gridstruct% area )
1252 deallocate ( atm%gridstruct%rarea )
1254 deallocate ( atm%gridstruct% area_c )
1255 deallocate ( atm%gridstruct%rarea_c )
1257 deallocate ( atm%gridstruct% dx )
1258 deallocate ( atm%gridstruct%rdx )
1259 deallocate ( atm%gridstruct% dy )
1260 deallocate ( atm%gridstruct%rdy )
1262 deallocate ( atm%gridstruct% dxc )
1263 deallocate ( atm%gridstruct%rdxc )
1264 deallocate ( atm%gridstruct% dyc )
1265 deallocate ( atm%gridstruct%rdyc )
1267 deallocate ( atm%gridstruct% dxa )
1268 deallocate ( atm%gridstruct%rdxa )
1269 deallocate ( atm%gridstruct% dya )
1270 deallocate ( atm%gridstruct%rdya )
1272 deallocate ( atm%gridstruct%grid )
1273 deallocate ( atm%gridstruct%agrid )
1274 deallocate ( atm%gridstruct%sina )
1275 deallocate ( atm%gridstruct%cosa )
1277 deallocate ( atm%gridstruct% e1 )
1278 deallocate ( atm%gridstruct% e2 )
1283 deallocate (atm%gridstruct%iinta, &
1284 atm%gridstruct%jinta, &
1285 atm%gridstruct%iintb, &
1286 atm%gridstruct%jintb )
1288 deallocate ( atm%gridstruct%edge_s )
1289 deallocate ( atm%gridstruct%edge_n )
1290 deallocate ( atm%gridstruct%edge_w )
1291 deallocate ( atm%gridstruct%edge_e )
1293 deallocate ( atm%gridstruct%edge_vect_s )
1294 deallocate ( atm%gridstruct%edge_vect_n )
1295 deallocate ( atm%gridstruct%edge_vect_w )
1296 deallocate ( atm%gridstruct%edge_vect_e )
1298 deallocate ( atm%gridstruct%ex_s )
1299 deallocate ( atm%gridstruct%ex_n )
1300 deallocate ( atm%gridstruct%ex_w )
1301 deallocate ( atm%gridstruct%ex_e )
1304 deallocate ( atm%gridstruct%l2c_u )
1305 deallocate ( atm%gridstruct%l2c_v )
1307 deallocate ( atm%gridstruct%divg_u )
1308 deallocate ( atm%gridstruct%divg_v )
1311 deallocate ( atm%gridstruct%z11 )
1312 deallocate ( atm%gridstruct%z12 )
1313 deallocate ( atm%gridstruct%z21 )
1314 deallocate ( atm%gridstruct%z22 )
1316 deallocate ( atm%gridstruct%a11 )
1317 deallocate ( atm%gridstruct%a12 )
1318 deallocate ( atm%gridstruct%a21 )
1319 deallocate ( atm%gridstruct%a22 )
1320 deallocate ( atm%gridstruct%vlon )
1321 deallocate ( atm%gridstruct%vlat )
1323 deallocate ( atm%gridstruct%f0 )
1324 deallocate ( atm%gridstruct%fC )
1327 deallocate( atm%gridstruct%ee1 )
1328 deallocate( atm%gridstruct%ee2 )
1331 deallocate( atm%gridstruct%ec1 )
1332 deallocate( atm%gridstruct%ec2 )
1335 deallocate( atm%gridstruct%ew )
1336 deallocate( atm%gridstruct%es )
1339 deallocate( atm%gridstruct%en1 )
1340 deallocate( atm%gridstruct%en2 )
1342 deallocate ( atm%gridstruct%cosa_u )
1343 deallocate ( atm%gridstruct%sina_u )
1344 deallocate ( atm%gridstruct%rsin_u )
1346 deallocate ( atm%gridstruct%cosa_v )
1347 deallocate ( atm%gridstruct%sina_v )
1348 deallocate ( atm%gridstruct%rsin_v )
1350 deallocate ( atm%gridstruct%cosa_s )
1352 deallocate ( atm%gridstruct%rsin2 )
1363 deallocate ( atm%gridstruct%cos_sg )
1364 deallocate ( atm%gridstruct%sin_sg )
1366 deallocate( atm%gridstruct%eww )
1367 deallocate( atm%gridstruct%ess )
1369 if (atm%neststruct%nested)
then 1370 deallocate(atm%neststruct%ind_h)
1371 deallocate(atm%neststruct%ind_u)
1372 deallocate(atm%neststruct%ind_v)
1374 deallocate(atm%neststruct%wt_h)
1375 deallocate(atm%neststruct%wt_u)
1376 deallocate(atm%neststruct%wt_v)
1378 deallocate(atm%neststruct%ind_b)
1379 deallocate(atm%neststruct%wt_b)
1388 if (
allocated(atm%neststruct%q_BC))
then 1389 do n=1,
size(atm%neststruct%q_BC)
1402 if (.not.atm%flagstruct%hydrostatic)
then 1409 if (atm%neststruct%twowaynest)
deallocate(atm%neststruct%ind_update_h)
1413 if (atm%flagstruct%grid_type < 4)
then 1414 if(
allocated(atm%grid_global))
deallocate(atm%grid_global)
1417 atm%allocated = .false.
1424 type(fv_nest_BC_type_3D),
intent(INOUT) :: BC
1425 type(fv_atmos_type),
intent(IN) :: Atm
1426 integer,
intent(IN) :: ns, istag, jstag
1427 logical,
intent(IN) :: dummy
1429 integer :: is, ie, js, je, isd, ied, jsd, jed, npx, npy, npz, ng
1431 if (bc%allocated)
return 1449 call allocate_fv_nest_bc_type_3d(bc,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz,ng,ns,istag,jstag,dummy)
1454 subroutine allocate_fv_nest_bc_type_3d(BC,is,ie,js,je,isd,ied,jsd,jed,npx,npy,npz,ng,ns,istag,jstag,dummy)
1456 type(fv_nest_BC_type_3D),
intent(INOUT) :: BC
1457 integer,
intent(IN) :: ns, istag, jstag
1458 logical,
intent(IN) :: dummy
1460 integer,
intent(IN) :: is, ie, js, je, isd, ied, jsd, jed, npx, npy, npz, ng
1462 if (bc%allocated)
return 1465 if (ie == npx-1 .and. .not. dummy)
then 1466 allocate(bc%east_t1(ie+1-ns+istag:ied+istag,jsd:jed+jstag,npz))
1467 allocate(bc%east_t0(ie+1-ns+istag:ied+istag,jsd:jed+jstag,npz))
1470 do i=ie+1-ns+istag,ied+istag
1471 bc%east_t1(i,j,k) = 0.
1472 bc%east_t0(i,j,k) = 0.
1477 allocate(bc%east_t1(1,1,npz))
1478 allocate(bc%east_t0(1,1,npz))
1481 if (js == 1 .and. .not. dummy)
then 1482 allocate(bc%south_t1(isd:ied+istag,jsd:js-1+ns,npz))
1483 allocate(bc%south_t0(isd:ied+istag,jsd:js-1+ns,npz))
1487 bc%south_t1(i,j,k) = 0.
1488 bc%south_t0(i,j,k) = 0.
1493 allocate(bc%south_t1(1,1,npz))
1494 allocate(bc%south_t0(1,1,npz))
1497 if (is == 1 .and. .not. dummy)
then 1498 allocate(bc%west_t1(isd:is-1+ns,jsd:jed+jstag,npz))
1499 allocate(bc%west_t0(isd:is-1+ns,jsd:jed+jstag,npz))
1503 bc%west_t1(i,j,k) = 0.
1504 bc%west_t0(i,j,k) = 0.
1509 allocate(bc%west_t1(1,1,npz))
1510 allocate(bc%west_t0(1,1,npz))
1513 if (je == npy-1 .and. .not. dummy)
then 1514 allocate(bc%north_t1(isd:ied+istag,je+1-ns+jstag:jed+jstag,npz))
1515 allocate(bc%north_t0(isd:ied+istag,je+1-ns+jstag:jed+jstag,npz))
1517 do j=je+1-ns+jstag,jed+jstag
1519 bc%north_t1(i,j,k) = 0.
1520 bc%north_t0(i,j,k) = 0.
1525 allocate(bc%north_t1(1,1,npz))
1526 allocate(bc%north_t0(1,1,npz))
1529 bc%allocated = .true.
1535 type(fv_nest_BC_type_3d) :: BC
1537 if (.not. bc%allocated)
return 1539 deallocate(bc%north_t1)
1540 deallocate(bc%south_t1)
1541 deallocate(bc%west_t1)
1542 deallocate(bc%east_t1)
1544 if (
allocated(bc%north_t0))
then 1545 deallocate(bc%north_t0)
1546 deallocate(bc%south_t0)
1547 deallocate(bc%west_t0)
1548 deallocate(bc%east_t0)
1551 bc%allocated = .false.
subroutine allocate_fv_nest_bc_type_3d(BC, is, ie, js, je, isd, ied, jsd, jed, npx, npy, npz, ng, ns, istag, jstag, dummy)
subroutine allocate_fv_atmos_type(Atm, isd_in, ied_in, jsd_in, jed_in, is_in, ie_in, js_in, je_in, npx_in, npy_in, npz_in, ndims_in, ncnst_in, nq_in, ng_in, dummy, alloc_2d, ngrids_in)
subroutine deallocate_fv_nest_bc_type_3d(BC)
subroutine allocate_fv_nest_bc_type_3d_atm(BC, Atm, ns, istag, jstag, dummy)
integer, parameter max_step
integer, parameter, public r_grid
subroutine deallocate_fv_atmos_type(Atm)
Derived type containing the data.