Skip to content

Commit

Permalink
Move nems.configure templates to parm/ufs (#1737)
Browse files Browse the repository at this point in the history
This PR:
- moves `nems.configure.*.IN` templates from `ush` to `parm/ufs`.
- uses `atparse.bash` from the ufs-weather-model to fill those templates.
- make `gefs/config.resources` in WW3 same as in `gfs/config.resources`.  
- makes use of `HOMEgfs` instead of `SCRIPTDIR` and `script_dir` local variables that are unnecessary aliases and make code understanding easier.
- initializes PETS to 0 and then sets the right value if that component is enabled.

A follow-up PR will reconcile the templates and use them directly from the ufs-weather-model.  Several differences were noticed between the ones in `global-workflow` and `ufs-weather-model` and help may be needed from @junwang-noaa to update the ufs-weather-model (if required).

Fixes: #1599
  • Loading branch information
aerorahul authored Jul 14, 2023
1 parent 1c40bab commit 3520bcb
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 229 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ ush/make_ntc_bull.pl
ush/make_tif.sh
ush/month_name.sh
ush/imsfv3_scf2ioda.py
ush/atparse.bash

# version files
versions/build.ver
Expand Down
12 changes: 8 additions & 4 deletions parm/config/gefs/config.resources
Original file line number Diff line number Diff line change
Expand Up @@ -550,38 +550,42 @@ elif [[ "${step}" = "fcst" || "${step}" = "efcs" ]]; then
export MEDPETS MEDTHREADS
echo "MEDIATOR using (threads, PETS) = (${MEDTHREADS}, ${MEDPETS})"

CHMPETS=0; CHMTHREADS=0
if [[ "${DO_AERO}" = "YES" ]]; then
# GOCART shares the same grid and forecast tasks as FV3 (do not add write grid component tasks).
(( CHMTHREADS = ATMTHREADS ))
(( CHMPETS = FV3PETS ))
# Do not add to NTASKS_TOT
export CHMPETS CHMTHREADS
echo "GOCART using (threads, PETS) = (${CHMTHREADS}, ${CHMPETS})"
fi
export CHMPETS CHMTHREADS

WAVPETS=0; WAVTHREADS=0
if [[ "${DO_WAVE}" = "YES" ]]; then
(( WAVPETS = ntasks_ww3 * nthreads_ww3 ))
(( WAVTHREADS = nthreads_ww3 ))
export WAVPETS WAVTHREADS
echo "WW3 using (threads, PETS) = (${WAVTHREADS}, ${WAVPETS})"
(( NTASKS_TOT = NTASKS_TOT + WAVPETS ))
fi
export WAVPETS WAVTHREADS

OCNPETS=0; OCNTHREADS=0
if [[ "${DO_OCN}" = "YES" ]]; then
(( OCNPETS = ntasks_mom6 * nthreads_mom6 ))
(( OCNTHREADS = nthreads_mom6 ))
export OCNPETS OCNTHREADS
echo "MOM6 using (threads, PETS) = (${OCNTHREADS}, ${OCNPETS})"
(( NTASKS_TOT = NTASKS_TOT + OCNPETS ))
fi
export OCNPETS OCNTHREADS

ICEPETS=0; ICETHREADS=0
if [[ "${DO_ICE}" = "YES" ]]; then
(( ICEPETS = ntasks_cice6 * nthreads_cice6 ))
(( ICETHREADS = nthreads_cice6 ))
export ICEPETS ICETHREADS
echo "CICE6 using (threads, PETS) = (${ICETHREADS}, ${ICEPETS})"
(( NTASKS_TOT = NTASKS_TOT + ICEPETS ))
fi
export ICEPETS ICETHREADS

echo "Total PETS for ${_CDUMP} = ${NTASKS_TOT}"

Expand Down
14 changes: 11 additions & 3 deletions parm/config/gefs/config.ufs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ if [[ "${skip_mom6}" == "false" ]]; then
CHLCLIM="seawifs_1998-2006_smoothed_2X.nc"
MOM6_RESTART_SETTING='r'
MOM6_RIVER_RUNOFF='False'
eps_imesh="4.0e-1"
;;
"100")
ntasks_mom6=20
Expand All @@ -267,6 +268,7 @@ if [[ "${skip_mom6}" == "false" ]]; then
CHLCLIM="seawifs_1998-2006_smoothed_2X.nc"
MOM6_RESTART_SETTING='n'
MOM6_RIVER_RUNOFF='False'
eps_imesh="2.5e-1"
;;
"50")
ntasks_mom6=60
Expand All @@ -279,7 +281,8 @@ if [[ "${skip_mom6}" == "false" ]]; then
CHLCLIM="seawifs-clim-1997-2010.${NX_GLB}x${NY_GLB}.v20180328.nc"
MOM6_RESTART_SETTING='n'
MOM6_RIVER_RUNOFF='True'
;;
eps_imesh="1.0e-1"
;;
"025")
ntasks_mom6=220
OCNTIM=1800
Expand All @@ -291,12 +294,14 @@ if [[ "${skip_mom6}" == "false" ]]; then
CHLCLIM="seawifs-clim-1997-2010.${NX_GLB}x${NY_GLB}.v20180328.nc"
MOM6_RIVER_RUNOFF='True'
MOM6_RESTART_SETTING="r"
eps_imesh="1.0e-1"
;;
*)
echo "FATAL ERROR: Unsupported MOM6 resolution = ${mom6_res}, ABORT!"
exit 1
;;
esac

