1 |
# This is a script in Bash. |
2 |
|
3 |
# This script collects input files necessary for the program "gcm" and |
4 |
# runs "gcm". Run this script in the directory where you want "gcm" to run. |
5 |
# The "ln" command does not report missing targets, so we check them first. |
6 |
|
7 |
trap 'echo -e \\a; exit 1' ERR |
8 |
|
9 |
# Specify directories: |
10 |
|
11 |
REL_dir=/usr/local/guez/LMDZ_work/LMDZE/Results_etat0_lim |
12 |
##REL_dir=$workdir/LMDZE/Results_etat0_lim |
13 |
|
14 |
IGCM_dir=~/Documents/Around_LMDZ/Around_LMDZE/Input_gcm |
15 |
##IGCM_dir=~ |
16 |
|
17 |
executable_dir=/usr/local/guez/LMDZ_work/LMDZE/Compil_prod_g95 |
18 |
##executable_dir=$workdir/LMDZE/Compil_prod |
19 |
|
20 |
RGCM_dir=/usr/local/guez/LMDZ_work/LMDZE/Results_gcm |
21 |
##RGCM_dir=$workdir/LMDZE/Results_gcm |
22 |
# (used only for a restart or a comparison) |
23 |
|
24 |
set -x |
25 |
|
26 |
test -d $REL_dir |
27 |
test -d $IGCM_dir |
28 |
test -d $executable_dir |
29 |
|
30 |
set +x |
31 |
|
32 |
read -p \ |
33 |
"Identifier for the set of parameters (\"*.def\" files and namelists)? " \ |
34 |
igcm_id |
35 |
read -p \ |
36 |
"Run number of \"etat0_lim\", for \"limit.nc\" and \"coefoz_LMDZ.nc\"? " \ |
37 |
numb_cr |
38 |
|
39 |
read -p \ |
40 |
"Do you want to restart from the end of a previous \"gcm\" run? (y/[n]) " \ |
41 |
restart |
42 |
if [[ $restart = y ]] |
43 |
then |
44 |
echo "Previous run number of \"gcm\" for \"start.nc\" and \"startphy.nc\ ?" |
45 |
read prev_gcm |
46 |
fi |
47 |
|
48 |
set -x |
49 |
|
50 |
my_host=`hostname` |
51 |
|
52 |
if [[ $my_host = vierne ]] |
53 |
then |
54 |
# This is only useful if the program was compiled with G95: |
55 |
G95_FPU_UNDERFLOW=${G95_FPU_UNDERFLOW:+No} |
56 |
G95_FPU_INVALID=${G95_FPU_INVALID:+No} |
57 |
fi |
58 |
|
59 |
test -f $REL_dir/$numb_cr/limit.nc |
60 |
ln -f -s $REL_dir/$numb_cr/limit.nc . |
61 |
|
62 |
if [[ -f $REL_dir/$numb_cr/coefoz_LMDZ.nc ]] |
63 |
then |
64 |
ln -f -s $REL_dir/$numb_cr/coefoz_LMDZ.nc . |
65 |
fi |
66 |
|
67 |
if [[ $restart != y ]] |
68 |
then |
69 |
# Start-up files come from "etat0_lim": |
70 |
ln -f -s $REL_dir/$numb_cr/start*.nc . |
71 |
else |
72 |
ln -f -s $RGCM_dir/$prev_gcm/restart.nc start.nc |
73 |
ln -f -s $RGCM_dir/$prev_gcm/restartphy.nc startphy.nc |
74 |
fi |
75 |
|
76 |
rm -f *.def |
77 |
test -f $IGCM_dir/$igcm_id/run.def |
78 |
ln -s $IGCM_dir/$igcm_id/*.def . |
79 |
date |
80 |
|
81 |
if [[ $my_host = brodie ]] |
82 |
then |
83 |
rsh brodie01 \ |
84 |
export F_PROGINF=YES\; \ |
85 |
cd $PWD\; \ |
86 |
$executable_dir/gcm <$IGCM_dir/$igcm_id/gcm_nml.txt >gcm_out.txt \ |
87 |
2>gcm_err.txt |
88 |
elif [[ $my_host = zahir* ]] |
89 |
then |
90 |
hpmcount $executable_dir/gcm \ |
91 |
<$IGCM_dir/$igcm_id/gcm_nml.txt >gcm_out.txt 2>gcm_err.txt |
92 |
else |
93 |
time $executable_dir/gcm \ |
94 |
<$IGCM_dir/$igcm_id/gcm_nml.txt >gcm_out.txt 2>gcm_err.txt |
95 |
fi |
96 |
|
97 |
echo -e '\a' # beep |
98 |
set +x |
99 |
read -p "Previous run number for comparison [none] ? " |
100 |
if [[ -n $REPLY ]] |
101 |
then |
102 |
selective_diff.sh $RGCM_dir/$REPLY . |
103 |
fi |