diff --git a/README.md b/README.md index 57b5969..82a60b3 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Miscellaneous pre- and post-processing scripts for NorESM - mg_budget_plot.py: Script for plotting the the tendency terms that contribute to the total tendencies of the cloud microphysics scheme by Morrison and Gettelman in NorESM2/CAM6 - PostProc: Scripts for post processing model output - rcat_noresm.sh: Concatenate and compress NorESM model output +- RunScript: sample run scripts - Utilities: Miscellaneous scripts and programs - buildCPRNC_NIRD.sh: File to build the cprnc tool needed by rcat_noresm.sh - test_rcat_noresm.sh: Unit tests for rcat_noresm.sh diff --git a/RunScript/run_noresm/run_noresm3.sh b/RunScript/run_noresm/run_noresm3.sh new file mode 100755 index 0000000..901c3f3 --- /dev/null +++ b/RunScript/run_noresm/run_noresm3.sh @@ -0,0 +1,253 @@ +#!/usr/bin/env bash +set -eu -o pipefail; shopt -s failglob + +## Account settings +PROJECT="nn9560k" # Where source code is located +ACCOUNT="nn9560k" # Who pays for CPU hours +## See .../query_testlists --list machine +MACHINE=${MACHINE:-"betzy"} +## See .../query_testlists --list compiler +COMPILER=${COMPILER:-"intel"} + +## What base tag version of NorESM are we testing +TAG=${TAG:-"noresm3_0_alpha03b"} +SRC_LABEL=${TAG} + +## LABEL is the case name that will be used for the test +LABEL=${LABEL:-"3.0a03b"} + +## Case label (overwrite) +LABEL="rest-NOIIAJRARYF6162OC_20250506.${LABEL}" +#LABEL="hybrid_fates-nocomp.${LABEL}" +# LABEL="hybrid_fatesnocomp.${LABEL}" +timestamp=$(date +"%Y%m%d") + +## Compset long name +CSHORT=${CSHORT:-"n1850"} +CTIME=${CTIME:-"1850"} +CATM=${CATM:-"CAM70%LT%NORESM%CAMoslo"} +#CLND=${CLND:-"CLM60%FATES-NOCOMP"} +CLND=${CLND:-"CLM60%FATES"} +CICE=${CICE:-"CICE"} +COCE=${COCE:-"BLOM%HYB%ECO"} +CROF=${CROF:-"MOSART"} +CGLC=${CFLC:-"DGLC%NOEVOLVE"} +CWAV=${CWAV:-"SWAV"} +COMPSET=${COMPSET:-"${CTIME}_${CATM}_${CLND}_${CICE}_${COCE}_${CROF}_${CGLC}_${CWAV}_SESP"} + +## Resolution +RES=${RES:-"ne30pg3_tn14"} +RES_LABEL=${RES_LABEL:-"ne30_tn14"} + +## Component settings +## BLOM_TAG: This can be either a tag or a branch +## tag: "" +## branch: "develop/" +## BLOM_REPO: source for development version, either url to remote +## repository or local path +BLOM_DEVELOP="no" +if [ "${BLOM_DEVELOP}" == "yes" ]; then + #BLOM_LABEL=${BLOM_LABEL:-"output_switches"} + #BLOM_LABEL=${BLOM_LABEL:-"master"} + #BLOM_TAG=${BLOM_TAG:-"${BLOM_LABEL}"} # Use this for tags + #BLOM_TAG=${BLOM_TAG:-"develop/${BLOM_LABEL}"} # Use this for branches + BLOM_REPO=${BLOM_REPO:-"https://github.com/NorESMhub/BLOM"} + #BLOM_REPO=${BLOM_REPO:-"https://github.com/TomasTorsvik/BLOM-TTfork"} + #BLOM_REPO=${BLOM_REPO:-"https://github.com/jmaerz/BLOM"} + SRC_LABEL="${SRC_LABEL}.BLOM-${BLOM_LABEL}" +fi + +## Decide if you run model in debug mode +## - Debug flags enabled +RUN_DEBUG_MODE="no" + +## Decied if we run with the --run-unsupported flag +## This should be used for compsets for which there are no +## science supported experiments available +RUN_UNSUPPORTED="yes" + +## Decide whether or not to run manage_externals/checkout_externals +## While this is not perfect, it works if used consistently +## NB: If you check out the target tag from outside the script, +## be sure to run checkout_externals yourself, this script might +## miss it. +RUN_CHECKOUT="no" + +## Source and case directories +REPO=${REPO:-"https://github.com/NorESMhub/NorESM"} +SRCROOT="/cluster/projects/${PROJECT}/${USER}/NorESM/src/${SRC_LABEL}" +CASEROOT="/cluster/projects/${PROJECT}/${USER}/NorESM/cases" +CASENAME="${CSHORT}.${RES_LABEL}.${LABEL}.${timestamp}" +CASEDIR="${CASEROOT}/${CASENAME}" +RUNDIR="/cluster/work/users/${USER}/noresm/${CASENAME}/run/" + +## Include usermods? +USE_USERMODS="yes" +if [ "${USE_USERMODS}" == "yes" ]; then + USERMODS="${SRCROOT}/cime_config/usermods_dirs/reduced_out_devsim/" +fi + +# Copy this run script to CASEDIR +COPY_THIS_FILE="yes" +this_file="${PWD}/"; this_file+=$(basename "$0") +echo "Running ${this_file}" + + +##--- Function: Check for execution errors --- +perror() { + ## Print an error message and exit if a non-zero error code is passed + if [ $1 -ne 0 ]; then + echo "ERROR (${1}): ${2}" + exit $1 + fi +} + +##--- Checkout model source code --- +## (make sure that clone exists, otherwise, clone REPO) +if [ ! -d "${SRCROOT}" ]; then + git clone -o NorESM ${REPO} ${SRCROOT} + perror $? "running 'git clone -o NorESM ${REPO} ${SRCROOT}'" + RUN_CHECKOUT="yes" +fi + +## Ensure correct source is checked out +cd ${SRCROOT} +if [ "${RUN_CHECKOUT}" != "no" ]; then + if [ "$( git describe )" != "${TAG}" ]; then + git checkout ${TAG} + perror $? "running 'git checkout ${TAG}'" + fi + + #--- Checkout TAG version --- + ./bin/git-fleximod update + perror $? "running './bin/git-fleximod update'" + + #--- Checkout BLOM development version --- + if [ "${BLOM_DEVELOP}" == "yes" ]; then + cd components/blom + ## Remove old "develop" repo if present + if git config remote.develop.url > /dev/null; then + git remote rm develop + fi + git remote add develop ${BLOM_REPO} + git fetch --all + git fetch --tags --all + git checkout --detach ${BLOM_TAG} + git submodule update + cd ${SRCROOT} + fi +fi + + +##--- Create your case +cd ${SRCROOT} +if [ ! -d "${CASEDIR}" ]; then + ## Only run create_newcase if the case does not exist + echo "=== Creating new case ===" + cn_args=" --case ${CASEDIR} --compset ${COMPSET} --res ${RES} --project ${ACCOUNT} --machine ${MACHINE} --compiler ${COMPILER}" + if [ "${RUN_UNSUPPORTED}" == "yes" ]; then + cn_args="${cn_args} --run-unsupported" + fi + if [ "${USE_USERMODS}" == "yes" ]; then + cn_args="${cn_args} --user-mods-dir ${USERMODS}" + fi + ./cime/scripts/create_newcase ${cn_args} + perror $? "running './cime/scripts/create_newcase ${cn_args}'" +fi + + +## Move to your case directory +cd ${CASEDIR} +perror $? "trying 'cd ${CASEDIR}'" +if [ "${COPY_THIS_FILE}" == "yes" ]; then + cp ${this_file} ${CASEDIR} + perror $? "running 'cp ${this_file} ${CASEDIR}'" +fi + + +## Copy noresm setup files +#NORESM_SETUP_DIR="/cluster/projects/nn9560k/tomast/NorESM/src/" +#cp -r ${NORESM_SETUP_DIR}/SourceMods/hybrid_wavparam_fatessp/* ./SourceMods/ + + +## Any PE changes must go here +./xmlchange NTASKS=1920 +./xmlchange NTASKS_OCN=256 +./xmlchange ROOTPE=0 +./xmlchange ROOTPE_OCN=1920 + +## Set up the case as configured so far +echo "=== Setup for new case ===" +./case.setup +perror $? "trying './case.setup'" + +## Changes that affect the build go here +./xmlchange STOP_OPTION=nyears +./xmlchange STOP_N=4 +./xmlchange REST_N=1 +./xmlchange REST_OPTION=nyears +./xmlchange RESUBMIT=0 +./xmlchange --subgroup case.run JOB_WALLCLOCK_TIME=48:00:00 +./xmlchange --subgroup case.st_archive JOB_WALLCLOCK_TIME=03:00:00 + +## Changes to user_nl_* files goes here +cat <> user_nl_cam +use_aerocom = .false. +interpolate_nlat = 192 +interpolate_nlon = 288 +interpolate_output = .true. +history_aerosol = .false. +zmconv_c0_lnd = 0.0075D0 +zmconv_c0_ocn = 0.0300D0 +zmconv_ke = 5.0E-6 +zmconv_ke_lnd = 1.0E-5 +clim_modal_aero_top_press = 1.D-4 +micro_mg_dcs = 600.D-6 +bndtvg = '/cluster/shared/noresm/inputdata/atm/cam/ggas/noaamisc.r8.nc' +EOF +perror $? "adding variables to user_nl_cam" + + +# cat <> user_nl_blom +# ICFILE = "/cluster/shared/noresm/inputdata/restart/NOIIAJRAOC20TR_TL319_tn14_ppm_20240816/rest/1775-01-01-00000/NOIIAJRAOC20TR_TL319_tn14_ppm_20240816.blom.r.1775-01-01-00000.nc" +# EOF +# cat <> user_nl_blom +# ICFILE = "/cluster/shared/noresm/inputdata/restart/NOIIAJRAOC_TL319_tn14_3.0a3_newmix_20250430/rest/0062-01-01-00000/NOIIAJRAOC_TL319_tn14_3.0a3_newmix_20250430.blom.r.0062-01-01-00000.nc" +# EOF +cat <> user_nl_blom +ICFILE = "/cluster/shared/noresm/inputdata/restart/NOIIAJRARYF6162OC.TL319_tn14.3.0a03a.20250506/rest/1774-01-01-00000/NOIIAJRARYF6162OC.TL319_tn14.3.0a03a.20250506.blom.r.1774-01-01-00000.nc" +EOF +perror $? "adding variables to user_nl_blom" + +# cat <> user_nl_cice +# ice_ic = "/cluster/shared/noresm/inputdata/restart/NOIIAJRAOC20TR_TL319_tn14_ppm_20240816/rest/1775-01-01-00000/NOIIAJRAOC20TR_TL319_tn14_ppm_20240816.cice.r.1775-01-01-00000.nc" +# EOF +# cat <> user_nl_cice +# ice_ic = "/cluster/shared/noresm/inputdata/restart/NOIIAJRAOC_TL319_tn14_3.0a3_newmix_20250430/rest/0062-01-01-00000/NOIIAJRAOC_TL319_tn14_3.0a3_newmix_20250430.cice.r.0062-01-01-00000.nc" +# EOF +cat <> user_nl_cice +ice_ic = "/cluster/shared/noresm/inputdata/restart/NOIIAJRARYF6162OC.TL319_tn14.3.0a03a.20250506/rest/1774-01-01-00000/NOIIAJRARYF6162OC.TL319_tn14.3.0a03a.20250506.cice.r.1774-01-01-00000.nc" +EOF +perror $? "adding variables to user_nl_cice" + +cat <> user_nl_clm +use_fates_nocomp = .true. +use_fates_fixed_biogeog = .true. +use_fates_luh = .false. +fates_radiation_model = 'twostream' +finidat = '/cluster/work/users/kjetisaa/archive/i1850.FATES-NOCOMP-noLU_cal15_twosteam.ne30pg3_tn14.noresm3_0_alpha01.20250326/rest/0101-01-01-00000/i1850.FATES-NOCOMP-noLU_cal15_twosteam.ne30pg3_tn14.noresm3_0_alpha01.20250326.clm2.r.0101-01-01-00000.nc' +fates_history_dimlevel = 1,1 +EOF +perror $? "adding variables to user_nl_clm" + + +## Build and submit case +echo "=== Build the case ===" +./preview_namelists +./case.build +perror $? "trying './case.build'" + + +echo "=== Submit the case ===" +./case.submit +perror $? "trying './case.submit'" diff --git a/RunScript/run_test/run_noresm_BLOMdev_test.sh b/RunScript/run_test/run_noresm_BLOMdev_test.sh new file mode 100755 index 0000000..c337a71 --- /dev/null +++ b/RunScript/run_test/run_noresm_BLOMdev_test.sh @@ -0,0 +1,390 @@ +#!/usr/bin/env bash +set -eu -o pipefail; shopt -s failglob + +## Experiment settings +PROJECT="nn9560k" # Where source code is located +ACCOUNT="nn9560k" # Who pays for CPU hours +## See .../query_testlists --list machine +XML_MACHINE=${XML_MACHINE:-"betzy"} +## See .../query_testlists --list compiler +## Default: if not set, use all available compiler options +## options: "intel", "gnu" +XML_COMPILER=${XML_COMPILER:-""} + +## What base version of NorESM are we testing +## options: "noresm2.0", "noresm2.1", "noresm2.3", "noresm2.5", "noresm3.0" +NORESM_VERSION=${NORESM_VERSION:-"noresm3.0"} + +## See $SRCROOT/cime/scripts/query_testlists for all available options. +## NorESM categories have the suffix "_noresm" +## options: allactive, blom, cam, clm, hamocc +TEST_CATEGORY="blom" + +## Decide if you will generate baselines +## options: "yes", "no" +GENERATE_BASELINES="no" +# LABEL="feature-noresm3_0_alpha03b" # optional, default LABEL is generated from TAG +# BASELINE_NAME="noresm3_0_alpha03b" # optional, default is LABEL + +## Baseline comparison with release version should mainly refrence root folder +## options: "yes", "no" +MAKE_RELEASE_TEST="no" + +## Decide if you will compare against baselines +## options: "yes", "no" +COMPARE_BASELINES="no" + +## Will we compare with a release version baseline? +## options: "yes", "no" +COMPARE_WITH_RELEASE="no" + +## Allow baseline overwrite +## options: "yes", "no" +OVERWRITE_BASELINES="yes" + +## TEST_TYPE : "c" : XML_CATEGORY +## "f" : FILE +## "s" : single test +TEST_TYPE="s" + +## Decide if you run model in debug mode +## - Debug flags enabled +## options: "yes", "no" +RUN_DEBUG_MODE="no" + +## Decide if you want to retry failed tests +## >0 implies --wait, i.e. the script will wait until +## submitted jobs have completed +RETRY=0 + +## Decied if we run with the --run-unsupported flag +## This should be used for compsets for which there are no +## science supported experiments available +## options: "yes", "no" +RUN_UNSUPPORTED="yes" + +## Decide whether or not to run manage_externals/checkout_externals +## While this is not perfect, it works if used consistently +## NB: If you check out the target tag from outside the script, +## be sure to run checkout_externals yourself, this script might +## miss it. +## options: "yes", "no" +RUN_CHECKOUT="no" + +##----------------------- + +##--- Test setup --- +## +##----- Test category +case ${TEST_CATEGORY} in + "allactive") + XML_CATEGORY=${XML_CATEGORY:-"prealpha_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/noresm_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/noresm_develop"} + #TESTFILE=${TESTFILE:-"${PWD}/ALL_testfile.txt"} + #TESTFILE=${TESTFILE:-"${PWD}/ALL_N2.3_testfile.txt"} + ;; + "blom") + XML_CATEGORY=${XML_CATEGORY:-"aux_blom_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/blom_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/blom_develop"} + #TESTFILE=${TESTFILE:-"${PWD}/BLOM_testfile.txt"} + ;; + "cam") + XML_CATEGORY=${XML_CATEGORY:-"aux_cam_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/cam_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/cam_develop"} + ;; + "clm") + XML_CATEGORY=${XML_CATEGORY:-"aux_clm_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/ctsm_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/ctsm_develop"} + ;; + "hamocc") + XML_CATEGORY=${XML_CATEGORY:-"aux_hamocc_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/blom_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/blom_develop"} + ;; + *) + echo "ERROR: Unknown TEST_CATEGORY ${TEST_CATEGORY}" + exit + ;; +esac +if [ "${MAKE_RELEASE_TEST}" == "yes" ]; then + BASELINE_ROOT="/cluster/shared/noresm/noresm_baselines" +fi +if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_ROOT="/cluster/shared/noresm/noresm_baselines" +fi +## +##----- Test type +case ${TEST_TYPE} in + "c") + TEST_TYPE_STR=${TEST_TYPE_STR:-"--xml-category ${XML_CATEGORY}"} + ;; + "f") + TEST_TYPE_STR=${TEST_TYPE_STR:-"--testfile ${TESTFILE}"} + ;; + "s") + ### single test from "blom" category + TESTNAME=${TESTNAME:-"SMS_D_Ld1.T62_tn14.NOINYOC.betzy_intel"} + #TESTNAME=${TESTNAME:-"SMS_D_Ld1.T62_tn14.NOINYOC.betzy_intel"} + #TESTNAME=${TESTNAME:-"PET_Ld3.T62_tn14.NOINY.betzy_intel"} + #TESTNAME=${TESTNAME:-"PEM_Ld3.T62_tn14.NOINY.betzy_intel"} + #TESTNAME=${TESTNAME:-"PET_Ld5.f19_tn14.N1850.betzy_intel"} + ### single test from "cam" category + #TESTNAME=${TESTNAME:-"ERP_D_Ln9.f19_f19_mtn14.QPC6.betzy_intel.cam-outfrq9s"} + ### single test from "allactive" category + #TESTNAME=${TESTNAME:-"SMS_D_Ld1.ne16pg3_tn14.N1850fates-sp.betzy_gnu.allactive-defaultio"} + #TESTNAME=${TESTNAME:-"SMS_D_Ld1.ne30pg3_tn14.N1850fates-sp.betzy_gnu.allactive-defaultio"} + #TESTNAME=${TESTNAME:-"SMS_D_Ld1.ne30pg3_tn14.N1850fates-nocomp.betzy_intel.allactive-defaultio"} + #TESTNAME=${TESTNAME:-"ERI.ne30pg3_tn14.N1850.betzy_intel.allactive-defaultio"} + #TESTNAME=${TESTNAME:-"ERS_Ld5.f19_tn14.NHIST.betzy_intel.allactive-defaultio"} + #TESTNAME=${TESTNAME:-"ERS_D_Ld4.ne30pg3_tn14.N2N1850.betzy_intel.allactive-defaultio"} + #TESTNAME=${TESTNAME:-"PFS.f09_tn14.NHISTfrc2.betzy_intel.allactive-defaultio"} + ### + TEST_TYPE_STR=${TEST_TYPE_STR:-"${TESTNAME}"} + ;; + *) + echo "ERROR: Unknown TEST_TYPE ${TEST_TYPE}" + exit + ;; +esac +## +##----- Model settings +## TAG should either be a release name, tag name or branch name +case ${NORESM_VERSION} in + "noresm2.0") + TAG=${TAG:-"release-noresm2.0.9"} + XML_COMPILER="intel" + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.0.8"} + else + case ${TEST_CATEGORY} in + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm2.0.7_v1.4.1"} + ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="no" + ;; + "noresm2.1") + TAG=${TAG:-"release-noresm2.1.3"} + XML_COMPILER="intel" + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.1.2"} + else + case ${TEST_CATEGORY} in + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm2.1.1_dev1.5.1.3"} + ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="no" + ;; + "noresm2.3") + TAG=${TAG:-"noresm2_3_alpha03"} + XML_COMPILER="intel" + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.1.4"} + else + case ${TEST_CATEGORY} in + "allactive") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_3_alpha03_dev1.7.1.4"} + ;; + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_3_alpha02"} + ;; + "cam") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_3_alpha02"} + ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="no" + ;; + "noresm2.5") + TAG=${TAG:-"noresm2_5_alpha09a"} + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.1.4"} + else + case ${TEST_CATEGORY} in + "allactive") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_5_alpha09a_dev1.7.1.4"} + ;; + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_5_alpha09a_dev1.7.1.4"} + ;; + #"cam") + # COMPARE_NAME=${COMPARE_NAME:-"noresm2_5_alpha08d"} + # ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="yes" + ;; + "noresm3.0") + TAG=${TAG:-"noresm3_0_alpha03b"} + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.1.4"} + else + case ${TEST_CATEGORY} in + "allactive") + COMPARE_NAME=${COMPARE_NAME:-"noresm3_0_alpha03b"} + ;; + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm3_0_alpha03b"} + ;; + #"cam") + # COMPARE_NAME=${COMPARE_NAME:-"noresm2_5_alpha08d"} + # ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="yes" + ;; + *) + echo "ERROR: Unknown NORESM_VERSION ${NORESM_VERSION}" + exit + ;; +esac + +## LABEL is the case name that will be used for the test +LABEL=${LABEL:-${TAG}} + +## Component settings +## BLOM_TAG: This can be either a tag or a branch +## tag: "" +## branch: "develop/" +## BLOM_REPO: source for development version, either url to remote +## repository or local path +BLOM_DEVELOP="yes" +if [ "${BLOM_DEVELOP}" == "yes" ]; then + BLOM_IS_TAG="no" + if [ "${BLOM_IS_TAG}" == "yes" ]; then + #BLOM_LABEL=${BLOM_LABEL:-"v1.4.1"} + #BLOM_LABEL=${BLOM_LABEL:-"v1.6.8"} + #BLOM_LABEL=${BLOM_LABEL:-"dev1.7.1.4"} + #BLOM_LABEL=${BLOM_LABEL:-"v1.7.2"} + BLOM_LABEL=${BLOM_LABEL:-"dev1.9.0.13"} + BLOM_TAG=${BLOM_TAG:-"${BLOM_LABEL}"} # Use this for tags + BLOM_REPO=${BLOM_REPO:-"https://github.com/NorESMhub/BLOM"} + else + BLOM_LABEL=${BLOM_LABEL:-"master"} + #BLOM_LABEL=${BLOM_LABEL:-"seaice_enhanced_gas_fluxes_noresm2.0"} + #BLOM_LABEL=${BLOM_LABEL:-"hamocc_reset_dustflx"} + #BLOM_LABEL=${BLOM_LABEL:-"main_add_gnu_tests"} + #BLOM_LABEL=${BLOM_LABEL:-"rpointers-update-blom"} + #BLOM_LABEL=${BLOM_LABEL:-"feature-whole_array_initialization"} + BLOM_TAG=${BLOM_TAG:-"develop/${BLOM_LABEL}"} # Use this for branches + BLOM_REPO=${BLOM_REPO:-"https://github.com/TomasTorsvik/BLOM-TTfork"} + #BLOM_REPO=${BLOM_REPO:-"https://github.com/matsbn/BLOM"} + #BLOM_REPO=${BLOM_REPO:-"https://github.com/mvdebolskiy/BLOM"} + fi + #BLOM_UNIT="cgs" + #SET_HAMOCC_ICE_LEADFRAC=${SET_HAMOCC_ICE_LEADFRAC:-"0.02"} + LABEL="${LABEL}_${BLOM_LABEL}" +fi + +## Source and case directories +REPO=${REPO:-"https://github.com/NorESMhub/NorESM"} +SRCROOT="/cluster/projects/${PROJECT}/${USER}/NorESM/src/${LABEL}" + + +##--- Function: Check for execution errors --- +perror() { + ## Print an error message and exit if a non-zero error code is passed + if [ $1 -ne 0 ]; then + echo "ERROR (${1}): ${2}" + exit $1 + fi +} + + +##--- Checkout model source code --- +## (make sure that clone exists, otherwise, clone REPO) +if [ ! -d "${SRCROOT}" ]; then + git clone -o NorESM ${REPO} ${SRCROOT} + perror $? "running 'git clone -o NorESM ${REPO} ${SRCROOT}'" + RUN_CHECKOUT="yes" +fi + +## Ensure correct source is checked out +cd ${SRCROOT} +if [ "${RUN_CHECKOUT}" != "no" ]; then + if [ "$( git describe )" != "${TAG}" ]; then + git checkout ${TAG} + perror $? "running 'git checkout ${TAG}'" + fi + + if [ "${USE_GITFLEXIMOD}" == "yes" ]; then + ./bin/git-fleximod update + perror $? "running './bin/git-fleximod update'" + else + ./manage_externals/checkout_externals + perror $? "running './manage_externals/checkout_externals'" + fi + + #--- Checkout BLOM development version --- + if [ "${BLOM_DEVELOP}" == "yes" ]; then + cd components/blom + ## Remove old "develop" repo if present + if git config remote.develop.url > /dev/null; then + git remote rm develop + fi + git remote add develop ${BLOM_REPO} + git fetch --all + git fetch --tags --all + git checkout --detach ${BLOM_TAG} + if [ "${USE_GITFLEXIMOD}" == "yes" ]; then + git submodule update + fi + cd ${SRCROOT} + fi +fi + + +##--- Create test case --- +cn_args=" --project ${ACCOUNT} --xml-machine ${XML_MACHINE}" +cn_args="${cn_args} --output-root ${USERWORK}/noresm/${LABEL} ${TEST_TYPE_STR}" +cn_args="${cn_args} --retry ${RETRY}" + +# check if compiler is set +if [ ! -z "${XML_COMPILER}" ]; then + cn_args="${cn_args} --xml-compiler ${XML_COMPILER}" +fi + +if [ "${GENERATE_BASELINES}" == "yes" ]; then + BASELINE_NAME=${BASELINE_NAME:-${LABEL}} # Do not overwrite if already set + cn_args="${cn_args} --baseline-root ${BASELINE_ROOT} --generate ${BASELINE_NAME}" +fi + +if [ "${COMPARE_BASELINES}" == "yes" ]; then + cn_args="${cn_args} --baseline-root ${COMPARE_ROOT} --compare ${COMPARE_NAME}" +fi + +if [ "${OVERWRITE_BASELINES}" == "yes" ]; then + cn_args="${cn_args} --allow-baseline-overwrite" +fi + + +./cime/scripts/create_test ${cn_args} +perror $? "running './cime/scripts/create_test ${cn_args}'" + diff --git a/RunScript/run_test/run_noresm_main_test.sh b/RunScript/run_test/run_noresm_main_test.sh new file mode 100755 index 0000000..e91d9ff --- /dev/null +++ b/RunScript/run_test/run_noresm_main_test.sh @@ -0,0 +1,340 @@ +#!/usr/bin/env bash +set -eu -o pipefail; shopt -s failglob + +## Experiment settings +PROJECT="nn9560k" # Where source code is located +ACCOUNT="nn9560k" # Who pays for CPU hours +## See .../query_testlists --list machine +XML_MACHINE=${XML_MACHINE:-"betzy"} +## See .../query_testlists --list compiler +## Default: if not set, use all available compiler options +## options: "intel", "gnu" +XML_COMPILER=${XML_COMPILER:-""} + +## What base version of NorESM are we testing +## options: "noresm2.0", "noresm2.1", "noresm2.3", "noresm2.5", "noresm3.0" +NORESM_VERSION=${NORESM_VERSION:-"noresm3.0"} + +## See $SRCROOT/cime/scripts/query_testlists for all available options. +## NorESM categories have the suffix "_noresm" +## options: allactive, blom, cam, clm, hamocc +TEST_CATEGORY="blom" + +## Decide if you will generate baselines +## options: "yes", "no" +GENERATE_BASELINES="no" + +## Baseline comparison with release version should mainly refrence root folder +## options: "yes", "no" +MAKE_RELEASE_TEST="no" + +## Decide if you will compare against baselines +## options: "yes", "no" +COMPARE_BASELINES="yes" + +## Will we compare with a release version baseline? +## options: "yes", "no" +COMPARE_WITH_RELEASE="no" + +## Allow baseline overwrite +## options: "yes", "no" +OVERWRITE_BASELINES="yes" + +## TEST_TYPE : "c" : XML_CATEGORY +## "f" : FILE +## "s" : single test +TEST_TYPE="c" + +## Decide if you run model in debug mode +## - Debug flags enabled +## options: "yes", "no" +RUN_DEBUG_MODE="no" + +## Decide if you want to retry failed tests +## >0 implies --wait, i.e. the script will wait until +## submitted jobs have completed +RETRY=0 + +## Decied if we run with the --run-unsupported flag +## This should be used for compsets for which there are no +## science supported experiments available +## options: "yes", "no" +RUN_UNSUPPORTED="yes" + +## Decide whether or not to run manage_externals/checkout_externals +## While this is not perfect, it works if used consistently +## NB: If you check out the target tag from outside the script, +## be sure to run checkout_externals yourself, this script might +## miss it. +## options: "yes", "no" +RUN_CHECKOUT="no" + +##----------------------- + +##--- Test setup --- +## +##----- Test category +case ${TEST_CATEGORY} in + "allactive") + XML_CATEGORY=${XML_CATEGORY:-"prealpha_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/noresm_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/noresm_develop"} + ;; + "blom") + XML_CATEGORY=${XML_CATEGORY:-"aux_blom_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/blom_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/blom_develop"} + ;; + "cam") + XML_CATEGORY=${XML_CATEGORY:-"aux_cam_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/cam_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/cam_develop"} + ;; + "clm") + XML_CATEGORY=${XML_CATEGORY:-"aux_clm_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/ctsm_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/ctsm_develop"} + ;; + "hamocc") + XML_CATEGORY=${XML_CATEGORY:-"aux_hamocc_noresm"} + BASELINE_ROOT=${BASELINE_ROOT:-"/cluster/shared/noresm/noresm_baselines/blom_develop"} + COMPARE_ROOT=${COMPARE_ROOT:-"/cluster/shared/noresm/noresm_baselines/blom_develop"} + ;; + *) + echo "ERROR: Unknown TEST_CATEGORY ${TEST_CATEGORY}" + exit + ;; +esac +if [ "${MAKE_RELEASE_TEST}" == "yes" ]; then + BASELINE_ROOT="/cluster/shared/noresm/noresm_baselines" +fi +if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_ROOT="/cluster/shared/noresm/noresm_baselines" +fi +## +##----- Test type +case ${TEST_TYPE} in + "c") + TEST_TYPE_STR=${TEST_TYPE_STR:-"--xml-category ${XML_CATEGORY}"} + ;; + "f") + #TESTFILE=${TESTFILE:-"${PWD}/BLOM_testfile.txt"} + TESTFILE=${TESTFILE:-"${PWD}/ALL_testfile.txt"} + TEST_TYPE_STR=${TEST_TYPE_STR:-"--testfile ${TESTFILE}"} + ;; + "s") + ### single test from "blom" category + #TESTNAME=${TESTNAME:-"ERP_Ld3.T62_tn14.NOINYOC.betzy_intel"} + #TESTNAME=${TESTNAME:-"ERP_Ld3_P256.T62_tn14.NOINYOC.betzy_intel"} + #TESTNAME=${TESTNAME:-"SMS_D_Ld1.T62_tn14.NOINYOC.betzy_intel"} + #TESTNAME=${TESTNAME:-"PET_Ld3.T62_tn14.NOINY.betzy_intel"} + #TESTNAME=${TESTNAME:-"PEM_Ld3.T62_tn14.NOINY.betzy_intel"} + #TESTNAME=${TESTNAME:-"PET_Ld5.f19_tn14.N1850.betzy_intel"} + #TESTNAME=${TESTNAME:-"ERS_D_Ld4.ne30pg3_tn14.N1850.betzy_intel"} + #TESTNAME=${TESTNAME:-"ERS_D_Ld4.ne30pg3_tn14.N2N1850.betzy_intel"} + #TESTNAME=${TESTNAME:-"ERS_Ld3.TL319_tn05.NOIIAJRA.betzy_intel.blom-hybrid"} + #TESTNAME=${TESTNAME:-"ERP_Ld3_P256.T62_tn14.NOINYOC.betzy_intel"} + ### single test from "allactive" category + #TESTNAME=${TESTNAME:-"SMS_D_Ld1.ne30pg3_tn14.N1850fates-sp.betzy_gnu.allactive-defaultio"} + TESTNAME=${TESTNAME:-"ERI.ne30pg3_tn14.N1850.betzy_intel.allactive-defaultio"} + #TESTNAME=${TESTNAME:-"ERR_Ld3.ne30pg3_tn14.N1850.betzy_intel.allactive-defaultio"} + #TESTNAME=${TESTNAME:-"ERS_Ld5.f19_tn14.NHIST.betzy_intel.allactive-defaultio"} + #TESTNAME=${TESTNAME:-"PFS.f09_tn14.NHISTfrc2.betzy_intel.allactive-defaultio"} + ### + TEST_TYPE_STR=${TEST_TYPE_STR:-"${TESTNAME}"} + ;; + *) + echo "ERROR: Unknown TEST_TYPE ${TEST_TYPE}" + exit + ;; +esac +## +##----- Model settings +## TAG should either be a release name, tag name or branch name +case ${NORESM_VERSION} in + "noresm2.0") + TAG=${TAG:-"release-noresm2.0.9"} + XML_COMPILER="intel" + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.0.8"} + else + case ${TEST_CATEGORY} in + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm2.0.7_v1.4.1"} + ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="no" + ;; + "noresm2.1") + TAG=${TAG:-"release-noresm2.1.3"} + XML_COMPILER="intel" + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.1.2"} + else + case ${TEST_CATEGORY} in + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm2.1.1_dev1.5.1.3"} + ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="no" + ;; + "noresm2.3") + TAG=${TAG:-"noresm2_3_alpha03"} + XML_COMPILER="intel" + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.1.4"} + else + case ${TEST_CATEGORY} in + "allactive") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_3_alpha03"} + ;; + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_3_alpha03"} + ;; + "cam") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_3_alpha03"} + ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="no" + ;; + "noresm2.5") + TAG=${TAG:-"noresm2_5_alpha09a"} + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.1.4"} + else + case ${TEST_CATEGORY} in + "allactive") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_5_alpha08d"} + ;; + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm2_5_alpha08d"} + ;; + #"cam") + # COMPARE_NAME=${COMPARE_NAME:-"noresm2_5_alpha08d"} + # ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="yes" + ;; + "noresm3.0") + TAG=${TAG:-"noresm3_0_alpha03a"} + if [ "${COMPARE_WITH_RELEASE}" == "yes" ]; then + COMPARE_NAME=${COMPARE_NAME:-"release-noresm2.1.4"} + else + case ${TEST_CATEGORY} in + "allactive") + COMPARE_NAME=${COMPARE_NAME:-"noresm3_0_alpha03"} + ;; + "blom" | "hamocc") + COMPARE_NAME=${COMPARE_NAME:-"noresm3_0_alpha03"} + ;; + "cam") + COMPARE_NAME=${COMPARE_NAME:-"noresm3_0_alpha03"} + ;; + "clm") + COMPARE_NAME=${COMPARE_NAME:-"noresm3_0_alpha03"} + ;; + *) + echo "No baseline comparison case selected." + ;; + esac + fi + ## Are we using git-fleximod? + USE_GITFLEXIMOD="yes" + ;; + *) + echo "ERROR: Unknown NORESM_VERSION ${NORESM_VERSION}" + exit + ;; +esac + +## LABEL is the case name that will be used for the test +LABEL=${LABEL:-${TAG}} + +## Source and case directories +REPO=${REPO:-"https://github.com/NorESMhub/NorESM"} +SRCROOT="/cluster/projects/${PROJECT}/${USER}/NorESM/src/${LABEL}" + + +##--- Function: Check for execution errors --- +perror() { + ## Print an error message and exit if a non-zero error code is passed + if [ $1 -ne 0 ]; then + echo "ERROR (${1}): ${2}" + exit $1 + fi +} + + +##--- Checkout model source code --- +## (make sure that clone exists, otherwise, clone REPO) +if [ ! -d "${SRCROOT}" ]; then + git clone -o NorESM ${REPO} ${SRCROOT} + perror $? "running 'git clone -o NorESM ${REPO} ${SRCROOT}'" + RUN_CHECKOUT="yes" +fi + +## Ensure correct source is checked out +cd ${SRCROOT} +if [ "${RUN_CHECKOUT}" != "no" ]; then + if [ "$( git describe )" != "${TAG}" ]; then + git checkout ${TAG} + perror $? "running 'git checkout ${TAG}'" + fi + + if [ "${USE_GITFLEXIMOD}" == "yes" ]; then + ./bin/git-fleximod update + perror $? "running './bin/git-fleximod update'" + else + ./manage_externals/checkout_externals + perror $? "running './manage_externals/checkout_externals'" + fi +fi + + +##--- Create test case --- +cn_args=" --project ${ACCOUNT} --xml-machine ${XML_MACHINE}" +cn_args="${cn_args} --output-root ${USERWORK}/noresm/${LABEL} ${TEST_TYPE_STR}" +cn_args="${cn_args} --retry ${RETRY}" + +# check if compiler is set +if [ ! -z "${XML_COMPILER}" ]; then + cn_args="${cn_args} --xml-compiler ${XML_COMPILER}" +fi + +if [ "${GENERATE_BASELINES}" == "yes" ]; then + BASELINE_NAME=${LABEL} + cn_args="${cn_args} --baseline-root ${BASELINE_ROOT} --generate ${BASELINE_NAME}" +fi + +if [ "${COMPARE_BASELINES}" == "yes" ]; then + cn_args="${cn_args} --baseline-root ${COMPARE_ROOT} --compare ${COMPARE_NAME}" +fi + +if [ "${OVERWRITE_BASELINES}" == "yes" ]; then + cn_args="${cn_args} --allow-baseline-overwrite" +fi + + +./cime/scripts/create_test ${cn_args} +perror $? "running './cime/scripts/create_test ${cn_args}'" +