From 51c5619547507b8f18958825f366240293e729cb Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Mon, 4 Nov 2024 10:05:26 -0600 Subject: [PATCH] Use stochastic restart patterns on rerun The stochastic pattern restart files were not being copied into the input directory when restarting the model after a segment/failure. These files are now copied in. Additional changes appear to be needed for them to be used by UFS. The files are NOT copied in for non-rerun warm starts. Refs #2937 --- parm/config/gefs/config.fcst | 12 +++--- parm/config/gfs/config.efcs | 1 + parm/config/gfs/config.fcst | 15 ++++--- ush/forecast_postdet.sh | 12 +++++- ush/forecast_predet.sh | 77 +++++++++++++++++++++--------------- 5 files changed, 70 insertions(+), 47 deletions(-) diff --git a/parm/config/gefs/config.fcst b/parm/config/gefs/config.fcst index b2a9c10afe..7d22b94954 100644 --- a/parm/config/gefs/config.fcst +++ b/parm/config/gefs/config.fcst @@ -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" +export DO_OCN_SPPT="NO" +export DO_OCN_PERT_EPBL="NO" #coupling settings export cplmode="ufs.frac" diff --git a/parm/config/gfs/config.efcs b/parm/config/gfs/config.efcs index 1837cf0619..36e3f96095 100644 --- a/parm/config/gfs/config.efcs +++ b/parm/config/gfs/config.efcs @@ -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" diff --git a/parm/config/gfs/config.fcst b/parm/config/gfs/config.fcst index 571e6cafb5..ad2d400f22 100644 --- a/parm/config/gfs/config.fcst +++ b/parm/config/gfs/config.fcst @@ -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" +export DO_OCN_SPPT="NO" +export DO_OCN_PERT_EPBL="NO" #coupling settings export cplmode="ufs.frac" diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index 25b2e28d75..03b4d4fe91 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -47,7 +47,15 @@ FV3_postdet() { || ( echo "FATAL ERROR: Unable to copy FV3 IC, ABORT!"; exit 1 ) done - if [[ "${RERUN}" != "YES" ]]; then + if [[ "${RERUN}" == "YES" ]]; then + 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 + else # Replace sfc_data with sfcanl_data restart files from current cycle (if found) local nn for (( nn = 1; nn <= ntiles; nn++ )); do @@ -78,7 +86,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 diff --git a/ush/forecast_predet.sh b/ush/forecast_predet.sh index d359a86622..d432594c15 100755 --- a/ush/forecast_predet.sh +++ b/ush/forecast_predet.sh @@ -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" @@ -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 #-------------------------------------------------------------------------- @@ -669,7 +682,7 @@ 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 + # if (( MEMBER > 0 )); then # these are only applicable for ensemble members local imem=${MEMBER#0} local base_seed=$((current_cycle*10000 + imem*100)) @@ -680,7 +693,7 @@ MOM6_predet(){ 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 - fi + # fi # Fix files ${NCP} "${FIXgfs}/mom6/${OCNRES}/"* "${DATA}/INPUT/" # TODO: These need to be explicit