source: BOL/script_install/instal1d.sh @ 2971

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

New version

  • Property svn:executable set to *
File size: 6.6 KB
RevLine 
[1693]1#!/bin/ksh
[1704]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
[1693]7#
[1704]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/
[2050]11# 3) compile the lmdz1.F with vertical resolution L59 and L40
[1704]12# 4) runs a subset of the cases
13###############################################################################
[1693]14
[2033]15PATH=~/bin:$PATH
16
17armcu=1
18toga=1
19twpice=1
[2050]20#
21llm=59
[2033]22
[1726]23# Check in ~lmdz/WWW/DistribG95 which 1d version to use
[2035]24version1d=20140428
[1704]25modele=""
26if [ "$modele" = "" ] ; then
27   if [ -f install.sh ] ; then
[1841]28      version=`sed -n "s/^version=//p" install.sh | tail -1`
[1704]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
[1693]40
[1704]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###############################################################################
[1693]47cd $modele
48LMDGCM=`pwd`
[1704]49LMDlibf=$LMDGCM/modipsl/modeles/LMDZ5/libf/
[2050]50cd $LMDlibf
51rev=`svn info -r BASE | grep vision | tail -1 | awk ' { print $NF } '`
52cd $LMDGCM
[1693]53
[1704]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
[1693]67
[1704]68###############################################################################
69# Downloading modified source files and input files
70###############################################################################
[1693]71cd $LMDGCM
[1704]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
[1726]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}
[1693]79else
[1704]80   cp -a /home/jygz/LMDZ/SLMDZ/LMDZ5_source_20120112/lmdz1d_source_20120112 .
81   source=${LMDGCM}/lmdz1d_source_20120112
[1693]82fi
83
[1704]84################################################################################
85# Creating directory for 1d cases
86################################################################################
[1876]87if [ -d 1dcases ] ; then
[1693]88  echo '1dcases existe deja'
89  echo 'on continue'
90else
91  echo 'creation du directory 1dcases'
92  mkdir 1dcases
93fi
94cd 1dcases
95
[1868]96for cas in amma arm_cu ayotte case_e eq_rd_cv fire hapex92_init rico toga sanduref sandufast sanduslow twpice ; do
[1876]97   if [ -d $cas ] ; then
[1693]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
[1704]109################################################################################
110# Installing source files and compiling
111################################################################################
[2050]112
113if [ $rev -le 2015 ] ; then 
[1693]114cd $LMDlibf
[2050]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
[1704]126chmod +x ../tools/install_1d_src.sh
127../tools/install_1d_src.sh
[2050]128fi
[1693]129
130##   Nettoyage
131\rm -r ${source}
132#
[2050]133cd ${LMDlibf}
134   physique=lmd
135if [ -d phy1d ] ; then
136   physique=1d
137fi
138
139cd ../
[1693]140\rm -f makefile
[2050]141./makelmdz -d ${llm} -p ${physique} lmdz1d
[1704]142if [ -f lmdz1d.e ] ; then
[2050]143   mv lmdz1d.e lmdz1d_L${llm}.e
[1704]144 echo Compilation successfull
[1868]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
[2050]147    ln -s `pwd`/lmdz1d_L${llm}.e ${LMDGCM}/1dcases/$cas/lmdz1d.e
[1704]148 done
[1693]149else
[1704]150 echo Compilation aborted
[1868]151 exit
[1693]152fi
[1704]153
154echo '#########################################################################'
155echo '   1D test cases'
156echo '#########################################################################'
157
[2033]158if [ $toga = 1 ] ; then
[1704]159echo ====================================
[1868]160echo TEST CASE : toga' (1 month)'
[1704]161echo ====================================
[1868]162echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end
163cd ${LMDGCM}/1dcases/toga
[1693]164./xqt.x NPv3.1
[1868]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
[2033]176display var.gif :&
[1868]177rm -f tmp.jnl
178rm -f var.gif
[2033]179cd ..
180fi
[1704]181
[2033]182if [ $twpice = 1 ] ; then
[1704]183echo ====================================
[1868]184echo TEST CASE : twpice
[1704]185echo ====================================
[1868]186echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end
[2033]187cd twpice
[1693]188./xqt.x NPv3.1
[1868]189\rm tmp.jnl ; touch tmp.jnl
190rm -f var.gif
191cat <<eod>> tmp.jnl
[2033]192use histhf_NPv3.1.nc
[1868]193shade/title="cas twpice: cloud fraction (-)" rneb
194frame/file=var.gif
195eod
196ferret <<eod
197go tmp.jnl
198quit
199eod
[2033]200display -remote var.gif :&
[1868]201rm -f tmp.jnl
202rm -f var.gif
[2033]203cd ..
204fi
[1693]205
[1704]206if [ $armcu = 1 ] ; then
[1868]207echo ====================================
208echo TEST CASE : arm_cu
209echo ====================================
210echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end
[2033]211cd arm_cu
[1868]212./compile.x
[2033]213ln -s lmdz1d.e lmdz1d_L40.e
[1868]214./xqt.x NPv3.1
215\rm tmp.jnl ; touch tmp.jnl
216rm -f var.gif
217cat <<eod>> tmp.jnl
[2033]218use histhf_NPv3.1.nc
[1868]219shade/title="cas arm_cu: cloud fraction (-)" rneb
220frame/file=var.gif
221eod
222ferret <<eod
223go tmp.jnl
224quit
225eod
[2033]226display -remote var.gif :&
[1868]227rm -f tmp.jnl
228rm -f var.gif
[2033]229cd ..
[1693]230fi
231
Note: See TracBrowser for help on using the repository browser.