Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/gc_doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Feb 19, 2025
2 parents 4999046 + 32fe4c8 commit 88b38a8
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 66 deletions.
5 changes: 2 additions & 3 deletions reg_tests/global_cycle/C192.gsi_lndincsoilnoahmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ export DONST="NO"
export use_ufo=.true.

export DO_SFCCYCLE=".FALSE."
export DO_LNDINC=".TRUE."
export DO_SOI_INC=".true."
export GCYCLE_INTERP_LNDINC=".true."
export GCYCLE_DO_SOILINCR=".true."
export GCYCLE_INTERP_LANDINCR=".true."
export LSOIL_INCR=3

export VERBOSE=YES
Expand Down
5 changes: 2 additions & 3 deletions reg_tests/global_cycle/C192.gsitile_lndincsoilnoahmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ export DONST="NO"
export use_ufo=.true.

export DO_SFCCYCLE=".FALSE."
export DO_LNDINC=".TRUE."
export DO_SOI_INC=".true."
export GCYCLE_INTERP_LNDINC=".false."
export GCYCLE_DO_SOILINCR=".true."
export GCYCLE_INTERP_LANDINCR=".false."
export LSOIL_INCR=3

export VERBOSE=YES
Expand Down
7 changes: 3 additions & 4 deletions reg_tests/global_cycle/C192.jedi_lndincsoilnoahmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ export DONST="NO"
export use_ufo=.true.

export DO_SFCCYCLE=".FALSE."
export DO_LNDINC=".TRUE."
export DO_SOI_INC=".true."
export GCYCLE_INTERP_LNDINC=".false."
export SOI_INC_FNAME="soil_sfcincr_jedi"
export GCYCLE_DO_SOILINCR=".true."
export GCYCLE_INTERP_LANDINCR=".false."
export SOILINCR_FNAME="soil_sfcincr_jedi"
export LSOIL_INCR=3

export VERBOSE=YES
Expand Down
6 changes: 2 additions & 4 deletions reg_tests/global_cycle/C768.lndincsnow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ export FNSNOA=$COMIN/gdas.t00z.snogrb_t1534.3072.1536
export FNACNA=$COMIN/gdas.t00z.seaice.5min.blend.grb
export NST_FILE=$COMIN/gdas.t00z.dtfanl.nc

export DO_SNO_INC=.true. # must be lower-case.
export DO_SOI_INC=.false.
export GCYCLE_INTERP_LNDINC=.false.
export GCYCLE_DO_SNOWINCR=.true. # must be lower-case.
export GCYCLE_INTERP_LANDINCR=.false.
export JCAP=1534
export LONB=3072
export LATB=1536
Expand All @@ -42,7 +41,6 @@ export DONST="NO"
export use_ufo=.true.

export DO_SFCCYCLE=".FALSE."
export DO_LNDINC=".TRUE."

