source: BOL/script_install/instal1d.sh @ 2339

Last change on this file since 2339 was 2050, checked in by Laurent Fairhead, 10 years ago

New version

  • Property svn:executable set to *
File size: 6.6 KB
Line 
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
15PATH=~/bin:$PATH
16
17armcu=1
18toga=1
19twpice=1
20#
21llm=59
22
23# Check in ~lmdz/WWW/DistribG95 which 1d version to use
24version1d=20140428
25modele=""
26if [ "$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
39fi
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###############################################################################
47cd $modele
48LMDGCM=`pwd`
49LMDlibf=$LMDGCM/modipsl/modeles/LMDZ5/libf/
50cd $LMDlibf
51rev=`svn info -r BASE | grep vision | tail -1 | awk ' { print $NF } '`
52cd $LMDGCM
53
54###############################################################################
55# Check if the svn version is more recent than 1700
56# If not, an  older script must be used
57###############################################################################
58cd $LMDGCM/modipsl/modeles
59new1d=`svn info LMDZ5 | grep Revision | awk ' { fl = 0 ; if ( $2 > 1699 )  fl=1 ; print fl } '`
60echo new1d $new1d
61if [ $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
66fi
67
68###############################################################################
69# Downloading modified source files and input files
70###############################################################################
71cd $LMDGCM
72interne=no # can be modified once the files have been downloaded
73           # in order to take them directly on your computer
74if [ $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}
79else
80   cp -a /home/jygz/LMDZ/SLMDZ/LMDZ5_source_20120112/lmdz1d_source_20120112 .
81   source=${LMDGCM}/lmdz1d_source_20120112
82fi
83
84################################################################################
85# Creating directory for 1d cases
86################################################################################
87if [ -d 1dcases ] ; then
88  echo '1dcases existe deja'
89  echo 'on continue'
90else
91  echo 'creation du directory 1dcases'
92  mkdir 1dcases
93fi
94cd 1dcases
95
96for 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
105done
106
107
108
109################################################################################
110# Installing source files and compiling
111################################################################################
112
113if [ $rev -le 2015 ] ; then 
114cd $LMDlibf
115if [ -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
123else
124   cp -r phy1d phy1dorig # sauvegarde du phy1d d'origine
125fi
126chmod +x ../tools/install_1d_src.sh
127../tools/install_1d_src.sh
128fi
129
130##   Nettoyage
131\rm -r ${source}
132#
133cd ${LMDlibf}
134   physique=lmd
135if [ -d phy1d ] ; then
136   physique=1d
137fi
138
139cd ../
140\rm -f makefile
141./makelmdz -d ${llm} -p ${physique} lmdz1d
142if [ -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
149else
150 echo Compilation aborted
151 exit
152fi
153
154echo '#########################################################################'
155echo '   1D test cases'
156echo '#########################################################################'
157
158if [ $toga = 1 ] ; then
159echo ====================================
160echo TEST CASE : toga' (1 month)'
161echo ====================================
162echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end
163cd ${LMDGCM}/1dcases/toga
164./xqt.x NPv3.1
165\rm tmp.jnl ; touch tmp.jnl
166rm -f var.gif
167cat <<eod>> tmp.jnl
168use histhf_NPv3.1.nc
169shade/title="cas toga: cloud fraction (-)" rneb
170frame/file=var.gif
171eod
172ferret <<eod
173go tmp.jnl
174quit
175eod
176display var.gif :&
177rm -f tmp.jnl
178rm -f var.gif
179cd ..
180fi
181
182if [ $twpice = 1 ] ; then
183echo ====================================
184echo TEST CASE : twpice
185echo ====================================
186echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end
187cd twpice
188./xqt.x NPv3.1
189\rm tmp.jnl ; touch tmp.jnl
190rm -f var.gif
191cat <<eod>> tmp.jnl
192use histhf_NPv3.1.nc
193shade/title="cas twpice: cloud fraction (-)" rneb
194frame/file=var.gif
195eod
196ferret <<eod
197go tmp.jnl
198quit
199eod
200display -remote var.gif :&
201rm -f tmp.jnl
202rm -f var.gif
203cd ..
204fi
205
206if [ $armcu = 1 ] ; then
207echo ====================================
208echo TEST CASE : arm_cu
209echo ====================================
210echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end
211cd arm_cu
212./compile.x
213ln -s lmdz1d.e lmdz1d_L40.e
214./xqt.x NPv3.1
215\rm tmp.jnl ; touch tmp.jnl
216rm -f var.gif
217cat <<eod>> tmp.jnl
218use histhf_NPv3.1.nc
219shade/title="cas arm_cu: cloud fraction (-)" rneb
220frame/file=var.gif
221eod
222ferret <<eod
223go tmp.jnl
224quit
225eod
226display -remote var.gif :&
227rm -f tmp.jnl
228rm -f var.gif
229cd ..
230fi
231
Note: See TracBrowser for help on using the repository browser.