Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/gsibec/gsi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ m_berror_stats_reg.F90
rapidrefresh_cldsurf_mod.f90
chemmod.f90
radarZ_global_module.f90
fv3_regional_interface.f90
gsi_rfv3io_mod.f90
mod_fv3_lola.f90
grdcrd.f90
Expand Down
16 changes: 13 additions & 3 deletions src/gsibec/gsi/balmod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,8 @@ subroutine locatelat_reg(mype)
! 2005-03-28 wu - replace mlath with mlat
! 2005-04-22 treadon - change berror file to 4-byte reals
! 2005-06-06 wu - setup f1 for balance projection (st->t) when fstat=.true.
! 2022-04-20 x.zhang - add switch (usenewgfsberror)for no need to convert
! the unit of clat for using global 127-L BE in regional DA
!
! input argument list:
! mype - mpi task id
Expand All @@ -937,6 +939,7 @@ subroutine locatelat_reg(mype)
use m_kinds, only: r_single
use gridmod, only: nlon,nlat,lat2,lon2,istart,jstart,region_lat
use constants, only: deg2rad,one
use m_berror_stats, only: usenewgfsberror
implicit none

! Declare passed variables
Expand All @@ -960,9 +963,16 @@ subroutine locatelat_reg(mype)
allocate( clat_avn(mlat), clat_avn4(mlat) )
read(lunin)clat_avn4
close(lunin)
do i=1,mlat
clat_avn(i)=clat_avn4(i)*deg2rad
end do
if (usenewgfsberror) then
! 'The unit of clat from global BE is radian, do not need to convert'
do i=1,mlat
clat_avn(i)=clat_avn4(i)
end do
else
do i=1,mlat
clat_avn(i)=clat_avn4(i)*deg2rad
end do
end if
deallocate(clat_avn4)


Expand Down
21 changes: 12 additions & 9 deletions src/gsibec/gsi/compute_derived.F90
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ subroutine compute_derived(mype,init_pass)
use mpeu_util, only: getindex
use mpeu_util, only: die, tell
use gsi_io, only: verbose
use gen_qsat

implicit none


