source: BOL/script_install/instal1d.sh @ 2032

Last change on this file since 2032 was 1876, checked in by Laurent Fairhead, 11 years ago

Correcting some strange shell behaviour

  • Property svn:executable set to *
File size: 5.9 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 L39 and L40
12# 4) runs a subset of the cases
13###############################################################################
14
15# Check in ~lmdz/WWW/DistribG95 which 1d version to use
16version1d=20130717
17modele=""
18if [ "$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
31fi
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###############################################################################
39cd $modele
40LMDGCM=`pwd`
41LMDlibf=$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###############################################################################
47cd $LMDGCM/modipsl/modeles
48new1d=`svn info LMDZ5 | grep Revision | awk ' { fl = 0 ; if ( $2 > 1699 )  fl=1 ; print fl } '`
49echo new1d $new1d
50if [ $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
55fi
56
57###############################################################################
58# Downloading modified source files and input files
59###############################################################################
60cd $LMDGCM
61interne=no # can be modified once the files have been downloaded
62           # in order to take them directly on your computer
63if [ $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}
68else
69   cp -a /home/jygz/LMDZ/SLMDZ/LMDZ5_source_20120112/lmdz1d_source_20120112 .
70   source=${LMDGCM}/lmdz1d_source_20120112
71fi
72
73################################################################################
74# Creating directory for 1d cases
75################################################################################
76if [ -d 1dcases ] ; then
77  echo '1dcases existe deja'
78  echo 'on continue'
79else
80  echo 'creation du directory 1dcases'
81  mkdir 1dcases
82fi
83cd 1dcases
84
85for 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
94done
95
96
97
98################################################################################
99# Installing source files and compiling
100################################################################################
101cd $LMDlibf
102chmod +x ../tools/install_1d_src.sh
103../tools/install_1d_src.sh
104
105##   Nettoyage
106\rm -r ${source}
107#
108cd ${LMDlibf}/..
109\rm -f makefile
110./makegcm -d 39 -p 1d lmdz1d
111if [ -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
118else
119 echo Compilation aborted
120 exit
121fi
122
123echo '#########################################################################'
124echo '   1D test cases'
125echo '#########################################################################'
126
127echo ====================================
128echo TEST CASE : toga' (1 month)'
129echo ====================================
130echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end
131cd ${LMDGCM}/1dcases/toga
132./xqt.x NPv3.1
133\rm tmp.jnl ; touch tmp.jnl
134rm -f var.gif
135cat <<eod>> tmp.jnl
136use histhf_NPv3.1.nc
137shade/title="cas toga: cloud fraction (-)" rneb
138frame/file=var.gif
139eod
140ferret <<eod
141go tmp.jnl
142quit
143eod
144display var.gif
145rm -f tmp.jnl
146rm -f var.gif
147
148echo ====================================
149echo TEST CASE : twpice
150echo ====================================
151echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end
152cd ../twpice
153./xqt.x NPv3.1
154\rm tmp.jnl ; touch tmp.jnl
155rm -f var.gif
156cat <<eod>> tmp.jnl
157use histLES_NPv3.1.nc
158shade/title="cas twpice: cloud fraction (-)" rneb
159frame/file=var.gif
160eod
161ferret <<eod
162go tmp.jnl
163quit
164eod
165display var.gif
166rm -f tmp.jnl
167rm -f var.gif
168
169armcu=1
170if [ $armcu = 1 ] ; then
171echo ====================================
172echo TEST CASE : arm_cu
173echo ====================================
174echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end
175cd ../arm_cu
176./compile.x
177ln -s lmdz1d_L40.e lmdz1d.e
178./xqt.x NPv3.1
179\rm tmp.jnl ; touch tmp.jnl
180rm -f var.gif
181cat <<eod>> tmp.jnl
182use histmth_NPv3.1.nc
183shade/title="cas arm_cu: cloud fraction (-)" rneb
184frame/file=var.gif
185eod
186ferret <<eod
187go tmp.jnl
188quit
189eod
190display var.gif
191rm -f tmp.jnl
192rm -f var.gif
193fi
194
Note: See TracBrowser for help on using the repository browser.