export VERBOSE=YES
export CYCLVARS=FSNOL=99999.,FSNOS=99999.,
Expand Down
58 changes: 29 additions & 29 deletions sorc/global_cycle.fd/cycle.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
!!
!! There are three main options (which can be called in combination):
!! 1. Update the surface fields with sfccylce (do_sfccycle = .true.)
!! 2. Update the land states with increments read in from file (do_lndinc = .true.)
!! 2. Update the land states with increments read in from file (do_landincr = .true.)
!! Can read in either a GSI-output increment file and regrid it,
!! or (preferred) a file on the native model grid ( either produced
!! by JEDI, or pre- regridded from a GSI-output file)
Expand Down Expand Up @@ -62,12 +62,12 @@
!! terrain.
!! -DONST Call routines to process NSST records.
!! -DO_SFCCYCLE Call sfccycle routine to update surface fields
!! -DO_LNDINC Call routines to add land increments to sfc restarts
!! (includes do_soi_inc and/or do_sno_inc)
!! -DO_SOI_INC Apply increments to soil states. Requires DO_LNDINC=.true.
!! -DO_SNO_INC Apply increments to snow states. Requires DO_LNDINC=.true.
!! -DO_LANDINCR Call routines to add land increments to sfc restarts
!! (includes do_soilincr and/or do_snowincr)
!! -DO_SOILINCR Apply increments to soil states. Requires DO_LANDINCR=.true.
!! -DO_SNOWINCR Apply increments to snow states. Requires DO_LANDINCR=.true.
!! (NOTE: oudated, coded here for Noah LSM only).
!! -INTERP_LNDINC Land increment is on Gaussian grid (from GSI) and should
!! -INTERP_LANDINCR Land increment is on Gaussian grid (from GSI) and should
!! be regridded to the native model grid
!! -LSOIL_INCR Number of soil layers (from top) to apply soil increments to.
!! LSOIL_INCR is currently set to 3 by default.
Expand Down Expand Up @@ -110,12 +110,12 @@ PROGRAM SFC_DRV
INTEGER :: ISOT, IVEGSRC, LENSFC, ZSEA1_MM, ZSEA2_MM, IERR
INTEGER :: NPROCS, MYRANK, NUM_THREADS, NUM_PARTHDS, MAX_TASKS
REAL :: FH, DELTSFC, ZSEA1, ZSEA2
LOGICAL :: USE_UFO, DO_NSST, DO_LNDINC, DO_SFCCYCLE, FRAC_GRID
LOGICAL :: USE_UFO, DO_NSST, DO_LANDINCR, DO_SFCCYCLE, FRAC_GRID
!
NAMELIST/NAMCYC/ IDIM,JDIM,LSOIL,LUGB,IY,IM,ID,IH,FH,&
DELTSFC,IALB,USE_UFO,DONST, &
DO_SFCCYCLE,ISOT,IVEGSRC,ZSEA1_MM, &
ZSEA2_MM, MAX_TASKS, DO_LNDINC, FRAC_GRID
ZSEA2_MM, MAX_TASKS, DO_LANDINCR, FRAC_GRID
!
DATA IDIM,JDIM,LSOIL/96,96,4/
DATA IY,IM,ID,IH,FH/1997,8,2,0,0./
Expand All @@ -137,7 +137,7 @@ PROGRAM SFC_DRV

USE_UFO = .FALSE.
DONST = "NO"
DO_LNDINC = .FALSE.
DO_LANDINCR = .FALSE.
DO_SFCCYCLE = .TRUE.
FRAC_GRID = .FALSE.

Expand Down Expand Up @@ -179,7 +179,7 @@ PROGRAM SFC_DRV

CALL SFCDRV(LUGB,IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
IY,IM,ID,IH,FH,IALB, &
USE_UFO,DO_NSST,DO_SFCCYCLE,DO_LNDINC, &
USE_UFO,DO_NSST,DO_SFCCYCLE,DO_LANDINCR, &
FRAC_GRID,ZSEA1,ZSEA2,ISOT,IVEGSRC,MYRANK)

PRINT*
Expand Down Expand Up @@ -294,7 +294,7 @@ END PROGRAM SFC_DRV
!! differences between the filtered and unfiltered terrain.
!! @param[in] DO_NSST When true, process NSST records.
!! @param[in] DO_SFCCYCLE Call sfccycle routine to update surface fields
!! @param[in] DO_LNDINC Read in land increment files, and add increments to
!! @param[in] DO_LANDINCR Read in land increment files, and add increments to
!! requested states.
!! @param[in] FRAC_GRID When true, run with fractional grid.
!! @param[in] ZSEA1 When running NSST model, this is the lower bound
Expand All @@ -307,7 +307,7 @@ END PROGRAM SFC_DRV
!! @author Mark Iredell, George Gayno
SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
IY,IM,ID,IH,FH,IALB, &
USE_UFO,DO_NSST,DO_SFCCYCLE,DO_LNDINC,&
USE_UFO,DO_NSST,DO_SFCCYCLE,DO_LANDINCR,&
FRAC_GRID,ZSEA1,ZSEA2,ISOT,IVEGSRC,MYRANK)
!
USE READ_WRITE_DATA
Expand All @@ -328,7 +328,7 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
INTEGER, INTENT(IN) :: ISOT, IVEGSRC, MYRANK

