Skip to content

Commit

Permalink
GitHub Issue NOAA-EMC#26. Pushing back the recent developments fixes…
Browse files Browse the repository at this point in the history
… with FV3SAR GSI interface in the branch gsi_fv3reg4coldstart.
  • Loading branch information
TingLei-NOAA committed Sep 18, 2020
1 parent 56652c2 commit 4ad95b5
Show file tree
Hide file tree
Showing 14 changed files with 285 additions and 118 deletions.
29 changes: 16 additions & 13 deletions src/gsi/aniso_ens_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ subroutine ens_uv_to_psichi(u,v,truewind)
!
! program history log:
! 2008-08-21 pondeca
! 2020-05-04 wu - no rotate_wind for fv3_regional
!
! input argument list:
! u(nlat,nlon) - earth relative u-field on analysis grid
Expand All @@ -82,7 +83,7 @@ subroutine ens_uv_to_psichi(u,v,truewind)
use kinds, only: i_kind,r_kind,r_single
use constants, only: one,two
use gridmod, only: nlon,nlat,region_lon,region_lat,region_dx,region_dy, &
rotate_wind_ll2xy
rotate_wind_ll2xy,fv3_regional
use wind_fft, only: divvort_to_psichi

implicit none
Expand Down Expand Up @@ -116,19 +117,21 @@ subroutine ens_uv_to_psichi(u,v,truewind)
! minval(region_lon),maxval(region_lon)
! print*,'in ens_uv_to_psichi: region_lat,min,max=', &
! minval(region_lat),maxval(region_lat)
do i=1,nlat
do j=1,nlon
rlon=region_lon(i,j)
rlat=region_lat(i,j)
dlon=float(j)*one
dlat=float(i)*one
ue=u(i,j)
ve=v(i,j)
call rotate_wind_ll2xy(ue,ve,ug,vg,rlon,dlon,dlat)
u(i,j)=ug
v(i,j)=vg
if(.not.fv3_regional)then
do i=1,nlat
do j=1,nlon
rlon=region_lon(i,j)
rlat=region_lat(i,j)
dlon=float(j)*one
dlat=float(i)*one
ue=u(i,j)
ve=v(i,j)
call rotate_wind_ll2xy(ue,ve,ug,vg,rlon,dlon,dlat)
u(i,j)=ug
v(i,j)=vg
enddo
enddo
enddo
endif
if (truewind) return
!==========================================================================
!==>divergence and vorticity computation
Expand Down
75 changes: 46 additions & 29 deletions src/gsi/get_gefs_for_regional.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ subroutine get_gefs_for_regional
! when using ensembles from different time
! 2016-12-12 tong - add code to get nemsio meta data, if use_gfs_nemsio=True
! 2020-07-01 Bi - add code to get netCDF data, if use_gfs_ncio=.true.
! 2020-05-04 wu - no rotate_wind for fv3_regional
!
! input argument list:
!
Expand All @@ -36,7 +37,8 @@ subroutine get_gefs_for_regional

use gridmod, only: idsl5,regional,use_gfs_nemsio,use_gfs_ncio,&
ncepgfs_head,ncepgfs_headv
use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy
use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy,&
fv3_regional
use hybrid_ensemble_parameters, only: region_lat_ens,region_lon_ens
use hybrid_ensemble_parameters, only: en_perts,ps_bar,nelen
use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_a1,grd_e1,p_e2a,uv_hyb_ens,dual_res
Expand Down Expand Up @@ -860,37 +862,52 @@ subroutine get_gefs_for_regional
jjmin=grd_mix%nlon
ratio_x=(nlon-one)/(grd_mix%nlon-one)
ratio_y=(nlat-one)/(grd_mix%nlat-one)
do k=1,grd_mix%nsig
ku=k ; kv=ku+grd_mix%nsig ; kt=kv+grd_mix%nsig ; kq=kt+grd_mix%nsig ; koz=kq+grd_mix%nsig
kcw=koz+grd_mix%nsig
do j=1,grd_mix%lon2
do i=1,grd_mix%lat2
if(.not. fv3_regional)then
do k=1,grd_mix%nsig
ku=k ; kv=ku+grd_mix%nsig ; kt=kv+grd_mix%nsig ; kq=kt+grd_mix%nsig ; koz=kq+grd_mix%nsig
kcw=koz+grd_mix%nsig
do j=1,grd_mix%lon2
do i=1,grd_mix%lat2

ii=i+grd_mix%istart(mm1)-2
jj=j+grd_mix%jstart(mm1)-2
ii=min(grd_mix%nlat,max(1,ii))
jj=min(grd_mix%nlon,max(1,jj))
iimax=max(ii,iimax)
iimin=min(ii,iimin)
jjmax=max(jj,jjmax)
jjmin=min(jj,jjmin)
dlon_ens=float(jj)
dlat_ens=float(ii)
dlon=one+(dlon_ens-one)*ratio_x
dlat=one+(dlat_ens-one)*ratio_y

call rotate_wind_ll2xy(work_sub(1,i,j,ku),work_sub(1,i,j,kv), &
uob,vob,region_lon_ens(ii,jj),dlon,dlat)
st_eg(i,j,k,n)=uob
vp_eg(i,j,k,n)=vob