Expand Down Expand Up @@ -191,7 +193,7 @@ subroutine compute_derived(mype,init_pass)
iderivative=0
ice=.true.
do ii=1,nfldsig
call genqsat(ges_qsat(1,1,1,ii),ges_tsen(1,1,1,ii),ges_prsl(1,1,1,ii),lat2,lon2, &
call genqsat(ges_qsat(:,:,:,ii),ges_tsen(:,:,:,ii),ges_prsl(:,:,:,ii),lat2,lon2, &
nsig,ice,iderivative)
enddo

Expand Down Expand Up @@ -289,12 +291,13 @@ subroutine compute_derived(mype,init_pass)
! and for getting time derivatives of prognostic variables for
! time extrapolation and non-linear balance constraints.

do nt=1,nfldsig
call get_derivatives(gsi_metguess_bundle(nt),&
gsi_xderivative_bundle(nt), &
gsi_yderivative_bundle(nt))
enddo

if(.not. regional) then
do nt=1,nfldsig
call get_derivatives(gsi_metguess_bundle(nt),&
gsi_xderivative_bundle(nt), &
gsi_yderivative_bundle(nt))
enddo
endif
#ifdef USE_ALL_ORIGINAL
if(.not. wrf_mass_regional .and. tendsflag)then
#else
Expand Down Expand Up @@ -438,13 +441,13 @@ subroutine compute_derived(mype,init_pass)
end if

ice=.true.
call genqsat(qsatg,ges_tsen(1,1,1,ntguessig),ges_prsl(1,1,1,ntguessig),lat2,lon2, &
call genqsat(qsatg,ges_tsen(:,:,:,ntguessig),ges_prsl(:,:,:,ntguessig),lat2,lon2, &
nsig,ice,iderivative)

! Now load over nfldsig bins for limq (when nobs_bins /= zero)
iderivative = 0
do ii=1,nfldsig
call genqsat(ges_qsat(1,1,1,ii),ges_tsen(1,1,1,ii),ges_prsl(1,1,1,ii),lat2,lon2, &
call genqsat(ges_qsat(:,:,:,ii),ges_tsen(:,:,:,ii),ges_prsl(:,:,:,ii),lat2,lon2, &
nsig,ice,iderivative)
end do
endif
Expand Down
6 changes: 4 additions & 2 deletions src/gsibec/gsi/compute_qvar3d.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ subroutine compute_qvar3d
use m_berror_stats, only: varq
#endif /* USE_ALL_ORIGINAL */

use gen_qsat

implicit none

! Declare local variables
Expand Down Expand Up @@ -84,7 +86,7 @@ subroutine compute_qvar3d
iderivative = 0
ice=.true.
do it=1,nfldsig
call genqsat(ges_qsat(1,1,1,it),ges_tsen(1,1,1,it),ges_prsl(1,1,1,it),lat2,lon2, &
call genqsat(ges_qsat(:,:,:,it),ges_tsen(:,:,:,it),ges_prsl(:,:,:,it),lat2,lon2, &
nsig,ice,iderivative)
enddo

Expand Down Expand Up @@ -127,7 +129,7 @@ subroutine compute_qvar3d
iderivative = 2
end if
ice=.true.
call genqsat(qsatg,ges_tsen(1,1,1,ntguessig),ges_prsl(1,1,1,ntguessig),lat2,lon2,nsig,ice,iderivative)
call genqsat(qsatg,ges_tsen(:,:,:,ntguessig),ges_prsl(:,:,:,ntguessig),lat2,lon2,nsig,ice,iderivative)

if (qoption==2) then
allocate(rhgues(lat2,lon2,nsig))
Expand Down
1 change: 1 addition & 0 deletions src/gsibec/gsi/control2state_ad.F90
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ subroutine control2state_ad(rval,bval,grad)

! Adjoint of convert input normalized RH to q to add contribution of moisture
! to t, p , and normalized rh
if(regional .and. ls_prse) rv_prse = 0.
if(do_normal_rh_to_q_ad) call normal_rh_to_q_ad(cv_rh,cv_t,rv_prse,rv_q)

! Adjoint to convert ps to 3-d pressure
Expand Down
43 changes: 0 additions & 43 deletions src/gsibec/gsi/fv3_regional_interface.f90

This file was deleted.

8 changes: 5 additions & 3 deletions src/gsibec/gsi/genqsat.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module gen_qsat
contains
subroutine genqsat(qsat,tsen,prsl,lat2,lon2,nsig,ice,iderivative)
!$$$ subprogram documentation block
! . . . .
Expand Down Expand Up @@ -62,8 +64,8 @@ subroutine genqsat(qsat,tsen,prsl,lat2,lon2,nsig,ice,iderivative)
implicit none

logical ,intent(in ) :: ice
real(r_kind),dimension(lat2,lon2,nsig),intent( out) :: qsat
real(r_kind),dimension(lat2,lon2,nsig),intent(in ) :: tsen,prsl
real(r_kind),dimension(:,:,:),intent( out) :: qsat
real(r_kind),dimension(:,:,:),intent(in ) :: tsen,prsl
integer(i_kind) ,intent(in ) :: lat2,lon2,nsig,iderivative


Expand Down Expand Up @@ -234,4 +236,4 @@ subroutine genqsat(qsat,tsen,prsl,lat2,lon2,nsig,ice,iderivative)
end do
return
end subroutine genqsat

end module gen_qsat
1 change: 1 addition & 0 deletions src/gsibec/gsi/get_gefs_ensperts_dualres.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ subroutine get_gefs_ensperts_dualres (tau)
#ifdef USE_ALL_ORIGINAL
use m_revBens, only: revBens_ensmean_overwrite
#endif /* USE_ALL_ORIGINAL */
use gen_qsat
implicit none

integer(i_kind),intent(in) :: tau
Expand Down
18 changes: 7 additions & 11 deletions src/gsibec/gsi/gsi_rfv3io_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,13 @@ subroutine gsi_rfv3io_get_grid_specs(ierr)

!!! get ak,bk

allocate(aeta1_ll(nsig),aeta2_ll(nsig))
allocate(eta1_ll(nsig+1),eta2_ll(nsig+1))
allocate(ak(nz),bk(nz),abk_fv3(nz))
if(.not.allocated(aeta1_ll))allocate(aeta1_ll(nsig))
if(.not.allocated(aeta2_ll))allocate(aeta2_ll(nsig))
if(.not.allocated(eta1_ll))allocate(eta1_ll(nsig+1))
if(.not.allocated(eta2_ll))allocate(eta2_ll(nsig+1))
if(.not.allocated(ak))allocate(ak(nz))
if(.not.allocated(bk))allocate(bk(nz))
if(.not.allocated(abk_fv3))allocate(abk_fv3(nz))

do k=ndimensions+1,nvariables
iret=nf90_inquire_variable(gfile_loc,k,name,len)
Expand Down Expand Up @@ -3635,10 +3639,6 @@ subroutine m_gsi_rfv3io_get_grid_specs(gsi_lats,gsi_lons,ierr)
integer(i_kind),allocatable :: gfile_loc_layout(:)
character(len=180) :: filename_layout

!coupler_res_filenam='/home/masanori/da/RDASApp_gsib/jedi-assim_test_gsib/rrfs-data_fv3jedi_2022052619/Data/gsibec/coupler.res'
!grid_spec='/home/masanori/da/RDASApp_gsib/jedi-assim_test_gsib/rrfs-data_fv3jedi_2022052619/Data/gsibec/fv3_grid_spec'
!ak_bk='/home/masanori/da/RDASApp_gsib/jedi-assim_test_gsib/rrfs-data_fv3jedi_2022052619/Data/gsibec/fv3_akbk'

coupler_res_filenam='coupler.res'
grid_spec='fv3_grid_spec'
ak_bk='fv3_akbk'
Expand Down Expand Up @@ -3837,11 +3837,7 @@ subroutine m_gsi_rfv3io_get_grid_specs(gsi_lats,gsi_lons,ierr)
call m_generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt,gsi_lats,gsi_lons)

deallocate (grid_lon,grid_lat,grid_lont,grid_latt)
deallocate (ak,bk,abk_fv3)

deallocate(ny_layout_len,ny_layout_b,ny_layout_e)
deallocate(aeta1_ll,aeta2_ll)
deallocate(eta1_ll,eta2_ll)

return
end subroutine m_gsi_rfv3io_get_grid_specs
Expand Down
7 changes: 2 additions & 5 deletions src/gsibec/gsi/gsimod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module gsimod
bkgv_flowdep,bkgv_rewgtfct,bkgv_write,fpsproj,nhscrf,adjustozvar,fut2ps,cwcoveqqcov,adjustozhscl,&
bkgv_write_cv,bkgv_write_sv
use berror, only: simcv !_RT intro for testing
use m_berror_stats, only: usenewgfsberror
use compact_diffs, only: noq,init_compact_diffs

use gridmod, only: nlat,nlon,nsig,&
Expand Down Expand Up @@ -417,7 +418,7 @@ module gsimod

namelist/bkgerr/vs,nhscrf,hzscl,hswgt,norh,ndeg,noq,bw,norsp,fstat,pert_berr,pert_berr_fct, &
bkgv_flowdep,bkgv_rewgtfct,bkgv_write,fpsproj,adjustozvar,fut2ps,cwcoveqqcov,adjustozhscl,&
simcv,bkgv_write_cv,bkgv_write_sv
simcv,bkgv_write_cv,bkgv_write_sv,usenewgfsberror

! STRONGOPTS (strong dynamic constraint)
! reg_tlnmc_type - =1 for 1st version of regional strong constraint
Expand Down Expand Up @@ -702,10 +703,6 @@ subroutine gsimain_initialize_(nfldsig,nmlfile)
if (mype==0) write(6,*)'GSIMOD: tendencies and derivatives are on'
endif

if (regional) then
call convert_fv3_regional
endif

! Initialize variables, create/initialize arrays
lendian_in = -1
call create_ges_tendencies(tendsflag,thisrc)
Expand Down
Loading