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