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=/home/guez/In_transit/LMDZE_work/Results_etat0_lim |
12 |
##REL_dir=$workdir/LMDZE/Results_etat0_lim |
13 |
|
14 |
IGCM_dir=~/Documents/Utilisation_LMDZ/Input_gcm |
15 |
##IGCM_dir=~ |
16 |
|
17 |
executable_dir=/home/guez/In_transit/LMDZE_work/Compil_prod |
18 |
##executable_dir=$workdir/LMDZE/Compil_prod |
19 |
|
20 |
RGCM_dir=/home/guez/In_transit/LMDZE_work/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 |
test -f $REL_dir/$numb_cr/coefoz_LMDZ.nc |
61 |
ln -f -s $REL_dir/$numb_cr/limit.nc $REL_dir/$numb_cr/coefoz_LMDZ.nc . |
62 |
|
63 |
if [[ $restart != y ]] |
64 |
then |
65 |
# Start-up files come from "etat0_lim": |
66 |
ln -f -s $REL_dir/$numb_cr/start*.nc . |
67 |
else |
68 |
ln -f -s $RGCM_dir/$prev_gcm/restart.nc start.nc |
69 |
ln -f -s $RGCM_dir/$prev_gcm/restartphy.nc startphy.nc |
70 |
fi |
71 |
|
72 |
rm -f *.def |
73 |
test -f $IGCM_dir/$igcm_id/run.def |
74 |
ln -s $IGCM_dir/$igcm_id/*.def . |
75 |
date |
76 |
|
77 |
if [[ $my_host = brodie ]] |
78 |
then |
79 |
rsh brodie01 \ |
80 |
export F_PROGINF=YES\; \ |
81 |
cd $PWD\; \ |
82 |
$executable_dir/gcm <$IGCM_dir/$igcm_id/gcm_nml.txt >gcm_out.txt \ |
83 |
2>gcm_err.txt |
84 |
elif [[ $my_host = zahir* ]] |
85 |
then |
86 |
hpmcount $executable_dir/gcm \ |
87 |
<$IGCM_dir/$igcm_id/gcm_nml.txt >gcm_out.txt 2>gcm_err.txt |
88 |
else |
89 |
time $executable_dir/gcm \ |
90 |
<$IGCM_dir/$igcm_id/gcm_nml.txt >gcm_out.txt 2>gcm_err.txt |
91 |
fi |
92 |
|
93 |
echo -e '\a' # beep |
94 |
set +x |
95 |
read -p "Previous run number for comparison [none] ? " |
96 |
if [[ -n $REPLY ]] |
97 |
then |
98 |
selective_diff.sh $RGCM_dir/$REPLY . |
99 |
fi |