Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stochastic restart patterns on rerun #3077

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
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
12 changes: 7 additions & 5 deletions parm/config/gefs/config.fcst
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,13 @@ case ${imp_physics} in
esac

# Stochastic physics
export DO_SPPT=${DO_SPPT:-"NO"}
export DO_SKEB=${DO_SKEB:-"NO"}
export DO_SHUM=${DO_SHUM:-"NO"}
export DO_LAND_PERT=${DO_LAND_PERT:-"NO"}
export DO_CA=${DO_CA:-"YES"}
export DO_SPPT="NO"
export DO_SKEB="NO"
export DO_SHUM="NO"
export DO_LAND_PERT="NO"
export DO_CA="NO"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this config file being used by mem000 in ensemble?, if so, then DO_CA should be YES.

export DO_OCN_SPPT="NO"
export DO_OCN_PERT_EPBL="NO"

#coupling settings
export cplmode="ufs.frac"
Expand Down
1 change: 1 addition & 0 deletions parm/config/gfs/config.efcs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export SPPT_TAU=21600.
export SPPT_LSCALE=500000.
export SPPT_LOGIT=".true."
export SPPT_SFCLIMIT=".true."
export DO_CA="YES"

if [[ "${QUILTING}" == ".true." ]] && [[ "${OUTPUT_GRID}" == "gaussian_grid" ]]; then
export DIAG_TABLE="${PARMgfs}/ufs/fv3/diag_table_da"
Expand Down
15 changes: 7 additions & 8 deletions parm/config/gfs/config.fcst
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,13 @@ case ${imp_physics} in
esac

# Stochastic physics
export DO_SPPT=${DO_SPPT:-"NO"}
export DO_SKEB=${DO_SKEB:-"NO"}
export DO_SHUM=${DO_SHUM:-"NO"}
export DO_LAND_PERT=${DO_LAND_PERT:-"NO"}
export DO_CA=${DO_CA:-"YES"}
if [[ "${DO_NEST:-NO}" == "YES" ]] ; then
export DO_CA="NO" # CA does not work with nesting.
fi
export DO_SPPT="NO"
export DO_SKEB="NO"
export DO_SHUM="NO"
export DO_LAND_PERT="NO"
export DO_CA="NO"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GFS is using CA, so DO_CA should be YES.

export DO_OCN_SPPT="NO"
export DO_OCN_PERT_EPBL="NO"