LOGICAL, INTENT(IN) :: USE_UFO, DO_NSST,DO_SFCCYCLE
LOGICAL, INTENT(IN) :: DO_LNDINC, FRAC_GRID
LOGICAL, INTENT(IN) :: DO_LANDINCR, FRAC_GRID

REAL, INTENT(IN) :: FH, DELTSFC, ZSEA1, ZSEA2

Expand Down Expand Up @@ -387,7 +387,7 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
INTEGER, DIMENSION(LENSFC) :: STC_UPDATED, SLC_UPDATED
REAL, DIMENSION(LENSFC,LSOIL) :: STCINC, SLCINC

LOGICAL :: FILE_EXISTS, DO_SOI_INC, INTERP_LNDINC, DO_SNO_INC
LOGICAL :: FILE_EXISTS, DO_SOILINCR, INTERP_LANDINCR, DO_SNOWINCR
CHARACTER(LEN=3) :: RANKCH
INTEGER :: lsoil_incr

Expand All @@ -396,13 +396,13 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
! increments.
!--------------------------------------------------------------------------------

NAMELIST/NAMSFCD/ NST_FILE, lsoil_incr, DO_SNO_INC, DO_SOI_INC, INTERP_LNDINC
NAMELIST/NAMSFCD/ NST_FILE, lsoil_incr, DO_SNOWINCR, DO_SOILINCR, INTERP_LANDINCR

DATA NST_FILE/'NULL'/

DO_SNO_INC = .FALSE.
DO_SOI_INC = .FALSE.
INTERP_LNDINC = .FALSE.
DO_SNOWINCR = .FALSE.
DO_SOILINCR = .FALSE.
INTERP_LANDINCR = .FALSE.
lsoil_incr = 3 !default


Expand Down Expand Up @@ -475,16 +475,16 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
ALLOCATE(SICFCS_FG(LENSFC))
ENDIF

IF (DO_LNDINC) THEN
IF (DO_LANDINCR) THEN
! identify variables to be updated, and allocate arrays.
IF (DO_SOI_INC ) THEN
IF (DO_SOILINCR ) THEN
PRINT*
PRINT*," APPLYING SOIL INCREMENTS"
ALLOCATE(STC_BCK(LENSFC, LSOIL), SMC_BCK(LENSFC, LSOIL), SLC_BCK(LENSFC,LSOIL))
ALLOCATE(LANDINC_MASK_FG(LENSFC))
ENDIF
! FOR NOW, CODE SO CAN DO BOTH, BUT MIGHT NEED TO THINK ABOUT THIS SOME MORE.
IF (DO_SNO_INC) THEN
IF (DO_SNOWINCR) THEN
! ideally, would check here that sfcsub snow DA update is not also requested
! but latter is controlled by fnsol, which is read in within that routine.
! should be done at script level.
Expand Down Expand Up @@ -522,7 +522,7 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
call MPI_ABORT(MPI_COMM_WORLD, 18, IERR)
ENDIF

IF ( (IS_NOAHMP .OR. INTERP_LNDINC) .AND. DO_SNO_INC) THEN
IF ( (IS_NOAHMP .OR. INTERP_LANDINCR) .AND. DO_SNOWINCR) THEN
print *, 'FATAL ERROR: Snow increment update does not work with NOAH_MP/with interp'
call MPI_ABORT(MPI_COMM_WORLD, 29, IERR)
ENDIF
Expand Down Expand Up @@ -560,7 +560,7 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
ENDIF

! CALCULATE MASK FOR LAND INCREMENTS
IF (DO_LNDINC) &
IF (DO_LANDINCR) &
CALL CALCULATE_LANDINC_MASK(SWEFCS, VETFCS, SOTFCS, &
LENSFC,VEG_TYPE_LANDICE, LANDINC_MASK)

Expand Down Expand Up @@ -686,11 +686,11 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
! READ IN AND APPLY LAND INCREMENTS
!--------------------------------------------------------------------------------

IF (DO_LNDINC) THEN
IF (DO_LANDINCR) THEN

