Skip to content
This repository has been archived by the owner on Feb 24, 2025. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into port_2_i2021
Browse files Browse the repository at this point in the history
  • Loading branch information
[David Huber] committed Feb 16, 2023
2 parents dd6ccf0 + 8857995 commit 3bf0c5c
Show file tree
Hide file tree
Showing 19 changed files with 1,626 additions and 145 deletions.
12 changes: 6 additions & 6 deletions regression/global_4dvar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ SINGLEOB=""
# bftab_sst= bufr table for sst ONLY needed for sst retrieval (retrieval=.true.)
# aeroinfo = text file with information about assimilation of aerosol data

anavinfo=$fixgsi/global_anavinfo.l${LEVS}.txt
anavinfo=$fixgsi/global_anavinfo_qlqi.l${LEVS}.txt
berror=$fixgsi/Big_Endian/global_berror.l${LEVS}y${NLAT}.f77
locinfo=$fixgsi/global_hybens_info.l${LEVS}.txt
satinfo=$fixgsi/global_satinfo.txt
Expand Down Expand Up @@ -311,9 +311,9 @@ $gsi_namelist
EOF
cp gsiparm.anl gsiparm.anl.obsvr

echo "run gsi now"
echo "run gsi observer"
eval "$APRUN $tmpdir/gsi.x < gsiparm.anl > stdout.obsvr 2>&1"
rc=$?
ra=$?

# Run gsi identity model 4dvar under Parallel Operating Environment (poe) on NCEP IBM
rm -f siganl sfcanl.gsi satbias_out fort.2*
Expand All @@ -331,8 +331,8 @@ cat <<EOF > gsiparm.anl
$gsi_namelist
EOF

echo "run gsi now"
echo "run gsi 4dvar"
eval "$APRUN $tmpdir/gsi.x < gsiparm.anl > stdout 2>&1"
rc=$?

rb=$?
rc=$((ra+rb))
exit $rc
1 change: 0 additions & 1 deletion regression/regression_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ for jn in `seq ${RSTART} ${REND}`; do
$scripts/regression_wait.sh ${job[$jn]} ${rcname} $check_resource
rc=$?
if [ $rc -ne 0 ]; then
rm -f ${rcname}
exit 1
fi
done
Expand Down
4 changes: 2 additions & 2 deletions regression/regression_param.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ case $regtest in
topts[1]="0:15:00" ; popts[1]="20/1/" ; ropts[1]="/1"
topts[2]="0:15:00" ; popts[2]="20/2/" ; ropts[2]="/1"
elif [[ "$machine" = "Orion" ]]; then
topts[1]="0:15:00" ; popts[1]="4/4/" ; ropts[1]="/1"
topts[2]="0:15:00" ; popts[2]="6/6/" ; ropts[2]="/1"
topts[1]="0:15:00" ; popts[1]="20/1/" ; ropts[1]="/1"
topts[2]="0:15:00" ; popts[2]="20/2/" ; ropts[2]="/1"
elif [[ "$machine" = "Jet" ]]; then
topts[1]="0:15:00" ; popts[1]="4/4/" ; ropts[1]="/1"
topts[2]="0:15:00" ; popts[2]="6/6/" ; ropts[2]="/1"
Expand Down
17 changes: 13 additions & 4 deletions regression/regression_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -576,11 +576,20 @@ mkdir -p $vfydir

$ncp $output $vfydir/

# Final check for any failed tests
count=$(grep -i "fail" $output |wc -l)
if [ $count -gt 0 ]; then
(( failed_test = $failed_test + $count ))
fi

# Remove job log files is no failures detected
cd $scripts
rm -f ${exp1}.out
rm -f ${exp2}.out
rm -f ${exp3}.out
rm -f ${exp2_scale}.out
if [ $count -eq 0 ]; then
rm -f ${exp1}.out
rm -f ${exp2}.out
rm -f ${exp3}.out
rm -f ${exp2_scale}.out
fi

if [[ "$clean" = ".true." ]]; then
rm -rf $savdir
Expand Down
43 changes: 29 additions & 14 deletions regression/regression_test_enkf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ maxtime=1200
maxmem=${maxmem:-3400000} # set in regression_param
maxmem=$((${memnode:-64}*1024*1024))

