generated from coderefinery/template-workshop-webpage
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from gold2718/share
Workshop contributions from Steve
- Loading branch information
Showing
3 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#! /bin/bash | ||
## Run an out-of-the-box N2000 experiment | ||
## but with reduced output. | ||
|
||
## Experiment basics, modify these for your experiment | ||
TAG=${TAG:-"release-noresm2.0.7"} | ||
COMPSET=${COMPSET:-"N2000"} | ||
RES=${RES:-"f19_tn14"} | ||
SRCROOT=${SRCROOT:-"/cluster/projects/nn1001k/xxUSERxx/NorESM"} | ||
CASEDIR=${CASEDIR:-"/cluster/work/users/xxUSERxx/cases"} | ||
REPO=${REPO:-"https://github.com/NorESMhub/NorESM"} | ||
PROJECT=${PROJECT:-"nn9039k"} | ||
STOP_OPTION=${STOP_OPTION:-"ndays"} | ||
STOP_N=${STOP_N:-"5"} | ||
|
||
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 | ||
} | ||
|
||
## 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" | ||
|
||
## (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 [ "$( git describe )" != "${TAG}" ]; then | ||
git checkout ${TAG} | ||
perror $? "running 'git checkout ${TAG}'" | ||
RUN_CHECKOUT="yes" | ||
fi | ||
if [ "${RUN_CHECKOUT}" != "no" ]; then | ||
./manage_externals/checkout_externals | ||
perror $? "running './manage_externals/checkout_externals'" | ||
fi | ||
|
||
## Create your case | ||
## Because the TAG above is a techical release most compset / res | ||
## combinations are unsuported. | ||
if [ ! -d "${CASEDIR}" ]; then | ||
## Only run create_newcase if the case does not exist | ||
cn_args=" --case ${CASEDIR} --compset ${COMPSET} --res ${RES} --project ${PROJECT}" | ||
cn_args="${cn_args} --run-unsupported" | ||
./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}'" | ||
|
||
## Any PE changes must go here | ||
|
||
## Set up the case as configured so far | ||
if [ ! -f "CaseStatus" ]; then | ||
## Setup the case if it looks like it has not been setup | ||
./case.setup | ||
perror $? "trying './case.setup'" | ||
fi | ||
|
||
## Changes that affect the build go here | ||
# Testing a short run first with DEBUG=TRUE is valuable | ||
# Comment out change for longer runs | ||
#./xmlchange DEBUG=TRUE | ||
#perror $? "trying './xmlchange DEBUG=TRUE'" | ||
./xmlchange STOP_OPTION=${STOP_OPTION},STOP_N=${STOP_N} | ||
perror $? "trying './xmlchange STOP_OPTION=${STOP_OPTION},STOP_N=${STOP_N}'" | ||
|
||
## Build the model | ||
./case.build | ||
perror $? "trying './case.build'" | ||
|
||
## Last chance to modify run-time settings | ||
cat <<EOF >> user_nl_cam | ||
history_chemistry = .false. | ||
history_chemspecies_srf = .false. | ||
history_clubb = .false. | ||
EOF | ||
perror $? "adding variables to user_nl_cam" | ||
|
||
## Submit the job | ||
./case.submit | ||
perror $? "trying './case.submit'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#! /bin/bash | ||
## Run an out-of-the-box N2000 experiment for 13 months | ||
## but with reduced output. | ||
|
||
## Experiment basics, modify these for your experiment | ||
TAG="release-noresm2.0.7" | ||
COMPSET="N2000" | ||
RES="f19_tn14" | ||
SRCROOT="/cluster/projects/nn1001k/xxUSERxx/NorESM" | ||
CASEDIR="/cluster/work/users/xxUSERxx/cases" | ||
REPO="https://github.com/NorESMhub/NorESM" | ||
PROJECT="nn9039k" | ||
|
||
## (make sure that clone exists, otherwise, clone REPO) | ||
if [ ! -d "${SRCROOT}" ]; then | ||
git clone -o NorESM ${REPO} ${SRCROOT} | ||
fi | ||
|
||
## Ensure correct source is checked out | ||
cd ${SRCROOT} | ||
git checkout ${TAG} | ||
./manage_externals/checkout_externals | ||
|
||
## Create your case | ||
## Because the TAG above is a techical release most compset / res | ||
## combinations are unsuported. | ||
./cime/scripts/create_newcase --case ${CASEDIR} --compset ${COMPSET} --res ${RES} \ | ||
--project ${PROJECT} --run-unsupported | ||
|
||
## Move to your case directory | ||
cd ${CASEDIR} | ||
|
||
## Any PE changes must go here | ||
|
||
## Set up the case as configured so far | ||
./case.setup | ||
|
||
## Changes that affect the build go here | ||
# Testing a short run first with DEBUG=TRUE is valuable | ||
# Comment out change for longer runs | ||
#./xmlchange DEBUG=TRUE | ||
./xmlchange STOP_OPTION=nmonths,STOP_N=13 | ||
|
||
## Build the model | ||
./case.build | ||
|
||
## Last chance to modify run-time settings | ||
echo "history_chemistry = .false." >> user_nl_cam | ||
echo "history_chemspecies_srf = .false." >> user_nl_cam | ||
echo "history_clubb = .false." >> user_nl_cam | ||
|
||
## Submit the job | ||
./case.submit |