! SNOW INCREMENTS
! do snow first, as temperature updates will use snow analaysis
IF (DO_SNO_INC) THEN
IF (DO_SNOWINCR) THEN
! updates are made to snow depth only over land (and not-land ice).
! SWE is then updated from the snow depth analysis, using the model
! forecast density
Expand Down Expand Up @@ -734,7 +734,7 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
!re-calculate soilsnow mask if snow has been updated.
LANDINC_MASK_FG = LANDINC_MASK

IF (DO_SFCCYCLE .OR. DO_SNO_INC) THEN
IF (DO_SFCCYCLE .OR. DO_SNOWINCR) THEN
CALL CALCULATE_LANDINC_MASK(SWEFCS, VETFCS, SOTFCS, LENSFC, &
VEG_TYPE_LANDICE, LANDINC_MASK)
ENDIF
Expand All @@ -745,8 +745,8 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
SLC_BCK = SLCFCS

! SOIL INCREMENTS
IF ( DO_SOI_INC ) THEN
IF ( INTERP_LNDINC ) THEN
IF ( DO_SOILINCR ) THEN
IF ( INTERP_LANDINCR ) THEN

!--------------------------------------------------------------------------------
! read increments in
Expand Down Expand Up @@ -777,7 +777,7 @@ SUBROUTINE SFCDRV(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
CALL WRITE_DATA(LENSFC,IDIM,JDIM,LSOIL,DO_NSST,.true.,NSST, &
STCINC=STCINC,SLCINC=SLCINC)

ELSE ! if interp_lndinc
ELSE ! if interp_landincr

!--------------------------------------------------------------------------------
! read increments in
Expand Down
28 changes: 14 additions & 14 deletions ush/global_cycle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@
# between the filtered and unfiltered terrain. Default is true.
# DONST Process NST records when using NST model. Default is 'no'.
# DO_SFCCYCLE Call sfcsub routine
# DO_LNDINC Call routines to add snow and /or soil increments
# DO_SOI_INC Call routine to add soil increments
# DO_SNO_INC Call routine to add snow inrcements
# GCYCLE_INTERP_LNDIC Flag to regrid input land increment from Gaus to native model
# GCYCLE_DO_SOILINCR Call routine to add soil increments
# GCYCLE_DO_SNOWINCR Call routine to add snow inrcements
# GCYCLE_INTERP_LANDINCR Flag to regrid input land increment from Gaus to native model
# grid inside gcycle
#
# zsea1/zsea2 When running with NST model, this is the lower/upper bound
Expand Down Expand Up @@ -269,13 +268,14 @@ CYCLVARS=${CYCLVARS:-""}
use_ufo=${use_ufo:-.true.}
DONST=${DONST:-"NO"}
DO_SFCCYCLE=${DO_SFCCYCLE:-.true.}
DO_LNDINC=${DO_LNDINC:-.false.}
DO_SOI_INC=${DO_SOI_INC:-.false.}
DO_SNO_INC=${DO_SNO_INC:-.false.}
if [ "$DO_SOI_INC" == ".true." ] || [ "$DO_SNO_INC" == ".true." ] ; then
DO_LNDINC=".true."
GCYCLE_DO_SOILINCR=${GCYCLE_DO_SOILINCR:-.false.}
GCYCLE_DO_SNOWINCR=${GCYCLE_DO_SNOWINCR:-.false.}
if [ "$GCYCLE_DO_SOILINCR" == ".true." ] || [ "$GCYCLE_DO_SNOWINCR" == ".true." ] ; then
DO_LANDINCR=".true."
else
DO_LANDINCR=".false."
fi
GCYCLE_INTERP_LNDINC=${GCYCLE_INTERP_LNDINC:-.false.}
GCYCLE_INTERP_LANDINCR=${GCYCLE_INTERP_LANDINCR:-.false.}
zsea1=${zsea1:-0}
zsea2=${zsea2:-0}
MAX_TASKS_CY=${MAX_TASKS_CY:-99999}
Expand Down Expand Up @@ -386,7 +386,7 @@ cat << EOF > fort.36
idim=$CRES, jdim=$CRES, lsoil=$LSOIL,
iy=$iy, im=$im, id=$id, ih=$ih, fh=$FHOUR,
deltsfc=$DELTSFC,ialb=$IALB,use_ufo=$use_ufo,donst="$DONST",
do_sfccycle=$DO_SFCCYCLE,do_lndinc=$DO_LNDINC,isot=$ISOT,ivegsrc=$IVEGSRC,
do_sfccycle=$DO_SFCCYCLE,do_landincr=$DO_LANDINCR,isot=$ISOT,ivegsrc=$IVEGSRC,
zsea1_mm=$zsea1,zsea2_mm=$zsea2,MAX_TASKS=$MAX_TASKS_CY,
frac_grid=$FRAC_GRID
/
Expand All @@ -396,9 +396,9 @@ EOF
cat << EOF > fort.37
&NAMSFCD
NST_FILE="$NST_FILE",
DO_SOI_INC=$DO_SOI_INC,
DO_SNO_INC=$DO_SNO_INC,
INTERP_LNDINC=$GCYCLE_INTERP_LNDINC,
DO_SOILINCR=$GCYCLE_DO_SOILINCR,
DO_SNOWINCR=$GCYCLE_DO_SNOWINCR,
INTERP_LANDINCR=$GCYCLE_INTERP_LANDINCR,
lsoil_incr=$LSOIL_INCR,
/
EOF
Expand Down
17 changes: 8 additions & 9 deletions ush/global_cycle_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ else
fi

export DO_SFCCYLE=${DO_SFCCYCLE:-".true."}
export DO_LNDINC=${DO_LNDINC:-".false."}
export DO_SOI_INC=${DO_SOI_INC:-".false."}
export DO_SNO_INC=${DO_SNO_INC:-".false."}
export GCYCLE_INTERP_LNDINC=${GCYCLE_INTERP_LNDINC:-".false."}
SOI_INC_FNAME=${SOI_INC_FNAME:-"soil_xainc"}
export GCYCLE_DO_SOILINCR=${GCYCLE_DO_SOILINCR:-".false."}
export GCYCLE_DO_SNOWINCR=${GCYCLE_DO_SNOWINCR:-".false."}
export GCYCLE_INTERP_LANDINCR=${GCYCLE_INTERP_LANDINCR:-".false."}
SOILINCR_FNAME=${SOILINCR_FNAME:-"soil_xainc"}
export FRAC_GRID=${FRAC_GRID:-".false."}

CRES=$(echo $CASE | cut -c 2-)
Expand Down Expand Up @@ -96,15 +95,15 @@ for n in $(seq 1 $ntiles); do
ln -fs $FIXorog/${CASE}/C${CRES}.mx${OCNRES}_oro_data.tile${n}.nc $DATA/fnorog.00$n
fi

if [[ "$DO_SNO_INC" == ".true." ]] ; then
if [[ "$GCYCLE_DO_SNOWINCR" == ".true." ]] ; then
ln -fs $COMIN/$PDY.${cyc}0000.xainc.tile${n}.nc $DATA/snow_xainc.00$n
fi

if [ "$DO_SOI_INC" == ".true." ] && [ "$GCYCLE_INTERP_LNDINC" == ".false." ] ; then
ln -fs $COMIN/${SOI_INC_FNAME}.00${n} $DATA/soil_xainc.00$n
if [ "$GCYCLE_DO_SOILINCR" == ".true." ] && [ "$GCYCLE_INTERP_LANDINCR" == ".false." ] ; then
ln -fs $COMIN/${SOILINCR_FNAME}.00${n} $DATA/soil_xainc.00$n
fi

if [ "$DO_SOI_INC" == ".true." ] && [ "$GCYCLE_INTERP_LNDINC" == ".true." ] ; then
if [ "$GCYCLE_DO_SOILINCR" == ".true." ] && [ "$GCYCLE_INTERP_LANDINCR" == ".true." ] ; then
ln -fs $COMIN/sfcincr_gsi.00$n $DATA/sfcincr_gsi.00$n
fi
done
Expand Down

0 comments on commit 88b38a8

Please sign in to comment.