export nthreads_mom6 ntasks_mom6
export OCNTIM
export NX_GLB NY_GLB
Expand All @@ -305,6 +310,7 @@ if [[ "${skip_mom6}" == "false" ]]; then
export CHLCLIM
export MOM6_RIVER_RUNOFF
export MOM6_RESTART_SETTING
export eps_imesh
fi

# CICE6 specific settings
Expand Down Expand Up @@ -357,10 +363,12 @@ if [[ "${skip_ww3}" == "false" ]]; then
ntasks_ww3=262
;;
"glo_200")
ntasks_ww3=40
ntasks_ww3=30
nthreads_ww3=1
;;
"glo_500")
ntasks_ww3=10
ntasks_ww3=12
nthreads_ww3=1
;;
"mx025")
ntasks_ww3=80
Expand Down
12 changes: 8 additions & 4 deletions parm/config/gfs/config.resources
Original file line number Diff line number Diff line change
Expand Up @@ -544,38 +544,42 @@ elif [[ "${step}" = "fcst" || "${step}" = "efcs" ]]; then
export MEDPETS MEDTHREADS
echo "MEDIATOR using (threads, PETS) = (${MEDTHREADS}, ${MEDPETS})"

CHMPETS=0; CHMTHREADS=0
if [[ "${DO_AERO}" = "YES" ]]; then
# GOCART shares the same grid and forecast tasks as FV3 (do not add write grid component tasks).
(( CHMTHREADS = ATMTHREADS ))
(( CHMPETS = FV3PETS ))
# Do not add to NTASKS_TOT
export CHMPETS CHMTHREADS
echo "GOCART using (threads, PETS) = (${CHMTHREADS}, ${CHMPETS})"
fi
export CHMPETS CHMTHREADS

WAVPETS=0; WAVTHREADS=0
if [[ "${DO_WAVE}" = "YES" ]]; then
(( WAVPETS = ntasks_ww3 * nthreads_ww3 ))
(( WAVTHREADS = nthreads_ww3 ))
export WAVPETS WAVTHREADS
echo "WW3 using (threads, PETS) = (${WAVTHREADS}, ${WAVPETS})"
(( NTASKS_TOT = NTASKS_TOT + WAVPETS ))
fi
export WAVPETS WAVTHREADS

OCNPETS=0; OCNTHREADS=0
if [[ "${DO_OCN}" = "YES" ]]; then
(( OCNPETS = ntasks_mom6 * nthreads_mom6 ))
(( OCNTHREADS = nthreads_mom6 ))
export OCNPETS OCNTHREADS
echo "MOM6 using (threads, PETS) = (${OCNTHREADS}, ${OCNPETS})"
(( NTASKS_TOT = NTASKS_TOT + OCNPETS ))
fi
export OCNPETS OCNTHREADS