# Copy stdout and sanl files
# Copy stdout and incr files
# from $savdir to $tmpdir
list="$exp1 $exp2 $exp3"
for exp in $list; do
Expand All @@ -43,7 +43,7 @@ for exp in $list; do
imem=1
while [[ $imem -le $nmem ]]; do
member="_mem"`printf %03i $imem`
$ncp $savdir/$exp/sanl_${global_adate}_fhr06$member $tmpdir/sanl$member.$exp
$ncp $savdir/$exp/incr_${global_adate}_fhr06$member $tmpdir/incr$member.$exp
(( imem = $imem + 1 ))
done
done
Expand Down Expand Up @@ -282,10 +282,13 @@ nmem=10
imem=1
while [[ $imem -le $nmem ]]; do
member="_mem"`printf %03i $imem`
if ! cmp -s sanl$member.${exp1} sanl$member.${exp2}
then
echo 'sanl'$member'.'${exp1}' sanl'$member'.'${exp2}' are NOT identical'
fi
ncdump incr$member.${exp1} > incr$member.${exp1}.out
ncdump incr$member.${exp2} > incr$member.${exp2}.out
if [ ! diff incr$member.${exp1}.out incr$member.${exp2}.out ]; then
echo 'incr'$member'.'${exp1}' incr'$member'.'${exp2}' are NOT identical'
else
rm -f incr$member.${exp1}.out incr$member.${exp2}.out
fi
(( imem = $imem + 1 ))
done
echo
Expand Down Expand Up @@ -379,11 +382,14 @@ else
imem=1
while [[ $imem -le $nmem ]]; do
member="_mem"`printf %03i $imem`
if ! cmp -s sanl$member.${exp1} sanl$member.${exp3}
then
echo 'sanl'$member'.'${exp1}' sanl'$member'.'${exp3}' are NOT identical'
ncdump incr$member.${exp1} > incr$member.${exp1}.out
ncdump incr$member.${exp3} > incr$member.${exp3}.out
if [ ! diff incr$member.${exp1}.out incr$member.${exp3}.out ]; then
echo 'incr'$member'.'${exp1}' incr'$member'.'${exp3}' are NOT identical'
else
rm -f incr$member.${exp1}.out incr$member.${exp3}.out
fi
(( imem = $imem + 1 ))
(( imem = $imem + 1 ))
done
echo
} >> $output
Expand Down Expand Up @@ -411,11 +417,20 @@ mkdir -p $vfydir

$ncp $output $vfydir/

# Final check for any failed tests
count=$(grep -i "fail" $output |wc -l)
if [ $count -gt 0 ]; then
(( failed_test = $failed_test + $count ))
fi

# Remove job log files is no failures detected
cd $scripts
rm -f ${exp1}.out
rm -f ${exp2}.out
rm -f ${exp3}.out
rm -f ${exp2_scale}.out
if [ $count -eq 0 ]; then
rm -f ${exp1}.out
rm -f ${exp2}.out
rm -f ${exp3}.out
rm -f ${exp2_scale}.out
fi

if [[ "$clean" = ".true." ]]; then
rm -rf $savdir
Expand Down
3 changes: 2 additions & 1 deletion src/enkf/gridinfo_fv3reg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ module gridinfo
!
!$$$

use mpisetup, only: nproc, mpi_integer, mpi_real4, mpi_comm_world,mpi_status
use mpisetup, only: nproc, mpi_integer, mpi_real4,mpi_status
use mpimod, only: mpi_comm_world
use params, only: datapath,nlevs,nlons,nlats,use_gfs_nemsio, fgfileprefixes, &
fv3fixpath, nx_res,ny_res, ntiles,l_fv3reg_filecombined,paranc, &
fv3_io_layout_nx,fv3_io_layout_ny
Expand Down
173 changes: 173 additions & 0 deletions src/gsi/apply_scaledepwgts.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
!$$$ program documentation block
!
! program history:
!
! 2018-03-28 T. Lei and D. Kleist - consoliated and added codes
! for the scale dependent scale localization scheme
!
!$$$ end documentation block

function fwgtofwvlen (rvlft,rvrgt,rcons,rlen,rinput)
!$$$ subprogram documentation block
!
! subprogram: fwgtofwvlen
!
! abstract: Calculation of spectral filter functions
!
!$$$ end documentation block

use kinds, only: r_kind,i_kind,r_single
implicit none

real(r_kind),intent(in) :: rvlft,rvrgt,rcons,rlen,rinput
real(r_kind) :: fwgtofwvlen
real(r_kind) :: rlen1,rtem1,rconshalf

rlen1=rlen/10.0_r_kind ! rlen corresponds to a (-5,5) region
rconshalf=0.5_r_kind*rcons
if(rinput > rvlft .and. rinput < rvrgt) then
fwgtofwvlen=rcons
else
rtem1=min(abs(rinput-rvlft),abs(rinput-rvrgt))
fwgtofwvlen=rconshalf*(1.0_r_kind+tanh(5.0_r_kind-rtem1/rlen1))
endif

end function fwgtofwvlen
! . . . .
subroutine init_mult_spc_wgts(jcap_in)
!$$$ subprogram documentation block
!
! subprogram: init_mult_spc_wgts
!
!$$$ end documentation block

use kinds, only: r_kind,i_kind,r_single
use hybrid_ensemble_parameters,only: s_ens_hv,sp_loc,grd_ens,grd_loc,sp_ens
use hybrid_ensemble_parameters,only: n_ens,p_sploc2ens,grd_sploc
use hybrid_ensemble_parameters,only: use_localization_grid
use gridmod,only: use_sp_eqspace
use general_specmod, only: general_init_spec_vars
use constants, only: zero,half,one,two,three,rearth,pi
use constants, only: rad2deg
use mpimod, only: mype
use general_sub2grid_mod, only: general_sub2grid_create_info
use egrid2agrid_mod,only: g_create_egrid2agrid
use general_sub2grid_mod, only: sub2grid_info
use gsi_io, only: verbose
use hybrid_ensemble_parameters, only: nsclgrp
use hybrid_ensemble_parameters, only: spc_multwgt,spcwgt_params,i_ensloccov4scl
implicit none

