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