ICEPETS=0; ICETHREADS=0
if [[ "${DO_ICE}" = "YES" ]]; then
(( ICEPETS = ntasks_cice6 * nthreads_cice6 ))
(( ICETHREADS = nthreads_cice6 ))
export ICEPETS ICETHREADS
echo "CICE6 using (threads, PETS) = (${ICETHREADS}, ${ICEPETS})"
(( NTASKS_TOT = NTASKS_TOT + ICEPETS ))
fi
export ICEPETS ICETHREADS

echo "Total PETS for ${_CDUMP} = ${NTASKS_TOT}"

Expand Down
8 changes: 7 additions & 1 deletion parm/config/gfs/config.ufs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ if [[ "${skip_mom6}" == "false" ]]; then
CHLCLIM="seawifs_1998-2006_smoothed_2X.nc"
MOM6_RESTART_SETTING='r'
MOM6_RIVER_RUNOFF='False'
eps_imesh="4.0e-1"
;;
"100")
ntasks_mom6=20
Expand All @@ -267,6 +268,7 @@ if [[ "${skip_mom6}" == "false" ]]; then
CHLCLIM="seawifs_1998-2006_smoothed_2X.nc"
MOM6_RESTART_SETTING='n'
MOM6_RIVER_RUNOFF='False'
eps_imesh="2.5e-1"
;;
"50")
ntasks_mom6=60
Expand All @@ -279,7 +281,8 @@ if [[ "${skip_mom6}" == "false" ]]; then
CHLCLIM="seawifs-clim-1997-2010.${NX_GLB}x${NY_GLB}.v20180328.nc"
MOM6_RESTART_SETTING='n'
MOM6_RIVER_RUNOFF='True'
;;
eps_imesh="1.0e-1"
;;
"025")
ntasks_mom6=220
OCNTIM=1800
Expand All @@ -291,12 +294,14 @@ if [[ "${skip_mom6}" == "false" ]]; then
CHLCLIM="seawifs-clim-1997-2010.${NX_GLB}x${NY_GLB}.v20180328.nc"
MOM6_RIVER_RUNOFF='True'
MOM6_RESTART_SETTING="r"
eps_imesh="1.0e-1"
;;
*)
echo "FATAL ERROR: Unsupported MOM6 resolution = ${mom6_res}, ABORT!"
exit 1
;;
esac

export nthreads_mom6 ntasks_mom6
export OCNTIM
export NX_GLB NY_GLB
Expand All @@ -305,6 +310,7 @@ if [[ "${skip_mom6}" == "false" ]]; then
export CHLCLIM
export MOM6_RIVER_RUNOFF
export MOM6_RESTART_SETTING
export eps_imesh
fi

# CICE6 specific settings
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 6 additions & 9 deletions scripts/exglobal_forecast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,13 @@

source "${HOMEgfs}/ush/preamble.sh"

SCRIPTDIR="${HOMEgfs}/ush"
echo "MAIN: environment loaded for ${machine} platform,Current Script locates in ${SCRIPTDIR}."

# include all subroutines. Executions later.
source "${SCRIPTDIR}/cplvalidate.sh" # validation of cpl*
source "${SCRIPTDIR}/forecast_predet.sh" # include functions for variable definition
source "${SCRIPTDIR}/forecast_det.sh" # include functions for run type determination
source "${SCRIPTDIR}/forecast_postdet.sh" # include functions for variables after run type determination
source "${SCRIPTDIR}/nems_configure.sh" # include functions for nems_configure processing
source "${SCRIPTDIR}/parsing_model_configure_FV3.sh"
source "${HOMEgfs}/ush/cplvalidate.sh" # validation of cpl*
source "${HOMEgfs}/ush/forecast_predet.sh" # include functions for variable definition
source "${HOMEgfs}/ush/forecast_det.sh" # include functions for run type determination
source "${HOMEgfs}/ush/forecast_postdet.sh" # include functions for variables after run type determination
source "${HOMEgfs}/ush/nems_configure.sh" # include functions for nems_configure processing
source "${HOMEgfs}/ush/parsing_model_configure_FV3.sh"

# Compset string. For nems.configure.* template selection. Default ATM only
confignamevarfornems=${confignamevarfornems:-'atm'}
Expand Down
Loading

0 comments on commit 3520bcb

Please sign in to comment.