integer(i_kind),intent(in ) :: jcap_in
real(r_kind),allocatable :: totwvlength(:)

integer(i_kind) i,ii,j,k,l,n,kk,nsigend
integer(i_kind) ig
real(r_kind) rwv0,rtem1,rtem2
real (r_kind):: fwgtofwvlen
integer(i_kind) :: l_sum_spc_weights

! Spectral scale decomposition is differernt between SDL-cross and SDL-nocross
if( i_ensloccov4scl == 1 )then
l_sum_spc_weights = 1
else
l_sum_spc_weights = 0
end if

allocate(totwvlength(jcap_in))

rwv0=2*pi*rearth*0.001_r_kind
do i=1,jcap_in
totwvlength(i)= rwv0/real(i)
enddo
do i=1,jcap_in
rtem1=0
do ig=1,nsclgrp
if(ig /= 2) then
spc_multwgt(i,ig)=fwgtofwvlen(spcwgt_params(1,ig),spcwgt_params(2,ig),&
spcwgt_params(3,ig),spcwgt_params(4,ig),totwvlength(i))
if(l_sum_spc_weights == 0 ) then
rtem1=rtem1+spc_multwgt(i,ig)
else
rtem1=rtem1+spc_multwgt(i,ig)*spc_multwgt(i,ig)
endif
endif
enddo
rtem2 =1.0_r_kind - rtem1
if(abs(rtem2) >= zero) then

if(l_sum_spc_weights == 0 ) then
spc_multwgt(i,2)=rtem2
else
spc_multwgt(i,2)=sqrt(rtem2)
endif
endif
enddo
spc_multwgt=max(spc_multwgt,0.0_r_kind)

deallocate(totwvlength)
return
end subroutine init_mult_spc_wgts

subroutine apply_scaledepwgts(grd_in,sp_in,wbundle,spwgts,wbundle2)
!
! Program history log:
! 2017-03-30 J. Kay, X. Wang - copied from Kleist's apply_scaledepwgts and
! add the calculation of scale-dependent weighting for mixed resolution ensemble
! POC: xuguang.wang@ou.edu
!
use constants, only: one
use control_vectors, only: nrf_var,cvars2d,cvars3d,control_vector
use kinds, only: r_kind,i_kind
use kinds, only: r_single
use mpimod, only: mype,nvar_id,levs_id
use hybrid_ensemble_parameters, only: oz_univ_static
use general_specmod, only: general_spec_multwgt
use gsi_bundlemod, only: gsi_bundle
use general_sub2grid_mod, only: general_sub2grid,general_grid2sub
use general_specmod, only: spec_vars
use general_sub2grid_mod, only: sub2grid_info
use mpimod, only: mpi_comm_world,mype,npe,ierror
use file_utility, only : get_lun
implicit none

! Declare passed variables
type(gsi_bundle),intent(in) :: wbundle
type(gsi_bundle),intent(inout) :: wbundle2
type(spec_vars),intent (in):: sp_in
type(sub2grid_info),intent(in)::grd_in
real(r_kind),dimension(0:sp_in%jcap),intent(in):: spwgts

! Declare local variables
integer(i_kind) ii,kk
integer(i_kind) i,j,lunit

real(r_kind),dimension(grd_in%lat2,grd_in%lon2):: slndt,sicet,sst
real(r_kind),dimension(grd_in%nlat*grd_in%nlon*grd_in%nlevs_alloc) :: hwork
real(r_kind),dimension(grd_in%nlat,grd_in%nlon,grd_in%nlevs_alloc) :: work
real(r_kind),dimension(sp_in%nc):: spc1
character*64 :: fname1
character*5:: varname1

! Beta1 first
! Get from subdomains to
call general_sub2grid(grd_in,wbundle%values,hwork)
work=reshape(hwork,(/grd_in%nlat,grd_in%nlon,grd_in%nlevs_alloc/))

do kk=1,grd_in%nlevs_alloc
! Transform from physical space to spectral space
call general_g2s0(grd_in,sp_in,spc1,work(:,:,kk))

! Apply spectral weights
call general_spec_multwgt(sp_in,spc1,spwgts)
! Transform back to physical space
call general_s2g0(grd_in,sp_in,spc1,work(:,:,kk))

end do

! Transfer work back to subdomains
hwork=reshape(work,(/grd_in%nlat*grd_in%nlon*grd_in%nlevs_alloc/))
call general_grid2sub(grd_in,hwork,wbundle2%values)

return
end subroutine apply_scaledepwgts
Loading

0 comments on commit 3bf0c5c

Please sign in to comment.