source: trunk/MESOSCALE/LMD_MM_MARS/SIMU/meso_install.sh @ 1596

Last change on this file since 1596 was 1568, checked in by aslmd, 8 years ago

added possibility to test GCM only.

File size: 4.9 KB
Line 
1#! /bin/bash
2
3################################
4# A. Spiga 09/06/2015
5# Install the LMD mesoscale model
6################################
7# prerequisite: NETCDF
8# -- NETCDF env variable
9################################
10## DEFAULT
11## name of the folder
12name="MESORUN"
13## SVN version
14version="HEAD"
15version="1520"
16################################
17
18meso="on"
19while getopts "gn:h" options; do
20  case $options in
21   n ) name="${OPTARG}";;
22   g ) meso="off";; 
23   h ) echo "
24# OPTIONS
25# -n [name] --> name of the folder to be created
26# -g        --> only compile GCM (for tests)
27" ; exit ;;
28  esac
29done
30
31################################
32## machine on which you will compile
33machine="CICLAD"
34## fortran compiler used
35fortcom="ifort"
36## server for sources
37where_is_svn="http://svn.lmd.jussieu.fr/Planeto/trunk/"
38## grid definition for GCM
39dimgcm="64x48x29"
40## location of static data
41webrepo="http://data.spiga.fr/mesoscale_model/STATIC_DATA/"
42## TBD: datadir: http://www.lmd.jussieu.fr/~lmdz/planets/mars/datadir/
43################################
44
45## -----------------------------
46## import settings and structure
47## -----------------------------
48echo "*** get structure"
49rm -rf $name > /dev/null 2> /dev/null
50svn -q co $where_is_svn"/MESOSCALE/LMD_MM_MARS/SIMU/MESORUN" $name
51refrepo=$PWD/$name
52## fill here user input to obtain independent script
53case ${fortcom} in
54  "ifort") echo 1 > $refrepo/wpsin ; echo 5 > $refrepo/mesoin ; echo 1 >> $refrepo/mesoin ;;
55esac
56
57## ----------------
58## create code repo
59## ----------------
60echo "*** get SVN repository"
61\rm $refrepo/code
62svn -q co -N $where_is_svn $refrepo/code
63
64## ------------
65## get GCM code
66## ------------
67echo "*** get GCM code version "$version
68cd $refrepo/code
69svn -q update -r $version LMDZ.MARS
70svn -q update -r $version LMDZ.COMMON
71cd $refrepo/code/LMDZ.COMMON
72svn -q co http://forge.ipsl.jussieu.fr/fcm/svn/PATCHED/FCM_V1.2
73ln -sf FCM_V1.2/bin/fcm .
74
75## --------------
76## compile IOIPSL
77## --------------
78log=$refrepo/code/logcompile_ioipsl
79echo "*** compile IOIPSL: check progress in "$log
80rm -rf $log ; touch $log
81cd $refrepo/code/LMDZ.COMMON/ioipsl
82./install_ioipsl_$fortcom".bash" > $log 2> $log
83
84## -----------
85## compile GCM
86## -----------
87log=$refrepo/code/logcompile_gcm
88echo "*** compile GCM: check progress in "$log
89rm -rf $log ; touch $log
90cd $refrepo/code/LMDZ.COMMON
91./makelmdz_fcm -cpp MESOINI -j 8 -s 2 -d $dimgcm -arch $machine$fortcom -parallel mpi -p mars gcm > $log 2> $log
92./makelmdz_fcm              -j 8 -s 2 -d $dimgcm -arch $machine$fortcom               -p mars newstart >> $log 2>> $log
93cd $refrepo/gcm
94\rm gcm.e
95ln -sf $refrepo/code/LMDZ.COMMON/bin/gcm_$dimgcm"_phymars_para.e" gcm.e
96cd $refrepo/gcm/newstart
97\rm newstart.e
98ln -sf $refrepo/code/LMDZ.COMMON/bin/newstart_$dimgcm"_phymars_seq.e" newstart.e
99
100## START MESOSCALE PART
101if [[ "${meso}" == "on" ]]
102then
103
104## ----------------------
105## get and make mesoscale
106## ----------------------
107echo "*** get and compile mesoscale version "$version
108cd $refrepo/code
109svn update -r $version MESOSCALE > /dev/null
110cd $refrepo/code/MESOSCALE/LMD_MM_MARS
111ls $refrepo/mesoin
112if [[ "$?" == 0 ]] ; then
113  ./makemeso -p < $refrepo/mesoin
114else
115  ./makemeso -p
116fi
117rm -rf $refrepo/mesoin
118rm -rf $refrepo/code_compiled
119ln -sf $refrepo/code/MESOSCALE/LMD_MM_MARS/LATEST $refrepo/code_compiled
120
121## -------------------------------
122## make ini&bdy tools in mesoscale
123## -------------------------------
124echo "*** compile initialization tools"
125cd $refrepo/code_compiled
126ln -sf $refrepo/code/MESOSCALE/LMD_MM_MARS/SRC/SCRIPTS/prepare_ini .
127./prepare_ini > /dev/null
128##
129cd $refrepo/code_compiled/PREP_MARS
130./compile"_"$fortcom
131##
132cd $refrepo/code_compiled/WPS
133ls $refrepo/wpsin
134if [[ "$?" == 0 ]] ; then
135  ./configure < $refrepo/wpsin > /dev/null 2> /dev/null
136else
137  ./configure
138fi
139rm -rf $refrepo/wpsin
140rm -rf logcompile
141./compile > logcompile 2>&1
142
143## ------------------
144## import static data
145## ------------------
146echo "*** get static data"
147rm -rf $refrepo/data_static
148svn co -q $where_is_svn/MESOSCALE/LMD_MM_MARS/WPS_GEOG $refrepo/data_static
149cd $refrepo/data_static
150rm -rf logdown
151wget $webrepo"/albedo_TES.tar.gz" -a logdown
152wget $webrepo"/mola_topo64.tar.gz" -a logdown
153wget $webrepo"/thermal_TES.tar.gz" -a logdown
154for fff in *.tar.gz; do
155  tar xzvf $fff > /dev/null
156  rm -rf $fff
157done
158
159## ------------------------
160## get and compile postproc
161## ------------------------
162echo "*** get and compile post-processing tool"
163cd $refrepo
164svn co -q https://github.com/aymeric-spiga/api/trunk postproc
165cd $refrepo/postproc
166./compile
167
168fi
169## END MESOSCALE PART
170
171## ------------------------
172## make a minimal startbase
173## ------------------------
174echo "*** make a minimal startbase"
175cd $refrepo/gcm/newstart
176./mini_startbase.sh
177
178## -----
179## check
180## -----
181echo "*** CHECKLIST:"
182ls -lL $refrepo/gcm/gcm.e
183ls -lL $refrepo/geogrid/geogrid.exe
184ls -lL $refrepo/metgrid/metgrid.exe
185ls -lL $refrepo/prep/readmeteo.exe
186ls -lL $refrepo/data_static/albedo_TES
187ls -lL $refrepo/real.exe
188ls -lL $refrepo/wrf.exe
189ls -lL $refrepo/postproc/api
190
Note: See TracBrowser for help on using the repository browser.