t_eg(i,j,k,n)=work_sub(1,i,j,kt) ! now pot virtual temp
rh_eg(i,j,k,n)=work_sub(1,i,j,kq) ! now rh
oz_eg(i,j,k,n)=work_sub(1,i,j,koz)
cw_eg(i,j,k,n)=work_sub(1,i,j,kcw)
ii=i+grd_mix%istart(mm1)-2
jj=j+grd_mix%jstart(mm1)-2
ii=min(grd_mix%nlat,max(1,ii))
jj=min(grd_mix%nlon,max(1,jj))
iimax=max(ii,iimax)
iimin=min(ii,iimin)
jjmax=max(jj,jjmax)
jjmin=min(jj,jjmin)
dlon_ens=float(jj)
dlat_ens=float(ii)
dlon=one+(dlon_ens-one)*ratio_x
dlat=one+(dlat_ens-one)*ratio_y
call rotate_wind_ll2xy(work_sub(1,i,j,ku),work_sub(1,i,j,kv), &
uob,vob,region_lon_ens(ii,jj),dlon,dlat)
st_eg(i,j,k,n)=uob
vp_eg(i,j,k,n)=vob
t_eg(i,j,k,n)=work_sub(1,i,j,kt) ! now pot virtual temp
rh_eg(i,j,k,n)=work_sub(1,i,j,kq) ! now rh
oz_eg(i,j,k,n)=work_sub(1,i,j,koz)
cw_eg(i,j,k,n)=work_sub(1,i,j,kcw)
end do
end do
end do
end do
else
do k=1,grd_mix%nsig
ku=k ; kv=ku+grd_mix%nsig ; kt=kv+grd_mix%nsig ; kq=kt+grd_mix%nsig ; koz=kq+grd_mix%nsig
kcw=koz+grd_mix%nsig
do j=1,grd_mix%lon2
do i=1,grd_mix%lat2
st_eg(i,j,k,n)=work_sub(1,i,j,ku)
vp_eg(i,j,k,n)=work_sub(1,i,j,kv)
t_eg(i,j,k,n)=work_sub(1,i,j,kt) ! now pot virtual temp
rh_eg(i,j,k,n)=work_sub(1,i,j,kq) ! now rh
oz_eg(i,j,k,n)=work_sub(1,i,j,koz)
cw_eg(i,j,k,n)=work_sub(1,i,j,kcw)
end do
end do
end do
endif
kz=num_fields ; kps=kz-1
do j=1,grd_mix%lon2
do i=1,grd_mix%lat2
Expand Down
24 changes: 16 additions & 8 deletions src/gsi/gfs_stratosphere.f90
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ subroutine add_gfs_stratosphere
! of unused variables
! 2016-12-10 tong - add code to gfs nemsio meta data, if use_gfs_nemsio=True
! 2019-09-24 martin - add support for when use_gfs_ncio is True
! 2020-05-04 wu - no rotate_wind for fv3_regional
!
! input argument list:
!
Expand All @@ -864,7 +865,7 @@ subroutine add_gfs_stratosphere

use gridmod, only: regional,wrf_nmm_regional,use_gfs_nemsio,use_gfs_ncio
use gridmod, only: region_lat,region_lon,aeta1_ll,aeta2_ll,pdtop_ll,pt_ll
use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy
use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy,fv3_regional
use gridmod, only: use_gfs_ozone,jcap_gfs,nlat_gfs,nlon_gfs
use constants,only: zero,one_tenth,half,one,ten,fv,t0c,r0_05,r60,r3600
use mpimod, only: mype
Expand Down Expand Up @@ -1586,13 +1587,20 @@ subroutine add_gfs_stratosphere
if (xsplo(k) > xspli_g(1)) ysplov_g(k)=yspliv_g(1)
enddo
! blend contributions from regional and global:
do k=1,nsig
! rotate gfs wind to nmmb coordinate:
call rotate_wind_ll2xy(ysplou_g(k),ysplov_g(k), &
uob,vob,region_lon(ii,jj),dlon,dlat)
ut(i,j,k)=blend_rm(k)*ysplou_r(k)+blend_gm(k)*uob
vt(i,j,k)=blend_rm(k)*ysplov_r(k)+blend_gm(k)*vob
enddo
if(fv3_regional)then
do k=1,nsig
ut(i,j,k)=blend_rm(k)*ysplou_r(k)+blend_gm(k)*ysplou_g(k)
vt(i,j,k)=blend_rm(k)*ysplov_r(k)+blend_gm(k)*ysplov_g(k)
enddo
else
do k=1,nsig
! rotate gfs wind to nmmb coordinate:
call rotate_wind_ll2xy(ysplou_g(k),ysplov_g(k), &
uob,vob,region_lon(ii,jj),dlon,dlat)
ut(i,j,k)=blend_rm(k)*ysplou_r(k)+blend_gm(k)*uob
vt(i,j,k)=blend_rm(k)*ysplov_r(k)+blend_gm(k)*vob
enddo
endif

! t -- regional contribution
do k=1,nsig_save
Expand Down
Loading

0 comments on commit 4ad95b5

Please sign in to comment.