1 | #!/bin/ksh |
---|
2 | |
---|
3 | ############################################################################### |
---|
4 | # Script for installing a 1D version of LMDZ. |
---|
5 | # LMDZ team. For questions : lmdz-svp@lmd.jussieu.fr |
---|
6 | # valid for svn version from 21/12/2012 (end of the world) or svn 1700 |
---|
7 | # |
---|
8 | # 1) Modifies the directory LMDZ.../modipsl/modeles/LMDZ5/libf/phy1d |
---|
9 | # which contains the single column version of the model. |
---|
10 | # 2) installs a series of test cases on LMDZ.../1dcases/ |
---|
11 | # 3) compile the lmdz1.F with vertical resolution L39 and L40 |
---|
12 | # 4) runs a subset of the cases |
---|
13 | ############################################################################### |
---|
14 | |
---|
15 | # Check in ~lmdz/WWW/DistribG95 which 1d version to use |
---|
16 | version1d=20130717 |
---|
17 | modele="" |
---|
18 | if [ "$modele" = "" ] ; then |
---|
19 | if [ -f install.sh ] ; then |
---|
20 | version=`sed -n "s/^version=//p" install.sh | tail -1` |
---|
21 | echo $version |
---|
22 | modele=`pwd`/LMDZ${version} |
---|
23 | elif [ -d modipsl ] ; then |
---|
24 | modele=`pwd` |
---|
25 | else |
---|
26 | echo "You should run instal1d.sh either in the directory" |
---|
27 | echo "containing install.sh, or in that containing modipsl" |
---|
28 | echo "or specify the path of LMDZ. modele=LMDZ... in instal1d.sh" |
---|
29 | exit |
---|
30 | fi |
---|
31 | fi |
---|
32 | |
---|
33 | ############################################################################### |
---|
34 | # Paths of main directories |
---|
35 | # Directories of simulations will be placed in |
---|
36 | # $modele/1dcases |
---|
37 | # Sources of physical routines in $modele/modipsl/modeles/LMDZ5/libf/phy1d |
---|
38 | ############################################################################### |
---|
39 | cd $modele |
---|
40 | LMDGCM=`pwd` |
---|
41 | LMDlibf=$LMDGCM/modipsl/modeles/LMDZ5/libf/ |
---|
42 | |
---|
43 | ############################################################################### |
---|
44 | # Check if the svn version is more recent than 1700 |
---|
45 | # If not, an older script must be used |
---|
46 | ############################################################################### |
---|
47 | cd $LMDGCM/modipsl/modeles |
---|
48 | new1d=`svn info LMDZ5 | grep Revision | awk ' { fl = 0 ; if ( $2 > 1699 ) fl=1 ; print fl } '` |
---|
49 | echo new1d $new1d |
---|
50 | if [ $new1d = 0 ] ; then |
---|
51 | echo Your model verison is too old for this instal1d.sh script |
---|
52 | echo You should use instead |
---|
53 | echo http://www.lmd.jussieu.fr/~lmdz/Distrib/install_old_archive/instal1d.sh |
---|
54 | exit |
---|
55 | fi |
---|
56 | |
---|
57 | ############################################################################### |
---|
58 | # Downloading modified source files and input files |
---|
59 | ############################################################################### |
---|
60 | cd $LMDGCM |
---|
61 | interne=no # can be modified once the files have been downloaded |
---|
62 | # in order to take them directly on your computer |
---|
63 | if [ $interne = no ] ; then |
---|
64 | wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/lmdz1d_source_${version1d}.tar.gz |
---|
65 | tar xvfz lmdz1d_source_${version1d}.tar.gz |
---|
66 | rm -f lmdz1d_source_${version1d}.tar.gz |
---|
67 | source=${LMDGCM}/lmdz1d_source_${version1d} |
---|
68 | else |
---|
69 | cp -a /home/jygz/LMDZ/SLMDZ/LMDZ5_source_20120112/lmdz1d_source_20120112 . |
---|
70 | source=${LMDGCM}/lmdz1d_source_20120112 |
---|
71 | fi |
---|
72 | |
---|
73 | ################################################################################ |
---|
74 | # Creating directory for 1d cases |
---|
75 | ################################################################################ |
---|
76 | if [ -d 1dcases ] ; then |
---|
77 | echo '1dcases existe deja' |
---|
78 | echo 'on continue' |
---|
79 | else |
---|
80 | echo 'creation du directory 1dcases' |
---|
81 | mkdir 1dcases |
---|
82 | fi |
---|
83 | cd 1dcases |
---|
84 | |
---|
85 | for cas in amma arm_cu ayotte case_e eq_rd_cv fire hapex92_init rico toga sanduref sandufast sanduslow twpice ; do |
---|
86 | if [ -d $cas ] ; then |
---|
87 | echo $cas existe deja |
---|
88 | echo 'on continue, mais il faudra verifier qu il ne manque rien dans '$cas |
---|
89 | else |
---|
90 | echo 'creation du directory de simulation '$cas |
---|
91 | cp -a ${source}/$cas . |
---|
92 | fi |
---|
93 | dir $cas |
---|
94 | done |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | ################################################################################ |
---|
99 | # Installing source files and compiling |
---|
100 | ################################################################################ |
---|
101 | cd $LMDlibf |
---|
102 | chmod +x ../tools/install_1d_src.sh |
---|
103 | ../tools/install_1d_src.sh |
---|
104 | |
---|
105 | ## Nettoyage |
---|
106 | \rm -r ${source} |
---|
107 | # |
---|
108 | cd ${LMDlibf}/.. |
---|
109 | \rm -f makefile |
---|
110 | ./makegcm -d 39 -p 1d lmdz1d |
---|
111 | if [ -f lmdz1d.e ] ; then |
---|
112 | mv lmdz1d.e lmdz1d_L39.e |
---|
113 | echo Compilation successfull |
---|
114 | for cas in amma ayotte case_e eq_rd_cv fire hapex92_init rico toga sanduref sandufast sanduslow twpice ; do |
---|
115 | rm -f ${LMDGCM}/1dcases/$cas/lmdz1d.e |
---|
116 | ln -s `pwd`/lmdz1d_L39.e ${LMDGCM}/1dcases/$cas/lmdz1d.e |
---|
117 | done |
---|
118 | else |
---|
119 | echo Compilation aborted |
---|
120 | exit |
---|
121 | fi |
---|
122 | |
---|
123 | echo '#########################################################################' |
---|
124 | echo ' 1D test cases' |
---|
125 | echo '#########################################################################' |
---|
126 | |
---|
127 | echo ==================================== |
---|
128 | echo TEST CASE : toga' (1 month)' |
---|
129 | echo ==================================== |
---|
130 | echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end |
---|
131 | cd ${LMDGCM}/1dcases/toga |
---|
132 | ./xqt.x NPv3.1 |
---|
133 | \rm tmp.jnl ; touch tmp.jnl |
---|
134 | rm -f var.gif |
---|
135 | cat <<eod>> tmp.jnl |
---|
136 | use histhf_NPv3.1.nc |
---|
137 | shade/title="cas toga: cloud fraction (-)" rneb |
---|
138 | frame/file=var.gif |
---|
139 | eod |
---|
140 | ferret <<eod |
---|
141 | go tmp.jnl |
---|
142 | quit |
---|
143 | eod |
---|
144 | display var.gif |
---|
145 | rm -f tmp.jnl |
---|
146 | rm -f var.gif |
---|
147 | |
---|
148 | echo ==================================== |
---|
149 | echo TEST CASE : twpice |
---|
150 | echo ==================================== |
---|
151 | echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end |
---|
152 | cd ../twpice |
---|
153 | ./xqt.x NPv3.1 |
---|
154 | \rm tmp.jnl ; touch tmp.jnl |
---|
155 | rm -f var.gif |
---|
156 | cat <<eod>> tmp.jnl |
---|
157 | use histLES_NPv3.1.nc |
---|
158 | shade/title="cas twpice: cloud fraction (-)" rneb |
---|
159 | frame/file=var.gif |
---|
160 | eod |
---|
161 | ferret <<eod |
---|
162 | go tmp.jnl |
---|
163 | quit |
---|
164 | eod |
---|
165 | display var.gif |
---|
166 | rm -f tmp.jnl |
---|
167 | rm -f var.gif |
---|
168 | |
---|
169 | armcu=1 |
---|
170 | if [ $armcu = 1 ] ; then |
---|
171 | echo ==================================== |
---|
172 | echo TEST CASE : arm_cu |
---|
173 | echo ==================================== |
---|
174 | echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end |
---|
175 | cd ../arm_cu |
---|
176 | ./compile.x |
---|
177 | ln -s lmdz1d_L40.e lmdz1d.e |
---|
178 | ./xqt.x NPv3.1 |
---|
179 | \rm tmp.jnl ; touch tmp.jnl |
---|
180 | rm -f var.gif |
---|
181 | cat <<eod>> tmp.jnl |
---|
182 | use histmth_NPv3.1.nc |
---|
183 | shade/title="cas arm_cu: cloud fraction (-)" rneb |
---|
184 | frame/file=var.gif |
---|
185 | eod |
---|
186 | ferret <<eod |
---|
187 | go tmp.jnl |
---|
188 | quit |
---|
189 | eod |
---|
190 | display var.gif |
---|
191 | rm -f tmp.jnl |
---|
192 | rm -f var.gif |
---|
193 | fi |
---|
194 | |
---|