#coupling settings
export cplmode="ufs.frac"
Expand Down
16 changes: 14 additions & 2 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,19 @@ FV3_postdet() {
|| ( echo "FATAL ERROR: Unable to copy FV3 IC, ABORT!"; exit 1 )
done

if [[ "${RERUN}" != "YES" ]]; then
if [[ "${RERUN}" == "YES" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bingfu-NOAA @EricSinsky-NOAA Is there a time that we want to start the model with these files? i.e., use them in more ways than a RERUN?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 00Z, we will stop at 16-day forecast, then warm start the model to run 16-48 days forecast segment. We will need those files at that time besides a RERUN.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subsequent segments count as RERUNs inside the system.

if [[ "${DO_SPPT:-}" == "YES" || "${DO_SKEB:-}" == "YES" || \
"${DO_SHUM:-}" == "YES" || "${DO_LAND_PERT:-}" == "YES" ]]; then
stochini=".true."
file_list=$(stoch_restarts)
echo "Copying stochastic restarts for 'RUN=${RUN}' at '${restart_date}' from '${restart_dir}'"
for stoch_file in $(stoch_restarts); do
restart_file="${restart_date:0:8}.${restart_date:8:2}0000.${stoch_file}"
${NCP} "${restart_dir}/${restart_file}" "${DATA}/INPUT/${stoch_file}" \
|| ( echo "FATAL ERROR: Unable to copy stochastic restart, ABORT!"; exit 1 )
done
fi
else
# Replace sfc_data with sfcanl_data restart files from current cycle (if found)
local nn
for (( nn = 1; nn <= ntiles; nn++ )); do
Expand Down Expand Up @@ -78,7 +90,7 @@ FV3_postdet() {
"${DATA}/INPUT/fv_tracer.res.tile${nn}.nc"
done
fi # if [[ ${use_anl_aero} == "YES" ]]; then
fi # if [[ "${RERUN}" != "YES" ]]; then
fi # if [[ "${RERUN}" == "YES" ]]; then

fi # if [[ "${warm_start}" == ".true." ]]; then

Expand Down
89 changes: 50 additions & 39 deletions ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,22 @@ FV3_restarts(){
IFS=, echo "${fv3_restart_files[*]}"
}

stoch_restarts(){
# These only get copied for reruns
local stoch_restart_files
stoch_restart_files=( )

if [[ "${DO_SPPT:-}" == "YES" || "${DO_SKEB:-}" == "YES" || \
"${DO_SHUM:-}" == "YES" || "${DO_LAND_PERT:-}" == "YES" ]]; then
stoch_restart_files+=(atm_stoch.res.nc)
fi
if [[ "${DO_OCN:-}" == "YES" && ( "${DO_OCN_SPPT:-}" == "YES" || "${DO_OCN_PERT_EPBL}" == "YES" ) ]]; then
stoch_restart_files+=(ocn_stoch.res.nc)
fi
# Create a comma separated string from array using IFS
IFS=, echo "${stoch_restart_files[*]}"
}

# shellcheck disable=SC2034
common_predet(){
echo "SUB ${FUNCNAME[0]}: Defining variables for shared through model components"
Expand Down Expand Up @@ -369,41 +385,38 @@ FV3_predet(){
do_sppt=".false."
do_ca=".false."
ISEED=0
if (( MEMBER > 0 )); then # these are only applicable for ensemble members
local imem=${MEMBER#0}
local base_seed=$((current_cycle*10000 + imem*100))
local imem=${MEMBER#0}
local base_seed=$((current_cycle*10000 + imem*100))

if [[ "${DO_SKEB:-}" == "YES" ]]; then
do_skeb=".true."
ISEED_SKEB=$((base_seed + 1))
fi

if [[ "${DO_SHUM:-}" == "YES" ]]; then
do_shum=".true."
ISEED_SHUM=$((base_seed + 2))
fi
if [[ "${DO_SKEB:-}" == "YES" ]]; then
do_skeb=".true."
ISEED_SKEB=$((base_seed + 1))
fi

if [[ "${DO_SPPT:-}" == "YES" ]]; then
do_sppt=".true."
ISEED_SPPT=$((base_seed + 3)),$((base_seed + 4)),$((base_seed + 5)),$((base_seed + 6)),$((base_seed + 7))
fi
if [[ "${DO_SHUM:-}" == "YES" ]]; then
do_shum=".true."
ISEED_SHUM=$((base_seed + 2))
fi

if [[ "${DO_CA:-}" == "YES" ]]; then
do_ca=".true."
ISEED_CA=$(( (base_seed + 18) % 2147483647 ))
fi
if [[ "${DO_SPPT:-}" == "YES" ]]; then
do_sppt=".true."
ISEED_SPPT=$((base_seed + 3)),$((base_seed + 4)),$((base_seed + 5)),$((base_seed + 6)),$((base_seed + 7))
fi

if [[ "${DO_LAND_PERT:-}" == "YES" ]]; then
lndp_type=${lndp_type:-2}
ISEED_LNDP=$(( (base_seed + 5) % 2147483647 ))
LNDP_TAU=${LNDP_TAU:-21600}
LNDP_SCALE=${LNDP_SCALE:-500000}
lndp_var_list=${lndp_var_list:-"'smc', 'vgf',"}
lndp_prt_list=${lndp_prt_list:-"0.2,0.1"}
n_var_lndp=$(echo "${lndp_var_list}" | wc -w)
fi
if [[ "${DO_CA:-}" == "YES" ]]; then
do_ca=".true."
ISEED_CA=$(( (base_seed + 18) % 2147483647 ))
fi

fi # end of ensemble member specific options
if [[ "${DO_LAND_PERT:-}" == "YES" ]]; then
lndp_type=${lndp_type:-2}
ISEED_LNDP=$(( (base_seed + 5) % 2147483647 ))
LNDP_TAU=${LNDP_TAU:-21600}
LNDP_SCALE=${LNDP_SCALE:-500000}
lndp_var_list=${lndp_var_list:-"'smc', 'vgf',"}
lndp_prt_list=${lndp_prt_list:-"0.2,0.1"}
n_var_lndp=$(echo "${lndp_var_list}" | wc -w)
fi

#--------------------------------------------------------------------------

Expand Down Expand Up @@ -669,17 +682,15 @@ MOM6_predet(){

# If using stochastic parameterizations, create a seed that does not exceed the
# largest signed integer
if (( MEMBER > 0 )); then # these are only applicable for ensemble members
local imem=${MEMBER#0}
local base_seed=$((current_cycle*10000 + imem*100))
local imem=${MEMBER#0}
local base_seed=$((current_cycle*10000 + imem*100))

if [[ "${DO_OCN_SPPT:-}" == "YES" ]]; then
ISEED_OCNSPPT=$((base_seed + 8)),$((base_seed + 9)),$((base_seed + 10)),$((base_seed + 11)),$((base_seed + 12))
fi
if [[ "${DO_OCN_SPPT:-}" == "YES" ]]; then
ISEED_OCNSPPT=$((base_seed + 8)),$((base_seed + 9)),$((base_seed + 10)),$((base_seed + 11)),$((base_seed + 12))
fi

if [[ "${DO_OCN_PERT_EPBL:-}" == "YES" ]]; then
ISEED_EPBL=$((base_seed + 13)),$((base_seed + 14)),$((base_seed + 15)),$((base_seed + 16)),$((base_seed + 17))
fi
if [[ "${DO_OCN_PERT_EPBL:-}" == "YES" ]]; then
ISEED_EPBL=$((base_seed + 13)),$((base_seed + 14)),$((base_seed + 15)),$((base_seed + 16)),$((base_seed + 17))
fi

# Fix files
Expand Down
1 change: 1 addition & 0 deletions ush/parsing_namelists_FV3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ if [[ "${DO_SPPT}" = "YES" || "${DO_SHUM}" = "YES" || "${DO_SKEB}" = "YES" || "$

cat >> input.nml << EOF
&nam_stochy
stochini=${stochini:-".false."}
EOF

if [[ ${DO_SKEB} = "YES" ]]; then
Expand Down
Loading