25 use mpp_domains_mod,
only: domain2d
26 use mpp_domains_mod,
only: domain1d, mpp_get_domain_components, &
27 mpp_get_global_domain, &
28 mpp_get_data_domain, &
29 mpp_get_compute_domain, &
30 north, south, east, west, &
32 mpp_domains_set_stack_size, &
33 mpp_update_domains, mpp_get_neighbor_pe
34 use mpp_mod,
only: fatal, input_nml_file, &
35 mpp_error ,mpp_pe, mpp_sync, &
36 mpp_npes, mpp_root_pe, mpp_gather, &
37 mpp_get_current_pelist, null_pe
39 use tracer_manager_mod,
only: get_tracer_index,get_tracer_names
40 use field_manager_mod,
only: model_atmos
41 use time_manager_mod,
only: get_time &
42 ,
operator(-),
operator(/) &
43 ,time_type,time_type_to_real
44 use constants_mod,
only: cp_air, cp_vapor, grav, kappa &
45 ,pi=>pi_8,rdgas, rvgas
55 use fv_mp_mod,
only: is_master, mp_reduce_min, mp_reduce_max
58 use fms_mod,
only: check_nml_error,file_exist
59 use fms_io_mod,
only: read_data,get_global_att_value
113 real(kind=R_GRID),
dimension(:,:,:),
allocatable ::
agrid_reg & !<-- Lon/lat of cell centers
124 real,
dimension(:,:,:),
allocatable :: delp_bc, divgd_bc, u_bc, v_bc, uc_bc, vc_bc
125 real,
dimension(:,:,:,:),
allocatable :: q_bc
127 real,
dimension(:,:,:),
allocatable :: pt_bc, w_bc, delz_bc
129 real,
dimension(:,:,:),
allocatable :: q_con_bc
131 real,
dimension(:,:,:),
allocatable :: cappa_bc
156 real,
parameter ::
tice=273.16 &
160 real,
parameter ::
zvir = rvgas/rdgas - 1. &
161 ,
cv_air = cp_air - rdgas &
162 ,
cv_vap = cp_vapor - rvgas
167 ,
oro_data =
'oro_data.tile7.halo4.nc' 174 real(kind=R_GRID),
parameter::
dbl_snan=x
'FFF7FFFFFFFFFFFF' 206 integer,
intent(in) :: isd,ied,jsd,jed,npx,npy
214 integer :: i,i_start,i_end,j,j_start,j_end,klev_out
292 ntracers=atm%ncnst - atm%flagstruct%dnats
309 sphum_index = get_tracer_index(model_atmos,
'sphum')
327 ,atm%regional_bc_bounds%is_north &
328 ,atm%regional_bc_bounds%ie_north &
329 ,atm%regional_bc_bounds%js_north &
330 ,atm%regional_bc_bounds%je_north &
331 ,atm%regional_bc_bounds%is_north_uvs &
332 ,atm%regional_bc_bounds%ie_north_uvs &
333 ,atm%regional_bc_bounds%js_north_uvs &
334 ,atm%regional_bc_bounds%je_north_uvs &
335 ,atm%regional_bc_bounds%is_north_uvw &
336 ,atm%regional_bc_bounds%ie_north_uvw &
337 ,atm%regional_bc_bounds%js_north_uvw &
338 ,atm%regional_bc_bounds%je_north_uvw &
346 ,atm%regional_bc_bounds%is_north &
347 ,atm%regional_bc_bounds%ie_north &
348 ,atm%regional_bc_bounds%js_north &
349 ,atm%regional_bc_bounds%je_north &
350 ,atm%regional_bc_bounds%is_north_uvs &
351 ,atm%regional_bc_bounds%ie_north_uvs &
352 ,atm%regional_bc_bounds%js_north_uvs &
353 ,atm%regional_bc_bounds%je_north_uvs &
354 ,atm%regional_bc_bounds%is_north_uvw &
355 ,atm%regional_bc_bounds%ie_north_uvw &
356 ,atm%regional_bc_bounds%js_north_uvw &
357 ,atm%regional_bc_bounds%je_north_uvw &
371 ,atm%regional_bc_bounds%is_south &
372 ,atm%regional_bc_bounds%ie_south &
373 ,atm%regional_bc_bounds%js_south &
374 ,atm%regional_bc_bounds%je_south &
375 ,atm%regional_bc_bounds%is_south_uvs &
376 ,atm%regional_bc_bounds%ie_south_uvs &
377 ,atm%regional_bc_bounds%js_south_uvs &
378 ,atm%regional_bc_bounds%je_south_uvs &
379 ,atm%regional_bc_bounds%is_south_uvw &
380 ,atm%regional_bc_bounds%ie_south_uvw &
381 ,atm%regional_bc_bounds%js_south_uvw &
382 ,atm%regional_bc_bounds%je_south_uvw &
390 ,atm%regional_bc_bounds%is_south &
391 ,atm%regional_bc_bounds%ie_south &
392 ,atm%regional_bc_bounds%js_south &
393 ,atm%regional_bc_bounds%je_south &
394 ,atm%regional_bc_bounds%is_south_uvs &
395 ,atm%regional_bc_bounds%ie_south_uvs &
396 ,atm%regional_bc_bounds%js_south_uvs &
397 ,atm%regional_bc_bounds%je_south_uvs &
398 ,atm%regional_bc_bounds%is_south_uvw &
399 ,atm%regional_bc_bounds%ie_south_uvw &
400 ,atm%regional_bc_bounds%js_south_uvw &
401 ,atm%regional_bc_bounds%je_south_uvw &
415 ,atm%regional_bc_bounds%is_east &
416 ,atm%regional_bc_bounds%ie_east &
417 ,atm%regional_bc_bounds%js_east &
418 ,atm%regional_bc_bounds%je_east &
419 ,atm%regional_bc_bounds%is_east_uvs &
420 ,atm%regional_bc_bounds%ie_east_uvs &
421 ,atm%regional_bc_bounds%js_east_uvs &
422 ,atm%regional_bc_bounds%je_east_uvs &
423 ,atm%regional_bc_bounds%is_east_uvw &
424 ,atm%regional_bc_bounds%ie_east_uvw &
425 ,atm%regional_bc_bounds%js_east_uvw &
426 ,atm%regional_bc_bounds%je_east_uvw &
434 ,atm%regional_bc_bounds%is_east &
435 ,atm%regional_bc_bounds%ie_east &
436 ,atm%regional_bc_bounds%js_east &
437 ,atm%regional_bc_bounds%je_east &
438 ,atm%regional_bc_bounds%is_east_uvs &
439 ,atm%regional_bc_bounds%ie_east_uvs &
440 ,atm%regional_bc_bounds%js_east_uvs &
441 ,atm%regional_bc_bounds%je_east_uvs &
442 ,atm%regional_bc_bounds%is_east_uvw &
443 ,atm%regional_bc_bounds%ie_east_uvw &
444 ,atm%regional_bc_bounds%js_east_uvw &
445 ,atm%regional_bc_bounds%je_east_uvw &
459 ,atm%regional_bc_bounds%is_west &
460 ,atm%regional_bc_bounds%ie_west &
461 ,atm%regional_bc_bounds%js_west &
462 ,atm%regional_bc_bounds%je_west &
463 ,atm%regional_bc_bounds%is_west_uvs &
464 ,atm%regional_bc_bounds%ie_west_uvs &
465 ,atm%regional_bc_bounds%js_west_uvs &
466 ,atm%regional_bc_bounds%je_west_uvs &
467 ,atm%regional_bc_bounds%is_west_uvw &
468 ,atm%regional_bc_bounds%ie_west_uvw &
469 ,atm%regional_bc_bounds%js_west_uvw &
470 ,atm%regional_bc_bounds%je_west_uvw &
478 ,atm%regional_bc_bounds%is_west &
479 ,atm%regional_bc_bounds%ie_west &
480 ,atm%regional_bc_bounds%js_west &
481 ,atm%regional_bc_bounds%je_west &
482 ,atm%regional_bc_bounds%is_west_uvs &
483 ,atm%regional_bc_bounds%ie_west_uvs &
484 ,atm%regional_bc_bounds%js_west_uvs &
485 ,atm%regional_bc_bounds%je_west_uvs &
486 ,atm%regional_bc_bounds%is_west_uvw &
487 ,atm%regional_bc_bounds%ie_west_uvw &
488 ,atm%regional_bc_bounds%js_west_uvw &
489 ,atm%regional_bc_bounds%je_west_uvw &
540 if(.not.atm%flagstruct%warm_start)
then 556 if(.not.atm%flagstruct%warm_start)
then 571 if(.not.atm%flagstruct%warm_start)
then 586 if(.not.atm%flagstruct%warm_start)
then 637 type(fv_regional_bc_bounds_type),
intent(out) :: regional_bc_bounds
643 integer,
parameter :: invalid_index = -99
650 regional_bc_bounds%is_north = invalid_index
651 regional_bc_bounds%ie_north = invalid_index
652 regional_bc_bounds%js_north = invalid_index
653 regional_bc_bounds%je_north = invalid_index
654 regional_bc_bounds%is_north_uvs = invalid_index
655 regional_bc_bounds%ie_north_uvs = invalid_index
656 regional_bc_bounds%js_north_uvs = invalid_index
657 regional_bc_bounds%je_north_uvs = invalid_index
658 regional_bc_bounds%is_north_uvw = invalid_index
659 regional_bc_bounds%ie_north_uvw = invalid_index
660 regional_bc_bounds%js_north_uvw = invalid_index
661 regional_bc_bounds%je_north_uvw = invalid_index
663 regional_bc_bounds%is_south = invalid_index
664 regional_bc_bounds%ie_south = invalid_index
665 regional_bc_bounds%js_south = invalid_index
666 regional_bc_bounds%je_south = invalid_index
667 regional_bc_bounds%is_south_uvs = invalid_index
668 regional_bc_bounds%ie_south_uvs = invalid_index
669 regional_bc_bounds%js_south_uvs = invalid_index
670 regional_bc_bounds%je_south_uvs = invalid_index
671 regional_bc_bounds%is_south_uvw = invalid_index
672 regional_bc_bounds%ie_south_uvw = invalid_index
673 regional_bc_bounds%js_south_uvw = invalid_index
674 regional_bc_bounds%je_south_uvw = invalid_index
676 regional_bc_bounds%is_east = invalid_index
677 regional_bc_bounds%ie_east = invalid_index
678 regional_bc_bounds%js_east = invalid_index
679 regional_bc_bounds%je_east = invalid_index
680 regional_bc_bounds%is_east_uvs = invalid_index
681 regional_bc_bounds%ie_east_uvs = invalid_index
682 regional_bc_bounds%js_east_uvs = invalid_index
683 regional_bc_bounds%je_east_uvs = invalid_index
684 regional_bc_bounds%is_east_uvw = invalid_index
685 regional_bc_bounds%ie_east_uvw = invalid_index
686 regional_bc_bounds%js_east_uvw = invalid_index
687 regional_bc_bounds%je_east_uvw = invalid_index
689 regional_bc_bounds%is_west = invalid_index
690 regional_bc_bounds%ie_west = invalid_index
691 regional_bc_bounds%js_west = invalid_index
692 regional_bc_bounds%je_west = invalid_index
693 regional_bc_bounds%is_west_uvs = invalid_index
694 regional_bc_bounds%ie_west_uvs = invalid_index
695 regional_bc_bounds%js_west_uvs = invalid_index
696 regional_bc_bounds%je_west_uvs = invalid_index
697 regional_bc_bounds%is_west_uvw = invalid_index
698 regional_bc_bounds%ie_west_uvw = invalid_index
699 regional_bc_bounds%js_west_uvw = invalid_index
700 regional_bc_bounds%je_west_uvw = invalid_index
716 regional_bc_bounds%is_north=isd-1
717 regional_bc_bounds%ie_north=ied+1
719 regional_bc_bounds%js_north=jsd-1
720 regional_bc_bounds%je_north=0
728 regional_bc_bounds%is_south=isd-1
729 regional_bc_bounds%ie_south=ied+1
732 regional_bc_bounds%je_south=jed+1
740 regional_bc_bounds%is_east=isd-1
741 regional_bc_bounds%ie_east=0
743 regional_bc_bounds%js_east=jsd-1
745 regional_bc_bounds%js_east=1
748 regional_bc_bounds%je_east=jed+1
760 regional_bc_bounds%ie_west=ied+1
762 regional_bc_bounds%js_west=jsd-1
764 regional_bc_bounds%js_west=1
767 regional_bc_bounds%je_west=jed+1
782 regional_bc_bounds%is_north_uvs=isd
783 regional_bc_bounds%ie_north_uvs=ied
785 regional_bc_bounds%js_north_uvs=jsd
788 regional_bc_bounds%je_north_uvs=1
790 regional_bc_bounds%is_north_uvw=isd
791 regional_bc_bounds%ie_north_uvw=ied+1
793 regional_bc_bounds%js_north_uvw=jsd
794 regional_bc_bounds%je_north_uvw=0
802 regional_bc_bounds%is_south_uvs=isd
803 regional_bc_bounds%ie_south_uvs=ied
807 regional_bc_bounds%je_south_uvs=jed+1
809 regional_bc_bounds%is_south_uvw=isd
810 regional_bc_bounds%ie_south_uvw=ied+1
813 regional_bc_bounds%je_south_uvw=jed
821 regional_bc_bounds%is_east_uvs=isd
822 regional_bc_bounds%ie_east_uvs=0
824 regional_bc_bounds%js_east_uvs=jsd
827 regional_bc_bounds%js_east_uvs=1
830 regional_bc_bounds%je_east_uvs=jed+1
837 regional_bc_bounds%is_east_uvw=isd
838 regional_bc_bounds%ie_east_uvw=0
840 regional_bc_bounds%js_east_uvw=jsd
842 regional_bc_bounds%js_east_uvw=1
844 regional_bc_bounds%je_east_uvw=jed
856 regional_bc_bounds%ie_west_uvs=ied
858 regional_bc_bounds%js_west_uvs=jsd
861 regional_bc_bounds%js_west_uvs=1
864 regional_bc_bounds%je_west_uvs=jed+1
871 regional_bc_bounds%ie_west_uvw=ied+1
873 regional_bc_bounds%js_west_uvw=jsd
875 regional_bc_bounds%js_west_uvw=1
878 regional_bc_bounds%je_west_uvw=jed
908 integer :: i_start_data,istat,j_start_data,n,ncid_grid,var_id
910 character(len=150) :: filename,vname
922 call check(nf90_open(filename,nf90_nowrite,ncid_grid))
935 11110
format(
' i_start_data=',i5,
' j_start_data=',i5)
941 call check(nf90_inq_varid(ncid_grid,vname,var_id))
942 call check(nf90_get_var(ncid_grid,var_id &
943 ,
grid_reg(isd-1:ied+2,jsd-1:jed+2,1) &
944 ,start=(/i_start_data,j_start_data/) &
952 call check(nf90_inq_varid(ncid_grid,vname,var_id))
953 call check(nf90_get_var(ncid_grid,var_id &
954 ,
grid_reg(isd-1:ied+2,jsd-1:jed+2,2) &
955 ,start=(/i_start_data,j_start_data/) &
958 call check(nf90_close(ncid_grid))
1005 integer :: i,i_start_data,istat,j,j_start_data,ncid_oro,var_id
1007 character(len=150) :: filename,vname
1019 if (is_master())
then 1020 write(*,23421)trim(filename)
1021 23421
format(
' topo filename=',a)
1024 call check(nf90_open(filename,nf90_nowrite,ncid_oro))
1034 call check(nf90_inq_varid(ncid_oro,vname,var_id))
1035 call check(nf90_get_var(ncid_oro,var_id &
1036 ,
phis_reg(isd-1:ied+1,jsd-1:jed+1) &
1037 ,start=(/i_start_data,j_start_data/)))
1039 call check(nf90_close(ncid_oro))
1081 integer ,
intent(in) :: is ,ie ,js ,je & !<-- Integration limits of task subdomain
1082 ,isd,ied,jsd,jed & !<-- Memory limits of task subdomain
1085 real,
intent(in) :: ak(1:levp+1), bk(1:levp+1)
1102 ,isd, ied, jsd, jed &
1108 ,isd, ied, jsd, jed &
1113 ,atm%regional_bc_bounds )
1119 ,isd, ied, jsd, jed &
1122 allocate (
ak_in(1:levp+1))
1123 allocate (
bk_in(1:levp+1))
1153 integer ,
intent(in) :: isc,iec,jsc,jec & !<-- Integration limits of task subdomain
1160 integer :: ierr, ios
1161 real,
allocatable :: wk2(:,:)
1163 logical :: filtered_terrain
1164 logical :: gfs_dwinds
1166 logical :: checker_tr
1167 integer :: nt_checker
1168 namelist /external_ic_nml/ filtered_terrain, levp, gfs_dwinds &
1169 ,checker_tr, nt_checker
1178 read (input_nml_file,external_ic_nml,iostat=ios)
1179 ierr = check_nml_error(ios,
'external_ic_nml')
1182 11011
format(
' start_regional_restart failed to read external_ic_nml ierr=',i3)
1190 ,isd, ied, jsd, jed &
1193 allocate (wk2(levp+1,2))
1194 allocate (
ak_in(levp+1))
1195 allocate (
bk_in(levp+1))
1196 call read_data(
'INPUT/gfs_ctrl.nc',
'vcoord',wk2, no_domain=.true.)
1197 ak_in(1:levp+1) = wk2(1:levp+1,1)
1199 bk_in(1:levp+1) = wk2(1:levp+1,2)
1208 ,isc, iec, jsc, jec &
1209 ,isd, ied, jsd, jed &
1235 type(time_type),
intent(in) :: time
1236 type(time_type),
intent(in) :: time_step_atmos
1238 integer,
intent(in) :: isd,ied,jsd,jed & !<-- Memory limits of task subdomain
1245 integer :: atmos_time_step, sec
1247 type(time_type) :: atmos_time
1253 atmos_time = time - atm%Time_init
1254 atmos_time_step = atmos_time / time_step_atmos
1258 call get_time (time_step_atmos, sec)
1259 dt_atmos =
real(sec)
1261 if(atmos_time_step==0.or.atm%flagstruct%warm_start)
then 1279 ,atm%regional_bc_bounds )
1287 ,atm%bd%is, atm%bd%ie &
1288 ,atm%bd%js, atm%bd%je &
1289 ,isd, ied, jsd, jed &
1323 integer,
intent(in) :: is,ie,js,je & !<-- Compute limits of task subdomain
1326 real,
dimension(:),
intent(in) :: ak,bk
1338 integer :: dimid,i,j,k,klev_in,klev_out,n,nlev
1340 integer :: is_north,is_south,is_east,is_west &
1341 ,ie_north,ie_south,ie_east,ie_west &
1342 ,js_north,js_south,js_east,js_west &
1343 ,je_north,je_south,je_east,je_west
1345 integer :: is_u,ie_u,js_u,je_u &
1346 ,is_v,ie_v,js_v,je_v
1348 integer :: is_input,ie_input,js_input,je_input
1350 integer :: i_start,i_end,j_start,j_end
1352 real,
dimension(:,:,:),
allocatable :: ud,vd,uc,vc
1354 real,
dimension(:,:),
allocatable :: ps_reg
1355 real,
dimension(:,:,:),
allocatable :: ps_input,t_input &
1357 real,
dimension(:,:,:),
allocatable :: u_s_input,v_s_input &
1358 ,u_w_input,v_w_input
1359 real,
dimension(:,:,:,:),
allocatable :: tracers_input
1361 real(kind=R_GRID),
dimension(2):: p1, p2, p3, p4
1362 real(kind=R_GRID),
dimension(3):: e1, e2, ex, ey
1366 integer :: isc2, iec2, jsc2, jec2
1367 real(kind=R_GRID),
allocatable,
dimension(:,:) :: tmpx, tmpy
1368 integer :: start(4), nread(4)
1369 real(kind=R_GRID),
allocatable,
dimension(:,:,:) :: reg_grid
1370 real(kind=R_GRID),
allocatable,
dimension(:,:,:) :: reg_agrid
1373 logical,
save :: computed_regional_bc_indices=.false.
1375 character(len=3) :: int_to_char
1376 character(len=5) :: side
1377 character(len=6) :: fmt=
'(i3.3)' 1379 character(len=50) :: file_name
1381 integer,
save :: kount1=0,kount2=0
1383 character(len=60) :: var_name_root
1384 integer :: nside,nt,index
1387 logical :: call_remap
1410 write(int_to_char,fmt)
bc_hour 1411 file_name=
'INPUT/gfs_bndy.tile7.'//int_to_char//
'.nc' 1413 if (is_master())
then 1414 write(*,22211)trim(file_name)
1415 22211
format(
' regional_bc_data file_name=',a)
1422 call check(nf90_open(file_name,nf90_nowrite,
ncid))
1424 call check(nf90_inq_dimid(
ncid,
'lev',dimid))
1425 call check(nf90_inquire_dimension(
ncid,dimid,len=klev_in))
1436 allocate( ps_input(is_input:ie_input,js_input:je_input,1)) ; ps_input=
real_snan 1437 allocate( t_input(is_input:ie_input,js_input:je_input,1:klev_in)) ; t_input=
real_snan 1438 allocate( w_input(is_input:ie_input,js_input:je_input,1:klev_in)) ; w_input=
real_snan 1439 allocate( zh_input(is_input:ie_input,js_input:je_input,1:klev_in+1)) ; zh_input=
real_snan 1440 allocate(u_s_input(is_input:ie_input,js_input:je_input,1:klev_in)) ; u_s_input=
real_snan 1441 allocate(v_s_input(is_input:ie_input,js_input:je_input,1:klev_in)) ; v_s_input=
real_snan 1442 allocate(u_w_input(is_input:ie_input,js_input:je_input,1:klev_in)) ; u_w_input=
real_snan 1443 allocate(v_w_input(is_input:ie_input,js_input:je_input,1:klev_in)) ; v_w_input=
real_snan 1445 allocate(tracers_input(is_input:ie_input,js_input:je_input,klev_in,
ntracers)) ; tracers_input=
real_snan 1463 ,array_3d=ps_input )
1495 if (
data_source ==
'FV3GFS GAUSSIAN NEMSIO FILE')
then 1517 ,array_3d=u_s_input)
1530 ,array_3d=v_s_input)
1543 ,array_3d=u_w_input)
1556 ,array_3d=v_w_input)
1571 call get_tracer_names(model_atmos, nt, var_name_root)
1572 index= get_tracer_index(model_atmos,trim(var_name_root))
1582 ,array_4d=tracers_input &
1584 ,required=required )
1610 allocate(ps_reg(is_input:ie_input,js_input:je_input)) ; ps_reg=-9999999
1623 sides_scalars:
do nside=1,4
1671 ,klev_in, klev_out &
1712 allocate(tmpx(isc2:iec2, jsc2:jec2)) ; tmpx=
dbl_snan 1713 allocate(tmpy(isc2:iec2, jsc2:jec2)) ; tmpy=
dbl_snan 1714 start = 1; nread = 1
1715 start(1) = isc2; nread(1) = iec2 - isc2 + 1
1716 start(2) = jsc2; nread(2) = jec2 - jsc2 + 1
1717 call read_data(
"INPUT/grid.tile7.halo4.nc",
'x', tmpx, start, nread, no_domain=.true.)
1718 call read_data(
"INPUT/grid.tile7.halo4.nc",
'y', tmpy, start, nread, no_domain=.true.)
1720 allocate(reg_grid(isd-1:ied+2,jsd-1:jed+2,1:2)) ; reg_grid=
dbl_snan 1725 if ( reg_grid(i,j,1) /=
grid_reg(i,j,1) )
then 1726 write(0,*)
' reg_grid(i,j,1) /= grid_reg(i,j,1) ',i,j, reg_grid(i,j,1),
grid_reg(i,j,1)
1731 allocate(reg_agrid(isd-1:ied+1,jsd-1:jed+1,1:2)) ; reg_agrid=
dbl_snan 1734 call cell_center2(reg_grid(i,j, 1:2), reg_grid(i+1,j, 1:2), &
1735 reg_grid(i,j+1,1:2), reg_grid(i+1,j+1,1:2), &
1736 reg_agrid(i,j,1:2) )
1746 sides_winds:
do nside=1,4
1756 is_u=atm%regional_bc_bounds%is_north_uvs
1757 ie_u=atm%regional_bc_bounds%ie_north_uvs
1758 js_u=atm%regional_bc_bounds%js_north_uvs
1759 je_u=atm%regional_bc_bounds%je_north_uvs
1761 is_v=atm%regional_bc_bounds%is_north_uvw
1762 ie_v=atm%regional_bc_bounds%ie_north_uvw
1763 js_v=atm%regional_bc_bounds%js_north_uvw
1764 je_v=atm%regional_bc_bounds%je_north_uvw
1773 is_u=atm%regional_bc_bounds%is_south_uvs
1774 ie_u=atm%regional_bc_bounds%ie_south_uvs
1775 js_u=atm%regional_bc_bounds%js_south_uvs
1776 je_u=atm%regional_bc_bounds%je_south_uvs
1778 is_v=atm%regional_bc_bounds%is_south_uvw
1779 ie_v=atm%regional_bc_bounds%ie_south_uvw
1780 js_v=atm%regional_bc_bounds%js_south_uvw
1781 je_v=atm%regional_bc_bounds%je_south_uvw
1790 is_u=atm%regional_bc_bounds%is_east_uvs
1791 ie_u=atm%regional_bc_bounds%ie_east_uvs
1792 js_u=atm%regional_bc_bounds%js_east_uvs
1793 je_u=atm%regional_bc_bounds%je_east_uvs
1795 is_v=atm%regional_bc_bounds%is_east_uvw
1796 ie_v=atm%regional_bc_bounds%ie_east_uvw
1797 js_v=atm%regional_bc_bounds%js_east_uvw
1798 je_v=atm%regional_bc_bounds%je_east_uvw
1807 is_u=atm%regional_bc_bounds%is_west_uvs
1808 ie_u=atm%regional_bc_bounds%ie_west_uvs
1809 js_u=atm%regional_bc_bounds%js_west_uvs
1810 je_u=atm%regional_bc_bounds%je_west_uvs
1812 is_v=atm%regional_bc_bounds%is_west_uvw
1813 ie_v=atm%regional_bc_bounds%ie_west_uvw
1814 js_v=atm%regional_bc_bounds%js_west_uvw
1815 je_v=atm%regional_bc_bounds%je_west_uvw
1821 allocate(ud(is_u:ie_u,js_u:je_u,1:nlev)) ; ud=
real_snan 1822 allocate(vd(is_v:ie_v,js_v:je_v,1:nlev)) ; vd=
real_snan 1823 allocate(vc(is_u:ie_u,js_u:je_u,1:nlev)) ; vc=
real_snan 1824 allocate(uc(is_v:ie_v,js_v:je_v,1:nlev)) ; uc=
real_snan 1873 ,klev_in, klev_out &
1882 deallocate(ud,vd,uc,vc)
1902 if(
allocated(ps_input))
then 1903 deallocate(ps_input)
1905 if(
allocated(t_input))
then 1908 if(
allocated(zh_input))
then 1909 deallocate(zh_input)
1911 if(
allocated(w_input))
then 1914 if(
allocated(tracers_input))
then 1915 deallocate(tracers_input)
1917 if(
allocated(u_s_input))
then 1918 deallocate(u_s_input)
1920 if(
allocated(u_w_input))
then 1921 deallocate(u_w_input)
1923 if(
allocated(v_s_input))
then 1924 deallocate(v_s_input)
1926 if(
allocated(v_w_input))
then 1927 deallocate(v_w_input)
1966 if(atm%flagstruct%nudge_qv)
then 1990 integer :: i,ie0,is0,j,je0,js0,k,nside
2010 is0=lbound(
bc_t1%north%divgd_BC,1)
2011 ie0=ubound(
bc_t1%north%divgd_BC,1)
2012 js0=lbound(
bc_t1%north%divgd_BC,2)
2013 je0=ubound(
bc_t1%north%divgd_BC,2)
2021 is0=lbound(
bc_t1%south%divgd_BC,1)
2022 ie0=ubound(
bc_t1%south%divgd_BC,1)
2023 js0=lbound(
bc_t1%south%divgd_BC,2)
2024 je0=ubound(
bc_t1%south%divgd_BC,2)
2032 is0=lbound(
bc_t1%east%divgd_BC,1)
2033 ie0=ubound(
bc_t1%east%divgd_BC,1)
2034 js0=lbound(
bc_t1%east%divgd_BC,2)
2035 je0=ubound(
bc_t1%east%divgd_BC,2)
2043 is0=lbound(
bc_t1%west%divgd_BC,1)
2044 ie0=ubound(
bc_t1%west%divgd_BC,1)
2045 js0=lbound(
bc_t1%west%divgd_BC,2)
2046 je0=ubound(
bc_t1%west%divgd_BC,2)
2071 subroutine fill_q_con_bc
2084 integer :: i,ie0,is0,j,je0,js0,k,nside
2103 is0=lbound(
bc_t1%north%q_con_BC,1)
2104 ie0=ubound(
bc_t1%north%q_con_BC,1)
2105 js0=lbound(
bc_t1%north%q_con_BC,2)
2106 je0=ubound(
bc_t1%north%q_con_BC,2)
2114 is0=lbound(
bc_t1%south%q_con_BC,1)
2115 ie0=ubound(
bc_t1%south%q_con_BC,1)
2116 js0=lbound(
bc_t1%south%q_con_BC,2)
2117 je0=ubound(
bc_t1%south%q_con_BC,2)
2125 is0=lbound(
bc_t1%east%q_con_BC,1)
2126 ie0=ubound(
bc_t1%east%q_con_BC,1)
2127 js0=lbound(
bc_t1%east%q_con_BC,2)
2128 je0=ubound(
bc_t1%east%q_con_BC,2)
2136 is0=lbound(
bc_t1%west%q_con_BC,1)
2137 ie0=ubound(
bc_t1%west%q_con_BC,1)
2138 js0=lbound(
bc_t1%west%q_con_BC,2)
2139 je0=ubound(
bc_t1%west%q_con_BC,2)
2157 end subroutine fill_q_con_bc
2165 subroutine fill_cappa_bc
2178 integer :: i1,i2,j1,j2,nside
2180 real,
dimension(:,:,:),
pointer :: cappa,temp,liq_wat,sphum
2182 logical :: call_compute
2189 call_compute=.false.
2219 if(call_compute)
then 2228 call compute_cappa(i1,i2,j1,j2,cappa,temp,liq_wat,sphum)
2235 end subroutine fill_cappa_bc
2241 subroutine compute_cappa(i1,i2,j1,j2,cappa,temp,liq_wat,sphum)
2251 integer,
intent(in) :: i1,i2,j1,j2
2253 real,
dimension(i1:i2,j1:j2,1:npz) :: cappa,temp,liq_wat,sphum
2263 integer :: i,ie,is,j,je,js,k
2265 real :: cvm,qd,ql,qs,qv
2279 qd=max(0.,liq_wat(i,j,k))
2280 if( temp(i,j,k) >
tice )
then 2282 elseif( temp(i,j,k) <
tice-
t_i0 )
then 2288 qv=max(0.,sphum(i,j,k))
2291 cappa(i,j,k)=rdgas/(rdgas+cvm/(1.+
zvir*sphum(i,j,k)))
2299 end subroutine compute_cappa
2310 ,js_input,je_input &
2334 integer,
intent(in) :: is_input,ie_input,js_input,je_input,nlev
2335 integer,
intent(in) :: ntracers
2337 integer,
intent(in),
optional :: tlev
2339 character(len=*),
intent(in) :: var_name_root
2340 logical,
intent(in),
optional :: required
2346 real,
dimension(is_input:ie_input,js_input:je_input,1:nlev),
intent(out),
optional :: array_3d
2348 real,
dimension(is_input:ie_input,js_input:je_input,1:nlev,1:ntracers),
intent(out),
optional :: array_4d
2354 integer :: halo,lat,lev,lon
2356 integer :: i_count,i_start_array,i_start_data,i_end_array &
2357 ,j_count,j_start_array,j_start_data,j_end_array
2359 integer :: dim_id,nctype,ndims,var_id
2360 integer :: nside,status
2362 character(len=5) :: dim_name_x & !<-- Dimension names in
2365 character(len=80) :: var_name
2367 logical :: call_get_var
2368 logical :: required_local
2378 if(
present(required))
then 2379 required_local=required
2381 required_local=.true.
2392 call_get_var=.false.
2412 var_name=trim(var_name_root)//
"_bottom" 2414 i_start_array=is_input
2415 i_end_array =ie_input
2416 j_start_array=js_input
2417 if(trim(var_name_root)==
'u_s'.or.trim(var_name_root)==
'v_s')
then 2424 i_count=i_end_array-i_start_array+1
2426 j_count=j_end_array-j_start_array+1
2438 var_name=trim(var_name_root)//
"_top" 2440 i_start_array=is_input
2441 i_end_array =ie_input
2443 j_end_array =je_input
2446 i_count=i_end_array-i_start_array+1
2448 j_count=j_end_array-j_start_array+1
2460 var_name=trim(var_name_root)//
"_left" 2462 j_start_array=js_input
2463 j_end_array =je_input
2465 i_start_array=is_input
2467 if(trim(var_name_root)==
'u_w'.or.trim(var_name_root)==
'v_w')
then 2474 if(trim(var_name_root)==
'u_s'.or.trim(var_name_root)==
'v_s')
then 2485 i_count=i_end_array-i_start_array+1
2486 if(trim(var_name_root)==
'u_s'.or.trim(var_name_root)==
'v_s')
then 2487 j_start_data=j_start_array-1
2489 j_start_data=j_start_array
2491 j_count=j_end_array-j_start_array+1
2503 var_name=trim(var_name_root)//
"_right" 2505 j_start_array=js_input
2506 j_end_array =je_input
2509 i_end_array=ie_input
2512 if(trim(var_name_root)==
'u_s'.or.trim(var_name_root)==
'v_s')
then 2524 i_count=i_end_array-i_start_array+1
2525 if(trim(var_name_root)==
'u_s'.or.trim(var_name_root)==
'v_s')
then 2526 j_start_data=j_start_array-1
2528 j_start_data=j_start_array
2530 j_count=j_end_array-j_start_array+1
2541 if(call_get_var)
then 2542 if (
present(array_4d))
then 2543 status=nf90_inq_varid(
ncid,trim(var_name),var_id)
2544 if (required_local)
then 2547 if (status /= nf90_noerr)
then 2548 if (
east_bc)
write(0,*)
' WARNING: Tracer ',trim(var_name),
' not in input file' 2549 array_4d(:,:,:,tlev)=0.
2552 ,array_4d(i_start_array:i_end_array &
2553 ,j_start_array:j_end_array &
2555 ,start=(/i_start_data,j_start_data,1,tlev/) &
2556 ,count=(/i_count,j_count,nlev,1/)))
2560 call check(nf90_inq_varid(
ncid,trim(var_name),var_id))
2562 ,array_3d(i_start_array:i_end_array &
2563 ,j_start_array:j_end_array &
2565 ,start=(/i_start_data,j_start_data,1/) &
2566 ,count=(/i_count,j_count,nlev/)))
2580 subroutine check(status)
2581 integer,
intent(in) :: status
2583 if(status /= nf90_noerr)
then 2584 write(0,*)
' check netcdf status=',status
2585 write(0,10001)trim(nf90_strerror(status))
2586 10001
format(
' NetCDF error ',a)
2589 end subroutine check 2596 ,north_bc,south_bc &
2598 ,is_0,ie_0,js_0,je_0 &
2599 ,is_sn,ie_sn,js_sn,je_sn &
2600 ,is_we,ie_we,js_we,je_we &
2613 integer,
intent(in) :: klev,ntracers
2615 integer,
intent(in) :: is_0,ie_0,js_0,je_0
2616 integer,
intent(in) :: is_sn,ie_sn,js_sn,je_sn
2617 integer,
intent(in) :: is_we,ie_we,js_we,je_we
2619 character(len=5),
intent(in) :: side
2621 logical,
intent(in) :: north_bc,south_bc,east_bc,west_bc
2623 type(fv_regional_BC_variables),
intent(out) :: BC_side
2629 if(
allocated(bc_side%delp_BC))
then 2633 allocate(bc_side%delp_BC (is_0:ie_0,js_0:je_0,klev)) ; bc_side%delp_BC=
real_snan 2634 allocate(bc_side%divgd_BC(is_0:ie_0,js_0:je_0,klev)) ; bc_side%divgd_BC=
real_snan 2636 allocate(bc_side%q_BC (is_0:ie_0,js_0:je_0,1:klev,1:ntracers)) ; bc_side%q_BC=
real_snan 2639 allocate(bc_side%pt_BC (is_0:ie_0,js_0:je_0,klev)) ; bc_side%pt_BC=
real_snan 2640 allocate(bc_side%w_BC (is_0:ie_0,js_0:je_0,klev)) ; bc_side%w_BC=
real_snan 2641 allocate(bc_side%delz_BC (is_0:ie_0,js_0:je_0,klev)) ; bc_side%delz_BC=
real_snan 2643 allocate(bc_side%q_con_BC(is_0:ie_0,js_0:je_0,klev)) ; bc_side%q_con_BC=
real_snan 2645 allocate(bc_side%cappa_BC(is_0:ie_0,js_0:je_0,klev)) ; bc_side%cappa_BC=
real_snan 2656 allocate(bc_side%u_BC (is_sn:ie_sn, js_sn:je_sn, klev)) ; bc_side%u_BC=
real_snan 2657 allocate(bc_side%vc_BC(is_sn:ie_sn, js_sn:je_sn, klev)) ; bc_side%vc_BC=
real_snan 2661 allocate(bc_side%uc_BC(is_we:ie_we, js_we:je_we, klev)) ; bc_side%uc_BC=
real_snan 2662 allocate(bc_side%v_BC (is_we:ie_we, js_we:je_we, klev)) ; bc_side%v_BC=
real_snan 2675 ,is_bc,ie_bc,js_bc,je_bc &
2676 ,km, npz, ncnst, ak0, bk0 &
2677 ,psc, t_in, qa, omga, zh &
2682 type(fv_atmos_type),
intent(inout) :: Atm
2683 integer,
intent(in):: isd,ied,jsd,jed
2684 integer,
intent(in):: is_bc,ie_bc,js_bc,je_bc
2685 integer,
intent(in):: km & !<-- # of levels in 3-D input variables
2686 ,npz & !<-- # of levels in final 3-D integration variables
2688 real,
intent(in):: ak0(km+1), bk0(km+1)
2689 real,
intent(in),
dimension(is_bc:ie_bc,js_bc:je_bc):: psc
2690 real,
intent(in),
dimension(is_bc:ie_bc,js_bc:je_bc,km):: t_in
2691 real,
intent(in),
dimension(is_bc:ie_bc,js_bc:je_bc,km):: omga
2692 real,
intent(in),
dimension(is_bc:ie_bc,js_bc:je_bc,km,ncnst):: qa
2693 real,
intent(in),
dimension(is_bc:ie_bc,js_bc:je_bc,km+1):: zh
2695 real,
intent(inout),
dimension(isd-1:ied+1,jsd-1:jed+1):: phis_reg
2696 real,
intent(out),
dimension(is_bc:ie_bc,js_bc:je_bc) :: ps
2697 character(len=5),
intent(in) :: side
2698 type(fv_regional_BC_variables),
intent(inout) :: BC_side
2702 real,
dimension(:,:),
allocatable :: pe0
2703 real,
dimension(:,:),
allocatable :: qn1
2704 real,
dimension(:,:),
allocatable :: dp2
2705 real,
dimension(:,:),
allocatable :: pe1
2706 real,
dimension(:,:),
allocatable :: qp
2708 real wk(is_bc:ie_bc,js_bc:je_bc)
2709 real,
dimension(is_bc:ie_bc,js_bc:je_bc):: phis
2712 real(kind=R_GRID),
dimension(is_bc:ie_bc,npz+1):: pn1
2713 real(kind=R_GRID):: gz_fv(npz+1)
2714 real(kind=R_GRID),
dimension(2*km+1):: gz, pn
2715 real(kind=R_GRID),
dimension(is_bc:ie_bc,km+1):: pn0
2716 real(kind=R_GRID):: pst
2718 integer i,ie,is,j,je,js,k,l,m, k2,iq
2719 integer sphum, o3mr, liq_wat, ice_wat, rainwat, snowwat, graupel, cld_amt
2723 sphum = get_tracer_index(model_atmos,
'sphum')
2724 liq_wat = get_tracer_index(model_atmos,
'liq_wat')
2725 ice_wat = get_tracer_index(model_atmos,
'ice_wat')
2726 rainwat = get_tracer_index(model_atmos,
'rainwat')
2727 snowwat = get_tracer_index(model_atmos,
'snowwat')
2728 graupel = get_tracer_index(model_atmos,
'graupel')
2729 cld_amt = get_tracer_index(model_atmos,
'cld_amt')
2730 o3mr = get_tracer_index(model_atmos,
'o3mr')
2734 if (mpp_pe()==1)
then 2735 print *,
'sphum = ', sphum
2736 print *,
'clwmr = ', liq_wat
2737 print *,
' o3mr = ', o3mr
2738 print *,
'ncnst = ', ncnst
2741 if ( sphum/=1 )
then 2742 call mpp_error(fatal,
'SPHUM must be 1st tracer')
2751 if(side==
'west')
then 2756 if(side==
'east')
then 2761 if(side==
'south')
then 2766 if(side==
'north')
then 2770 allocate(pe0(is:ie,km+1)) ; pe0=
real_snan 2771 allocate(qn1(is:ie,npz)) ; qn1=
real_snan 2772 allocate(dp2(is:ie,npz)) ; dp2=
real_snan 2773 allocate(pe1(is:ie,npz+1)) ; pe1=
real_snan 2782 pe0(i,k) = ak0(k) + bk0(k)*psc(i,j)
2783 pn0(i,k) = log(pe0(i,k))
2790 gz(k) = zh(i,j,k)*grav
2796 gz(k) = 2.*gz(km+1) - gz(l)
2797 pn(k) = 2.*pn(km+1) - pn(l)
2801 if( phis_reg(i,j).le.gz(k) .and. phis_reg(i,j).ge.gz(k+1) )
then 2802 pst = pn(k) + (pn(k+1)-pn(k))*(gz(k)-phis_reg(i,j))/(gz(k)-gz(k+1))
2806 123 ps(i,j) = exp(pst)
2836 is=lbound(bc_side%delp_BC,1)
2837 ie=ubound(bc_side%delp_BC,1)
2838 js=lbound(bc_side%delp_BC,2)
2839 je=ubound(bc_side%delp_BC,2)
2846 pe0(i,k) = ak0(k) + bk0(k)*psc(i,j)
2847 pn0(i,k) = log(pe0(i,k))
2852 pe1(i,1) = atm%ak(1)
2853 pn1(i,1) = log(pe1(i,1))
2857 pe1(i,k) = atm%ak(k) + atm%bk(k)*ps(i,j)
2858 pn1(i,k) = log(pe1(i,k))
2865 dp2(i,k) = pe1(i,k+1) - pe1(i,k)
2866 bc_side%delp_BC(i,j,k) = dp2(i,k)
2873 if (iq /= cld_amt)
then 2876 qp(i,k) = qa(i,j,k,iq)
2880 call mappm(km, pe0, qp, npz, pe1, qn1, is,ie, 0, 8, atm%ptop)
2882 if ( iq==sphum )
then 2883 call fillq(ie-is+1, npz, 1, qn1, dp2)
2885 call fillz(ie-is+1, npz, 1, qn1, dp2)
2890 bc_side%q_BC(i,j,k,iq) = qn1(i,k)
2904 if ( pn1(i,1) .lt. pn0(i,1) )
then 2905 call mpp_error(fatal,
'FV3 top higher than NCEP/GFS')
2910 gz(k) = zh(i,j,k)*grav
2915 gz(k) = 2.*gz(km+1) - gz(l)
2916 pn(k) = 2.*pn(km+1) - pn(l)
2920 gz_fv(npz+1) = phis_reg(i,j)
2926 #ifdef USE_ISOTHERMO 2928 if ( (pn1(i,k).le.pn(l+1)) .and. (pn1(i,k).ge.pn(l)) )
then 2929 gz_fv(k) = gz(l) + (gz(l+1)-gz(l))*(pn1(i,k)-pn(l))/(pn(l+1)-pn(l))
2931 elseif ( pn1(i,k) .gt. pn(km+1) )
then 2933 gz_fv(k) = gz(km+1) + (gz_fv(npz+1)-gz(km+1))*(pn1(i,k)-pn(km+1))/(pn1(i,npz+1)-pn(km+1))
2939 if ( (pn1(i,k).le.pn(l+1)) .and. (pn1(i,k).ge.pn(l)) )
then 2940 gz_fv(k) = gz(l) + (gz(l+1)-gz(l))*(pn1(i,k)-pn(l))/(pn(l+1)-pn(l))
2958 if (
data_source /=
'FV3GFS GAUSSIAN NEMSIO FILE')
then 2960 bc_side%pt_BC(i,j,k) = (gz_fv(k)-gz_fv(k+1))/( rdgas*(pn1(i,k+1)-pn1(i,k))*(1.+
zvir*bc_side%q_BC(i,j,k,sphum)) )
2965 if ( .not. atm%flagstruct%hydrostatic )
then 2967 bc_side%delz_BC(i,j,k) = (gz_fv(k+1) - gz_fv(k)) / grav
2984 if (trim(
data_source) /=
'FV3GFS GAUSSIAN NEMSIO FILE')
then 2985 if ( atm%flagstruct%nwat .eq. 6 )
then 2988 qn1(i,k) = bc_side%q_BC(i,j,k,liq_wat)
2989 bc_side%q_BC(i,j,k,rainwat) = 0.
2990 bc_side%q_BC(i,j,k,snowwat) = 0.
2991 bc_side%q_BC(i,j,k,graupel) = 0.
2992 if ( bc_side%pt_BC(i,j,k) > 273.16 )
then 2993 bc_side%q_BC(i,j,k,liq_wat) = qn1(i,k)
2994 bc_side%q_BC(i,j,k,ice_wat) = 0.
2995 #ifdef ORIG_CLOUDS_PART 2996 else if ( bc_side%pt_BC(i,j,k) < 258.16 )
then 2997 bc_side%q_BC(i,j,k,liq_wat) = 0.
2998 bc_side%q_BC(i,j,k,ice_wat) = qn1(i,k)
3000 bc_side%q_BC(i,j,k,liq_wat) = qn1(i,k)*((bc_side%pt_BC(i,j,k)-258.16)/15.)
3001 bc_side%q_BC(i,j,k,ice_wat) = qn1(i,k) - bc_side%q_BC(i,j,k,liq_wat)
3004 else if ( bc_side%pt_BC(i,j,k) < 233.16 )
then 3005 bc_side%q_BC(i,j,k,liq_wat) = 0.
3006 bc_side%q_BC(i,j,k,ice_wat) = qn1(i,k)
3009 bc_side%q_BC(i,j,k,liq_wat) = qn1(i,k)*((bc_side%pt_BC(i,j,k)-233.16)/40.)
3010 bc_side%q_BC(i,j,k,ice_wat) = qn1(i,k) - bc_side%q_BC(i,j,k,liq_wat)
3012 if (bc_side%pt_BC(i,j,k)<258.16 .and. bc_side%q_BC(i,j,k-1,ice_wat)>1.e-5 )
then 3013 bc_side%q_BC(i,j,k,liq_wat) = 0.
3014 bc_side%q_BC(i,j,k,ice_wat) = qn1(i,k)
3016 bc_side%q_BC(i,j,k,liq_wat) = qn1(i,k)*((bc_side%pt_BC(i,j,k)-233.16)/40.)
3017 bc_side%q_BC(i,j,k,ice_wat) = qn1(i,k) - bc_side%q_BC(i,j,k,liq_wat)
3023 bc_side%q_BC(i,j,k,ice_wat), bc_side%q_BC(i,j,k,snowwat) )
3035 if ( .not. atm%flagstruct%hydrostatic )
then 3038 qp(i,k) = omga(i,j,k)
3042 call mappm(km, pe0, qp, npz, pe1, qn1, is,ie, -1, 4, atm%ptop)
3044 if (
data_source ==
'FV3GFS GAUSSIAN NEMSIO FILE')
then 3047 bc_side%w_BC(i,j,k) = qn1(i,k)
3055 qp(i,k) = t_in(i,j,k)
3059 call mappm(km, pe0, qp, npz, pe1, qn1, is,ie, 2, 4, atm%ptop)
3063 bc_side%pt_BC(i,j,k) = qn1(i,k)
3070 bc_side%w_BC(i,j,k) = qn1(i,k)/bc_side%delp_BC(i,j,k)*bc_side%delz_BC(i,j,k)
3084 wk(i,j) = phis_reg(i,j)/grav - zh(i,j,km+1)
3091 wk(i,j) = ps(i,j) - psc(i,j)
3095 deallocate (pe0,qn1,dp2,pe1,qp)
3096 if (is_master())
write(*,*)
'done remap_scalar_nggps_regional_bc' 3106 ,is_input,ie_input &
3107 ,js_input,je_input &
3108 ,is_u,ie_u,js_u,je_u &
3109 ,is_v,ie_v,js_v,je_v &
3112 ,psc, ud, vd, uc, vc &
3114 type(fv_atmos_type),
intent(inout) :: Atm
3115 integer,
intent(in):: is_input, ie_input, js_input, je_input
3116 integer,
intent(in):: is_u,ie_u,js_u,je_u
3117 integer,
intent(in):: is_v,ie_v,js_v,je_v
3118 integer,
intent(in):: km & !<-- # of levels in 3-D input variables
3120 real,
intent(in):: ak0(km+1), bk0(km+1)
3122 real,
intent(in) :: psc(is_input:ie_input,js_input:je_input)
3124 real,
intent(in):: ud(is_u:ie_u,js_u:je_u,km)
3125 real,
intent(in):: vc(is_u:ie_u,js_u:je_u,km)
3126 real,
intent(in):: vd(is_v:ie_v,js_v:je_v,km)
3127 real,
intent(in):: uc(is_v:ie_v,js_v:je_v,km)
3128 type(fv_regional_BC_variables),
intent(inout) :: BC_side
3130 real,
dimension(:,:),
allocatable :: pe0
3131 real,
dimension(:,:),
allocatable :: pe1
3132 real,
dimension(:,:),
allocatable :: qn1_d,qn1_c
3135 allocate(pe0(is_u:ie_u, km+1)) ; pe0=
real_snan 3136 allocate(pe1(is_u:ie_u, npz+1)) ; pe1=
real_snan 3137 allocate(qn1_d(is_u:ie_u, npz)) ; qn1_d=
real_snan 3138 allocate(qn1_c(is_u:ie_u, npz)) ; qn1_c=
real_snan 3141 j_loopu:
do j=js_u,je_u
3149 pe0(i,k) = ak0(k) + bk0(k)*0.5*(psc(i,j-1)+psc(i,j))
3154 pe1(i,k) = atm%ak(k) + atm%bk(k)*0.5*(psc(i,j-1)+psc(i,j))
3157 call mappm(km, pe0(is_u:ie_u,1:km+1), ud(is_u:ie_u,j,1:km), npz, pe1(is_u:ie_u,1:npz+1), &
3158 qn1_d(is_u:ie_u,1:npz), is_u,ie_u, -1, 8, atm%ptop )
3159 call mappm(km, pe0(is_u:ie_u,1:km+1), vc(is_u:ie_u,j,1:km), npz, pe1(is_u:ie_u,1:npz+1), &
3160 qn1_c(is_u:ie_u,1:npz), is_u,ie_u, -1, 8, atm%ptop )
3163 bc_side%u_BC(i,j,k) = qn1_d(i,k)
3164 bc_side%vc_BC(i,j,k) = qn1_c(i,k)
3175 allocate(pe0(is_v:ie_v, km+1)) ; pe0=
real_snan 3176 allocate(pe1(is_v:ie_v, npz+1)) ; pe1=
real_snan 3177 allocate(qn1_d(is_v:ie_v, npz)) ; qn1_d=
real_snan 3178 allocate(qn1_c(is_v:ie_v, npz)) ; qn1_c=
real_snan 3181 j_loopv:
do j=js_v,je_v
3190 pe0(i,k) = ak0(k) + bk0(k)*0.5*(psc(i-1,j)+psc(i,j))
3195 pe1(i,k) = atm%ak(k) + atm%bk(k)*0.5*(psc(i-1,j)+psc(i,j))
3198 call mappm(km, pe0(is_v:ie_v,1:km+1), vd(is_v:ie_v,j,1:km), npz, pe1(is_v:ie_v,1:npz+1), &
3199 qn1_d(is_v:ie_v,1:npz), is_v,ie_v, -1, 8, atm%ptop)
3200 call mappm(km, pe0(is_v:ie_v,1:km+1), uc(is_v:ie_v,j,1:km), npz, pe1(is_v:ie_v,1:npz+1), &
3201 qn1_c(is_v:ie_v,1:npz), is_v,ie_v, -1, 8, atm%ptop)
3204 bc_side%v_BC(i,j,k) = qn1_d(i,k)
3205 bc_side%uc_BC(i,j,k) = qn1_c(i,k)
3216 if (is_master())
write(*,*)
'done remap_dwinds' 3249 integer,
intent(in) :: nlayers
3251 real,
intent(in) :: fcst_time
3259 real,
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz),
intent(out) :: &
3263 real,
dimension(bd%isd:,bd%jsd:,1:),
intent(out) :: delz,w
3265 real,
dimension(bd%isd:,bd%jsd:,1:),
intent(out) :: q_con
3269 real,
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz,ntracers),
intent(out) :: q
3272 real,
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz),
intent(out) :: cappa
3277 real,
dimension(bd%isd:bd%ied,bd%jsd:bd%jed+1,npz),
intent(out) :: u,vc
3279 real,
dimension(bd%isd:bd%ied+1,bd%jsd:bd%jed,npz),
intent(out) :: uc,v
3285 real :: fraction_interval
3378 ,i1_uvs,i2_uvs,j1_uvs,j2_uvs &
3379 ,i1_uvw,i2_uvw,j1_uvw,j2_uvw )
3392 type(fv_regional_BC_variables),
intent(in) :: side_t0 &
3395 character(len=*),
intent(in) :: side
3397 integer,
intent(in) :: i1,i2,j1,j2 &
3398 ,i1_uvs,i2_uvs,j1_uvs,j2_uvs &
3399 ,i1_uvw,i2_uvw,j1_uvw,j2_uvw
3405 integer :: i,ie,j,je,jend,jend_uvs,jend_uvw &
3406 ,jstart,jstart_uvs,jstart_uvw,k,nt,nz
3418 if((trim(side)==
'east'.or.trim(side)==
'west').and..not.
north_bc)
then 3423 if((trim(side)==
'east'.or.trim(side)==
'west').and..not.
south_bc)
then 3432 delp(i,j,k)=side_t0%delp_BC(i,j,k) &
3433 +(side_t1%delp_BC(i,j,k)-side_t0%delp_BC(i,j,k)) &
3435 pt(i,j,k)=side_t0%pt_BC(i,j,k) &
3436 +(side_t1%pt_BC(i,j,k)-side_t0%pt_BC(i,j,k)) &
3439 cappa(i,j,k)=side_t0%cappa_BC(i,j,k) &
3440 +(side_t1%cappa_BC(i,j,k)-side_t0%cappa_BC(i,j,k)) &
3446 do j=jstart_uvs,jend_uvs
3448 u(i,j,k)=side_t0%u_BC(i,j,k) &
3449 +(side_t1%u_BC(i,j,k)-side_t0%u_BC(i,j,k)) &
3451 vc(i,j,k)=side_t0%vc_BC(i,j,k) &
3452 +(side_t1%vc_BC(i,j,k)-side_t0%vc_BC(i,j,k)) &
3457 do j=jstart_uvw,jend_uvw
3459 v(i,j,k)=side_t0%v_BC(i,j,k) &
3460 +(side_t1%v_BC(i,j,k)-side_t0%v_BC(i,j,k)) &
3462 uc(i,j,k)=side_t0%uc_BC(i,j,k) &
3463 +(side_t1%uc_BC(i,j,k)-side_t0%uc_BC(i,j,k)) &
3469 ie=min(ubound(side_t0%delz_BC,1),ubound(delz,1))
3470 je=min(ubound(side_t0%delz_BC,2),ubound(delz,2))
3476 delz(i,j,k)=side_t0%delz_BC(i,j,k) &
3477 +(side_t1%delz_BC(i,j,k)-side_t0%delz_BC(i,j,k)) &
3480 q_con(i,j,k)=side_t0%q_con_BC(i,j,k) &
3481 +(side_t1%q_con_BC(i,j,k)-side_t0%q_con_BC(i,j,k)) &
3484 w(i,j,k)=side_t0%w_BC(i,j,k) &
3485 +(side_t1%w_BC(i,j,k)-side_t0%w_BC(i,j,k)) &
3495 q(i,j,k,nt)=side_t0%q_BC(i,j,k,nt) &
3496 +(side_t1%q_BC(i,j,k,nt)-side_t0%q_BC(i,j,k,nt)) &
3537 integer,
intent(in) :: lbnd_x,ubnd_x,lbnd_y,ubnd_y,ubnd_z
3539 integer,
intent(in) :: is,ie,js,je & !<-- Compute limits
3542 integer,
intent(in),
optional :: index4
3544 real,
intent(in) :: fcst_time
3546 character(len=*),
intent(in) :: bc_vbl_name
3552 real,
dimension(lbnd_x:ubnd_x,lbnd_y:ubnd_y,1:ubnd_z) &
3553 ,
intent(out) :: array
3559 integer :: i1,i2,j1,j2
3560 integer :: lbnd1,ubnd1,lbnd2,ubnd2
3566 logical :: call_interp
3577 if(
present(index4))
then 3604 if(trim(bc_vbl_name)==
'uc'.or.trim(bc_vbl_name)==
'v')
then 3625 if(trim(bc_vbl_name)==
'uc'.or.trim(bc_vbl_name)==
'v')
then 3631 if(trim(bc_vbl_name)==
'u'.or.trim(bc_vbl_name)==
'vc')
then 3659 if(trim(bc_vbl_name)==
'u'.or.trim(bc_vbl_name)==
'vc')
then 3681 if(trim(bc_vbl_name)==
'uc'.or.trim(bc_vbl_name)==
'v')
then 3691 if(trim(bc_vbl_name)==
'u'.or.trim(bc_vbl_name)==
'vc')
then 3709 ,lbnd1,ubnd1,lbnd2,ubnd2 &
3713 ,lbnd_x,ubnd_x,lbnd_y,ubnd_y,ubnd_z &
3715 ,lbnd1,ubnd1,lbnd2,ubnd2 &
3734 ,bc_side_t0,bc_side_t1 &
3736 ,lbnd1,ubnd1,lbnd2,ubnd2 &
3750 integer,
intent(in) :: iq
3752 character(len=*),
intent(in) :: bc_vbl_name
3754 type(fv_regional_BC_variables),
pointer :: bc_side_t0,bc_side_t1
3761 integer,
intent(out) :: lbnd1,ubnd1,lbnd2,ubnd2
3763 real,
dimension(:,:,:),
pointer :: bc_t0,bc_t1
3769 select case (bc_vbl_name)
3772 bc_t0=>bc_side_t0%delp_BC
3773 bc_t1=>bc_side_t1%delp_BC
3775 bc_t0=>bc_side_t0%delz_BC
3776 bc_t1=>bc_side_t1%delz_BC
3778 bc_t0=>bc_side_t0%pt_BC
3779 bc_t1=>bc_side_t1%pt_BC
3781 bc_t0=>bc_side_t0%w_BC
3782 bc_t1=>bc_side_t1%w_BC
3784 bc_t0=>bc_side_t0%divgd_BC
3785 bc_t1=>bc_side_t1%divgd_BC
3788 bc_t0=>bc_side_t0%cappa_BC
3789 bc_t1=>bc_side_t1%cappa_BC
3793 bc_t0=>bc_side_t0%q_con_BC
3794 bc_t1=>bc_side_t1%q_con_BC
3799 101
format(
' iq<1 is not a valid index for q_BC array in retrieve_bc_variable_data')
3801 lbnd1=lbound(bc_side_t0%q_BC,1)
3802 lbnd2=lbound(bc_side_t0%q_BC,2)
3803 ubnd1=ubound(bc_side_t0%q_BC,1)
3804 ubnd2=ubound(bc_side_t0%q_BC,2)
3805 bc_t0=>bc_side_t0%q_BC(:,:,:,iq)
3806 bc_t1=>bc_side_t1%q_BC(:,:,:,iq)
3808 bc_t0=>bc_side_t0%u_BC
3809 bc_t1=>bc_side_t1%u_BC
3811 bc_t0=>bc_side_t0%v_BC
3812 bc_t1=>bc_side_t1%v_BC
3814 bc_t0=>bc_side_t0%uc_BC
3815 bc_t1=>bc_side_t1%uc_BC
3817 bc_t0=>bc_side_t0%vc_BC
3818 bc_t1=>bc_side_t1%vc_BC
3822 if(trim(bc_vbl_name)/=
'q')
then 3823 lbnd1=lbound(bc_t0,1)
3824 lbnd2=lbound(bc_t0,2)
3825 ubnd1=ubound(bc_t0,1)
3826 ubnd2=ubound(bc_t0,2)
3846 ,bc_update_interval )
3860 integer,
intent(in) :: lbnd_x,ubnd_x,lbnd_y,ubnd_y,ubnd_z
3862 integer,
intent(in) :: lbnd1,ubnd1,lbnd2,ubnd2
3864 integer,
intent(in) :: i1,i2,j1,j2
3866 integer,
intent(in) :: bc_update_interval
3868 real,
intent(in) :: fcst_time
3870 real,
dimension(lbnd1:ubnd1,lbnd2:ubnd2,1:ubnd_z) :: bc_t0 & !<-- Interpolate between these
3877 real,
dimension(lbnd_x:ubnd_x,lbnd_y:ubnd_y,1:ubnd_z) &
3878 ,
intent(out) :: array
3886 real :: fraction_interval
3897 fraction_interval=mod(fcst_time,(bc_update_interval*3600.)) &
3898 /(bc_update_interval*3600.)
3905 array(i,j,k)=bc_t0(i,j,k) &
3906 +(bc_t1(i,j,k)-bc_t0(i,j,k))*fraction_interval
3919 ,is_s,ie_s,js_s,je_s &
3920 ,is_w,ie_w,js_w,je_w &
3937 integer,
intent(in) :: is,ie,js,je & !<-- Index limits for centers of grid cells
3938 ,is_s,ie_s,js_s,je_s & !<-- Index limits for south/north edges of grid cells
3939 ,is_w,ie_w,js_w,je_w
3941 real,
intent(in) :: fraction
3943 type(fv_regional_BC_variables),
intent(in) :: t0,t1
3945 type(fv_atmos_type),
intent(inout) :: Atm
3951 integer :: i,j,k,n,nlayers
3962 k_loop:
do k=1,nlayers
3973 atm%delp(i,j,k)=t0%delp_BC(i,j,k) &
3974 +(t1%delp_BC(i,j,k)-t0%delp_BC(i,j,k)) &
3978 atm%delz(i,j,k)=t0%delz_BC(i,j,k) &
3979 +(t1%delz_BC(i,j,k)-t0%delz_BC(i,j,k)) &
3982 atm%w(i,j,k)=t0%w_BC(i,j,k) &
3983 +(t1%w_BC(i,j,k)-t0%w_BC(i,j,k)) &
3986 atm%pt(i,j,k)=t0%pt_BC(i,j,k) &
3987 +(t1%pt_BC(i,j,k)-t0%pt_BC(i,j,k)) &
3990 atm%q_con(i,j,k)=t0%q_con_BC(i,j,k) &
3991 +(t1%q_con_BC(i,j,k)-t0%q_con_BC(i,j,k)) &
4008 atm%q(i,j,k,n)=t0%q_BC(i,j,k,n) &
4009 +(t1%q_BC(i,j,k,n)-t0%q_BC(i,j,k,n)) &
4022 atm%u(i,j,k)=t0%u_BC(i,j,k) &
4023 +(t1%u_BC(i,j,k)-t0%u_BC(i,j,k)) &
4025 atm%vc(i,j,k)=t0%vc_BC(i,j,k) &
4026 +(t1%vc_BC(i,j,k)-t0%vc_BC(i,j,k)) &
4034 atm%v(i,j,k)=t0%v_BC(i,j,k) &
4035 +(t1%v_BC(i,j,k)-t0%v_BC(i,j,k)) &
4037 atm%uc(i,j,k)=t0%uc_BC(i,j,k) &
4038 +(t1%uc_BC(i,j,k)-t0%uc_BC(i,j,k)) &
4056 ,nlev,ntracers,bnds )
4070 integer,
intent(in) :: nlev & !<-- # of model layers.
4083 integer :: i,ie_c,ie_s,ie_w,is_c,is_s,is_w &
4084 ,j,je_c,je_s,je_w,js_c,js_s,js_w &
4112 is_s=bnds%is_north_uvs
4113 ie_s=bnds%ie_north_uvs
4114 js_s=bnds%js_north_uvs
4115 je_s=bnds%je_north_uvs
4117 is_w=bnds%is_north_uvw
4118 ie_w=bnds%ie_north_uvw
4119 js_w=bnds%js_north_uvw
4120 je_w=bnds%je_north_uvw
4135 is_s=bnds%is_south_uvs
4136 ie_s=bnds%ie_south_uvs
4137 js_s=bnds%js_south_uvs
4138 je_s=bnds%je_south_uvs
4140 is_w=bnds%is_south_uvw
4141 ie_w=bnds%ie_south_uvw
4142 js_w=bnds%js_south_uvw
4143 je_w=bnds%je_south_uvw
4158 is_s=bnds%is_east_uvs
4159 ie_s=bnds%ie_east_uvs
4160 js_s=bnds%js_east_uvs
4161 je_s=bnds%je_east_uvs
4163 is_w=bnds%is_east_uvw
4164 ie_w=bnds%ie_east_uvw
4165 js_w=bnds%js_east_uvw
4166 je_w=bnds%je_east_uvw
4181 is_s=bnds%is_west_uvs
4182 ie_s=bnds%ie_west_uvs
4183 js_s=bnds%js_west_uvs
4184 je_s=bnds%je_west_uvs
4186 is_w=bnds%is_west_uvw
4187 ie_w=bnds%ie_west_uvw
4188 js_w=bnds%js_west_uvw
4189 je_w=bnds%je_west_uvw
4275 integer,
intent(in) :: isd,ied,jsd,jed,npz
4277 integer,
intent(in) :: liq_wat,sphum
4283 integer :: i1,i2,j1,j2
4287 real,
dimension(:,:,:),
pointer :: delp,delz,pt
4289 real,
dimension(:,:,:),
pointer :: q_con
4292 real,
dimension(:,:,:),
pointer ::cappa
4295 real,
dimension(:,:,:,:),
pointer :: q
4312 q =>
bc_t1%north%q_BC
4314 q_con=>
bc_t1%north%q_con_BC
4316 delp =>
bc_t1%north%delp_BC
4317 delz =>
bc_t1%north%delz_BC
4319 cappa=>
bc_t1%north%cappa_BC
4321 pt =>
bc_t1%north%pt_BC
4330 q =>
bc_t1%south%q_BC
4332 q_con=>
bc_t1%south%q_con_BC
4334 delp =>
bc_t1%south%delp_BC
4335 delz =>
bc_t1%south%delz_BC
4337 cappa=>
bc_t1%south%cappa_BC
4339 pt =>
bc_t1%south%pt_BC
4350 q_con=>
bc_t1%east%q_con_BC
4352 delp =>
bc_t1%east%delp_BC
4353 delz =>
bc_t1%east%delz_BC
4355 cappa=>
bc_t1%east%cappa_BC
4357 pt =>
bc_t1%east%pt_BC
4368 q_con=>
bc_t1%west%q_con_BC
4370 delp =>
bc_t1%west%delp_BC
4371 delz =>
bc_t1%west%delz_BC
4373 cappa=>
bc_t1%west%cappa_BC
4375 pt =>
bc_t1%west%pt_BC
4407 dp1 =
zvir*q(i,j,k,sphum)
4410 cvm=(1.-q(i,j,k,sphum)+q_con(i,j,k))*
cv_air &
4412 pkz=exp(cappa(i,j,k)*log(rdg*delp(i,j,k)*pt(i,j,k) &
4413 *(1.+dp1)*(1.-q_con(i,j,k))/delz(i,j,k)))
4415 pkz=exp(kappa*log(rdg*delp(i,j,k)*pt(i,j,k) &
4416 *(1.+dp1)*(1.-q_con(i,j,k))/delz(i,j,k)))
4418 pt(i,j,k)=pt(i,j,k)*(1.+dp1)*(1.-q_con(i,j,k))/pkz
4420 pkz=exp(kappa*log(rdg*delp(i,j,k)*pt(i,j,k) &
4421 *(1.+dp1)/delz(i,j,k)))
4422 pt(i,j,k)=pt(i,j,k)*(1.+dp1)/pkz
4448 subroutine p_maxmin(qname, q, is, ie, js, je, km, fac)
4449 character(len=*),
intent(in):: qname
4450 integer,
intent(in):: is, ie, js, je, km
4451 real,
intent(in):: q(is:ie, js:je, km)
4452 real,
intent(in):: fac
4461 if( q(i,j,k) < qmin )
then 4463 elseif( q(i,j,k) > qmax )
then 4469 call mp_reduce_min(qmin)
4470 call mp_reduce_max(qmax)
4471 if(is_master())
write(6,*) qname, qmax*fac, qmin*fac
4476 subroutine pmaxmn(qname, q, is, ie, js, je, km, fac, area, domain)
4477 character(len=*),
intent(in):: qname
4478 integer,
intent(in):: is, ie, js, je
4479 integer,
intent(in):: km
4480 real,
intent(in):: q(is:ie, js:je, km)
4481 real,
intent(in):: fac
4482 real(kind=R_GRID),
intent(IN):: area(is-3:ie+3, js-3:je+3)
4483 type(domain2d),
intent(INOUT) :: domain
4485 real qmin, qmax, gmean
4495 if( q(i,j,k) < qmin )
then 4497 elseif( q(i,j,k) > qmax )
then 4504 call mp_reduce_min(qmin)
4505 call mp_reduce_max(qmax)
4507 gmean =
g_sum(domain, q(is,js,km), is, ie, js, je, 3, area, 1, reproduce=.true.)
4508 if(is_master())
write(6,*) qname, qmax*fac, qmin*fac, gmean*fac
4513 subroutine fillq(im, km, nq, q, dp)
4514 integer,
intent(in):: im
4515 integer,
intent(in):: km
4516 integer,
intent(in):: nq
4517 real ,
intent(in):: dp(im,km)
4518 real ,
intent(inout) :: q(im,km,nq)
4520 integer i, k, ic, k1
4527 if( q(i,k,ic) < 0. )
then 4528 q(i,k1,ic) = q(i,k1,ic) + q(i,k,ic)*dp(i,k)/dp(i,k1)
4537 if( q(i,k,ic) < 0. )
then 4538 q(i,k1,ic) = q(i,k1,ic) + q(i,k,ic)*dp(i,k)/dp(i,k1)
4546 end subroutine fillq 4549 real,
intent(inout):: ql, qr, qi, qs
4550 real,
parameter:: qi0_max = 2.0e-3
4551 real,
parameter:: ql0_max = 2.5e-3
4554 if ( ql > ql0_max )
then 4559 if ( qi > qi0_max )
then 4581 integer,
intent(in) :: isd,ied,jsd,jed
4583 type(fv_atmos_type),
target,
intent(inout) :: Atm
4589 integer :: i,i_x,ie,is,j,j_x,je,js,k
4591 real,
parameter:: q1_h2o = 2.2e-6
4592 real,
parameter:: q7_h2o = 3.8e-6
4593 real,
parameter:: q100_h2o = 3.8e-6
4594 real,
parameter:: q1000_h2o = 3.1e-6
4595 real,
parameter:: q2000_h2o = 2.8e-6
4596 real,
parameter:: q3000_h2o = 3.0e-6
4597 real,
parameter:: wt=2., xt=1./(1.+wt)
4601 type(fv_regional_bc_bounds_type),
pointer :: bnds
4607 bnds=>atm%regional_bc_bounds
4614 is=lbound(
bc_t1%north%q_BC,1)
4615 ie=ubound(
bc_t1%north%q_BC,1)
4616 js=lbound(
bc_t1%north%q_BC,2)
4617 je=ubound(
bc_t1%north%q_BC,2)
4636 p00=p00+
bc_t1%north%delp_BC(i_x,j_x,k)
4645 is=lbound(
bc_t1%south%q_BC,1)
4646 ie=ubound(
bc_t1%south%q_BC,1)
4647 js=lbound(
bc_t1%south%q_BC,2)
4648 je=ubound(
bc_t1%south%q_BC,2)
4667 p00=p00+
bc_t1%south%delp_BC(i_x,j_x,k)
4676 is=lbound(
bc_t1%east%q_BC,1)
4677 ie=ubound(
bc_t1%east%q_BC,1)
4678 js=lbound(
bc_t1%east%q_BC,2)
4679 je=ubound(
bc_t1%east%q_BC,2)
4698 p00=p00+
bc_t1%east%delp_BC(i_x,j_x,k)
4707 is=lbound(
bc_t1%west%q_BC,1)
4708 ie=ubound(
bc_t1%west%q_BC,1)
4709 js=lbound(
bc_t1%west%q_BC,2)
4710 je=ubound(
bc_t1%west%q_BC,2)
4729 p00=p00+
bc_t1%west%delp_BC(i_x,j_x,k)
4749 if ( p00 < 30.e2 )
then 4750 if ( p00 < 1. )
then 4752 elseif ( p00 <= 7. .and. p00 >= 1. )
then 4753 q00 = q1_h2o + (q7_h2o-q1_h2o)*log(
pref(k)/1.)/log(7.)
4754 elseif ( p00 < 100. .and. p00 >= 7. )
then 4755 q00 = q7_h2o + (q100_h2o-q7_h2o)*log(
pref(k)/7.)/log(100./7.)
4756 elseif ( p00 < 1000. .and. p00 >= 100. )
then 4757 q00 = q100_h2o + (q1000_h2o-q100_h2o)*log(
pref(k)/1.e2)/log(10.)
4758 elseif ( p00 < 2000. .and. p00 >= 1000. )
then 4759 q00 = q1000_h2o + (q2000_h2o-q1000_h2o)*log(
pref(k)/1.e3)/log(2.)
4761 q00 = q2000_h2o + (q3000_h2o-q2000_h2o)*log(
pref(k)/2.e3)/log(1.5)
4776 subroutine dump_field_3d (domain, name, field, isd, ied, jsd, jed, nlev, stag)
4783 type(domain2d),
intent(INOUT) :: domain
4784 character(len=*),
intent(IN) :: name
4785 real,
dimension(isd:ied,jsd:jed,1:nlev),
intent(INOUT) :: field
4786 integer,
intent(IN) :: isd, ied, jsd, jed, nlev
4787 integer,
intent(IN) :: stag
4790 character(len=128) :: fname
4791 type(axistype) :: x, y, z
4792 type(fieldtype) :: f
4793 type(domain1D) :: xdom, ydom
4795 integer :: is, ie, js, je
4796 integer :: isg, ieg, jsg, jeg, nxg, nyg, npx, npy
4797 integer :: i, j, halo, iext, jext
4798 logical :: is_root_pe
4799 real,
allocatable,
dimension(:,:,:) :: glob_field
4800 integer,
allocatable,
dimension(:) :: pelist
4801 character(len=1) :: stagname
4802 integer :: isection_s, isection_e, jsection_s, jsection_e
4804 write(fname,
"(A,A,A,I1.1,A)")
"regional_",name,
".tile", 7 ,
".nc" 4805 write(0,*)
'dump_field_3d: file name = |', trim(fname) ,
'|' 4807 call mpp_get_domain_components( domain, xdom, ydom )
4808 call mpp_get_compute_domain( domain, is, ie, js, je )
4809 call mpp_get_global_domain ( domain, isg, ieg, jsg, jeg, xsize=npx, ysize=npy, position=center )
4812 if ( halo /= 3 )
then 4813 write(0,*)
'dusan- halo should be 3 ', halo
4828 nxg = npx + 2*halo + iext
4829 nyg = npy + 2*halo + jext
4830 nz =
size(field,dim=3)
4832 allocate( glob_field(isg-halo:ieg+halo+iext, jsg-halo:jeg+halo+jext, 1:nz) )
4839 if ( isd < 0 ) isection_s = isd
4840 if ( ied > npx-1 ) isection_e = ied
4841 if ( jsd < 0 ) jsection_s = jsd
4842 if ( jed > npy-1 ) jsection_e = jed
4844 allocate( pelist(mpp_npes()) )
4845 call mpp_get_current_pelist(pelist)
4847 is_root_pe = (mpp_pe()==mpp_root_pe())
4849 call mpp_gather(isection_s,isection_e,jsection_s,jsection_e, nz, &
4850 pelist, field(isection_s:isection_e,jsection_s:jsection_e,:), glob_field, is_root_pe, halo, halo)
4852 call mpp_open( unit, trim(fname), action=mpp_wronly, form=mpp_netcdf, threading=mpp_single)
4854 call mpp_write_meta( unit, x,
'grid_xt',
'km',
'X distance',
'X', domain=xdom, data=(/(i*1.0,i=1,nxg)/) )
4855 call mpp_write_meta( unit, y,
'grid_yt',
'km',
'Y distance',
'Y', domain=ydom, data=(/(j*1.0,j=1,nyg)/) )
4856 call mpp_write_meta( unit, z,
'lev',
'km',
'Z distance', data=(/(i*1.0,i=1,nz)/) )
4858 call mpp_write_meta( unit, f, (/x,y,z/), name,
'unit', name)
4859 call mpp_write_meta( unit,
"stretch_factor", rval=
stretch_factor )
4860 call mpp_write_meta( unit,
"target_lon", rval=
target_lon )
4861 call mpp_write_meta( unit,
"target_lat", rval=
target_lat )
4862 call mpp_write_meta( unit,
"cube_res", ival=
cube_res)
4863 call mpp_write_meta( unit,
"parent_tile", ival=
parent_tile )
4864 call mpp_write_meta( unit,
"refine_ratio", ival=
refine_ratio )
4865 call mpp_write_meta( unit,
"istart_nest", ival=
istart_nest )
4866 call mpp_write_meta( unit,
"jstart_nest", ival=
jstart_nest )
4867 call mpp_write_meta( unit,
"iend_nest", ival=
iend_nest )
4868 call mpp_write_meta( unit,
"jend_nest", ival=
jend_nest )
4869 call mpp_write_meta( unit,
"ihalo_shift", ival=halo )
4870 call mpp_write_meta( unit,
"jhalo_shift", ival=halo )
4871 call mpp_write_meta( unit, mpp_get_id(f),
"hstagger", cval=stagname )
4872 call mpp_write( unit, x )
4873 call mpp_write( unit, y )
4874 call mpp_write( unit, z )
4875 call mpp_write( unit, f, glob_field )
4877 call mpp_close( unit )
4881 subroutine dump_field_2d (domain, name, field, isd, ied, jsd, jed, stag)
4883 type(domain2d),
intent(INOUT) :: domain
4884 character(len=*),
intent(IN) :: name
4885 real,
dimension(isd:ied,jsd:jed),
intent(INOUT) :: field
4886 integer,
intent(IN) :: isd, ied, jsd, jed
4887 integer,
intent(IN) :: stag
4890 character(len=128) :: fname
4891 type(axistype) :: x, y
4892 type(fieldtype) :: f
4893 type(domain1D) :: xdom, ydom
4894 integer :: is, ie, js, je
4895 integer :: isg, ieg, jsg, jeg, nxg, nyg, npx, npy
4896 integer :: i, j, halo, iext, jext
4897 logical :: is_root_pe
4898 real,
allocatable,
dimension(:,:) :: glob_field
4899 integer,
allocatable,
dimension(:) :: pelist
4900 character(len=1) :: stagname
4901 integer :: isection_s, isection_e, jsection_s, jsection_e
4903 write(fname,
"(A,A,A,I1.1,A)")
"regional_",name,
".tile", 7 ,
".nc" 4906 call mpp_get_domain_components( domain, xdom, ydom )
4907 call mpp_get_compute_domain( domain, is, ie, js, je )
4908 call mpp_get_global_domain ( domain, isg, ieg, jsg, jeg, xsize=npx, ysize=npy, position=center )
4911 if ( halo /= 3 )
then 4912 write(0,*)
'dusan- halo should be 3 ', halo
4927 nxg = npx + 2*halo + iext
4928 nyg = npy + 2*halo + jext
4930 allocate( glob_field(isg-halo:ieg+halo+iext, jsg-halo:jeg+halo+jext) )
4937 if ( isd < 0 ) isection_s = isd
4938 if ( ied > npx-1 ) isection_e = ied
4939 if ( jsd < 0 ) jsection_s = jsd
4940 if ( jed > npy-1 ) jsection_e = jed
4942 allocate( pelist(mpp_npes()) )
4943 call mpp_get_current_pelist(pelist)
4945 is_root_pe = (mpp_pe()==mpp_root_pe())
4947 call mpp_gather(isection_s,isection_e,jsection_s,jsection_e, &
4948 pelist, field(isection_s:isection_e,jsection_s:jsection_e), glob_field, is_root_pe, halo, halo)
4950 call mpp_open( unit, trim(fname), action=mpp_wronly, form=mpp_netcdf, threading=mpp_single)
4952 call mpp_write_meta( unit, x,
'grid_xt',
'km',
'X distance',
'X', domain=xdom, data=(/(i*1.0,i=1,nxg)/) )
4953 call mpp_write_meta( unit, y,
'grid_yt',
'km',
'Y distance',
'Y', domain=ydom, data=(/(j*1.0,j=1,nyg)/) )
4955 call mpp_write_meta( unit, f, (/x,y/), name,
'unit', name)
4956 call mpp_write_meta( unit,
"stretch_factor", rval=
stretch_factor )
4957 call mpp_write_meta( unit,
"target_lon", rval=
target_lon )
4958 call mpp_write_meta( unit,
"target_lat", rval=
target_lat )
4959 call mpp_write_meta( unit,
"cube_res", ival=
cube_res)
4960 call mpp_write_meta( unit,
"parent_tile", ival=
parent_tile )
4961 call mpp_write_meta( unit,
"refine_ratio", ival=
refine_ratio )
4962 call mpp_write_meta( unit,
"istart_nest", ival=
istart_nest )
4963 call mpp_write_meta( unit,
"jstart_nest", ival=
jstart_nest )
4964 call mpp_write_meta( unit,
"iend_nest", ival=
iend_nest )
4965 call mpp_write_meta( unit,
"jend_nest", ival=
jend_nest )
4966 call mpp_write_meta( unit,
"ihalo_shift", ival=halo )
4967 call mpp_write_meta( unit,
"jhalo_shift", ival=halo )
4968 call mpp_write_meta( unit, mpp_get_id(f),
"hstagger", cval=stagname )
4969 call mpp_write( unit, x )
4970 call mpp_write( unit, y )
4971 call mpp_write( unit, f, glob_field )
4973 call mpp_close( unit )
4981 subroutine exch_uv(domain, bd, npz, u, v)
4986 type(domain2d),
intent(inout) :: domain
4988 integer,
intent(in) ::
npz 4989 real,
intent(inout) :: u (bd%isd:bd%ied ,bd%jsd:bd%jed+1,1:
npz)
4990 real,
intent(inout) :: v (bd%isd:bd%ied+1,bd%jsd:bd%jed ,1:
npz)
4992 integer,
parameter :: ibufexch=2500000
4993 real,
dimension(ibufexch) :: buf1,buf2,buf3,buf4
4994 integer :: ihandle1,ihandle2,ihandle3,ihandle4
4995 integer,
dimension(MPI_STATUS_SIZE) :: istat
4996 integer :: ic, i, j, k, is, ie, js, je
4997 integer :: irecv, isend, ierr
5000 integer :: north_pe, south_pe, east_pe, west_pe
5003 call mpp_get_neighbor_pe( domain, north, north_pe)
5004 call mpp_get_neighbor_pe( domain, south, south_pe)
5005 call mpp_get_neighbor_pe( domain, west, west_pe)
5006 call mpp_get_neighbor_pe( domain, east, east_pe)
5022 if( north_pe /= null_pe )
then 5023 call mpi_irecv(buf1,ibufexch,mpi_real,north_pe,north_pe &
5024 ,mpi_comm_world,ihandle1,irecv)
5028 if( south_pe /= null_pe )
then 5029 call mpi_irecv(buf2,ibufexch,mpi_real,south_pe,south_pe &
5030 ,mpi_comm_world,ihandle2,irecv)
5034 if( north_pe /= null_pe )
then 5061 call mpi_issend(buf3,ic,mpi_real,north_pe,mype &
5062 ,mpi_comm_world,ihandle3,isend)
5066 if( south_pe /= null_pe )
then 5093 call mpi_issend(buf4,ic,mpi_real,south_pe,mype &
5094 ,mpi_comm_world,ihandle4,isend)
5098 if( south_pe /= null_pe )
then 5100 call mpi_wait(ihandle2,istat,ierr)
5129 if( north_pe /= null_pe )
then 5131 call mpi_wait(ihandle1,istat,ierr)
5165 character (len = 80) :: source
5166 integer :: ncids,sourcelength
5167 logical :: lstatus,regional
5172 lstatus = get_global_att_value(
'INPUT/gfs_data.nc',
"source", source)
5174 lstatus = get_global_att_value(
'INPUT/gfs_data.tile1.nc',
"source", source)
5176 if (.not. lstatus)
then 5177 if (mpp_pe() == 0)
write(0,*)
'INPUT source not found ',lstatus,
' set source=No Source Attribute' 5178 source=
'No Source Attribute' 5188 type(fv_regional_BC_variables),
intent(inout) :: BC_side
5192 integer :: k, j, i, iq, is, ie, js, je
5193 integer :: liq_wat, ice_wat, rainwat, snowwat, graupel, cld_amt
5194 real :: qt, wt, m_fac
5196 is=lbound(bc_side%delp_BC,1)
5197 ie=ubound(bc_side%delp_BC,1)
5198 js=lbound(bc_side%delp_BC,2)
5199 je=ubound(bc_side%delp_BC,2)
5201 liq_wat = get_tracer_index(model_atmos,
'liq_wat')
5202 ice_wat = get_tracer_index(model_atmos,
'ice_wat')
5203 rainwat = get_tracer_index(model_atmos,
'rainwat')
5204 snowwat = get_tracer_index(model_atmos,
'snowwat')
5205 graupel = get_tracer_index(model_atmos,
'graupel')
5206 cld_amt = get_tracer_index(model_atmos,
'cld_amt')
5208 source:
if (trim(
data_source) ==
'FV3GFS GAUSSIAN NEMSIO FILE')
then 5214 wt = bc_side%delp_BC(i,j,k)
5215 if ( nwat == 6 )
then 5216 qt = wt*(1. + bc_side%q_BC(i,j,k,liq_wat) + &
5217 bc_side%q_BC(i,j,k,ice_wat) + &
5218 bc_side%q_BC(i,j,k,rainwat) + &
5219 bc_side%q_BC(i,j,k,snowwat) + &
5220 bc_side%q_BC(i,j,k,graupel))
5222 qt = wt*(1. + sum(bc_side%q_BC(i,j,k,2:nwat)))
5225 bc_side%delp_BC(i,j,k) = qt
5236 wt = bc_side%delp_BC(i,j,k)
5237 if ( nwat == 6 )
then 5238 qt = wt*(1. + bc_side%q_BC(i,j,k,liq_wat) + &
5239 bc_side%q_BC(i,j,k,ice_wat) + &
5240 bc_side%q_BC(i,j,k,rainwat) + &
5241 bc_side%q_BC(i,j,k,snowwat) + &
5242 bc_side%q_BC(i,j,k,graupel))
5244 qt = wt*(1. + sum(bc_side%q_BC(i,j,k,2:nwat)))
5248 bc_side%q_BC(i,j,k,iq) = m_fac * bc_side%q_BC(i,j,k,iq)
5250 bc_side%delp_BC(i,j,k) = qt
subroutine dump_field_2d(domain, name, field, isd, ied, jsd, jed, stag)
integer, parameter jend_nest
integer, parameter iend_nest
subroutine, public mid_pt_sphere(p1, p2, pm)
subroutine, public prt_height(qname, is, ie, js, je, ng, km, press, phis, delz, peln, area, lat)
subroutine dump_field_3d(domain, name, field, isd, ied, jsd, jed, nlev, stag)
logical, save, public begin_regional_restart
subroutine, public regional_boundary_update(array, bc_vbl_name, lbnd_x, ubnd_x, lbnd_y, ubnd_y, ubnd_z, is, ie, js, je, isd, ied, jsd, jed, fcst_time, index4)
real, public current_time_in_seconds
The module 'fv_mp_mod' is a single program multiple data (SPMD) parallel decompostion/communication m...
integer, parameter refine_ratio
subroutine, public regional_bc_t1_to_t0(BC_t1, BC_t0, nlev, ntracers, bnds)
integer, parameter, public h_stagger
integer, save bc_update_interval
character(len=100) grid_data
real, parameter stretch_factor
subroutine, public moist_cv(is, ie, isd, ied, jsd, jed, km, j, k, nwat, sphum, liq_wat, rainwat, ice_wat, snowwat, graupel, q, qd, cvm, t1)
The subroutine 'moist_cv' computes the FV3-consistent moist heat capacity under constant volume...
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...
type(fv_regional_bc_variables), pointer, save bc_east_t1
subroutine, public regional_bc_data(Atm, bc_hour, is, ie, js, je, isd, ied, jsd, jed, ak, bk)
subroutine mp_auto_conversion(ql, qr, qi, qs)
subroutine remap_scalar_nggps_regional_bc(Atm, side, isd, ied, jsd, jed, is_bc, ie_bc, js_bc, je_bc, km, npz, ncnst, ak0, bk0, psc, t_in, qa, omga, zh, phis_reg, ps, BC_side)
integer, parameter cube_res
subroutine, public get_eta_level(npz, p_s, pf, ph, ak, bk, pscale)
The subroutine 'get_eta_level' returns the interface and layer-mean pressures for reference...
type(fv_domain_sides), target, save, public bc_t1
– Boundary values for all BC variables at successive times from the regional BC file ...
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'.
integer, save liq_water_index
real function, public inner_prod(v1, v2)
subroutine, public get_latlon_vector(pp, elon, elat)
subroutine, public get_unit_vect2(e1, e2, uc)
subroutine nudge_qv_bc(Atm, isd, ied, jsd, jed)
integer, parameter, public r_grid
integer, save, public next_time_to_read_bcs
integer, parameter parent_tile
subroutine read_regional_lon_lat
type(fv_regional_bc_variables), pointer, save bc_south_t1
real(kind=r_grid), dimension(:,:,:), allocatable grid_reg
– Lon/lat of cell corners
subroutine read_regional_bc_file(is_input, ie_input, js_input, je_input, nlev, ntracers, var_name_root, array_3d, array_4d, tlev, required)
type(fv_regional_bc_variables), pointer, save bc_south_t0
type(fv_domain_sides), target, save, public bc_t0
real, dimension(:), allocatable dum1d
type(fv_regional_bc_variables), pointer bc_side_t0
integer, parameter nhalo_data
subroutine bc_time_interpolation_general(is, ie, js, je, is_s, ie_s, js_s, je_s, is_w, ie_w, js_w, je_w, fraction, t0, t1, Atm)
character(len=80) data_source
real, parameter real_snan
subroutine, public set_regional_bcs(delp, delz, w, pt ifdef USE_COND
type(fv_regional_bc_variables), pointer, save bc_north_t1
subroutine, public setup_regional_bc(Atm, isd, ied, jsd, jed, npx, npy)
subroutine allocate_regional_bc_arrays(side, north_bc, south_bc, east_bc, west_bc, is_0, ie_0, js_0, je_0, is_sn, ie_sn, js_sn, je_sn, is_we, ie_we, js_we, je_we, klev, ntracers, BC_side)
real, dimension(:), allocatable, public bk_in
The module 'fv_mapz' contains the vertical mapping routines .
real, dimension(:), allocatable pref
real, parameter target_lon
subroutine, public fillz(im, km, nq, q, dp)
The subroutine 'fillz' is for mass-conservative filling of nonphysical negative values in the tracers...
The module 'fv_arrays' contains the 'fv_atmos_type' and associated datatypes.
subroutine p_maxmin(qname, q, is, ie, js, je, km, fac)
subroutine, public cell_center2(q1, q2, q3, q4, e2)
subroutine bc_values_into_arrays(side_t0, side_t1, side, i1, i2, j1, j2, i1_uvs, i2_uvs, j1_uvs, j2_uvs, i1_uvw, i2_uvw, j1_uvw, j2_uvw)
The module 'fv_eta' contains routine to set up the reference (Eulerian) pressure coordinate.
character(len=100) oro_data
subroutine convert_to_virt_pot_temp(isd, ied, jsd, jed, npz, sphum, liq_wat)
type(fv_regional_bc_variables), pointer, save bc_east_t0
integer, parameter istart_nest
subroutine, public moist_cp(is, ie, isd, ied, jsd, jed, km, j, k, nwat, sphum, liq_wat, rainwat, ice_wat, snowwat, graupel, q, qd, cpm, t1)
The subroutine 'moist_cp' computes the FV3-consistent moist heat capacity under constant pressure...
subroutine, public get_data_source(source, regional)
subroutine compute_regional_bc_indices(regional_bc_bounds)
type(fv_regional_bc_variables), pointer bc_side_t1
integer, save sphum_index
– Locations of tracer vbls in the tracers array
type(fv_regional_bc_bounds_type), pointer, save regional_bounds
real, dimension(:,:), allocatable phis_reg
– Filtered sfc geopotential
subroutine set_delp_and_tracers(BC_side, npz, nwat)
integer, parameter, public v_stagger
@ The module 'fv_diagnostics' contains routines to compute diagnosic fields.
The module 'fv_grid_utils' contains routines for setting up and computing grid-related quantities...
real(kind=r_grid), parameter dbl_snan
integer, save, public bc_hour
type(fv_regional_bc_variables), pointer, save bc_west_t0
subroutine bc_time_interpolation(array, lbnd_x, ubnd_x, lbnd_y, ubnd_y, ubnd_z, bc_t0, bc_t1, lbnd1, ubnd1, lbnd2, ubnd2, i1, i2, j1, j2, fcst_time, bc_update_interval)
type(fv_regional_bc_variables), pointer, save bc_north_t0
subroutine, public prt_gb_nh_sh(qname, is, ie, js, je, a2, area, lat)
real, parameter target_lat
real(kind=r_grid), dimension(:,:,:), allocatable agrid_reg
-- Lon/lat of cell centers
subroutine remap_dwinds_regional_bc(Atm, is_input, ie_input, js_input, je_input, is_u, ie_u, js_u, je_u, is_v, ie_v, js_v, je_v, km, npz, ak0, bk0, psc, ud, vd, uc, vc, BC_side)
subroutine, public start_regional_restart(Atm, isc, iec, jsc, jec, isd, ied, jsd, jed)
integer, parameter jstart_nest
subroutine pmaxmn(qname, q, is, ie, js, je, km, fac, area, domain)
subroutine retrieve_bc_variable_data(bc_vbl_name, bc_side_t0, bc_side_t1, bc_t0, bc_t1, lbnd1, ubnd1, lbnd2, ubnd2, iq)
real, dimension(:), allocatable, public ak_in
integer, save, public ntimesteps_per_bc_update
integer, parameter nhalo_model
subroutine, public exch_uv(domain, bd, npz, u, v)
subroutine read_regional_filtered_topo
subroutine fillq(im, km, nq, q, dp)
subroutine, public start_regional_cold_start(Atm, ak, bk, levp, is, ie, js, je, isd, ied, jsd, jed)
type(fv_regional_bc_variables), pointer, save bc_west_t1
subroutine, public read_new_bc_data(Atm, Time, Time_step_atmos, p_split, isd, ied, jsd, jed)
integer, parameter, public u_stagger