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 |
---|
12 | name="MESORUN" |
---|
13 | ################################ |
---|
14 | |
---|
15 | while getopts "n:h" options; do |
---|
16 | case $options in |
---|
17 | n ) name="${OPTARG}";; |
---|
18 | h ) echo " |
---|
19 | # OPTIONS |
---|
20 | # -n [name] --> name of the folder to be created |
---|
21 | " ; exit ;; |
---|
22 | esac |
---|
23 | done |
---|
24 | |
---|
25 | ################################ |
---|
26 | ## machine on which you will compile |
---|
27 | machine="CICLAD" |
---|
28 | ## fortran compiler used |
---|
29 | fortcom="ifort" |
---|
30 | ## server for sources |
---|
31 | where_is_svn="http://svn.lmd.jussieu.fr/Planeto/trunk/" |
---|
32 | ## grid definition for GCM |
---|
33 | dimgcm="64x48x29" |
---|
34 | ## location of static data |
---|
35 | webrepo="http://data.spiga.fr/mesoscale_model/STATIC_DATA/" |
---|
36 | ################################ |
---|
37 | |
---|
38 | ## ----------------------------- |
---|
39 | ## import settings and structure |
---|
40 | ## ----------------------------- |
---|
41 | echo "*** get structure" |
---|
42 | rm -rf $name > /dev/null 2> /dev/null |
---|
43 | svn -q co $where_is_svn"/MESOSCALE/LMD_MM_MARS/SIMU/MESORUN" $name |
---|
44 | refrepo=$PWD/$name |
---|
45 | ## fill here user input to obtain independent script |
---|
46 | case ${fortcom} in |
---|
47 | "ifort") echo 1 > $refrepo/wpsin ; echo 5 > $refrepo/mesoin ; echo 1 >> $refrepo/mesoin ;; |
---|
48 | esac |
---|
49 | |
---|
50 | ## ---------------- |
---|
51 | ## create code repo |
---|
52 | ## ---------------- |
---|
53 | echo "*** get SVN repository" |
---|
54 | \rm $refrepo/code |
---|
55 | svn -q co -N $where_is_svn $refrepo/code |
---|
56 | |
---|
57 | ## ------------ |
---|
58 | ## get GCM code |
---|
59 | ## ------------ |
---|
60 | echo "*** get GCM code" |
---|
61 | cd $refrepo/code |
---|
62 | svn -q update LMDZ.MARS |
---|
63 | svn -q update LMDZ.COMMON |
---|
64 | cd $refrepo/code/LMDZ.COMMON |
---|
65 | svn -q co http://forge.ipsl.jussieu.fr/fcm/svn/PATCHED/FCM_V1.2 |
---|
66 | ln -sf FCM_V1.2/bin/fcm . |
---|
67 | |
---|
68 | ## -------------- |
---|
69 | ## compile IOIPSL |
---|
70 | ## -------------- |
---|
71 | log=$refrepo/code/logcompile_ioipsl |
---|
72 | echo "*** compile IOIPSL: check progress in "$log |
---|
73 | rm -rf $log ; touch $log |
---|
74 | cd $refrepo/code/LMDZ.COMMON/ioipsl |
---|
75 | ./install_ioipsl_$fortcom".bash" > $log 2> $log |
---|
76 | |
---|
77 | ## ----------- |
---|
78 | ## compile GCM |
---|
79 | ## ----------- |
---|
80 | log=$refrepo/code/logcompile_gcm |
---|
81 | echo "*** compile GCM: check progress in "$log |
---|
82 | rm -rf $log ; touch $log |
---|
83 | cd $refrepo/code/LMDZ.COMMON |
---|
84 | ./makelmdz_fcm -cpp MESOINI -j 8 -s 2 -d $dimgcm -arch $machine$fortcom -parallel mpi -p mars gcm > $log 2> $log |
---|
85 | ./makelmdz_fcm -j 8 -s 2 -d $dimgcm -arch $machine$fortcom -p mars newstart > $log 2> $log |
---|
86 | cd $refrepo/gcm |
---|
87 | \rm gcm.e |
---|
88 | ln -sf $refrepo/code/LMDZ.COMMON/bin/gcm_$dimgcm"_phymars_para.e" gcm.e |
---|
89 | cd $refrepo/gcm/newstart |
---|
90 | \rm newstart.e |
---|
91 | ln -sf $refrepo/code/LMDZ.COMMON/bin/newstart_$dimgcm"_phymars_seq.e" newstart.e |
---|
92 | |
---|
93 | ## ---------------------- |
---|
94 | ## get and make mesoscale |
---|
95 | ## ---------------------- |
---|
96 | echo "*** get and compile mesoscale" |
---|
97 | cd $refrepo/code |
---|
98 | svn update MESOSCALE > /dev/null |
---|
99 | cd $refrepo/code/MESOSCALE/LMD_MM_MARS |
---|
100 | ls $refrepo/mesoin |
---|
101 | if [[ "$?" == 0 ]] ; then |
---|
102 | ./makemeso -p < $refrepo/mesoin |
---|
103 | else |
---|
104 | ./makemeso -p |
---|
105 | fi |
---|
106 | rm -rf $refrepo/mesoin |
---|
107 | rm -rf $refrepo/code_compiled |
---|
108 | ln -sf $refrepo/code/MESOSCALE/LMD_MM_MARS/LATEST $refrepo/code_compiled |
---|
109 | |
---|
110 | ## ------------------------------- |
---|
111 | ## make ini&bdy tools in mesoscale |
---|
112 | ## ------------------------------- |
---|
113 | echo "*** compile initialization tools" |
---|
114 | cd $refrepo/code_compiled |
---|
115 | ln -sf $refrepo/code/MESOSCALE/LMD_MM_MARS/SRC/SCRIPTS/prepare_ini . |
---|
116 | ./prepare_ini > /dev/null |
---|
117 | ## |
---|
118 | cd $refrepo/code_compiled/PREP_MARS |
---|
119 | ./compile"_"$fortcom |
---|
120 | ## |
---|
121 | cd $refrepo/code_compiled/WPS |
---|
122 | ls $refrepo/wpsin |
---|
123 | if [[ "$?" == 0 ]] ; then |
---|
124 | ./configure < $refrepo/wpsin > /dev/null 2> /dev/null |
---|
125 | else |
---|
126 | ./configure |
---|
127 | fi |
---|
128 | rm -rf $refrepo/wpsin |
---|
129 | rm -rf logcompile |
---|
130 | ./compile > logcompile 2>&1 |
---|
131 | |
---|
132 | ## ------------------ |
---|
133 | ## import static data |
---|
134 | ## ------------------ |
---|
135 | echo "*** get static data" |
---|
136 | rm -rf $refrepo/data_static |
---|
137 | svn co -q $where_is_svn/MESOSCALE/LMD_MM_MARS/WPS_GEOG $refrepo/data_static |
---|
138 | cd $refrepo/data_static |
---|
139 | rm -rf logdown |
---|
140 | wget $webrepo"/albedo_TES.tar.gz" -a logdown |
---|
141 | wget $webrepo"/mola_topo64.tar.gz" -a logdown |
---|
142 | wget $webrepo"/thermal_TES.tar.gz" -a logdown |
---|
143 | for fff in *.tar.gz; do |
---|
144 | tar xzvf $fff > /dev/null |
---|
145 | rm -rf $fff |
---|
146 | done |
---|
147 | |
---|
148 | ## ----- |
---|
149 | ## check |
---|
150 | ## ----- |
---|
151 | echo "*** CHECKLIST:" |
---|
152 | ls -lL $refrepo/gcm/gcm.e |
---|
153 | ls -lL $refrepo/geogrid/geogrid.exe |
---|
154 | ls -lL $refrepo/metgrid/metgrid.exe |
---|
155 | ls -lL $refrepo/prep/readmeteo.exe |
---|
156 | ls -lL $refrepo/data_static/albedo_TES |
---|
157 | ls -lL $refrepo/real.exe |
---|
158 | ls -lL $refrepo/wrf.exe |
---|
159 | |
---|