diff --git a/run_scripts/v2/reproduce/run.v2.LR.hist-GHG_0151.sh b/run_scripts/v2/reproduce/run.v2.LR.hist-GHG_0151.sh new file mode 100755 index 0000000..b129a72 --- /dev/null +++ b/run_scripts/v2/reproduce/run.v2.LR.hist-GHG_0151.sh @@ -0,0 +1,545 @@ +#!/bin/bash -fe + +# E3SMv2 Water Cycle run_e3sm script template. +# +# Configured to reproduce v2.LR.hist-GHG_0151 on chrysalis. +# Modify as needed for other machines. +# +# Bash coding style inspired by: +# http://kfirlavi.herokuapp.com/blog/2012/11/14/defensive-bash-programming + +main() { + +# For debugging, uncomment line below +#set -x + +# --- Configuration flags ---- + +# Machine and project +readonly MACHINE=chrysalis +readonly PROJECT="e3sm" + +# Simulation +readonly COMPSET="WCYCL20TR" # 20th century transient +readonly RESOLUTION="ne30pg2_EC30to60E2r2" + + + +# Code and compilation +readonly CHECKOUT="20221102-maint-20" +readonly BRANCH="maint-2.0" +readonly CHERRY=( ) +readonly DEBUG_COMPILE=false + +# BEFORE RUNNING : CHANGE the following CASE_NAME to desired value + +# For developmental simulations, recommended convention: +#readonly CASE_NAME=${CHECKOUT}.hist-GHG_0151.${RESOLUTION}.${MACHINE} +# For production simulations: +readonly CASE_NAME="v2.LR.hist-GHG_0151" + +# If this is part of a simulation campaign, ask your group lead about using a case_group label +# readonly CASE_GROUP="" + +# Run options +readonly MODEL_START_TYPE="hybrid" # 'initial', 'continue', 'branch', 'hybrid' +readonly START_DATE="1850-01-01" + +# Additional options for 'branch' and 'hybrid' +readonly GET_REFCASE=TRUE +readonly RUN_REFDIR="/lcrc/group/e3sm/${USER}/E3SMv2_test/v2.LR.hist-GHG_0151/init" +readonly RUN_REFCASE="v2.LR.piControl" +readonly RUN_REFDATE="0151-01-01" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' + +# Set paths +readonly CODE_ROOT="${HOME}/E3SMv2_test/code/${CHECKOUT}" +readonly CASE_ROOT="/lcrc/group/e3sm/${USER}/E3SMv2_test/${CASE_NAME}" + +# Sub-directories +readonly CASE_BUILD_DIR=${CASE_ROOT}/build +readonly CASE_ARCHIVE_DIR=${CASE_ROOT}/archive + +# Define type of run +# +# On Chrysalis +# XS : 14 nodes < 20 nodes --> fits in debug queue +# M : 53 nodes +# ML : 71 nodes +# L : 105 nodes +# +# short tests: 'XS_2x5_ndays', 'XS_1x10_ndays', 'S_1x10_ndays', +# 'M_1x10_ndays', 'ML_1x10_ndays', 'L_1x10_ndays' +# or 'production' for full simulation +readonly run='XS_1x10_ndays' +if [ "${run}" != "production" ]; then + + # Short test simulations + tmp=($(echo $run | tr "_" " ")) + layout=${tmp[0]} + units=${tmp[2]} + resubmit=$(( ${tmp[1]%%x*} -1 )) + length=${tmp[1]##*x} + + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/tests/${run}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/tests/${run}/run + readonly PELAYOUT=${layout} + readonly WALLTIME="00:20:00" + readonly STOP_OPTION=${units} + readonly STOP_N=${length} + readonly REST_OPTION=${STOP_OPTION} + readonly REST_N="1" + readonly RESUBMIT=${resubmit} + readonly DO_SHORT_TERM_ARCHIVING=false + +else + + # Production simulation + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/run + readonly PELAYOUT="ML" + readonly WALLTIME="10:00:00" + readonly STOP_OPTION="nyears" + readonly STOP_N="5" # How often to stop the model, should be a multiple of REST_N + readonly REST_OPTION="nyears" + readonly REST_N="1" + readonly RESUBMIT="32" # Submissions after initial one + readonly DO_SHORT_TERM_ARCHIVING=false +fi + +# Coupler history +readonly HIST_OPTION="nyears" +readonly HIST_N="1" + +# Leave empty (unless you understand what it does) +readonly OLD_EXECUTABLE="/lcrc/group/e3sm/ac.golaz/E3SMv2/v2.LR.hist-GHG_0301/build/e3sm.exe" + +# --- Toggle flags for what to do ---- +do_fetch_code=true +do_create_newcase=true +do_case_setup=true +do_case_build=true +do_case_submit=true + +# --- Now, do the work --- + +# Make directories created by this script world-readable +umask 022 + +# Fetch code from Github +fetch_code + +# Create case +create_newcase + +# Setup +case_setup + +# Build +case_build + +# Configure runtime options +runtime_options + +# Copy script into case_script directory for provenance +copy_script + +# Submit +case_submit + +# All done +echo $'\n----- All done -----\n' + +} + +# ======================= +# Custom user_nl settings +# ======================= + +user_nl() { + +cat << EOF >> user_nl_eam + nhtfrq = 0,-24,-6,-6,-3,-24,0 + mfilt = 1,30,120,120,240,30,1 + avgflag_pertape = 'A','A','I','A','A','A','I' + fexcl1 = 'CFAD_SR532_CAL', 'LINOZ_DO3', 'LINOZ_DO3_PSC', 'LINOZ_O3CLIM', 'LINOZ_O3COL', 'LINOZ_SSO3', 'hstobie_linoz' + fincl1 = 'extinct_sw_inp','extinct_lw_bnd7','extinct_lw_inp','CLD_CAL', 'TREFMNAV', 'TREFMXAV' + fincl2 = 'FLUT','PRECT','U200','V200','U850','V850','Z500','OMEGA500','UBOT','VBOT','TREFHT','TREFHTMN:M','TREFHTMX:X','QREFHT','TS','PS','TMQ','TUQ','TVQ','TOZ', 'FLDS', 'FLNS', 'FSDS', 'FSNS', 'SHFLX', 'LHFLX', 'TGCLDCWP', 'TGCLDIWP', 'TGCLDLWP', 'CLDTOT', 'T250', 'T200', 'T150', 'T100', 'T050', 'T025', 'T010', 'T005', 'T002', 'T001', 'TTOP', 'U250', 'U150', 'U100', 'U050', 'U025', 'U010', 'U005', 'U002', 'U001', 'UTOP', 'FSNT', 'FLNT' + fincl3 = 'PSL','T200','T500','U850','V850','UBOT','VBOT','TREFHT', 'Z700', 'TBOT:M' + fincl4 = 'FLUT','U200','U850','PRECT','OMEGA500' + fincl5 = 'PRECT','PRECC','TUQ','TVQ','QFLX','SHFLX','U90M','V90M' + fincl6 = 'CLDTOT_ISCCP','MEANCLDALB_ISCCP','MEANTAU_ISCCP','MEANPTOP_ISCCP','MEANTB_ISCCP','CLDTOT_CAL','CLDTOT_CAL_LIQ','CLDTOT_CAL_ICE','CLDTOT_CAL_UN','CLDHGH_CAL','CLDHGH_CAL_LIQ','CLDHGH_CAL_ICE','CLDHGH_CAL_UN','CLDMED_CAL','CLDMED_CAL_LIQ','CLDMED_CAL_ICE','CLDMED_CAL_UN','CLDLOW_CAL','CLDLOW_CAL_LIQ','CLDLOW_CAL_ICE','CLDLOW_CAL_UN' + fincl7 = 'O3', 'PS', 'TROP_P' + +! Historical, vs single forcing configurations + +! | Configuration | GHGs | Aerosols and | Ozone | Solar | Volcanoes | Land use +! | | | precursors | | | | +! ----------------------------------------------------------------------------------------------- +! | historical | varying | varying | varying | varying | varying | varying +! | hist-GHG | varying | 1850 | 1850 | 1850 | 1850 | 1850 +! | hist-aer | 1850 | varying | 1850 | 1850 | 1850 | 1850 +! | hist-all-xGHG-xaer | 1850 | 1850 | varying | varying | varying | varying + +! (1) GHGs settings + +! (2) aeorosols and precursors + + ext_frc_cycle_yr = 1850 + ext_frc_type = 'CYCLICAL' + + srf_emis_cycle_yr = 1850 + srf_emis_specifier = 'DMS -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160416.nc', + 'SO2 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc', + 'bc_a4 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc', + 'num_a1 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc', + 'num_a2 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc', + 'num_a4 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc', + 'pom_a4 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc', + 'so4_a1 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc', + 'so4_a2 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc' + srf_emis_type = 'CYCLICAL' + + tracer_cnst_cycle_yr = 1849 + tracer_cnst_type = 'CYCLICAL' + +! (3) ozone + + chlorine_loading_fixed_ymd = 18500101 + chlorine_loading_type = 'FIXED' + + linoz_data_cycle_yr = 1850 + linoz_data_type = 'CYCLICAL' + +! (4) solar + + solar_data_file = '${input_data_dir}/atm/cam/solar/Solar_1850control_input4MIPS_c20181106.nc' + solar_data_type = 'FIXED' + solar_data_ymd = 18500101 + +! (5) volcanoes + + prescribed_volcaero_cycle_yr = 1 + prescribed_volcaero_file = 'CMIP_DOE-ACME_radiation_average_1850-2014_v3_c20171204.nc' + prescribed_volcaero_type = 'CYCLICAL' + +EOF + +cat << EOF >> user_nl_elm + hist_dov2xy = .true.,.true. + hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' + hist_mfilt = 1,365 + hist_nhtfrq = 0,-24 + hist_avgflag_pertape = 'A','A' + +! (6) Land use and cover + + do_transient_pfts = .false. + flanduse_timeseries = '' + + +! Override +check_finidat_fsurdat_consistency = .false. + +EOF + +cat << EOF >> user_nl_mosart + rtmhist_fincl2 = 'RIVER_DISCHARGE_OVER_LAND_LIQ' + rtmhist_mfilt = 1,365 + rtmhist_ndens = 2 + rtmhist_nhtfrq = 0,-24 +EOF + +} + +patch_mpas_streams() { + +echo + +} + +###################################################### +### Most users won't need to change anything below ### +###################################################### + +#----------------------------------------------------- +fetch_code() { + + if [ "${do_fetch_code,,}" != "true" ]; then + echo $'\n----- Skipping fetch_code -----\n' + return + fi + + echo $'\n----- Starting fetch_code -----\n' + local path=${CODE_ROOT} + local repo=e3sm + + echo "Cloning $repo repository branch $BRANCH under $path" + if [ -d "${path}" ]; then + echo "ERROR: Directory already exists. Not overwriting" + exit 20 + fi + mkdir -p ${path} + pushd ${path} + + # This will put repository, with all code + git clone git@github.com:E3SM-Project/${repo}.git . + + # Setup git hooks + rm -rf .git/hooks + git clone git@github.com:E3SM-Project/E3SM-Hooks.git .git/hooks + git config commit.template .git/hooks/commit.template + + # Check out desired branch + git checkout ${BRANCH} + + # Custom addition + if [ "${CHERRY}" != "" ]; then + echo ----- WARNING: adding git cherry-pick ----- + for commit in "${CHERRY[@]}" + do + echo ${commit} + git cherry-pick ${commit} + done + echo ------------------------------------------- + fi + + # Bring in all submodule components + git submodule update --init --recursive + + popd +} + +#----------------------------------------------------- +create_newcase() { + + if [ "${do_create_newcase,,}" != "true" ]; then + echo $'\n----- Skipping create_newcase -----\n' + return + fi + + echo $'\n----- Starting create_newcase -----\n' + + # Base arguments + args=" --case ${CASE_NAME} \ + --output-root ${CASE_ROOT} \ + --script-root ${CASE_SCRIPTS_DIR} \ + --handle-preexisting-dirs u \ + --compset ${COMPSET} \ + --res ${RESOLUTION} \ + --machine ${MACHINE} \ + --walltime ${WALLTIME} \ + --pecount ${PELAYOUT}" + + # Optional arguments + if [ ! -z "${PROJECT}" ]; then + args="${args} --project ${PROJECT}" + fi + if [ ! -z "${CASE_GROUP}" ]; then + args="${args} --case-group ${CASE_GROUP}" + fi + if [ ! -z "${QUEUE}" ]; then + args="${args} --queue ${QUEUE}" + fi + + ${CODE_ROOT}/cime/scripts/create_newcase ${args} + + if [ $? != 0 ]; then + echo $'\nNote: if create_newcase failed because sub-directory already exists:' + echo $' * delete old case_script sub-directory' + echo $' * or set do_newcase=false\n' + exit 35 + fi + +} + +#----------------------------------------------------- +case_setup() { + + if [ "${do_case_setup,,}" != "true" ]; then + echo $'\n----- Skipping case_setup -----\n' + return + fi + + echo $'\n----- Starting case_setup -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Setup some CIME directories + ./xmlchange EXEROOT=${CASE_BUILD_DIR} + ./xmlchange RUNDIR=${CASE_RUN_DIR} + + # Short term archiving + ./xmlchange DOUT_S=${DO_SHORT_TERM_ARCHIVING^^} + ./xmlchange DOUT_S_ROOT=${CASE_ARCHIVE_DIR} + + # Build with COSP, except for a data atmosphere (datm) + if [ `./xmlquery --value COMP_ATM` == "datm" ]; then + echo $'\nThe specified configuration uses a data atmosphere, so cannot activate COSP simulator\n' + else + echo $'\nConfiguring E3SM to use the COSP simulator\n' + ./xmlchange --id CAM_CONFIG_OPTS --append --val='-cosp' + fi + + # Extracts input_data_dir in case it is needed for user edits to the namelist later + local input_data_dir=`./xmlquery DIN_LOC_ROOT --value` + + # Custom user_nl + user_nl + + # Finally, run CIME case.setup + ./case.setup --reset + + popd +} + +#----------------------------------------------------- +case_build() { + + pushd ${CASE_SCRIPTS_DIR} + + # do_case_build = false + if [ "${do_case_build,,}" != "true" ]; then + + echo $'\n----- case_build -----\n' + + if [ "${OLD_EXECUTABLE}" == "" ]; then + # Ues previously built executable, make sure it exists + if [ -x ${CASE_BUILD_DIR}/e3sm.exe ]; then + echo 'Skipping build because $do_case_build = '${do_case_build} + else + echo 'ERROR: $do_case_build = '${do_case_build}' but no executable exists for this case.' + exit 297 + fi + else + # If absolute pathname exists and is executable, reuse pre-exiting executable + if [ -x ${OLD_EXECUTABLE} ]; then + echo 'Using $OLD_EXECUTABLE = '${OLD_EXECUTABLE} + cp -fp ${OLD_EXECUTABLE} ${CASE_BUILD_DIR}/ + else + echo 'ERROR: $OLD_EXECUTABLE = '$OLD_EXECUTABLE' does not exist or is not an executable file.' + exit 297 + fi + fi + echo 'WARNING: Setting BUILD_COMPLETE = TRUE. This is a little risky, but trusting the user.' + ./xmlchange BUILD_COMPLETE=TRUE + + # do_case_build = true + else + + echo $'\n----- Starting case_build -----\n' + + # Turn on debug compilation option if requested + if [ "${DEBUG_COMPILE^^}" == "TRUE" ]; then + ./xmlchange DEBUG=${DEBUG_COMPILE^^} + fi + + # Run CIME case.build + ./case.build + + # Some user_nl settings won't be updated to *_in files under the run directory + # Call preview_namelists to make sure *_in and user_nl files are consistent. + ./preview_namelists + + fi + + popd +} + +#----------------------------------------------------- +runtime_options() { + + echo $'\n----- Starting runtime_options -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Set simulation start date + ./xmlchange RUN_STARTDATE=${START_DATE} + + # Segment length + ./xmlchange STOP_OPTION=${STOP_OPTION,,},STOP_N=${STOP_N} + + # Restart frequency + ./xmlchange REST_OPTION=${REST_OPTION,,},REST_N=${REST_N} + + # Coupler history + ./xmlchange HIST_OPTION=${HIST_OPTION,,},HIST_N=${HIST_N} + + # Coupler budgets (always on) + ./xmlchange BUDGETS=TRUE + + # Set resubmissions + if (( RESUBMIT > 0 )); then + ./xmlchange RESUBMIT=${RESUBMIT} + fi + + # Run type + # Start from default of user-specified initial conditions + if [ "${MODEL_START_TYPE,,}" == "initial" ]; then + ./xmlchange RUN_TYPE="startup" + ./xmlchange CONTINUE_RUN="FALSE" + + # Continue existing run + elif [ "${MODEL_START_TYPE,,}" == "continue" ]; then + ./xmlchange CONTINUE_RUN="TRUE" + + elif [ "${MODEL_START_TYPE,,}" == "branch" ] || [ "${MODEL_START_TYPE,,}" == "hybrid" ]; then + ./xmlchange RUN_TYPE=${MODEL_START_TYPE,,} + ./xmlchange GET_REFCASE=${GET_REFCASE} + ./xmlchange RUN_REFDIR=${RUN_REFDIR} + ./xmlchange RUN_REFCASE=${RUN_REFCASE} + ./xmlchange RUN_REFDATE=${RUN_REFDATE} + echo 'Warning: $MODEL_START_TYPE = '${MODEL_START_TYPE} + echo '$RUN_REFDIR = '${RUN_REFDIR} + echo '$RUN_REFCASE = '${RUN_REFCASE} + echo '$RUN_REFDATE = '${START_DATE} + + else + echo 'ERROR: $MODEL_START_TYPE = '${MODEL_START_TYPE}' is unrecognized. Exiting.' + exit 380 + fi + + # Patch mpas streams files + patch_mpas_streams + + popd +} + +#----------------------------------------------------- +case_submit() { + + if [ "${do_case_submit,,}" != "true" ]; then + echo $'\n----- Skipping case_submit -----\n' + return + fi + + echo $'\n----- Starting case_submit -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Run CIME case.submit + ./case.submit + + popd +} + +#----------------------------------------------------- +copy_script() { + + echo $'\n----- Saving run script for provenance -----\n' + + local script_provenance_dir=${CASE_SCRIPTS_DIR}/run_script_provenance + mkdir -p ${script_provenance_dir} + local this_script_name=`basename $0` + local script_provenance_name=${this_script_name}.`date +%Y%m%d-%H%M%S` + cp -vp ${this_script_name} ${script_provenance_dir}/${script_provenance_name} + +} + +#----------------------------------------------------- +# Silent versions of popd and pushd +pushd() { + command pushd "$@" > /dev/null +} +popd() { + command popd "$@" > /dev/null +} +# Now, actually run the script +#----------------------------------------------------- +main diff --git a/run_scripts/v2/reproduce/run.v2.LR.hist-aer_0151.sh b/run_scripts/v2/reproduce/run.v2.LR.hist-aer_0151.sh index d80fd79..e9a42f6 100755 --- a/run_scripts/v2/reproduce/run.v2.LR.hist-aer_0151.sh +++ b/run_scripts/v2/reproduce/run.v2.LR.hist-aer_0151.sh @@ -22,7 +22,7 @@ readonly PROJECT="e3sm" # Simulation readonly COMPSET="WCYCL20TR" # 20th century transient readonly RESOLUTION="ne30pg2_EC30to60E2r2" -readonly CASE_NAME="v2.LR.hist-aer_0151" + # Code and compilation @@ -47,7 +47,7 @@ readonly START_DATE="1850-01-01" # Additional options for 'branch' and 'hybrid' readonly GET_REFCASE=TRUE -readonly RUN_REFDIR="/lcrc/group/e3sm/${USER}/E3SMv2_test/${CASE_NAME}/init" +readonly RUN_REFDIR="/lcrc/group/e3sm/${USER}/E3SMv2_test/v2.LR.hist-aer_0151/init" readonly RUN_REFCASE="v2.LR.piControl" readonly RUN_REFDATE="0151-01-01" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' @@ -82,8 +82,8 @@ if [ "${run}" != "production" ]; then readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/tests/${run}/case_scripts readonly CASE_RUN_DIR=${CASE_ROOT}/tests/${run}/run - readonly PELAYOUT="ML" - readonly WALLTIME="48:00:00" + readonly PELAYOUT=${layout} + readonly WALLTIME="00:20:00" readonly STOP_OPTION=${units} readonly STOP_N=${length} readonly REST_OPTION=${STOP_OPTION} @@ -97,7 +97,7 @@ else readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/case_scripts readonly CASE_RUN_DIR=${CASE_ROOT}/run readonly PELAYOUT="ML" - readonly WALLTIME="48:00:00" + readonly WALLTIME="10:00:00" readonly STOP_OPTION="nyears" readonly STOP_N="5" # How often to stop the model, should be a multiple of REST_N readonly REST_OPTION="nyears" @@ -230,6 +230,10 @@ cat << EOF >> user_nl_elm do_transient_pfts = .false. flanduse_timeseries = '' + +! Override +check_finidat_fsurdat_consistency = .false. + EOF cat << EOF >> user_nl_mosart diff --git a/run_scripts/v2/reproduce/run.v2.LR.hist-all-xGHG-xaer_0151.sh b/run_scripts/v2/reproduce/run.v2.LR.hist-all-xGHG-xaer_0151.sh new file mode 100755 index 0000000..5098478 --- /dev/null +++ b/run_scripts/v2/reproduce/run.v2.LR.hist-all-xGHG-xaer_0151.sh @@ -0,0 +1,540 @@ +#!/bin/bash -fe + +# E3SMv2 Water Cycle run_e3sm script template. +# +# Configured to reproduce v2.LR.hist-all-xGHG-xaer_0151 on chrysalis. +# Modify as needed for other machines. +# +# Bash coding style inspired by: +# http://kfirlavi.herokuapp.com/blog/2012/11/14/defensive-bash-programming + +main() { + +# For debugging, uncomment line below +#set -x + +# --- Configuration flags ---- + +# Machine and project +readonly MACHINE=chrysalis +readonly PROJECT="e3sm" + +# Simulation +readonly COMPSET="WCYCL20TR" # 20th century transient +readonly RESOLUTION="ne30pg2_EC30to60E2r2" + + + +# Code and compilation +readonly CHECKOUT="20221102-maint-20" +readonly BRANCH="maint-2.0" +readonly CHERRY=( ) +readonly DEBUG_COMPILE=false + +# BEFORE RUNNING : CHANGE the following CASE_NAME to desired value + +# For developmental simulations, recommended convention: +#readonly CASE_NAME=${CHECKOUT}.hist-all-xGHG-xaer_0151.${RESOLUTION}.${MACHINE} +# For production simulations: +readonly CASE_NAME="v2.LR.hist-all-xGHG-xaer_0151" + +# If this is part of a simulation campaign, ask your group lead about using a case_group label +# readonly CASE_GROUP="" + +# Run options +readonly MODEL_START_TYPE="hybrid" # 'initial', 'continue', 'branch', 'hybrid' +readonly START_DATE="1850-01-01" + +# Additional options for 'branch' and 'hybrid' +readonly GET_REFCASE=TRUE +readonly RUN_REFDIR="/lcrc/group/e3sm/${USER}/E3SMv2_test/v2.LR.hist-all-xGHG-xaer_0151/init" +readonly RUN_REFCASE="v2.LR.piControl" +readonly RUN_REFDATE="0151-01-01" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' + +# Set paths +readonly CODE_ROOT="${HOME}/E3SMv2_test/code/${CHECKOUT}" +readonly CASE_ROOT="/lcrc/group/e3sm/${USER}/E3SMv2_test/${CASE_NAME}" + +# Sub-directories +readonly CASE_BUILD_DIR=${CASE_ROOT}/build +readonly CASE_ARCHIVE_DIR=${CASE_ROOT}/archive + +# Define type of run +# +# On Chrysalis +# XS : 14 nodes < 20 nodes --> fits in debug queue +# M : 53 nodes +# ML : 71 nodes +# L : 105 nodes +# +# short tests: 'XS_2x5_ndays', 'XS_1x10_ndays', 'S_1x10_ndays', +# 'M_1x10_ndays', 'ML_1x10_ndays', 'L_1x10_ndays' +# or 'production' for full simulation +readonly run='XS_1x10_ndays' +if [ "${run}" != "production" ]; then + + # Short test simulations + tmp=($(echo $run | tr "_" " ")) + layout=${tmp[0]} + units=${tmp[2]} + resubmit=$(( ${tmp[1]%%x*} -1 )) + length=${tmp[1]##*x} + + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/tests/${run}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/tests/${run}/run + readonly PELAYOUT=${layout} + readonly WALLTIME="00:20:00" + readonly STOP_OPTION=${units} + readonly STOP_N=${length} + readonly REST_OPTION=${STOP_OPTION} + readonly REST_N="1" + readonly RESUBMIT=${resubmit} + readonly DO_SHORT_TERM_ARCHIVING=false + +else + + # Production simulation + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/run + readonly PELAYOUT="ML" + readonly WALLTIME="10:00:00" + readonly STOP_OPTION="nyears" + readonly STOP_N="5" # How often to stop the model, should be a multiple of REST_N + readonly REST_OPTION="nyears" + readonly REST_N="1" + readonly RESUBMIT="32" # Submissions after initial one + readonly DO_SHORT_TERM_ARCHIVING=false +fi + +# Coupler history +readonly HIST_OPTION="nyears" +readonly HIST_N="1" + +# Leave empty (unless you understand what it does) +readonly OLD_EXECUTABLE="/lcrc/group/e3sm/ac.golaz/E3SMv2/v2.LR.hist-GHG_0301/build/e3sm.exe" + +# --- Toggle flags for what to do ---- +do_fetch_code=true +do_create_newcase=true +do_case_setup=true +do_case_build=true +do_case_submit=true + +# --- Now, do the work --- + +# Make directories created by this script world-readable +umask 022 + +# Fetch code from Github +fetch_code + +# Create case +create_newcase + +# Setup +case_setup + +# Build +case_build + +# Configure runtime options +runtime_options + +# Copy script into case_script directory for provenance +copy_script + +# Submit +case_submit + +# All done +echo $'\n----- All done -----\n' + +} + +# ======================= +# Custom user_nl settings +# ======================= + +user_nl() { + +cat << EOF >> user_nl_eam + nhtfrq = 0,-24,-6,-6,-3,-24,0 + mfilt = 1,30,120,120,240,30,1 + avgflag_pertape = 'A','A','I','A','A','A','I' + fexcl1 = 'CFAD_SR532_CAL', 'LINOZ_DO3', 'LINOZ_DO3_PSC', 'LINOZ_O3CLIM', 'LINOZ_O3COL', 'LINOZ_SSO3', 'hstobie_linoz' + fincl1 = 'extinct_sw_inp','extinct_lw_bnd7','extinct_lw_inp','CLD_CAL', 'TREFMNAV', 'TREFMXAV' + fincl2 = 'FLUT','PRECT','U200','V200','U850','V850','Z500','OMEGA500','UBOT','VBOT','TREFHT','TREFHTMN:M','TREFHTMX:X','QREFHT','TS','PS','TMQ','TUQ','TVQ','TOZ', 'FLDS', 'FLNS', 'FSDS', 'FSNS', 'SHFLX', 'LHFLX', 'TGCLDCWP', 'TGCLDIWP', 'TGCLDLWP', 'CLDTOT', 'T250', 'T200', 'T150', 'T100', 'T050', 'T025', 'T010', 'T005', 'T002', 'T001', 'TTOP', 'U250', 'U150', 'U100', 'U050', 'U025', 'U010', 'U005', 'U002', 'U001', 'UTOP', 'FSNT', 'FLNT' + fincl3 = 'PSL','T200','T500','U850','V850','UBOT','VBOT','TREFHT', 'Z700', 'TBOT:M' + fincl4 = 'FLUT','U200','U850','PRECT','OMEGA500' + fincl5 = 'PRECT','PRECC','TUQ','TVQ','QFLX','SHFLX','U90M','V90M' + fincl6 = 'CLDTOT_ISCCP','MEANCLDALB_ISCCP','MEANTAU_ISCCP','MEANPTOP_ISCCP','MEANTB_ISCCP','CLDTOT_CAL','CLDTOT_CAL_LIQ','CLDTOT_CAL_ICE','CLDTOT_CAL_UN','CLDHGH_CAL','CLDHGH_CAL_LIQ','CLDHGH_CAL_ICE','CLDHGH_CAL_UN','CLDMED_CAL','CLDMED_CAL_LIQ','CLDMED_CAL_ICE','CLDMED_CAL_UN','CLDLOW_CAL','CLDLOW_CAL_LIQ','CLDLOW_CAL_ICE','CLDLOW_CAL_UN' + fincl7 = 'O3', 'PS', 'TROP_P' + +! Historical, vs single forcing configurations + +! | Configuration | GHGs | Aerosols and | Ozone | Solar | Volcanoes | Land use +! | | | precursors | | | | +! ----------------------------------------------------------------------------------------------- +! | historical | varying | varying | varying | varying | varying | varying +! | hist-GHG | varying | 1850 | 1850 | 1850 | 1850 | 1850 +! | hist-aer | 1850 | varying | 1850 | 1850 | 1850 | 1850 +! | hist-all-xGHG-xaer | 1850 | 1850 | varying | varying | varying | varying + +! (1) GHGs settings + + bndtvghg = ' ' + ch4vmr = 808.249e-9 + co2vmr = 284.317000e-6 + f11vmr = 32.1102e-12 + f12vmr = 0.0 + flbc_list = ' ' + n2ovmr = 273.0211e-9 + scenario_ghg = 'FIXED' + +! (2) aeorosols and precursors + + ext_frc_cycle_yr = 1850 + ext_frc_type = 'CYCLICAL' + + srf_emis_cycle_yr = 1850 + srf_emis_specifier = 'DMS -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160416.nc', + 'SO2 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc', + 'bc_a4 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc', + 'num_a1 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc', + 'num_a2 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc', + 'num_a4 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc', + 'pom_a4 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc', + 'so4_a1 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc', + 'so4_a2 -> ${input_data_dir}/atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc' + srf_emis_type = 'CYCLICAL' + + tracer_cnst_cycle_yr = 1849 + tracer_cnst_type = 'CYCLICAL' + +! (3) ozone + +! (4) solar + +! (5) volcanoes + +EOF + +# (1) GHGs settings: also set CCSM_CO2_PPMV +./xmlchange --id CCSM_CO2_PPMV --val "284.317" + +cat << EOF >> user_nl_elm + hist_dov2xy = .true.,.true. + hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' + hist_mfilt = 1,365 + hist_nhtfrq = 0,-24 + hist_avgflag_pertape = 'A','A' + +! (6) Land use and cover + + +! Override +check_finidat_fsurdat_consistency = .false. + +EOF + +cat << EOF >> user_nl_mosart + rtmhist_fincl2 = 'RIVER_DISCHARGE_OVER_LAND_LIQ' + rtmhist_mfilt = 1,365 + rtmhist_ndens = 2 + rtmhist_nhtfrq = 0,-24 +EOF + +} + +patch_mpas_streams() { + +echo + +} + +###################################################### +### Most users won't need to change anything below ### +###################################################### + +#----------------------------------------------------- +fetch_code() { + + if [ "${do_fetch_code,,}" != "true" ]; then + echo $'\n----- Skipping fetch_code -----\n' + return + fi + + echo $'\n----- Starting fetch_code -----\n' + local path=${CODE_ROOT} + local repo=e3sm + + echo "Cloning $repo repository branch $BRANCH under $path" + if [ -d "${path}" ]; then + echo "ERROR: Directory already exists. Not overwriting" + exit 20 + fi + mkdir -p ${path} + pushd ${path} + + # This will put repository, with all code + git clone git@github.com:E3SM-Project/${repo}.git . + + # Setup git hooks + rm -rf .git/hooks + git clone git@github.com:E3SM-Project/E3SM-Hooks.git .git/hooks + git config commit.template .git/hooks/commit.template + + # Check out desired branch + git checkout ${BRANCH} + + # Custom addition + if [ "${CHERRY}" != "" ]; then + echo ----- WARNING: adding git cherry-pick ----- + for commit in "${CHERRY[@]}" + do + echo ${commit} + git cherry-pick ${commit} + done + echo ------------------------------------------- + fi + + # Bring in all submodule components + git submodule update --init --recursive + + popd +} + +#----------------------------------------------------- +create_newcase() { + + if [ "${do_create_newcase,,}" != "true" ]; then + echo $'\n----- Skipping create_newcase -----\n' + return + fi + + echo $'\n----- Starting create_newcase -----\n' + + # Base arguments + args=" --case ${CASE_NAME} \ + --output-root ${CASE_ROOT} \ + --script-root ${CASE_SCRIPTS_DIR} \ + --handle-preexisting-dirs u \ + --compset ${COMPSET} \ + --res ${RESOLUTION} \ + --machine ${MACHINE} \ + --walltime ${WALLTIME} \ + --pecount ${PELAYOUT}" + + # Optional arguments + if [ ! -z "${PROJECT}" ]; then + args="${args} --project ${PROJECT}" + fi + if [ ! -z "${CASE_GROUP}" ]; then + args="${args} --case-group ${CASE_GROUP}" + fi + if [ ! -z "${QUEUE}" ]; then + args="${args} --queue ${QUEUE}" + fi + + ${CODE_ROOT}/cime/scripts/create_newcase ${args} + + if [ $? != 0 ]; then + echo $'\nNote: if create_newcase failed because sub-directory already exists:' + echo $' * delete old case_script sub-directory' + echo $' * or set do_newcase=false\n' + exit 35 + fi + +} + +#----------------------------------------------------- +case_setup() { + + if [ "${do_case_setup,,}" != "true" ]; then + echo $'\n----- Skipping case_setup -----\n' + return + fi + + echo $'\n----- Starting case_setup -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Setup some CIME directories + ./xmlchange EXEROOT=${CASE_BUILD_DIR} + ./xmlchange RUNDIR=${CASE_RUN_DIR} + + # Short term archiving + ./xmlchange DOUT_S=${DO_SHORT_TERM_ARCHIVING^^} + ./xmlchange DOUT_S_ROOT=${CASE_ARCHIVE_DIR} + + # Build with COSP, except for a data atmosphere (datm) + if [ `./xmlquery --value COMP_ATM` == "datm" ]; then + echo $'\nThe specified configuration uses a data atmosphere, so cannot activate COSP simulator\n' + else + echo $'\nConfiguring E3SM to use the COSP simulator\n' + ./xmlchange --id CAM_CONFIG_OPTS --append --val='-cosp' + fi + + # Extracts input_data_dir in case it is needed for user edits to the namelist later + local input_data_dir=`./xmlquery DIN_LOC_ROOT --value` + + # Custom user_nl + user_nl + + # Finally, run CIME case.setup + ./case.setup --reset + + popd +} + +#----------------------------------------------------- +case_build() { + + pushd ${CASE_SCRIPTS_DIR} + + # do_case_build = false + if [ "${do_case_build,,}" != "true" ]; then + + echo $'\n----- case_build -----\n' + + if [ "${OLD_EXECUTABLE}" == "" ]; then + # Ues previously built executable, make sure it exists + if [ -x ${CASE_BUILD_DIR}/e3sm.exe ]; then + echo 'Skipping build because $do_case_build = '${do_case_build} + else + echo 'ERROR: $do_case_build = '${do_case_build}' but no executable exists for this case.' + exit 297 + fi + else + # If absolute pathname exists and is executable, reuse pre-exiting executable + if [ -x ${OLD_EXECUTABLE} ]; then + echo 'Using $OLD_EXECUTABLE = '${OLD_EXECUTABLE} + cp -fp ${OLD_EXECUTABLE} ${CASE_BUILD_DIR}/ + else + echo 'ERROR: $OLD_EXECUTABLE = '$OLD_EXECUTABLE' does not exist or is not an executable file.' + exit 297 + fi + fi + echo 'WARNING: Setting BUILD_COMPLETE = TRUE. This is a little risky, but trusting the user.' + ./xmlchange BUILD_COMPLETE=TRUE + + # do_case_build = true + else + + echo $'\n----- Starting case_build -----\n' + + # Turn on debug compilation option if requested + if [ "${DEBUG_COMPILE^^}" == "TRUE" ]; then + ./xmlchange DEBUG=${DEBUG_COMPILE^^} + fi + + # Run CIME case.build + ./case.build + + # Some user_nl settings won't be updated to *_in files under the run directory + # Call preview_namelists to make sure *_in and user_nl files are consistent. + ./preview_namelists + + fi + + popd +} + +#----------------------------------------------------- +runtime_options() { + + echo $'\n----- Starting runtime_options -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Set simulation start date + ./xmlchange RUN_STARTDATE=${START_DATE} + + # Segment length + ./xmlchange STOP_OPTION=${STOP_OPTION,,},STOP_N=${STOP_N} + + # Restart frequency + ./xmlchange REST_OPTION=${REST_OPTION,,},REST_N=${REST_N} + + # Coupler history + ./xmlchange HIST_OPTION=${HIST_OPTION,,},HIST_N=${HIST_N} + + # Coupler budgets (always on) + ./xmlchange BUDGETS=TRUE + + # Set resubmissions + if (( RESUBMIT > 0 )); then + ./xmlchange RESUBMIT=${RESUBMIT} + fi + + # Run type + # Start from default of user-specified initial conditions + if [ "${MODEL_START_TYPE,,}" == "initial" ]; then + ./xmlchange RUN_TYPE="startup" + ./xmlchange CONTINUE_RUN="FALSE" + + # Continue existing run + elif [ "${MODEL_START_TYPE,,}" == "continue" ]; then + ./xmlchange CONTINUE_RUN="TRUE" + + elif [ "${MODEL_START_TYPE,,}" == "branch" ] || [ "${MODEL_START_TYPE,,}" == "hybrid" ]; then + ./xmlchange RUN_TYPE=${MODEL_START_TYPE,,} + ./xmlchange GET_REFCASE=${GET_REFCASE} + ./xmlchange RUN_REFDIR=${RUN_REFDIR} + ./xmlchange RUN_REFCASE=${RUN_REFCASE} + ./xmlchange RUN_REFDATE=${RUN_REFDATE} + echo 'Warning: $MODEL_START_TYPE = '${MODEL_START_TYPE} + echo '$RUN_REFDIR = '${RUN_REFDIR} + echo '$RUN_REFCASE = '${RUN_REFCASE} + echo '$RUN_REFDATE = '${START_DATE} + + else + echo 'ERROR: $MODEL_START_TYPE = '${MODEL_START_TYPE}' is unrecognized. Exiting.' + exit 380 + fi + + # Patch mpas streams files + patch_mpas_streams + + popd +} + +#----------------------------------------------------- +case_submit() { + + if [ "${do_case_submit,,}" != "true" ]; then + echo $'\n----- Skipping case_submit -----\n' + return + fi + + echo $'\n----- Starting case_submit -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Run CIME case.submit + ./case.submit + + popd +} + +#----------------------------------------------------- +copy_script() { + + echo $'\n----- Saving run script for provenance -----\n' + + local script_provenance_dir=${CASE_SCRIPTS_DIR}/run_script_provenance + mkdir -p ${script_provenance_dir} + local this_script_name=`basename $0` + local script_provenance_name=${this_script_name}.`date +%Y%m%d-%H%M%S` + cp -vp ${this_script_name} ${script_provenance_dir}/${script_provenance_name} + +} + +#----------------------------------------------------- +# Silent versions of popd and pushd +pushd() { + command pushd "$@" > /dev/null +} +popd() { + command popd "$@" > /dev/null +} +# Now, actually run the script +#----------------------------------------------------- +main diff --git a/run_scripts/v2/reproduce/run.v2.LR.piClim-histaer_0031.sh b/run_scripts/v2/reproduce/run.v2.LR.piClim-histaer_0031.sh new file mode 100755 index 0000000..8ff9a37 --- /dev/null +++ b/run_scripts/v2/reproduce/run.v2.LR.piClim-histaer_0031.sh @@ -0,0 +1,544 @@ +#!/bin/bash -fe + +# E3SMv2 Water Cycle run_e3sm script template. +# +# Configured to reproduce v2.LR.piClim-histaer_0031 on chrysalis. +# Modify as needed for other machines. +# +# Bash coding style inspired by: +# http://kfirlavi.herokuapp.com/blog/2012/11/14/defensive-bash-programming + +main() { + +# For debugging, uncomment line below +#set -x + +# --- Configuration flags ---- + +# Machine and project +readonly MACHINE=chrysalis +readonly PROJECT="e3sm" + +# Simulation +readonly COMPSET="F20TR" +readonly RESOLUTION="ne30pg2_EC30to60E2r2" + + + +# Code and compilation +readonly CHECKOUT="20221102-maint-20" +readonly BRANCH="maint-2.0" +readonly CHERRY=( ) +readonly DEBUG_COMPILE=false + +# BEFORE RUNNING : CHANGE the following CASE_NAME to desired value + +# For developmental simulations, recommended convention: +#readonly CASE_NAME=${CHECKOUT}.piClim-histaer_0031.${RESOLUTION}.${MACHINE} +# For production simulations: +readonly CASE_NAME="v2.LR.piClim-histaer_0031" + +# If this is part of a simulation campaign, ask your group lead about using a case_group label +# readonly CASE_GROUP="" + +# Run options +readonly MODEL_START_TYPE="hybrid" # 'initial', 'continue', 'branch', 'hybrid' +readonly START_DATE="1850-01-01" + +# Additional options for 'branch' and 'hybrid' +readonly GET_REFCASE=TRUE +readonly RUN_REFDIR="/lcrc/group/e3sm/${USER}/E3SMv2_test/v2.LR.piClim-histaer_0031/init" +readonly RUN_REFCASE="v2.LR.piClim-control" +readonly RUN_REFDATE="0031-01-01" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' + +# Set paths +readonly CODE_ROOT="${HOME}/E3SMv2_test/code/${CHECKOUT}" +readonly CASE_ROOT="/lcrc/group/e3sm/${USER}/E3SMv2_test/${CASE_NAME}" + +# Sub-directories +readonly CASE_BUILD_DIR=${CASE_ROOT}/build +readonly CASE_ARCHIVE_DIR=${CASE_ROOT}/archive + +# Define type of run +# short tests: 'XS_2x5_ndays', 'XS_1x10_ndays', 'S_1x10_ndays', +# 'M_1x10_ndays', 'L_1x10_ndays', 'XL_1x10_ndays' +# or 'production' for full simulation +readonly run='XS_1x10_ndays' +if [ "${run}" != "production" ]; then + + # Short test simulations + tmp=($(echo $run | tr "_" " ")) + layout=${tmp[0]} + units=${tmp[2]} + resubmit=$(( ${tmp[1]%%x*} -1 )) + length=${tmp[1]##*x} + + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/tests/${run}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/tests/${run}/run + readonly PELAYOUT=${layout} + readonly WALLTIME="00:20:00" + readonly STOP_OPTION=${units} + readonly STOP_N=${length} + readonly REST_OPTION=${STOP_OPTION} + readonly REST_N="1" + readonly RESUBMIT=${resubmit} + readonly DO_SHORT_TERM_ARCHIVING=false + +else + + # Production simulation + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/run + readonly PELAYOUT="ML" + readonly WALLTIME="48:00:00" + readonly STOP_OPTION="nyears" + readonly STOP_N="55" + readonly REST_OPTION="nyears" + readonly REST_N="1" + readonly RESUBMIT="2" + readonly DO_SHORT_TERM_ARCHIVING=false +fi + +# Coupler history +readonly HIST_OPTION="nyears" +readonly HIST_N="1" + +# Leave empty (unless you understand what it does) +readonly OLD_EXECUTABLE="" + +# --- Toggle flags for what to do ---- +do_fetch_code=true +do_create_newcase=true +do_case_setup=true +do_case_build=true +do_case_submit=true + +# --- Now, do the work --- + +# Make directories created by this script world-readable +umask 022 + +# Fetch code from Github +fetch_code + +# Create case +create_newcase + +# Setup +case_setup + +# Build +case_build + +# Configure runtime options +runtime_options + +# Copy script into case_script directory for provenance +copy_script + +# Submit +case_submit + +# All done +echo $'\n----- All done -----\n' + +} + +# ======================= +# Custom user_nl settings +# ======================= + +user_nl() { + +cat << EOF >> user_nl_eam + nhtfrq = 0,-24,-6,-6,-3,-24,0 + mfilt = 1,30,120,120,240,30,1 + avgflag_pertape = 'A','A','I','A','A','A','I' + fexcl1 = 'CFAD_SR532_CAL', 'LINOZ_DO3', 'LINOZ_DO3_PSC', 'LINOZ_O3CLIM', 'LINOZ_O3COL', 'LINOZ_SSO3', 'hstobie_linoz' + fincl1 = 'extinct_sw_inp','extinct_lw_bnd7','extinct_lw_inp','CLD_CAL', 'TREFMNAV', 'TREFMXAV','SST' + fincl2 = 'FLUT','PRECT','U200','V200','U850','V850','Z500','OMEGA500','UBOT','VBOT','TREFHT','TREFHTMN:M','TREFHTMX:X','QREFHT','TS','PS','TMQ','TUQ','TVQ','TOZ', 'FLDS', 'FLNS', 'FSDS', 'FSNS', 'SHFLX', 'LHFLX', 'TGCLDCWP', 'TGCLDIWP', 'TGCLDLWP', 'CLDTOT', 'T250', 'T200', 'T150', 'T100', 'T050', 'T025', 'T010', 'T005', 'T002', 'T001', 'TTOP', 'U250', 'U150', 'U100', 'U050', 'U025', 'U010', 'U005', 'U002', 'U001', 'UTOP', 'FSNT', 'FLNT' + fincl3 = 'PSL','T200','T500','U850','V850','UBOT','VBOT','TREFHT', 'Z700', 'TBOT:M' + fincl4 = 'FLUT','U200','U850','PRECT','OMEGA500' + fincl5 = 'PRECT','PRECC','TUQ','TVQ','QFLX','SHFLX','U90M','V90M' + fincl6 = 'CLDTOT_ISCCP','MEANCLDALB_ISCCP','MEANTAU_ISCCP','MEANPTOP_ISCCP','MEANTB_ISCCP','CLDTOT_CAL','CLDTOT_CAL_LIQ','CLDTOT_CAL_ICE','CLDTOT_CAL_UN','CLDHGH_CAL','CLDHGH_CAL_LIQ','CLDHGH_CAL_ICE','CLDHGH_CAL_UN','CLDMED_CAL','CLDMED_CAL_LIQ','CLDMED_CAL_ICE','CLDMED_CAL_UN','CLDLOW_CAL','CLDLOW_CAL_LIQ','CLDLOW_CAL_ICE','CLDLOW_CAL_UN' + fincl7 = 'O3', 'PS', 'TROP_P' + +!!................................................................................. +!! swtich on aerosol forcing diagnostics (a second call to radiation without aerosols) +!! monthly history file will include "_d1" fields by default when history_amwg = .True. +!! Reference: Ghan, S. J.: Technical Note: Estimating aerosol effects on cloud radiative forcing, +!! Atmos. Chem. Phys., 13, 9971–9974, https://doi.org/10.5194/acp-13-9971-2013, 2013. +!!................................................................................. + rad_diag_1 = 'A:Q:H2O', 'N:O2:O2', 'N:CO2:CO2', 'A:O3:O3', 'N:N2O:N2O', 'N:CH4:CH4', 'N:CFC11:CFC11', 'N:CFC12:CFC12', + history_amwg = .True. + +! Historical, vs single forcing configurations + +! | Configuration | GHGs | Aerosols and | Ozone | Solar | Volcanoes | Land use +! | | | precursors | | | | +! ----------------------------------------------------------------------------------------------- +! | historical | varying | varying | varying | varying | varying | varying +! | hist-GHG | varying | 1850 | 1850 | 1850 | 1850 | 1850 +! | hist-aer | 1850 | varying | 1850 | 1850 | 1850 | 1850 +! | hist-all-xGHG-xaer | 1850 | 1850 | varying | varying | varying | varying + +! (1) GHGs settings + + bndtvghg = ' ' + ch4vmr = 808.249e-9 + co2vmr = 284.317000e-6 + f11vmr = 32.1102e-12 + f12vmr = 0.0 + flbc_list = ' ' + n2ovmr = 273.0211e-9 + scenario_ghg = 'FIXED' + +! (2) aeorosols and precursors + +! (3) ozone + + chlorine_loading_fixed_ymd = 18500101 + chlorine_loading_type = 'FIXED' + + linoz_data_cycle_yr = 1850 + linoz_data_type = 'CYCLICAL' + +! (4) solar + + solar_data_file = '${input_data_dir}/atm/cam/solar/Solar_1850control_input4MIPS_c20181106.nc' + solar_data_type = 'FIXED' + solar_data_ymd = 18500101 + +! (5) volcanoes + + prescribed_volcaero_cycle_yr = 1 + prescribed_volcaero_file = 'CMIP_DOE-ACME_radiation_average_1850-2014_v3_c20171204.nc' + prescribed_volcaero_type = 'CYCLICAL' + +EOF + +cat << EOF >> user_nl_elm + hist_dov2xy = .true.,.true. + hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' + hist_mfilt = 1,365 + hist_nhtfrq = 0,-24 + hist_avgflag_pertape = 'A','A' + +! Override +check_finidat_fsurdat_consistency = .false. + + +! Override +check_finidat_fsurdat_consistency = .false. + +EOF + +cat << EOF >> user_nl_mosart + rtmhist_fincl2 = 'RIVER_DISCHARGE_OVER_LAND_LIQ' + rtmhist_mfilt = 1,365 + rtmhist_ndens = 2 + rtmhist_nhtfrq = 0,-24 +EOF + +# Override SST and sea-ice datasets +./xmlchange SSTICE_DATA_FILENAME=$input_data_dir/ocn/docn7/SSTDATA/sst_ice_v2.LR.piControl_0.5x0.5_climo_0001-0500.nc +./xmlchange SSTICE_GRID_FILENAME=$input_data_dir/ocn/docn7/domain.ocn.0.5x0.5.c211007.nc +./xmlchange SSTICE_YEAR_ALIGN=1 +./xmlchange SSTICE_YEAR_START=0 +./xmlchange SSTICE_YEAR_END=0 + +} + +patch_mpas_streams() { + +echo + +} + +###################################################### +### Most users won't need to change anything below ### +###################################################### + +#----------------------------------------------------- +fetch_code() { + + if [ "${do_fetch_code,,}" != "true" ]; then + echo $'\n----- Skipping fetch_code -----\n' + return + fi + + echo $'\n----- Starting fetch_code -----\n' + local path=${CODE_ROOT} + local repo=e3sm + + echo "Cloning $repo repository branch $BRANCH under $path" + if [ -d "${path}" ]; then + echo "ERROR: Directory already exists. Not overwriting" + exit 20 + fi + mkdir -p ${path} + pushd ${path} + + # This will put repository, with all code + git clone git@github.com:E3SM-Project/${repo}.git . + + # Setup git hooks + rm -rf .git/hooks + git clone git@github.com:E3SM-Project/E3SM-Hooks.git .git/hooks + git config commit.template .git/hooks/commit.template + + # Check out desired branch + git checkout ${BRANCH} + + # Custom addition + if [ "${CHERRY}" != "" ]; then + echo ----- WARNING: adding git cherry-pick ----- + for commit in "${CHERRY[@]}" + do + echo ${commit} + git cherry-pick ${commit} + done + echo ------------------------------------------- + fi + + # Bring in all submodule components + git submodule update --init --recursive + + popd +} + +#----------------------------------------------------- +create_newcase() { + + if [ "${do_create_newcase,,}" != "true" ]; then + echo $'\n----- Skipping create_newcase -----\n' + return + fi + + echo $'\n----- Starting create_newcase -----\n' + + # Base arguments + args=" --case ${CASE_NAME} \ + --output-root ${CASE_ROOT} \ + --script-root ${CASE_SCRIPTS_DIR} \ + --handle-preexisting-dirs u \ + --compset ${COMPSET} \ + --res ${RESOLUTION} \ + --machine ${MACHINE} \ + --walltime ${WALLTIME} \ + --pecount ${PELAYOUT}" + + # Optional arguments + if [ ! -z "${PROJECT}" ]; then + args="${args} --project ${PROJECT}" + fi + if [ ! -z "${CASE_GROUP}" ]; then + args="${args} --case-group ${CASE_GROUP}" + fi + if [ ! -z "${QUEUE}" ]; then + args="${args} --queue ${QUEUE}" + fi + + ${CODE_ROOT}/cime/scripts/create_newcase ${args} + + if [ $? != 0 ]; then + echo $'\nNote: if create_newcase failed because sub-directory already exists:' + echo $' * delete old case_script sub-directory' + echo $' * or set do_newcase=false\n' + exit 35 + fi + +} + +#----------------------------------------------------- +case_setup() { + + if [ "${do_case_setup,,}" != "true" ]; then + echo $'\n----- Skipping case_setup -----\n' + return + fi + + echo $'\n----- Starting case_setup -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Setup some CIME directories + ./xmlchange EXEROOT=${CASE_BUILD_DIR} + ./xmlchange RUNDIR=${CASE_RUN_DIR} + + # Short term archiving + ./xmlchange DOUT_S=${DO_SHORT_TERM_ARCHIVING^^} + ./xmlchange DOUT_S_ROOT=${CASE_ARCHIVE_DIR} + + # Build with COSP, except for a data atmosphere (datm) + if [ `./xmlquery --value COMP_ATM` == "datm" ]; then + echo $'\nThe specified configuration uses a data atmosphere, so cannot activate COSP simulator\n' + else + echo $'\nConfiguring E3SM to use the COSP simulator\n' + ./xmlchange --id CAM_CONFIG_OPTS --append --val='-cosp' + fi + + # Extracts input_data_dir in case it is needed for user edits to the namelist later + local input_data_dir=`./xmlquery DIN_LOC_ROOT --value` + + # Custom user_nl + user_nl + + # Finally, run CIME case.setup + ./case.setup --reset + + popd +} + +#----------------------------------------------------- +case_build() { + + pushd ${CASE_SCRIPTS_DIR} + + # do_case_build = false + if [ "${do_case_build,,}" != "true" ]; then + + echo $'\n----- case_build -----\n' + + if [ "${OLD_EXECUTABLE}" == "" ]; then + # Ues previously built executable, make sure it exists + if [ -x ${CASE_BUILD_DIR}/e3sm.exe ]; then + echo 'Skipping build because $do_case_build = '${do_case_build} + else + echo 'ERROR: $do_case_build = '${do_case_build}' but no executable exists for this case.' + exit 297 + fi + else + # If absolute pathname exists and is executable, reuse pre-exiting executable + if [ -x ${OLD_EXECUTABLE} ]; then + echo 'Using $OLD_EXECUTABLE = '${OLD_EXECUTABLE} + cp -fp ${OLD_EXECUTABLE} ${CASE_BUILD_DIR}/ + else + echo 'ERROR: $OLD_EXECUTABLE = '$OLD_EXECUTABLE' does not exist or is not an executable file.' + exit 297 + fi + fi + echo 'WARNING: Setting BUILD_COMPLETE = TRUE. This is a little risky, but trusting the user.' + ./xmlchange BUILD_COMPLETE=TRUE + + # do_case_build = true + else + + echo $'\n----- Starting case_build -----\n' + + # Turn on debug compilation option if requested + if [ "${DEBUG_COMPILE^^}" == "TRUE" ]; then + ./xmlchange DEBUG=${DEBUG_COMPILE^^} + fi + + # Run CIME case.build + ./case.build + + # Some user_nl settings won't be updated to *_in files under the run directory + # Call preview_namelists to make sure *_in and user_nl files are consistent. + ./preview_namelists + + fi + + popd +} + +#----------------------------------------------------- +runtime_options() { + + echo $'\n----- Starting runtime_options -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Set simulation start date + ./xmlchange RUN_STARTDATE=${START_DATE} + + # Segment length + ./xmlchange STOP_OPTION=${STOP_OPTION,,},STOP_N=${STOP_N} + + # Restart frequency + ./xmlchange REST_OPTION=${REST_OPTION,,},REST_N=${REST_N} + + # Coupler history + ./xmlchange HIST_OPTION=${HIST_OPTION,,},HIST_N=${HIST_N} + + # Coupler budgets (always on) + ./xmlchange BUDGETS=TRUE + + # Set resubmissions + if (( RESUBMIT > 0 )); then + ./xmlchange RESUBMIT=${RESUBMIT} + fi + + # Run type + # Start from default of user-specified initial conditions + if [ "${MODEL_START_TYPE,,}" == "initial" ]; then + ./xmlchange RUN_TYPE="startup" + ./xmlchange CONTINUE_RUN="FALSE" + + # Continue existing run + elif [ "${MODEL_START_TYPE,,}" == "continue" ]; then + ./xmlchange CONTINUE_RUN="TRUE" + + elif [ "${MODEL_START_TYPE,,}" == "branch" ] || [ "${MODEL_START_TYPE,,}" == "hybrid" ]; then + ./xmlchange RUN_TYPE=${MODEL_START_TYPE,,} + ./xmlchange GET_REFCASE=${GET_REFCASE} + ./xmlchange RUN_REFDIR=${RUN_REFDIR} + ./xmlchange RUN_REFCASE=${RUN_REFCASE} + ./xmlchange RUN_REFDATE=${RUN_REFDATE} + echo 'Warning: $MODEL_START_TYPE = '${MODEL_START_TYPE} + echo '$RUN_REFDIR = '${RUN_REFDIR} + echo '$RUN_REFCASE = '${RUN_REFCASE} + echo '$RUN_REFDATE = '${START_DATE} + + else + echo 'ERROR: $MODEL_START_TYPE = '${MODEL_START_TYPE}' is unrecognized. Exiting.' + exit 380 + fi + + # Patch mpas streams files + patch_mpas_streams + + popd +} + +#----------------------------------------------------- +case_submit() { + + if [ "${do_case_submit,,}" != "true" ]; then + echo $'\n----- Skipping case_submit -----\n' + return + fi + + echo $'\n----- Starting case_submit -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Run CIME case.submit + ./case.submit + + popd +} + +#----------------------------------------------------- +copy_script() { + + echo $'\n----- Saving run script for provenance -----\n' + + local script_provenance_dir=${CASE_SCRIPTS_DIR}/run_script_provenance + mkdir -p ${script_provenance_dir} + local this_script_name=`basename $0` + local script_provenance_name=${this_script_name}.`date +%Y%m%d-%H%M%S` + cp -vp ${this_script_name} ${script_provenance_dir}/${script_provenance_name} + +} + +#----------------------------------------------------- +# Silent versions of popd and pushd +pushd() { + command pushd "$@" > /dev/null +} +popd() { + command popd "$@" > /dev/null +} + +# Now, actually run the script +#----------------------------------------------------- +main diff --git a/run_scripts/v2/reproduce/run.v2.LR.piClim-histall_0031.sh b/run_scripts/v2/reproduce/run.v2.LR.piClim-histall_0031.sh new file mode 100755 index 0000000..c92da3b --- /dev/null +++ b/run_scripts/v2/reproduce/run.v2.LR.piClim-histall_0031.sh @@ -0,0 +1,501 @@ +#!/bin/bash -fe + +# E3SMv2 Water Cycle run_e3sm script template. +# +# Configured to reproduce v2.LR.piClim-histall_0031 on chrysalis. +# Modify as needed for other machines. +# +# Bash coding style inspired by: +# http://kfirlavi.herokuapp.com/blog/2012/11/14/defensive-bash-programming + +main() { + +# For debugging, uncomment line below +#set -x + +# --- Configuration flags ---- + +# Machine and project +readonly MACHINE=chrysalis +readonly PROJECT="e3sm" + +# Simulation +readonly COMPSET="F20TR" +readonly RESOLUTION="ne30pg2_EC30to60E2r2" + + + +# Code and compilation +readonly CHECKOUT="20221102-maint-20" +readonly BRANCH="maint-2.0" +readonly CHERRY=( ) +readonly DEBUG_COMPILE=false + +# BEFORE RUNNING : CHANGE the following CASE_NAME to desired value + +# For developmental simulations, recommended convention: +#readonly CASE_NAME=${CHECKOUT}.piClim-histall_0031.${RESOLUTION}.${MACHINE} +# For production simulations: +readonly CASE_NAME="v2.LR.piClim-histall_0031" + +# If this is part of a simulation campaign, ask your group lead about using a case_group label +# readonly CASE_GROUP="" + +# Run options +readonly MODEL_START_TYPE="hybrid" # 'initial', 'continue', 'branch', 'hybrid' +readonly START_DATE="1850-01-01" + +# Additional options for 'branch' and 'hybrid' +readonly GET_REFCASE=TRUE +readonly RUN_REFDIR="/lcrc/group/e3sm/${USER}/E3SMv2_test/v2.LR.piClim-histall_0031/init" +readonly RUN_REFCASE="v2.LR.piClim-control" +readonly RUN_REFDATE="0031-01-01" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' + +# Set paths +readonly CODE_ROOT="${HOME}/E3SMv2_test/code/${CHECKOUT}" +readonly CASE_ROOT="/lcrc/group/e3sm/${USER}/E3SMv2_test/${CASE_NAME}" + +# Sub-directories +readonly CASE_BUILD_DIR=${CASE_ROOT}/build +readonly CASE_ARCHIVE_DIR=${CASE_ROOT}/archive + +# Define type of run +# short tests: 'XS_2x5_ndays', 'XS_1x10_ndays', 'S_1x10_ndays', +# 'M_1x10_ndays', 'L_1x10_ndays', 'XL_1x10_ndays' +# or 'production' for full simulation +readonly run='XS_1x10_ndays' +if [ "${run}" != "production" ]; then + + # Short test simulations + tmp=($(echo $run | tr "_" " ")) + layout=${tmp[0]} + units=${tmp[2]} + resubmit=$(( ${tmp[1]%%x*} -1 )) + length=${tmp[1]##*x} + + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/tests/${run}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/tests/${run}/run + readonly PELAYOUT=${layout} + readonly WALLTIME="00:20:00" + readonly STOP_OPTION=${units} + readonly STOP_N=${length} + readonly REST_OPTION=${STOP_OPTION} + readonly REST_N="1" + readonly RESUBMIT=${resubmit} + readonly DO_SHORT_TERM_ARCHIVING=false + +else + + # Production simulation + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/run + readonly PELAYOUT="ML" + readonly WALLTIME="48:00:00" + readonly STOP_OPTION="nyears" + readonly STOP_N="55" + readonly REST_OPTION="nyears" + readonly REST_N="1" + readonly RESUBMIT="2" + readonly DO_SHORT_TERM_ARCHIVING=false +fi + +# Coupler history +readonly HIST_OPTION="nyears" +readonly HIST_N="1" + +# Leave empty (unless you understand what it does) +readonly OLD_EXECUTABLE="" + +# --- Toggle flags for what to do ---- +do_fetch_code=true +do_create_newcase=true +do_case_setup=true +do_case_build=true +do_case_submit=true + +# --- Now, do the work --- + +# Make directories created by this script world-readable +umask 022 + +# Fetch code from Github +fetch_code + +# Create case +create_newcase + +# Setup +case_setup + +# Build +case_build + +# Configure runtime options +runtime_options + +# Copy script into case_script directory for provenance +copy_script + +# Submit +case_submit + +# All done +echo $'\n----- All done -----\n' + +} + +# ======================= +# Custom user_nl settings +# ======================= + +user_nl() { + +cat << EOF >> user_nl_eam + nhtfrq = 0,-24,-6,-6,-3,-24,0 + mfilt = 1,30,120,120,240,30,1 + avgflag_pertape = 'A','A','I','A','A','A','I' + fexcl1 = 'CFAD_SR532_CAL', 'LINOZ_DO3', 'LINOZ_DO3_PSC', 'LINOZ_O3CLIM', 'LINOZ_O3COL', 'LINOZ_SSO3', 'hstobie_linoz' + fincl1 = 'extinct_sw_inp','extinct_lw_bnd7','extinct_lw_inp','CLD_CAL', 'TREFMNAV', 'TREFMXAV','SST' + fincl2 = 'FLUT','PRECT','U200','V200','U850','V850','Z500','OMEGA500','UBOT','VBOT','TREFHT','TREFHTMN:M','TREFHTMX:X','QREFHT','TS','PS','TMQ','TUQ','TVQ','TOZ', 'FLDS', 'FLNS', 'FSDS', 'FSNS', 'SHFLX', 'LHFLX', 'TGCLDCWP', 'TGCLDIWP', 'TGCLDLWP', 'CLDTOT', 'T250', 'T200', 'T150', 'T100', 'T050', 'T025', 'T010', 'T005', 'T002', 'T001', 'TTOP', 'U250', 'U150', 'U100', 'U050', 'U025', 'U010', 'U005', 'U002', 'U001', 'UTOP', 'FSNT', 'FLNT' + fincl3 = 'PSL','T200','T500','U850','V850','UBOT','VBOT','TREFHT', 'Z700', 'TBOT:M' + fincl4 = 'FLUT','U200','U850','PRECT','OMEGA500' + fincl5 = 'PRECT','PRECC','TUQ','TVQ','QFLX','SHFLX','U90M','V90M' + fincl6 = 'CLDTOT_ISCCP','MEANCLDALB_ISCCP','MEANTAU_ISCCP','MEANPTOP_ISCCP','MEANTB_ISCCP','CLDTOT_CAL','CLDTOT_CAL_LIQ','CLDTOT_CAL_ICE','CLDTOT_CAL_UN','CLDHGH_CAL','CLDHGH_CAL_LIQ','CLDHGH_CAL_ICE','CLDHGH_CAL_UN','CLDMED_CAL','CLDMED_CAL_LIQ','CLDMED_CAL_ICE','CLDMED_CAL_UN','CLDLOW_CAL','CLDLOW_CAL_LIQ','CLDLOW_CAL_ICE','CLDLOW_CAL_UN' + fincl7 = 'O3', 'PS', 'TROP_P' + +!!................................................................................. +!! swtich on aerosol forcing diagnostics (a second call to radiation without aerosols) +!! monthly history file will include "_d1" fields by default when history_amwg = .True. +!! Reference: Ghan, S. J.: Technical Note: Estimating aerosol effects on cloud radiative forcing, +!! Atmos. Chem. Phys., 13, 9971–9974, https://doi.org/10.5194/acp-13-9971-2013, 2013. +!!................................................................................. + rad_diag_1 = 'A:Q:H2O', 'N:O2:O2', 'N:CO2:CO2', 'A:O3:O3', 'N:N2O:N2O', 'N:CH4:CH4', 'N:CFC11:CFC11', 'N:CFC12:CFC12', + history_amwg = .True. + +EOF + +cat << EOF >> user_nl_elm + hist_dov2xy = .true.,.true. + hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' + hist_mfilt = 1,365 + hist_nhtfrq = 0,-24 + hist_avgflag_pertape = 'A','A' + +! Override +check_finidat_fsurdat_consistency = .false. + + +! Override +check_finidat_fsurdat_consistency = .false. + +EOF + +cat << EOF >> user_nl_mosart + rtmhist_fincl2 = 'RIVER_DISCHARGE_OVER_LAND_LIQ' + rtmhist_mfilt = 1,365 + rtmhist_ndens = 2 + rtmhist_nhtfrq = 0,-24 +EOF + +# Override SST and sea-ice datasets +./xmlchange SSTICE_DATA_FILENAME=$input_data_dir/ocn/docn7/SSTDATA/sst_ice_v2.LR.piControl_0.5x0.5_climo_0001-0500.nc +./xmlchange SSTICE_GRID_FILENAME=$input_data_dir/ocn/docn7/domain.ocn.0.5x0.5.c211007.nc +./xmlchange SSTICE_YEAR_ALIGN=1 +./xmlchange SSTICE_YEAR_START=0 +./xmlchange SSTICE_YEAR_END=0 + +} + +patch_mpas_streams() { + +echo + +} + +###################################################### +### Most users won't need to change anything below ### +###################################################### + +#----------------------------------------------------- +fetch_code() { + + if [ "${do_fetch_code,,}" != "true" ]; then + echo $'\n----- Skipping fetch_code -----\n' + return + fi + + echo $'\n----- Starting fetch_code -----\n' + local path=${CODE_ROOT} + local repo=e3sm + + echo "Cloning $repo repository branch $BRANCH under $path" + if [ -d "${path}" ]; then + echo "ERROR: Directory already exists. Not overwriting" + exit 20 + fi + mkdir -p ${path} + pushd ${path} + + # This will put repository, with all code + git clone git@github.com:E3SM-Project/${repo}.git . + + # Setup git hooks + rm -rf .git/hooks + git clone git@github.com:E3SM-Project/E3SM-Hooks.git .git/hooks + git config commit.template .git/hooks/commit.template + + # Check out desired branch + git checkout ${BRANCH} + + # Custom addition + if [ "${CHERRY}" != "" ]; then + echo ----- WARNING: adding git cherry-pick ----- + for commit in "${CHERRY[@]}" + do + echo ${commit} + git cherry-pick ${commit} + done + echo ------------------------------------------- + fi + + # Bring in all submodule components + git submodule update --init --recursive + + popd +} + +#----------------------------------------------------- +create_newcase() { + + if [ "${do_create_newcase,,}" != "true" ]; then + echo $'\n----- Skipping create_newcase -----\n' + return + fi + + echo $'\n----- Starting create_newcase -----\n' + + # Base arguments + args=" --case ${CASE_NAME} \ + --output-root ${CASE_ROOT} \ + --script-root ${CASE_SCRIPTS_DIR} \ + --handle-preexisting-dirs u \ + --compset ${COMPSET} \ + --res ${RESOLUTION} \ + --machine ${MACHINE} \ + --walltime ${WALLTIME} \ + --pecount ${PELAYOUT}" + + # Optional arguments + if [ ! -z "${PROJECT}" ]; then + args="${args} --project ${PROJECT}" + fi + if [ ! -z "${CASE_GROUP}" ]; then + args="${args} --case-group ${CASE_GROUP}" + fi + if [ ! -z "${QUEUE}" ]; then + args="${args} --queue ${QUEUE}" + fi + + ${CODE_ROOT}/cime/scripts/create_newcase ${args} + + if [ $? != 0 ]; then + echo $'\nNote: if create_newcase failed because sub-directory already exists:' + echo $' * delete old case_script sub-directory' + echo $' * or set do_newcase=false\n' + exit 35 + fi + +} + +#----------------------------------------------------- +case_setup() { + + if [ "${do_case_setup,,}" != "true" ]; then + echo $'\n----- Skipping case_setup -----\n' + return + fi + + echo $'\n----- Starting case_setup -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Setup some CIME directories + ./xmlchange EXEROOT=${CASE_BUILD_DIR} + ./xmlchange RUNDIR=${CASE_RUN_DIR} + + # Short term archiving + ./xmlchange DOUT_S=${DO_SHORT_TERM_ARCHIVING^^} + ./xmlchange DOUT_S_ROOT=${CASE_ARCHIVE_DIR} + + # Build with COSP, except for a data atmosphere (datm) + if [ `./xmlquery --value COMP_ATM` == "datm" ]; then + echo $'\nThe specified configuration uses a data atmosphere, so cannot activate COSP simulator\n' + else + echo $'\nConfiguring E3SM to use the COSP simulator\n' + ./xmlchange --id CAM_CONFIG_OPTS --append --val='-cosp' + fi + + # Extracts input_data_dir in case it is needed for user edits to the namelist later + local input_data_dir=`./xmlquery DIN_LOC_ROOT --value` + + # Custom user_nl + user_nl + + # Finally, run CIME case.setup + ./case.setup --reset + + popd +} + +#----------------------------------------------------- +case_build() { + + pushd ${CASE_SCRIPTS_DIR} + + # do_case_build = false + if [ "${do_case_build,,}" != "true" ]; then + + echo $'\n----- case_build -----\n' + + if [ "${OLD_EXECUTABLE}" == "" ]; then + # Ues previously built executable, make sure it exists + if [ -x ${CASE_BUILD_DIR}/e3sm.exe ]; then + echo 'Skipping build because $do_case_build = '${do_case_build} + else + echo 'ERROR: $do_case_build = '${do_case_build}' but no executable exists for this case.' + exit 297 + fi + else + # If absolute pathname exists and is executable, reuse pre-exiting executable + if [ -x ${OLD_EXECUTABLE} ]; then + echo 'Using $OLD_EXECUTABLE = '${OLD_EXECUTABLE} + cp -fp ${OLD_EXECUTABLE} ${CASE_BUILD_DIR}/ + else + echo 'ERROR: $OLD_EXECUTABLE = '$OLD_EXECUTABLE' does not exist or is not an executable file.' + exit 297 + fi + fi + echo 'WARNING: Setting BUILD_COMPLETE = TRUE. This is a little risky, but trusting the user.' + ./xmlchange BUILD_COMPLETE=TRUE + + # do_case_build = true + else + + echo $'\n----- Starting case_build -----\n' + + # Turn on debug compilation option if requested + if [ "${DEBUG_COMPILE^^}" == "TRUE" ]; then + ./xmlchange DEBUG=${DEBUG_COMPILE^^} + fi + + # Run CIME case.build + ./case.build + + # Some user_nl settings won't be updated to *_in files under the run directory + # Call preview_namelists to make sure *_in and user_nl files are consistent. + ./preview_namelists + + fi + + popd +} + +#----------------------------------------------------- +runtime_options() { + + echo $'\n----- Starting runtime_options -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Set simulation start date + ./xmlchange RUN_STARTDATE=${START_DATE} + + # Segment length + ./xmlchange STOP_OPTION=${STOP_OPTION,,},STOP_N=${STOP_N} + + # Restart frequency + ./xmlchange REST_OPTION=${REST_OPTION,,},REST_N=${REST_N} + + # Coupler history + ./xmlchange HIST_OPTION=${HIST_OPTION,,},HIST_N=${HIST_N} + + # Coupler budgets (always on) + ./xmlchange BUDGETS=TRUE + + # Set resubmissions + if (( RESUBMIT > 0 )); then + ./xmlchange RESUBMIT=${RESUBMIT} + fi + + # Run type + # Start from default of user-specified initial conditions + if [ "${MODEL_START_TYPE,,}" == "initial" ]; then + ./xmlchange RUN_TYPE="startup" + ./xmlchange CONTINUE_RUN="FALSE" + + # Continue existing run + elif [ "${MODEL_START_TYPE,,}" == "continue" ]; then + ./xmlchange CONTINUE_RUN="TRUE" + + elif [ "${MODEL_START_TYPE,,}" == "branch" ] || [ "${MODEL_START_TYPE,,}" == "hybrid" ]; then + ./xmlchange RUN_TYPE=${MODEL_START_TYPE,,} + ./xmlchange GET_REFCASE=${GET_REFCASE} + ./xmlchange RUN_REFDIR=${RUN_REFDIR} + ./xmlchange RUN_REFCASE=${RUN_REFCASE} + ./xmlchange RUN_REFDATE=${RUN_REFDATE} + echo 'Warning: $MODEL_START_TYPE = '${MODEL_START_TYPE} + echo '$RUN_REFDIR = '${RUN_REFDIR} + echo '$RUN_REFCASE = '${RUN_REFCASE} + echo '$RUN_REFDATE = '${START_DATE} + + else + echo 'ERROR: $MODEL_START_TYPE = '${MODEL_START_TYPE}' is unrecognized. Exiting.' + exit 380 + fi + + # Patch mpas streams files + patch_mpas_streams + + popd +} + +#----------------------------------------------------- +case_submit() { + + if [ "${do_case_submit,,}" != "true" ]; then + echo $'\n----- Skipping case_submit -----\n' + return + fi + + echo $'\n----- Starting case_submit -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Run CIME case.submit + ./case.submit + + popd +} + +#----------------------------------------------------- +copy_script() { + + echo $'\n----- Saving run script for provenance -----\n' + + local script_provenance_dir=${CASE_SCRIPTS_DIR}/run_script_provenance + mkdir -p ${script_provenance_dir} + local this_script_name=`basename $0` + local script_provenance_name=${this_script_name}.`date +%Y%m%d-%H%M%S` + cp -vp ${this_script_name} ${script_provenance_dir}/${script_provenance_name} + +} + +#----------------------------------------------------- +# Silent versions of popd and pushd +pushd() { + command pushd "$@" > /dev/null +} +popd() { + command popd "$@" > /dev/null +} + +# Now, actually run the script +#----------------------------------------------------- +main diff --git a/run_scripts/v2/reproduce/run.v2.NARRM.1pctCO2_0101.sh b/run_scripts/v2/reproduce/run.v2.NARRM.1pctCO2_0101.sh new file mode 100755 index 0000000..ec976ad --- /dev/null +++ b/run_scripts/v2/reproduce/run.v2.NARRM.1pctCO2_0101.sh @@ -0,0 +1,486 @@ +#!/bin/bash -fe + +# E3SMv2 Water Cycle run_e3sm script template. +# +# Configured to reproduce v2.NARRM.1pctCO2_0101 on chrysalis. +# Modify as needed for other machines. +# +# Bash coding style inspired by: +# http://kfirlavi.herokuapp.com/blog/2012/11/14/defensive-bash-programming + +main() { + +# For debugging, uncomment line below +#set -x + +# --- Configuration flags ---- + +# Machine and project +readonly MACHINE=chrysalis +readonly PROJECT="e3sm" + +# Simulation +readonly COMPSET="WCYCL1850-1pctCO2" +readonly RESOLUTION="northamericax4v1pg2_WC14to60E2r3" + +readonly CASE_GROUP="v2.RRM" + +# Code and compilation +readonly CHECKOUT="20221102-maint-20" +readonly BRANCH="maint-2.0" +readonly CHERRY=( ) +readonly DEBUG_COMPILE=false + +# BEFORE RUNNING : CHANGE the following CASE_NAME to desired value + +# For developmental simulations, recommended convention: +#readonly CASE_NAME=${CHECKOUT}.1pctCO2_0101.${RESOLUTION}.${MACHINE} +# For production simulations: +readonly CASE_NAME="v2.NARRM.1pctCO2_0101" + +# If this is part of a simulation campaign, ask your group lead about using a case_group label +# readonly CASE_GROUP="" + +# Run options +readonly MODEL_START_TYPE="hybrid" # 'initial', 'continue', 'branch', 'hybrid' +readonly START_DATE="0001-01-01" + +# Additional options for 'branch' and 'hybrid' +readonly GET_REFCASE=TRUE +readonly RUN_REFDIR="/lcrc/group/e3sm/${USER}/E3SMv2_test/${CASE_NAME}/init" +readonly RUN_REFCASE="v2.NARRM.piControl" +readonly RUN_REFDATE="0101-01-01" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' + +# Set paths +readonly CODE_ROOT="${HOME}/E3SMv2_test/code/${CHECKOUT}" +readonly CASE_ROOT="/lcrc/group/e3sm/${USER}/E3SMv2_test/${CASE_NAME}" + +# Sub-directories +readonly CASE_BUILD_DIR=${CASE_ROOT}/build +readonly CASE_ARCHIVE_DIR=${CASE_ROOT}/archive + +# Define type of run: short tests or 'production' for full simulation +readonly run='XS_1x10_ndays' +#readonly run='S_2x5_ndays' +#readonly run='M_1x10_ndays' +#readonly run='L_1x10_ndays' +if [ "${run}" != "production" ]; then + + # Short test simulations + tmp=($(echo $run | tr "_" " ")) + layout=${tmp[0]} + units=${tmp[2]} + resubmit=$(( ${tmp[1]%%x*} -1 )) + length=${tmp[1]##*x} + + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/tests/${run}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/tests/${run}/run + readonly PELAYOUT=${layout} + readonly WALLTIME="00:20:00" + readonly STOP_OPTION=${units} + readonly STOP_N=${length} + readonly STOP_DATE="-999" # -999 or specify stop date as yyyyddmm without leading zeros + readonly REST_OPTION=${STOP_OPTION} + readonly REST_N="1" + readonly RESUBMIT=${resubmit} + readonly DO_SHORT_TERM_ARCHIVING=false + +else + + # Production simulation + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/run + readonly PELAYOUT="ML" + readonly WALLTIME="48:00:00" + readonly STOP_OPTION="nyears" + readonly STOP_N="20" + readonly STOP_DATE="1510101" # -999 or specify stop date as yyyyddmm without leading zeros + readonly REST_OPTION="nyears" + readonly REST_N="1" + readonly RESUBMIT="7" + readonly DO_SHORT_TERM_ARCHIVING=false +fi + +# Coupler history +readonly HIST_OPTION="nyears" +readonly HIST_N="1" + +# Leave empty (unless you understand what it does) +readonly OLD_EXECUTABLE="" + +# --- Toggle flags for what to do ---- +do_fetch_code=true +do_create_newcase=true +do_case_setup=true +do_case_build=true +do_case_submit=true + +# --- Now, do the work --- + +# Make directories created by this script world-readable +umask 022 + +# Fetch code from Github +fetch_code + +# Create case +create_newcase + +# Setup +case_setup + +# Build +case_build + +# Configure runtime options +runtime_options + +# Copy script into case_script directory for provenance +copy_script + +# Submit +case_submit + +# All done +echo $'\n----- All done -----\n' + +} + +# ======================= +# Custom user_nl settings +# ======================= + +user_nl() { + +cat << EOF >> user_nl_eam + nhtfrq = 0,-24,-6,-6,-3,-24,0 + mfilt = 1,30,120,120,240,30,1 + avgflag_pertape = 'A','A','I','A','A','A','I' + fexcl1 = 'CFAD_SR532_CAL', 'LINOZ_DO3', 'LINOZ_DO3_PSC', 'LINOZ_O3CLIM', 'LINOZ_O3COL', 'LINOZ_SSO3', 'hstobie_linoz' + fincl1 = 'extinct_sw_inp','extinct_lw_bnd7','extinct_lw_inp','CLD_CAL', 'TREFMNAV', 'TREFMXAV' + fincl2 = 'FLUT','PRECT','U200','V200','U850','V850','Z500','OMEGA500','UBOT','VBOT','TREFHT','TREFHTMN:M','TREFHTMX:X','QREFHT','TS','PS','TMQ','TUQ','TVQ','TOZ', 'FLDS', 'FLNS', 'FSDS', 'FSNS', 'SHFLX', 'LHFLX', 'TGCLDCWP', 'TGCLDIWP', 'TGCLDLWP', 'CLDTOT', 'T250', 'T200', 'T150', 'T100', 'T050', 'T025', 'T010', 'T005', 'T002', 'T001', 'TTOP', 'U250', 'U150', 'U100', 'U050', 'U025', 'U010', 'U005', 'U002', 'U001', 'UTOP', 'FSNT', 'FLNT' + fincl3 = 'PSL','T200','T500','U850','V850','UBOT','VBOT','TREFHT', 'Z700', 'TBOT:M' + fincl4 = 'FLUT','U200','U850','PRECT','OMEGA500' + fincl5 = 'PRECT','PRECC','TUQ','TVQ','QFLX','SHFLX','U90M','V90M' + fincl6 = 'CLDTOT_ISCCP','MEANCLDALB_ISCCP','MEANTAU_ISCCP','MEANPTOP_ISCCP','MEANTB_ISCCP','CLDTOT_CAL','CLDTOT_CAL_LIQ','CLDTOT_CAL_ICE','CLDTOT_CAL_UN','CLDHGH_CAL','CLDHGH_CAL_LIQ','CLDHGH_CAL_ICE','CLDHGH_CAL_UN','CLDMED_CAL','CLDMED_CAL_LIQ','CLDMED_CAL_ICE','CLDMED_CAL_UN','CLDLOW_CAL','CLDLOW_CAL_LIQ','CLDLOW_CAL_ICE','CLDLOW_CAL_UN' + fincl7 = 'O3', 'PS', 'TROP_P' + +EOF + +cat << EOF >> user_nl_elm + hist_dov2xy = .true.,.true. + hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' + hist_mfilt = 1,365 + hist_nhtfrq = 0,-24 + hist_avgflag_pertape = 'A','A' + +! Override +check_finidat_fsurdat_consistency = .false. + +EOF + +cat << EOF >> user_nl_mosart + rtmhist_fincl2 = 'RIVER_DISCHARGE_OVER_LAND_LIQ' + rtmhist_mfilt = 1,365 + rtmhist_ndens = 2 + rtmhist_nhtfrq = 0,-24 +EOF + +} + +patch_mpas_streams() { + +echo + +} + +###################################################### +### Most users won't need to change anything below ### +###################################################### + +#----------------------------------------------------- +fetch_code() { + + if [ "${do_fetch_code,,}" != "true" ]; then + echo $'\n----- Skipping fetch_code -----\n' + return + fi + + echo $'\n----- Starting fetch_code -----\n' + local path=${CODE_ROOT} + local repo=e3sm + + echo "Cloning $repo repository branch $BRANCH under $path" + if [ -d "${path}" ]; then + echo "ERROR: Directory already exists. Not overwriting" + exit 20 + fi + mkdir -p ${path} + pushd ${path} + + # This will put repository, with all code + git clone git@github.com:E3SM-Project/${repo}.git . + + # Setup git hooks + rm -rf .git/hooks + git clone git@github.com:E3SM-Project/E3SM-Hooks.git .git/hooks + git config commit.template .git/hooks/commit.template + + # Check out desired branch + git checkout ${BRANCH} + + # Custom addition + if [ "${CHERRY}" != "" ]; then + echo ----- WARNING: adding git cherry-pick ----- + for commit in "${CHERRY[@]}" + do + echo ${commit} + git cherry-pick ${commit} + done + echo ------------------------------------------- + fi + + # Bring in all submodule components + git submodule update --init --recursive + + popd +} + +#----------------------------------------------------- +create_newcase() { + + if [ "${do_create_newcase,,}" != "true" ]; then + echo $'\n----- Skipping create_newcase -----\n' + return + fi + + echo $'\n----- Starting create_newcase -----\n' + + # Base arguments + args=" --case ${CASE_NAME} \ + --output-root ${CASE_ROOT} \ + --script-root ${CASE_SCRIPTS_DIR} \ + --handle-preexisting-dirs u \ + --compset ${COMPSET} \ + --res ${RESOLUTION} \ + --machine ${MACHINE} \ + --walltime ${WALLTIME} \ + --pecount ${PELAYOUT}" + + # Optional arguments + if [ ! -z "${PROJECT}" ]; then + args="${args} --project ${PROJECT}" + fi + if [ ! -z "${CASE_GROUP}" ]; then + args="${args} --case-group ${CASE_GROUP}" + fi + if [ ! -z "${QUEUE}" ]; then + args="${args} --queue ${QUEUE}" + fi + + ${CODE_ROOT}/cime/scripts/create_newcase ${args} + + if [ $? != 0 ]; then + echo $'\nNote: if create_newcase failed because sub-directory already exists:' + echo $' * delete old case_script sub-directory' + echo $' * or set do_newcase=false\n' + exit 35 + fi + +} + +#----------------------------------------------------- +case_setup() { + + if [ "${do_case_setup,,}" != "true" ]; then + echo $'\n----- Skipping case_setup -----\n' + return + fi + + echo $'\n----- Starting case_setup -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Setup some CIME directories + ./xmlchange EXEROOT=${CASE_BUILD_DIR} + ./xmlchange RUNDIR=${CASE_RUN_DIR} + + # Short term archiving + ./xmlchange DOUT_S=${DO_SHORT_TERM_ARCHIVING^^} + ./xmlchange DOUT_S_ROOT=${CASE_ARCHIVE_DIR} + + # Build with COSP, except for a data atmosphere (datm) + if [ `./xmlquery --value COMP_ATM` == "datm" ]; then + echo $'\nThe specified configuration uses a data atmosphere, so cannot activate COSP simulator\n' + else + echo $'\nConfiguring E3SM to use the COSP simulator\n' + ./xmlchange --id CAM_CONFIG_OPTS --append --val='-cosp' + fi + + # Extracts input_data_dir in case it is needed for user edits to the namelist later + local input_data_dir=`./xmlquery DIN_LOC_ROOT --value` + + # Custom user_nl + user_nl + + # Finally, run CIME case.setup + ./case.setup --reset + + popd +} + +#----------------------------------------------------- +case_build() { + + pushd ${CASE_SCRIPTS_DIR} + + # do_case_build = false + if [ "${do_case_build,,}" != "true" ]; then + + echo $'\n----- case_build -----\n' + + if [ "${OLD_EXECUTABLE}" == "" ]; then + # Ues previously built executable, make sure it exists + if [ -x ${CASE_BUILD_DIR}/e3sm.exe ]; then + echo 'Skipping build because $do_case_build = '${do_case_build} + else + echo 'ERROR: $do_case_build = '${do_case_build}' but no executable exists for this case.' + exit 297 + fi + else + # If absolute pathname exists and is executable, reuse pre-exiting executable + if [ -x ${OLD_EXECUTABLE} ]; then + echo 'Using $OLD_EXECUTABLE = '${OLD_EXECUTABLE} + cp -fp ${OLD_EXECUTABLE} ${CASE_BUILD_DIR}/ + else + echo 'ERROR: $OLD_EXECUTABLE = '$OLD_EXECUTABLE' does not exist or is not an executable file.' + exit 297 + fi + fi + echo 'WARNING: Setting BUILD_COMPLETE = TRUE. This is a little risky, but trusting the user.' + ./xmlchange BUILD_COMPLETE=TRUE + + # do_case_build = true + else + + echo $'\n----- Starting case_build -----\n' + + # Turn on debug compilation option if requested + if [ "${DEBUG_COMPILE^^}" == "TRUE" ]; then + ./xmlchange DEBUG=${DEBUG_COMPILE^^} + fi + + # Run CIME case.build + ./case.build + + fi + + # Some user_nl settings won't be updated to *_in files under the run directory + # Call preview_namelists to make sure *_in and user_nl files are consistent. + echo $'\n----- Preview namelists -----\n' + ./preview_namelists + + popd +} + +#----------------------------------------------------- +runtime_options() { + + echo $'\n----- Starting runtime_options -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Set simulation start date + ./xmlchange RUN_STARTDATE=${START_DATE} + + # Segment length + ./xmlchange STOP_OPTION=${STOP_OPTION,,},STOP_N=${STOP_N} + + # End date + ./xmlchange STOP_DATE=${STOP_DATE} + + # Restart frequency + ./xmlchange REST_OPTION=${REST_OPTION,,},REST_N=${REST_N} + + # Coupler history + ./xmlchange HIST_OPTION=${HIST_OPTION,,},HIST_N=${HIST_N} + + # Coupler budgets (always on) + ./xmlchange BUDGETS=TRUE + + # Set resubmissions + if (( RESUBMIT > 0 )); then + ./xmlchange RESUBMIT=${RESUBMIT} + fi + + # Run type + # Start from default of user-specified initial conditions + if [ "${MODEL_START_TYPE,,}" == "initial" ]; then + ./xmlchange RUN_TYPE="startup" + ./xmlchange CONTINUE_RUN="FALSE" + + # Continue existing run + elif [ "${MODEL_START_TYPE,,}" == "continue" ]; then + ./xmlchange CONTINUE_RUN="TRUE" + + elif [ "${MODEL_START_TYPE,,}" == "branch" ] || [ "${MODEL_START_TYPE,,}" == "hybrid" ]; then + ./xmlchange RUN_TYPE=${MODEL_START_TYPE,,} + ./xmlchange GET_REFCASE=${GET_REFCASE} + ./xmlchange RUN_REFDIR=${RUN_REFDIR} + ./xmlchange RUN_REFCASE=${RUN_REFCASE} + ./xmlchange RUN_REFDATE=${RUN_REFDATE} + echo 'Warning: $MODEL_START_TYPE = '${MODEL_START_TYPE} + echo '$RUN_REFDIR = '${RUN_REFDIR} + echo '$RUN_REFCASE = '${RUN_REFCASE} + echo '$RUN_REFDATE = '${START_DATE} + else + echo 'ERROR: $MODEL_START_TYPE = '${MODEL_START_TYPE}' is unrecognized. Exiting.' + exit 380 + fi + + # Patch mpas streams files + patch_mpas_streams + + popd +} + +#----------------------------------------------------- +case_submit() { + + if [ "${do_case_submit,,}" != "true" ]; then + echo $'\n----- Skipping case_submit -----\n' + return + fi + + echo $'\n----- Starting case_submit -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Run CIME case.submit + ./case.submit + + popd +} + +#----------------------------------------------------- +copy_script() { + + echo $'\n----- Saving run script for provenance -----\n' + + local script_provenance_dir=${CASE_SCRIPTS_DIR}/run_script_provenance + mkdir -p ${script_provenance_dir} + local this_script_name=`basename $0` + local script_provenance_name=${this_script_name}.`date +%Y%m%d-%H%M%S` + cp -vp ${this_script_name} ${script_provenance_dir}/${script_provenance_name} + +} + +#----------------------------------------------------- +# Silent versions of popd and pushd +pushd() { + command pushd "$@" > /dev/null +} +popd() { + command popd "$@" > /dev/null +} + +# Now, actually run the script +#----------------------------------------------------- +main diff --git a/run_scripts/v2/reproduce/run.v2.NARRM.abrupt-4xCO2_0101.sh b/run_scripts/v2/reproduce/run.v2.NARRM.abrupt-4xCO2_0101.sh new file mode 100755 index 0000000..d8575ae --- /dev/null +++ b/run_scripts/v2/reproduce/run.v2.NARRM.abrupt-4xCO2_0101.sh @@ -0,0 +1,481 @@ +#!/bin/bash -fe + +# E3SMv2 Water Cycle run_e3sm script template. +# +# Configured to reproduce v2.NARRM.abrupt-4xCO2_0101 on chrysalis. +# Modify as needed for other machines. +# +# Bash coding style inspired by: +# http://kfirlavi.herokuapp.com/blog/2012/11/14/defensive-bash-programming + +main() { + +# For debugging, uncomment line below +#set -x + +# --- Configuration flags ---- + +# Machine and project +readonly MACHINE=chrysalis +readonly PROJECT="e3sm" + +# Simulation +readonly COMPSET="WCYCL1850-4xCO2" +readonly RESOLUTION="northamericax4v1pg2_WC14to60E2r3" + +readonly CASE_GROUP="v2.RRM" + +# Code and compilation +readonly CHECKOUT="20221102-maint-20" +readonly BRANCH="maint-2.0" +readonly CHERRY=( ) +readonly DEBUG_COMPILE=false + +# BEFORE RUNNING : CHANGE the following CASE_NAME to desired value + +# For developmental simulations, recommended convention: +#readonly CASE_NAME=${CHECKOUT}.abrupt-4xCO2_0101.${RESOLUTION}.${MACHINE} +# For production simulations: +readonly CASE_NAME="v2.NARRM.abrupt-4xCO2_0101" + +# If this is part of a simulation campaign, ask your group lead about using a case_group label +# readonly CASE_GROUP="" + +# Run options +readonly MODEL_START_TYPE="hybrid" # 'initial', 'continue', 'branch', 'hybrid' +readonly START_DATE="0001-01-01" + +# Additional options for 'branch' and 'hybrid' +readonly GET_REFCASE=TRUE +readonly RUN_REFDIR="/lcrc/group/e3sm/${USER}/E3SMv2_test/${CASE_NAME}/init" +readonly RUN_REFCASE="v2.NARRM.piControl" +readonly RUN_REFDATE="0101-01-01" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' + +# Set paths +readonly CODE_ROOT="${HOME}/E3SMv2_test/code/${CHECKOUT}" +readonly CASE_ROOT="/lcrc/group/e3sm/${USER}/E3SMv2_test/${CASE_NAME}" + +# Sub-directories +readonly CASE_BUILD_DIR=${CASE_ROOT}/build +readonly CASE_ARCHIVE_DIR=${CASE_ROOT}/archive + +# Define type of run: short tests or 'production' for full simulation +readonly run='XS_1x10_ndays' +#readonly run='S_2x5_ndays' +#readonly run='M_1x10_ndays' +#readonly run='L_1x10_ndays' +if [ "${run}" != "production" ]; then + + # Short test simulations + tmp=($(echo $run | tr "_" " ")) + layout=${tmp[0]} + units=${tmp[2]} + resubmit=$(( ${tmp[1]%%x*} -1 )) + length=${tmp[1]##*x} + + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/tests/${run}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/tests/${run}/run + readonly PELAYOUT=${layout} + readonly WALLTIME="00:20:00" + readonly STOP_OPTION=${units} + readonly STOP_N=${length} + readonly REST_OPTION=${STOP_OPTION} + readonly REST_N="1" + readonly RESUBMIT=${resubmit} + readonly DO_SHORT_TERM_ARCHIVING=false + +else + + # Production simulation + readonly CASE_SCRIPTS_DIR=${CASE_ROOT}/case_scripts + readonly CASE_RUN_DIR=${CASE_ROOT}/run + readonly PELAYOUT="ML" + readonly WALLTIME="48:00:00" + readonly STOP_OPTION="nyears" + readonly STOP_N="20" + readonly REST_OPTION="nyears" + readonly REST_N="1" + readonly RESUBMIT="6" + readonly DO_SHORT_TERM_ARCHIVING=false +fi + +# Coupler history +readonly HIST_OPTION="nyears" +readonly HIST_N="1" + +# Leave empty (unless you understand what it does) +readonly OLD_EXECUTABLE="" + +# --- Toggle flags for what to do ---- +do_fetch_code=true +do_create_newcase=true +do_case_setup=true +do_case_build=true +do_case_submit=true + +# --- Now, do the work --- + +# Make directories created by this script world-readable +umask 022 + +# Fetch code from Github +fetch_code + +# Create case +create_newcase + +# Setup +case_setup + +# Build +case_build + +# Configure runtime options +runtime_options + +# Copy script into case_script directory for provenance +copy_script + +# Submit +case_submit + +# All done +echo $'\n----- All done -----\n' + +} + +# ======================= +# Custom user_nl settings +# ======================= + +user_nl() { + +cat << EOF >> user_nl_eam + nhtfrq = 0,-24,-6,-6,-3,-24,0 + mfilt = 1,30,120,120,240,30,1 + avgflag_pertape = 'A','A','I','A','A','A','I' + fexcl1 = 'CFAD_SR532_CAL', 'LINOZ_DO3', 'LINOZ_DO3_PSC', 'LINOZ_O3CLIM', 'LINOZ_O3COL', 'LINOZ_SSO3', 'hstobie_linoz' + fincl1 = 'extinct_sw_inp','extinct_lw_bnd7','extinct_lw_inp','CLD_CAL', 'TREFMNAV', 'TREFMXAV' + fincl2 = 'FLUT','PRECT','U200','V200','U850','V850','Z500','OMEGA500','UBOT','VBOT','TREFHT','TREFHTMN:M','TREFHTMX:X','QREFHT','TS','PS','TMQ','TUQ','TVQ','TOZ', 'FLDS', 'FLNS', 'FSDS', 'FSNS', 'SHFLX', 'LHFLX', 'TGCLDCWP', 'TGCLDIWP', 'TGCLDLWP', 'CLDTOT', 'T250', 'T200', 'T150', 'T100', 'T050', 'T025', 'T010', 'T005', 'T002', 'T001', 'TTOP', 'U250', 'U150', 'U100', 'U050', 'U025', 'U010', 'U005', 'U002', 'U001', 'UTOP', 'FSNT', 'FLNT' + fincl3 = 'PSL','T200','T500','U850','V850','UBOT','VBOT','TREFHT', 'Z700', 'TBOT:M' + fincl4 = 'FLUT','U200','U850','PRECT','OMEGA500' + fincl5 = 'PRECT','PRECC','TUQ','TVQ','QFLX','SHFLX','U90M','V90M' + fincl6 = 'CLDTOT_ISCCP','MEANCLDALB_ISCCP','MEANTAU_ISCCP','MEANPTOP_ISCCP','MEANTB_ISCCP','CLDTOT_CAL','CLDTOT_CAL_LIQ','CLDTOT_CAL_ICE','CLDTOT_CAL_UN','CLDHGH_CAL','CLDHGH_CAL_LIQ','CLDHGH_CAL_ICE','CLDHGH_CAL_UN','CLDMED_CAL','CLDMED_CAL_LIQ','CLDMED_CAL_ICE','CLDMED_CAL_UN','CLDLOW_CAL','CLDLOW_CAL_LIQ','CLDLOW_CAL_ICE','CLDLOW_CAL_UN' + fincl7 = 'O3', 'PS', 'TROP_P' + +EOF + +cat << EOF >> user_nl_elm + hist_dov2xy = .true.,.true. + hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' + hist_mfilt = 1,365 + hist_nhtfrq = 0,-24 + hist_avgflag_pertape = 'A','A' + +! Override +check_finidat_fsurdat_consistency = .false. + +EOF + +cat << EOF >> user_nl_mosart + rtmhist_fincl2 = 'RIVER_DISCHARGE_OVER_LAND_LIQ' + rtmhist_mfilt = 1,365 + rtmhist_ndens = 2 + rtmhist_nhtfrq = 0,-24 +EOF + +} + +patch_mpas_streams() { + +echo + +} + +###################################################### +### Most users won't need to change anything below ### +###################################################### + +#----------------------------------------------------- +fetch_code() { + + if [ "${do_fetch_code,,}" != "true" ]; then + echo $'\n----- Skipping fetch_code -----\n' + return + fi + + echo $'\n----- Starting fetch_code -----\n' + local path=${CODE_ROOT} + local repo=e3sm + + echo "Cloning $repo repository branch $BRANCH under $path" + if [ -d "${path}" ]; then + echo "ERROR: Directory already exists. Not overwriting" + exit 20 + fi + mkdir -p ${path} + pushd ${path} + + # This will put repository, with all code + git clone git@github.com:E3SM-Project/${repo}.git . + + # Setup git hooks + rm -rf .git/hooks + git clone git@github.com:E3SM-Project/E3SM-Hooks.git .git/hooks + git config commit.template .git/hooks/commit.template + + # Check out desired branch + git checkout ${BRANCH} + + # Custom addition + if [ "${CHERRY}" != "" ]; then + echo ----- WARNING: adding git cherry-pick ----- + for commit in "${CHERRY[@]}" + do + echo ${commit} + git cherry-pick ${commit} + done + echo ------------------------------------------- + fi + + # Bring in all submodule components + git submodule update --init --recursive + + popd +} + +#----------------------------------------------------- +create_newcase() { + + if [ "${do_create_newcase,,}" != "true" ]; then + echo $'\n----- Skipping create_newcase -----\n' + return + fi + + echo $'\n----- Starting create_newcase -----\n' + + # Base arguments + args=" --case ${CASE_NAME} \ + --output-root ${CASE_ROOT} \ + --script-root ${CASE_SCRIPTS_DIR} \ + --handle-preexisting-dirs u \ + --compset ${COMPSET} \ + --res ${RESOLUTION} \ + --machine ${MACHINE} \ + --walltime ${WALLTIME} \ + --pecount ${PELAYOUT}" + + # Optional arguments + if [ ! -z "${PROJECT}" ]; then + args="${args} --project ${PROJECT}" + fi + if [ ! -z "${CASE_GROUP}" ]; then + args="${args} --case-group ${CASE_GROUP}" + fi + if [ ! -z "${QUEUE}" ]; then + args="${args} --queue ${QUEUE}" + fi + + ${CODE_ROOT}/cime/scripts/create_newcase ${args} + + if [ $? != 0 ]; then + echo $'\nNote: if create_newcase failed because sub-directory already exists:' + echo $' * delete old case_script sub-directory' + echo $' * or set do_newcase=false\n' + exit 35 + fi + +} + +#----------------------------------------------------- +case_setup() { + + if [ "${do_case_setup,,}" != "true" ]; then + echo $'\n----- Skipping case_setup -----\n' + return + fi + + echo $'\n----- Starting case_setup -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Setup some CIME directories + ./xmlchange EXEROOT=${CASE_BUILD_DIR} + ./xmlchange RUNDIR=${CASE_RUN_DIR} + + # Short term archiving + ./xmlchange DOUT_S=${DO_SHORT_TERM_ARCHIVING^^} + ./xmlchange DOUT_S_ROOT=${CASE_ARCHIVE_DIR} + + # Build with COSP, except for a data atmosphere (datm) + if [ `./xmlquery --value COMP_ATM` == "datm" ]; then + echo $'\nThe specified configuration uses a data atmosphere, so cannot activate COSP simulator\n' + else + echo $'\nConfiguring E3SM to use the COSP simulator\n' + ./xmlchange --id CAM_CONFIG_OPTS --append --val='-cosp' + fi + + # Extracts input_data_dir in case it is needed for user edits to the namelist later + local input_data_dir=`./xmlquery DIN_LOC_ROOT --value` + + # Custom user_nl + user_nl + + # Finally, run CIME case.setup + ./case.setup --reset + + popd +} + +#----------------------------------------------------- +case_build() { + + pushd ${CASE_SCRIPTS_DIR} + + # do_case_build = false + if [ "${do_case_build,,}" != "true" ]; then + + echo $'\n----- case_build -----\n' + + if [ "${OLD_EXECUTABLE}" == "" ]; then + # Ues previously built executable, make sure it exists + if [ -x ${CASE_BUILD_DIR}/e3sm.exe ]; then + echo 'Skipping build because $do_case_build = '${do_case_build} + else + echo 'ERROR: $do_case_build = '${do_case_build}' but no executable exists for this case.' + exit 297 + fi + else + # If absolute pathname exists and is executable, reuse pre-exiting executable + if [ -x ${OLD_EXECUTABLE} ]; then + echo 'Using $OLD_EXECUTABLE = '${OLD_EXECUTABLE} + cp -fp ${OLD_EXECUTABLE} ${CASE_BUILD_DIR}/ + else + echo 'ERROR: $OLD_EXECUTABLE = '$OLD_EXECUTABLE' does not exist or is not an executable file.' + exit 297 + fi + fi + echo 'WARNING: Setting BUILD_COMPLETE = TRUE. This is a little risky, but trusting the user.' + ./xmlchange BUILD_COMPLETE=TRUE + + # do_case_build = true + else + + echo $'\n----- Starting case_build -----\n' + + # Turn on debug compilation option if requested + if [ "${DEBUG_COMPILE^^}" == "TRUE" ]; then + ./xmlchange DEBUG=${DEBUG_COMPILE^^} + fi + + # Run CIME case.build + ./case.build + + fi + + # Some user_nl settings won't be updated to *_in files under the run directory + # Call preview_namelists to make sure *_in and user_nl files are consistent. + echo $'\n----- Preview namelists -----\n' + ./preview_namelists + + popd +} + +#----------------------------------------------------- +runtime_options() { + + echo $'\n----- Starting runtime_options -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Set simulation start date + ./xmlchange RUN_STARTDATE=${START_DATE} + + # Segment length + ./xmlchange STOP_OPTION=${STOP_OPTION,,},STOP_N=${STOP_N} + + # Restart frequency + ./xmlchange REST_OPTION=${REST_OPTION,,},REST_N=${REST_N} + + # Coupler history + ./xmlchange HIST_OPTION=${HIST_OPTION,,},HIST_N=${HIST_N} + + # Coupler budgets (always on) + ./xmlchange BUDGETS=TRUE + + # Set resubmissions + if (( RESUBMIT > 0 )); then + ./xmlchange RESUBMIT=${RESUBMIT} + fi + + # Run type + # Start from default of user-specified initial conditions + if [ "${MODEL_START_TYPE,,}" == "initial" ]; then + ./xmlchange RUN_TYPE="startup" + ./xmlchange CONTINUE_RUN="FALSE" + + # Continue existing run + elif [ "${MODEL_START_TYPE,,}" == "continue" ]; then + ./xmlchange CONTINUE_RUN="TRUE" + + elif [ "${MODEL_START_TYPE,,}" == "branch" ] || [ "${MODEL_START_TYPE,,}" == "hybrid" ]; then + ./xmlchange RUN_TYPE=${MODEL_START_TYPE,,} + ./xmlchange GET_REFCASE=${GET_REFCASE} + ./xmlchange RUN_REFDIR=${RUN_REFDIR} + ./xmlchange RUN_REFCASE=${RUN_REFCASE} + ./xmlchange RUN_REFDATE=${RUN_REFDATE} + echo 'Warning: $MODEL_START_TYPE = '${MODEL_START_TYPE} + echo '$RUN_REFDIR = '${RUN_REFDIR} + echo '$RUN_REFCASE = '${RUN_REFCASE} + echo '$RUN_REFDATE = '${START_DATE} + else + echo 'ERROR: $MODEL_START_TYPE = '${MODEL_START_TYPE}' is unrecognized. Exiting.' + exit 380 + fi + + # Patch mpas streams files + patch_mpas_streams + + popd +} + +#----------------------------------------------------- +case_submit() { + + if [ "${do_case_submit,,}" != "true" ]; then + echo $'\n----- Skipping case_submit -----\n' + return + fi + + echo $'\n----- Starting case_submit -----\n' + pushd ${CASE_SCRIPTS_DIR} + + # Run CIME case.submit + ./case.submit + + popd +} + +#----------------------------------------------------- +copy_script() { + + echo $'\n----- Saving run script for provenance -----\n' + + local script_provenance_dir=${CASE_SCRIPTS_DIR}/run_script_provenance + mkdir -p ${script_provenance_dir} + local this_script_name=`basename $0` + local script_provenance_name=${this_script_name}.`date +%Y%m%d-%H%M%S` + cp -vp ${this_script_name} ${script_provenance_dir}/${script_provenance_name} + +} + +#----------------------------------------------------- +# Silent versions of popd and pushd +pushd() { + command pushd "$@" > /dev/null +} +popd() { + command popd "$@" > /dev/null +} + +# Now, actually run the script +#----------------------------------------------------- +main diff --git a/utils/check_results.bash b/utils/check_results.bash index e0971ef..c1f57ce 100755 --- a/utils/check_results.bash +++ b/utils/check_results.bash @@ -15,8 +15,7 @@ check_test_results() ##### case_name=v2.${resolution}.${simulation_name} - echo '' - echo ${case_name} + print_case=false # (4) After the job completed, check results cd /lcrc/group/e3sm/${USER}/${test_subdir}/${case_name}/tests @@ -28,7 +27,8 @@ check_test_results() # 482 lines, corresponding to 10 simulated days expected_line_count="482 atm_XS_1x10_ndays.txt" if [ "${actual_line_count}" == "${expected_line_count}" ]; then - echo "Line count test passed" + #echo "Line count test passed" + true # pass else echo "Line count test failed" echo ${actual_line_count} @@ -36,12 +36,14 @@ check_test_results() ((failed_line_count++)) echo "Debug:" echo "/lcrc/group/e3sm/${USER}/${test_subdir}/${case_name}/tests" + print_case=true fi actual_checksum=`md5sum atm_*.txt` expected_checksum="${checksum} atm_XS_1x10_ndays.txt" # If the checksums match, the results are BFB with the original code. if [ "${actual_checksum}" == "${expected_checksum}" ]; then - echo "Checksum test passed" + #echo "Checksum test passed" + true # pass else echo "Checksum test failed" echo ${actual_checksum} @@ -49,52 +51,63 @@ check_test_results() ((failed_checksum++)) echo "Debug:" echo "/lcrc/group/e3sm/${USER}/${test_subdir}/${case_name}/tests" + print_case=true + fi + + if ${print_case}; then + echo ${case_name} + echo '' fi } # Water Cycle (low-resolution) > DECK -check_test_results E3SMv2_test LR piControl 7547932242025fdf92014d06d6f9eec2 -check_test_results E3SMv2_test LR abrupt-4xCO2_0101 86bc7dfbdc6a71e4bd2925943a15c474 -check_test_results E3SMv2_test LR abrupt-4xCO2_0301 cd61cc01cfbd03913fafcb6cbe18a8bc -check_test_results E3SMv2_test LR 1pctCO2_0101 3300255fc76bc13433fafea37fb36570 +#check_test_results E3SMv2_test LR piControl 7547932242025fdf92014d06d6f9eec2 +#check_test_results E3SMv2_test LR abrupt-4xCO2_0101 86bc7dfbdc6a71e4bd2925943a15c474 +#check_test_results E3SMv2_test LR abrupt-4xCO2_0301 cd61cc01cfbd03913fafcb6cbe18a8bc +#check_test_results E3SMv2_test LR 1pctCO2_0101 3300255fc76bc13433fafea37fb36570 # Water Cycle (low-resolution) > Historical -check_test_results E3SMv2_test LR historical_0101 61a7f492bdcc6e6cd4a2b41c92546219 -check_test_results E3SMv2_test LR historical_0151 6b17c91b7e07d31c162adbfbe7782d42 -check_test_results E3SMv2_test LR historical_0201 e79dda36bb76507cc6fdf88292e8ced9 -check_test_results E3SMv2_test LR historical_0251 6ad002ff6f198f6ba936171da48bc5b2 -check_test_results E3SMv2_test LR historical_0301 42ffbf170db587dc25d84d5d2ec7bc12 -check_test_results E3SMv2_test LR historical_0101_bonus d23e455ba5bef0bf87211468570b6835 +#check_test_results E3SMv2_test LR historical_0101 61a7f492bdcc6e6cd4a2b41c92546219 +#check_test_results E3SMv2_test LR historical_0151 6b17c91b7e07d31c162adbfbe7782d42 +#check_test_results E3SMv2_test LR historical_0201 e79dda36bb76507cc6fdf88292e8ced9 +#check_test_results E3SMv2_test LR historical_0251 6ad002ff6f198f6ba936171da48bc5b2 +#check_test_results E3SMv2_test LR historical_0301 42ffbf170db587dc25d84d5d2ec7bc12 +#check_test_results E3SMv2_test LR historical_0101_bonus d23e455ba5bef0bf87211468570b6835 # Water Cycle (low-resolution) > Single-forcing (DAMIP-like) -check_test_results E3SMv2_test LR hist-GHG_0101 5cc8d0d76887740d8a82568e13e2ff36 -check_test_results E3SMv2_test LR hist-GHG_0201 9098a4135bfda91ccef99d3f701fd5e5 -check_test_results E3SMv2_test LR hist-GHG_0251 7924e97a4abf55bbd7be708987e29153 -check_test_results E3SMv2_test LR hist-GHG_0301 d461a8bbddd3afc9f8d701943609b83c -check_test_results E3SMv2_test LR hist-aer_0101 c00ea4f726194ced3669a7f0ae0bac27 -check_test_results E3SMv2_test LR hist-aer_0201 7feaa4d32a7a888ff969106e48ed9db7 -check_test_results E3SMv2_test LR hist-aer_0251 849376c7d30ad2dd296f4b4e16eeccf0 -check_test_results E3SMv2_test LR hist-aer_0301 d35d92f676c4b312e227415cf19b3316 -check_test_results E3SMv2_test LR hist-all-xGHG-xaer_0101 a5768c505bb12f778b2606ae8f5705ce -check_test_results E3SMv2_test LR hist-all-xGHG-xaer_0201 363ecb08227bdfd972e5f058dd12b434 -check_test_results E3SMv2_test LR hist-all-xGHG-xaer_0251 6a9465b94bef49a235defbd44db273bd -check_test_results E3SMv2_test LR hist-all-xGHG-xaer_0301 16a900d361d1edcbd24813445d7d1cd6 +#check_test_results E3SMv2_test LR hist-GHG_0101 5cc8d0d76887740d8a82568e13e2ff36 +check_test_results E3SMv2_test LR hist-GHG_0151 c9aff4fd826f18d0872135b845090a6b +#check_test_results E3SMv2_test LR hist-GHG_0201 9098a4135bfda91ccef99d3f701fd5e5 +#check_test_results E3SMv2_test LR hist-GHG_0251 7924e97a4abf55bbd7be708987e29153 +#check_test_results E3SMv2_test LR hist-GHG_0301 d461a8bbddd3afc9f8d701943609b83c +#check_test_results E3SMv2_test LR hist-aer_0101 c00ea4f726194ced3669a7f0ae0bac27 +check_test_results E3SMv2_test LR hist-aer_0151 1a85a01b55fa91abdf9983a17f24e774 +#check_test_results E3SMv2_test LR hist-aer_0201 7feaa4d32a7a888ff969106e48ed9db7 +#check_test_results E3SMv2_test LR hist-aer_0251 849376c7d30ad2dd296f4b4e16eeccf0 +#check_test_results E3SMv2_test LR hist-aer_0301 d35d92f676c4b312e227415cf19b3316 +#check_test_results E3SMv2_test LR hist-all-xGHG-xaer_0101 a5768c505bb12f778b2606ae8f5705ce +check_test_results E3SMv2_test LR hist-all-xGHG-xaer_0151 3d9726d0f3440c2fcd6625d85094a57c +#check_test_results E3SMv2_test LR hist-all-xGHG-xaer_0201 363ecb08227bdfd972e5f058dd12b434 +#check_test_results E3SMv2_test LR hist-all-xGHG-xaer_0251 6a9465b94bef49a235defbd44db273bd +#check_test_results E3SMv2_test LR hist-all-xGHG-xaer_0301 16a900d361d1edcbd24813445d7d1cd6 # Water Cycle (low-resolution) > AMIP -check_test_results E3SMv2_test LR amip_0101 a6cff5ea277dd3a08be6bbc4b1c84a69 -check_test_results E3SMv2_test LR amip_0201 64e0fae59c1f6a48da0cae534c8be4a1 +#check_test_results E3SMv2_test LR amip_0101 a6cff5ea277dd3a08be6bbc4b1c84a69 +#check_test_results E3SMv2_test LR amip_0201 64e0fae59c1f6a48da0cae534c8be4a1 check_test_results E3SMv2_test LR amip_0301 6ae0ba340ef42b945c8573e9e5d7a0c7 -check_test_results E3SMv2_test LR amip_0101_bonus c4b1c7337e89134fca7420437992ea97 +#check_test_results E3SMv2_test LR amip_0101_bonus c4b1c7337e89134fca7420437992ea97 # Water Cycle (low-resolution) > RFMIP -check_test_results E3SMv2_test LR piClim-control 6ce41c36ea2f86e984d12d364085323e -check_test_results E3SMv2_test LR piClim-histall_0021 c932625975561731c96124c4b3105b44 -check_test_results E3SMv2_test LR piClim-histall_0041 0e9d9fbc8a132299fed161bd833fdd43 -check_test_results E3SMv2_test LR piClim-histaer_0021 442ebb4ff467d8c9f57c5d5b4ec37bd9 -check_test_results E3SMv2_test LR piClim-histaer_0041 a67cf4f46aa6ca5f568b5a14f0b2f887 +#check_test_results E3SMv2_test LR piClim-control 6ce41c36ea2f86e984d12d364085323e +#check_test_results E3SMv2_test LR piClim-histall_0021 c932625975561731c96124c4b3105b44 +check_test_results E3SMv2_test LR piClim-histall_0031 d6fda41f1ed496d86ffc6cfd6929cc62 +#check_test_results E3SMv2_test LR piClim-histall_0041 0e9d9fbc8a132299fed161bd833fdd43 +#check_test_results E3SMv2_test LR piClim-histaer_0021 442ebb4ff467d8c9f57c5d5b4ec37bd9 +check_test_results E3SMv2_test LR piClim-histaer_0031 e8101ef8d0514c0ab00650a6413e59d8 +#check_test_results E3SMv2_test LR piClim-histaer_0041 a67cf4f46aa6ca5f568b5a14f0b2f887 # Water Cycle (NARRM) > DECK -check_test_results E3SMv2_test NARRM piControl c18df3c0834abd2b5c63899e37559ccd +#check_test_results E3SMv2_test NARRM piControl c18df3c0834abd2b5c63899e37559ccd check_test_results E3SMv2_test NARRM abrupt-4xCO2_0101 1eb5423d852764bbcd1bf67b180efc43 check_test_results E3SMv2_test NARRM 1pctCO2_0101 80e6c83b39d58cb00876506deabfd8c2 # Water Cycle (NARRM) > Historical -check_test_results E3SMv2_test NARRM historical_0101 4a9ccd61766640b4a4f4b15dc5f5b956 -check_test_results E3SMv2_test NARRM historical_0301 24147fbb5d601e1bd6fcae6ace72968c +#check_test_results E3SMv2_test NARRM historical_0101 4a9ccd61766640b4a4f4b15dc5f5b956 +#check_test_results E3SMv2_test NARRM historical_0301 24147fbb5d601e1bd6fcae6ace72968c # Water Cycle (NARRM) > AMIP check_test_results E3SMv2_test NARRM amip_0101 930b7fc7e946910c3c8e716f733d0f31 check_test_results E3SMv2_test NARRM amip_0201 a8326dd3922cbf32dccedb494fcedffb diff --git a/utils/test_reproduction_scripts.bash b/utils/test_reproduction_scripts.bash index 93994bc..0458e86 100755 --- a/utils/test_reproduction_scripts.bash +++ b/utils/test_reproduction_scripts.bash @@ -43,7 +43,7 @@ test_reproduction() github_address=https://raw.githubusercontent.com/E3SM-Project/e3sm_data_docs/main/run_scripts/v2/reproduce/${script_name} wget ${github_address} else - cp /home/ac.forsyth2/e3sm_data_docs/run_scripts/v2/reproduce/${script_name} ${script_name} + cp /home/ac.forsyth2/ez/e3sm_data_docs/run_scripts/v2/reproduce/${script_name} ${script_name} fi replace_in_file "E3SMv2_test" ${test_subdir} ${script_name} # Variable substitution in the string doesn't appear to work in this case, so using `if` statement. @@ -69,53 +69,14 @@ test_reproduction() ./${script_name} echo "If ${script_name} did not complete successfully, try the following:" - echo "Make fixes in /home/ac.forsyth2/e3sm_data_docs/run_scripts/v2/reproduce/${script_name}" + echo "Make fixes in /home/ac.forsyth2/ez/e3sm_data_docs/run_scripts/v2/reproduce/${script_name}" echo "Set use_wget=false" } # Load E3SM unified to make zstash available source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh -### Usual run ### - -# Water Cycle (low-resolution) > DECK -for simulation_name in piControl abrupt-4xCO2_0101 abrupt-4xCO2_0301 1pctCO2_0101; do - test_reproduction E3SMv2_test LR ${simulation_name} false false -done - -# Water Cycle (low-resolution) > Historical -for simulation_name in historical_0101 historical_0151 historical_0201 historical_0251 historical_0301 historical_0101_bonus; do - test_reproduction E3SMv2_test LR ${simulation_name} false false -done - -# Water Cycle (low-resolution) > Single-forcing (DAMIP-like) -for simulation_name in hist-GHG_0101 hist-GHG_0201 hist-GHG_0251 hist-GHG_0301 hist-aer_0101 hist-aer_0201 hist-aer_0251 hist-aer_0301 hist-all-xGHG-xaer_0101 hist-all-xGHG-xaer_0201 hist-all-xGHG-xaer_0251 hist-all-xGHG-xaer_0301; do - test_reproduction E3SMv2_test LR ${simulation_name} false false -done - -# Water Cycle (low-resolution) > AMIP -for simulation_name in amip_0101 amip_0201 amip_0301 amip_0101_bonus; do +# Remaining run scripts +for simulation_name in hist-GHG_0151 hist-aer_0151 hist-all-xGHG-xaer_0151 piClim-histall_0031 piClim-histaer_0031; do test_reproduction E3SMv2_test LR ${simulation_name} false false done - -# 24 hours is enough runtime to get to this point. - -# Water Cycle (low-resolution) > RFMIP -for simulation_name in piClim-control piClim-histall_0021 piClim-histall_0041 piClim-histaer_0021 piClim-histaer_0041; do - test_reproduction E3SMv2_test LR ${simulation_name} false false -done - -# Water Cycle (NARRM) > DECK -for simulation_name in piControl abrupt-4xCO2_0101 1pctCO2_0101; do - test_reproduction E3SMv2_test NARRM ${simulation_name} false false -done - -# Water Cycle (NARRM) > Historical -for simulation_name in historical_0101 historical_0301; do - test_reproduction E3SMv2_test NARRM ${simulation_name} false false -done - -# Water Cycle (NARRM) > AMIP -for simulation_name in amip_0101 amip_0201 amip_0301; do - test_reproduction E3SMv2_test NARRM ${simulation_name} false false -done diff --git a/utils/update_reproduction_scripts.bash b/utils/update_reproduction_scripts.bash index b56caee..71269fd 100755 --- a/utils/update_reproduction_scripts.bash +++ b/utils/update_reproduction_scripts.bash @@ -1,12 +1,12 @@ resolution=LR -for case_name in piControl abrupt-4xCO2_0101 abrupt-4xCO2_0301 1pctCO2_0101 historical_0101 historical_0151 historical_0201 historical_0251 historical_0301 historical_0101_bonus hist-GHG_0101 hist-GHG_0201 hist-GHG_0251 hist-GHG_0301 hist-aer_0101 hist-aer_0201 hist-aer_0251 hist-aer_0301 hist-all-xGHG-xaer_0101 hist-all-xGHG-xaer_0201 hist-all-xGHG-xaer_0251 hist-all-xGHG-xaer_0301 amip_0101 amip_0201 amip_0301 amip_0101_bonus piClim-control piClim-histall_0021 piClim-histall_0041 piClim-histaer_0021 piClim-histaer_0041; do +for case_name in hist-GHG_0151 hist-aer_0151 hist-all-xGHG-xaer_0151 piClim-histall_0031 piClim-histaer_0031; do ./generate_reproduction_script.bash ${resolution} ${case_name} diff ../run_scripts/v2/reproduce/run.v2.${resolution}.${case_name}.sh run.v2.${resolution}.${case_name}.sh mv run.v2.${resolution}.${case_name}.sh ../run_scripts/v2/reproduce/run.v2.${resolution}.${case_name}.sh done resolution=NARRM -for case_name in historical_0101 historical_0301 amip_0101 amip_0201 amip_0301; do +for case_name in historical_0151 historical_0201 historical_0251; do ./generate_reproduction_script.bash ${resolution} ${case_name} diff ../run_scripts/v2/reproduce/run.v2.${resolution}.${case_name}.sh run.v2.${resolution}.${case_name}.sh mv run.v2.${resolution}.${case_name}.sh ../run_scripts/v2/reproduce/run.v2.${resolution}.${case_name}.sh