source: dynamico_lmdz/aquaplanet/CMIP5a/RUN_AQUAPLANET_DYNAMICO_LMDZ5/example.sh @ 4063

Last change on this file since 4063 was 4048, checked in by dubos, 7 years ago

Aquaplanet CMIP5a : switch default output resolution to 144x142

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/bin/bash
2# How to use this script :
3# 1    Create a directory EXP for your experiment ; ALL commands below must be run from EXP
4# 2    Create a directory STORE to store the outputs of your experiment ; run "ln -s STORE storedir"
5# 3    run "BASE/example.sh init" where BASE is the directory containing this script
6# 4    (optional) Edit EXP/config.sh, EXP/run_icosa.def, EXP/*.xml
7# 5    run "./example.sh create" (NB : ./example.sh, NOT ../example.sh)
8# 6    run "./example.sh submit"
9
10function fullpath() 
11{ 
12    echo "$(cd -P $1 ; pwd)"
13}
14
15function years()
16{
17    for ((i="$1";i<="$2";i++)) ; do
18        echo $(printf 'year%02d' $i)
19    done
20}
21
22function cmd_create()
23{
24    source ./config.sh
25    env | grep YEARS
26    ls -l $PWD/storedir || (echo "$PWD/storedir is missing, please create it and retry." ; exit -1) || exit
27    STORE_ROOT=$( fullpath $PWD/storedir )
28    YEARS=$(years 1 $NB_YEARS)
29    for DIR in ce0l $YEARS ; do
30        rm -rf $DIR $STORE_ROOT/$DIR
31    done
32    STORE0L="$STORE_ROOT/ce0l"
33    $BASEDIR/prepare.sh ce0l ce0l "$STORE0L"
34    $BASEDIR/prepare.sh first $STORE0L year01 "$STORE_ROOT/year01"
35    PREV=year01
36    for YEAR in $(years 2 $NB_YEARS) ; do
37        $BASEDIR/prepare.sh next  $STORE0L "$STORE_ROOT/$PREV" $YEAR "$STORE_ROOT/$YEAR"
38        PREV=$YEAR
39    done
40}
41
42function submit_X64_CURIE()
43{
44    EXP=$1 ; shift
45    CMD="ccc_msub $* $EXP/job.sh"
46    MSG=$($CMD)
47    echo "$CMD : $MSG"
48    JOBID=$( echo "$MSG" | awk '{print $NF}' )
49    DEP="-a $JOBID"
50}
51
52function cmd_submit()
53{
54    source ./config.sh
55    DEP=""
56    submit_$ARCH ce0l
57    for YEAR in $(years 1 $NB_YEARS) ; do
58        submit_$ARCH $YEAR $DEP
59    done
60}
61
62function cmd_init()
63{
64    cp -fp $BASEDIR/*.sh $BASEDIR/*.xml $BASEDIR/*.def .
65    cat > config.sh <<EOF
66ARCH=X64_CURIE
67BASEDIR=$BASEDIR
68ESM_ROOT=$ESM_ROOT
69NB_YEARS=10
70NB_MPI_DYNAMICO=160
71NB_MPI_XIOS=16
72NB_MPI_CE0L=16
73JOB_WALLTIME=7200
74EOF
75    ls -lrh
76    echo
77    echo "$PWD/config.sh :"
78    cat config.sh
79    echo "If not done already, please create $PWD/storedir." 
80    echo 'You may edit config.sh, *.def, *.xml then run ./example.sh create'
81}
82
83function cmd_()
84{
85echo
86}
87
88BASEDIR=$(dirname ${BASH_SOURCE[0]})
89BASEDIR=$( fullpath $BASEDIR )
90ESM_ROOT=$( fullpath $BASEDIR/../../ )
91echo "Your command : $0 $*"
92echo "Script base dir : $BASEDIR"
93echo "Run from : $(fullpath $PWD)"
94echo "Usage : $0 [init|create|submit]"
95cmd_$1
Note: See TracBrowser for help on using the repository browser.