1 | #!/bin/bash |
---|
2 | # This script sets up and launches a (series of) simulation(s). |
---|
3 | # RECOMMENDATION: use main.sh to drive it (do not run it directly) |
---|
4 | |
---|
5 | set -eu |
---|
6 | set -vx |
---|
7 | |
---|
8 | #--------------------------------------------------------------------------- |
---|
9 | function define_expert_options() { # Expert-level choices |
---|
10 | #--------------------------------------------------------------------------- |
---|
11 | |
---|
12 | # optim: either "" or "-debug" to compile in debug mode |
---|
13 | # (slower but better diagnosis of segfaults) |
---|
14 | optim="" |
---|
15 | |
---|
16 | # "n" or "y". If testmode="y", then simulations run for a single day |
---|
17 | # per period. |
---|
18 | # NOTE: you must set mthend accordingly ! |
---|
19 | testmode="n" |
---|
20 | |
---|
21 | # Radiative code: "oldrad" / "rrtm" / "ecrad" |
---|
22 | rad="rrtm" |
---|
23 | |
---|
24 | # !!! STRONG recommendation : experiments with DIFFERENT Orchidee or |
---|
25 | # aerosol options should be performed in DIFFERENT LMDZ_Setup folders |
---|
26 | # !!! (especially as they may need different initial files) |
---|
27 | |
---|
28 | # AEROSOLS : "n" (=no)/"clim" (=average 1995-2014) / "spla" (interactive) |
---|
29 | # (WARNING : if you first run the scripts with aerosols=n, then you want |
---|
30 | # to change to =clim, you must remove the INIT and LIMIT folders and |
---|
31 | # rerun main.sh with init=1 in order to create aerosol files |
---|
32 | |
---|
33 | aerosols="clim" |
---|
34 | |
---|
35 | # SURFACE/VEGETATION SCHEME |
---|
36 | # - "none" : bucket scheme |
---|
37 | # CMIP6 : orchidee CMIP6 version |
---|
38 | # 7983/7994 : orchidee svn release 7983 (orch2.2) and 7994 (last tested) |
---|
39 | # If you need other orch versions, and also require XIOS, you'll need |
---|
40 | # to create the appropriate files in DEF/XMLfilesOR... |
---|
41 | veget="CMIP6" |
---|
42 | |
---|
43 | # New snow scheme INLANDSIS! "y" / "n" |
---|
44 | # Activates INLANDSIS compilation |
---|
45 | # to be done : treatment of specific restart and def file |
---|
46 | inlandsis="n" |
---|
47 | |
---|
48 | # netcdf: 0 (use existing library) / 1 (recompile netcdf, slow) |
---|
49 | netcdf=0 |
---|
50 | |
---|
51 | # --->>> ALSO PAY ATTENTION TO OUTPUT files, frequency, level ------------ |
---|
52 | # With IOIPSL : Choose your config.def among versions available in DEF, |
---|
53 | # copy it as config.def (the copy is done automatically for "iso"), |
---|
54 | # edit it and set up output files, frequencies and levels. |
---|
55 | # NB : For aerosols=spla, output level minimum 4 is required to outpu |
---|
56 | # the specific variables. |
---|
57 | # For aerosols=n, aerosol flags will automatically be set to "n". |
---|
58 | # With XIOS : adjust DEF/XMLfiles*/file*xml |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | #--------------------------------------------------------------------------- |
---|
63 | function enable_platform() { # Sed platform-specific headers |
---|
64 | #--------------------------------------------------------------------------- |
---|
65 | local file="$1" |
---|
66 | local platform |
---|
67 | |
---|
68 | case ${hostname:0:5} in |
---|
69 | jean-) platform="JZ";; |
---|
70 | spiri) platform="SP";; |
---|
71 | adast) platform="ADS";; |
---|
72 | *) echo "Warning: $hostname is not a known job platform (ignore if running locally)"; return 0;; |
---|
73 | esac |
---|
74 | |
---|
75 | sed -i'' -e "s/^#@$platform//" "$file" |
---|
76 | } |
---|
77 | |
---|
78 | #--------------------------------------------------------------------------- |
---|
79 | function load_install_lib() { #Fetch and source install_lmdz.sh to get myget |
---|
80 | #--------------------------------------------------------------------------- |
---|
81 | if [[ ! -f "install_lmdz.sh" ]]; then |
---|
82 | wget --no-cache "http://svn.lmd.jussieu.fr/LMDZ/BOL/script_install/install_lmdz.sh" |
---|
83 | fi |
---|
84 | # shellcheck disable=SC1090 |
---|
85 | source <(sed 's/function \(.*\) {/function installlmdz_\1 {/g' install_lmdz.sh) # source with a namespace for functions |
---|
86 | function myget { installlmdz_myget "$@"; } |
---|
87 | } |
---|
88 | |
---|
89 | #--------------------------------------------------------------------------- |
---|
90 | function set_default_params() { # Default value of script parameters |
---|
91 | #--------------------------------------------------------------------------- |
---|
92 | |
---|
93 | SIM=$(basename "$local_d")CTL # name |
---|
94 | phylmd="lmd" #option -p $phylmd for makelmdz |
---|
95 | |
---|
96 | cosp="n" # COSP |
---|
97 | xios="n" #XIOS |
---|
98 | |
---|
99 | # Nudging : |
---|
100 | ok_guide="n" |
---|
101 | # With nudging, use real calendar (climato=0) and monthly integrations |
---|
102 | climato=1 |
---|
103 | freq="mo" # frequence mensuelle mo ou annuelle yr |
---|
104 | |
---|
105 | # NB : the run stops in the BEGINNING of mthend (test "next=stopsim") |
---|
106 | mthini=200001 |
---|
107 | mthend=200501 |
---|
108 | resol="144x142x79" |
---|
109 | |
---|
110 | version="20230412.trunk" |
---|
111 | svn="" |
---|
112 | |
---|
113 | init=1 |
---|
114 | |
---|
115 | LIMIT="LIMIT" |
---|
116 | |
---|
117 | } |
---|
118 | |
---|
119 | #--------------------------------------------------------------------------- |
---|
120 | function read_cmdline_args() { |
---|
121 | #--------------------------------------------------------------------------- |
---|
122 | while (($# > 0)); do |
---|
123 | case $1 in |
---|
124 | "-h") cat <<........fin |
---|
125 | setup.sh can be launched/driven by main.sh |
---|
126 | setup.sh [-v version] [-r svn_release] [-init INIT] [-d 96x95x79] [-f mo] [-nudging] |
---|
127 | -v "version" like 20150828.trunk; see https://lmdz.lmd.jussieu.fr/Distrib/LISMOI.trunk (default <$version>) |
---|
128 | -r "svn_release" either the svn release number or "last" (default <$svn>) |
---|
129 | -d IMxJMxLM to run in resolution IM x JM x LM (default <$resol>) |
---|
130 | -install pour installer et compiler le modele |
---|
131 | -f mo/yr pour tourner en mensuel ou annuel (default <$freq>) |
---|
132 | -rad RAD Radiation |
---|
133 | -netcdf 0/1/DIR Netcdf installation |
---|
134 | -aerosols n/clim/spla Aerosols : none / climatological / interactive with SPLA |
---|
135 | -veget CMIP6 CMIP6 version of rchidee |
---|
136 | 7983 orch2.2 |
---|
137 | 7994 trunk |
---|
138 | "INIT" 1: creates INIT and LIMIT |
---|
139 | 0: reads from INIT and LIMIT |
---|
140 | SIMU: reads from preexisting simulation SIMU and LIMIT (default <$init>) |
---|
141 | -nudging to run with nudging. Nudging files must be created independently |
---|
142 | -p the physics to use (default <$phylmd>) |
---|
143 | -name install folder name (default <$SIM>) |
---|
144 | Other options available (see "options" section in the script) |
---|
145 | ........fin |
---|
146 | exit;; |
---|
147 | "-v") version="$2"; shift; shift;; |
---|
148 | "-r") svn=$2; shift; shift;; |
---|
149 | "-d") resol=$2; shift; shift;; |
---|
150 | "-f") freq=$2; shift; shift;; |
---|
151 | "-p") phylmd=$2; shift; shift;; |
---|
152 | "-name") SIM=$2; shift; shift;; |
---|
153 | "-rad") rad=$2; shift; shift;; |
---|
154 | "-netcdf") netcdf=$2; shift; shift;; |
---|
155 | "-aerosols") aerosols=$2; shift; shift;; |
---|
156 | "-veget") veget=$2; shift; shift;; |
---|
157 | "-cosp") cosp=y; shift;; |
---|
158 | "-xios") xios=y; shift;; |
---|
159 | "-init") init=$2; shift; shift;; |
---|
160 | "-nudging") ok_guide=y; shift;; |
---|
161 | "-climato") climato=$2; shift; shift;; |
---|
162 | "-mthini") mthini=$2; shift; shift;; |
---|
163 | "-mthend") mthend=$2; shift; shift;; |
---|
164 | *) echo "unexpected $1"; $0 -h; exit |
---|
165 | esac |
---|
166 | done |
---|
167 | |
---|
168 | # Initialisation |
---|
169 | if [[ $init = 1 || $init = 0 ]]; then |
---|
170 | INIT="INIT" |
---|
171 | else |
---|
172 | INIT=$init |
---|
173 | fi |
---|
174 | |
---|
175 | case $rad in |
---|
176 | oldrad) iflag_rrtm=0; NSW=2;; |
---|
177 | rrtm) iflag_rrtm=1; NSW=6;; |
---|
178 | ecrad) iflag_rrtm=2; NSW=6;; |
---|
179 | esac |
---|
180 | |
---|
181 | im=$(echo "$resol" | cut -dx -f1) |
---|
182 | jm=$(echo "$resol" | cut -dx -f2) |
---|
183 | lm=$(echo "$resol" | cut -dx -f3) |
---|
184 | |
---|
185 | yearini=$(echo "$mthini" | cut -c-4) |
---|
186 | if [[ $freq = yr ]]; then stopsim=$(echo "$mthend" | cut -c-4); else stopsim=$mthend; fi |
---|
187 | |
---|
188 | if [[ -d $SIM ]]; then |
---|
189 | echo "La simulation $SIM existe deja. Il est conseillé d'arrêter et de vérifier." |
---|
190 | echo "Si vous êtes sûr de vous, vous pouvez la prolonger. Voulez vous la prolonger ? (y/n)" |
---|
191 | read -r ans |
---|
192 | if [[ $ans != y ]]; then exit 1; fi |
---|
193 | fi |
---|
194 | |
---|
195 | ###################################################################### |
---|
196 | # Choix du nombre de processeurs |
---|
197 | # NOTES : |
---|
198 | # omp=8 by default (for Jean-Zay must be a divisor of 40 procs/node) |
---|
199 | # omp=1 : required for SPLA (omp parallelism not ready) |
---|
200 | # omp=2 for veget=CMIP6+XIOS beacause of a bug in ORCHIDEE/src_xml/xios_orchidee.f90 |
---|
201 | ###################################################################### |
---|
202 | (( mpi = ( jm + 1 ) / 2 )) |
---|
203 | omp=8 |
---|
204 | if [[ $aerosols = "spla" ]]; then omp=1; fi |
---|
205 | if [[ $veget = "CMIP6" && $xios = "y" ]]; then omp=2; fi |
---|
206 | if [[ $mpi -gt $NB_MPI_MAX ]]; then mpi=$NB_MPI_MAX; fi |
---|
207 | if [[ $omp -gt $NB_OMP_MAX ]]; then omp=$NB_OMP_MAX; fi |
---|
208 | |
---|
209 | # Compute how many mpi per node (required e.g. for Adastra) |
---|
210 | mpi_per_node=0 |
---|
211 | if [[ $NB_CORE_PER_NODE_MAX -gt 0 ]]; then |
---|
212 | local N_omp_mt=1 |
---|
213 | if [[ $omp -gt 1 ]]; then (( N_omp_mt = omp / N_HYPERTHREADING )); fi # take into account hyperthreading |
---|
214 | (( mpi_per_node = NB_CORE_PER_NODE_MAX / N_omp_mt )) |
---|
215 | if [[ mpi_per_node -gt mpi ]]; then mpi_per_node=$mpi; fi |
---|
216 | fi |
---|
217 | |
---|
218 | echo "Total MPI=$mpi (PER NODE=$mpi_per_node), OMP=$omp" |
---|
219 | } |
---|
220 | |
---|
221 | #--------------------------------------------------------------------------- |
---|
222 | function ensure_correct_option_combinations() { |
---|
223 | # AVOID COMBINATIONS OF OPTIONS THAT DON'T WORK in user choices |
---|
224 | #--------------------------------------------------------------------------- |
---|
225 | if [[ $ok_guide = y && $climato = 1 ]]; then |
---|
226 | echo "STOP: Running nudged simulations with climatological SSTs is not planned. Change <climato> to <0> or modify the setup (experts)"; exit 1 |
---|
227 | fi |
---|
228 | |
---|
229 | if [[ $climato = 0 && $freq = "yr" ]]; then |
---|
230 | echo "STOP: Running simulations with interannual SSTs is possible only month by month and a true calendar." |
---|
231 | echo "Change <climato> to <1> or <freq> to <mo> or modify setup.sh (experts)"; exit 1 |
---|
232 | fi |
---|
233 | |
---|
234 | |
---|
235 | # (Temporary) Constraints for aerosols=spla : |
---|
236 | # --> resolution 128x88x79 and rad=rrtm |
---|
237 | if [[ $aerosols = "spla" && ( ${im}x${jm} != "128x88" || $freq != mo ) ]]; then |
---|
238 | echo 'STOP: For now, <aerosols=spla> requires <resol=128x88x79>,' |
---|
239 | echo 'and uses the zoomed grid from gcm.def_zNAfrica_BiJe,' |
---|
240 | echo 'for which forcing & initial files are available' |
---|
241 | echo "Right now resol=<$resol>" |
---|
242 | echo 'Should be run in monthly mode' |
---|
243 | exit 1 |
---|
244 | fi |
---|
245 | |
---|
246 | if [[ $rad = "ecrad" && $phylmd != "lmd" ]]; then |
---|
247 | echo "<rad=ecrad> is only supported for <phy=phylmd> here" # (Amaury) I added this check because we fetch ecrad data from libf/phylmd/ecrad/data only. |
---|
248 | fi |
---|
249 | } |
---|
250 | |
---|
251 | #--------------------------------------------------------------------------- |
---|
252 | function install_model() { |
---|
253 | #--------------------------------------------------------------------------- |
---|
254 | mkdir -p "$LMDZD" |
---|
255 | |
---|
256 | local ins_xios ins_cosp ins_aero ins_inlandsis |
---|
257 | if [[ $xios = "y" ]]; then ins_xios="-xios"; else ins_xios=""; fi |
---|
258 | if [[ $cosp = "y" ]]; then ins_cosp="-cosp v1"; else ins_cosp=""; fi |
---|
259 | if [[ $aerosols = "spla" ]]; then ins_aero="-spla"; else ins_aero=""; fi |
---|
260 | if [[ $inlandsis = "y" ]]; then ins_inlandsis="-inlandsis"; else ins_inlandsis=""; fi |
---|
261 | if [[ -n $svn ]]; then svnopt="-r $svn"; else svnopt=""; fi |
---|
262 | |
---|
263 | if [[ $PARALLEL == 0 ]] ; then parallel= ; parsuf=seq ; else parallel="-parallel mpi_omp" ; parsuf= ; fi |
---|
264 | version_name=LMDZ$(echo "$version" | sed -e 's/-v//g' -e 's/-unstable//' -e 's/-r/r/' -e 's/ //g') |
---|
265 | LMDZname="${version_name}${svn}OR$veget${ins_xios}${parsuf}$( echo $optim | sed -e 's/[\ -]//g' )" |
---|
266 | MODEL="$LMDZD/$LMDZname/modipsl/modeles/LMDZ" |
---|
267 | |
---|
268 | if [[ -d $MODEL ]]; then echo "Found existing install at MODEL=$MODEL"; fi |
---|
269 | echo "Installing model" |
---|
270 | cd "$LMDZD" |
---|
271 | cp "$local_d/install_lmdz.sh" . |
---|
272 | chmod +x install_lmdz.sh |
---|
273 | local make_j=8 |
---|
274 | # We launch using $MPICMD, except if it's using mpirun (no srun equivalent for bash script) => if supported, the compilation runs in a cluster job |
---|
275 | jobcmd="\"$RUNBASHCMD $make_j\"" |
---|
276 | if [[ ${hostname:0:5} = "jean-" ]]; then jobcmd="\"$RUNBASHCMD $make_j --partition=compil\""; fi # On JeanZay: compile on the <compil> partition |
---|
277 | if [[ $(echo "$RUNBASHCMD" | cut -c -4) = "bash" ]]; then |
---|
278 | jobcmd="bash" |
---|
279 | fi |
---|
280 | echo "./install_lmdz.sh -noclean $optim -v $version $svnopt -d $resol -rad $rad -bench compile_only $parallel $ins_cosp $ins_xios $ins_aero $ins_inlandsis -name $LMDZname -veget $veget -netcdf $netcdf -arch $ARCH -make_j $make_j -jobcmd $jobcmd" >> install_lmdz_options.$$.sh |
---|
281 | chmod +x install_lmdz_options.$$.sh |
---|
282 | echo "Running install_lmdz_options.$$.sh" |
---|
283 | set -o pipefail |
---|
284 | ./install_lmdz_options.$$.sh |
---|
285 | #gcm=$MODEL/$(./install_lmdz_options.$$.sh | tee /dev/tty | tail -n 1 | sed -n "s:.* executable is \(.*\.e\).*:\1:p") |
---|
286 | gcm=$MODEL/bin/gcm.e |
---|
287 | set +o pipefail |
---|
288 | mv install_lmdz.sh install_lmdz.$$.sh |
---|
289 | cd "$local_d" |
---|
290 | } |
---|
291 | |
---|
292 | #--------------------------------------------------------------------------- |
---|
293 | function setup_def() { # modify various .def in ./DEF (+ xios xml ) |
---|
294 | #--------------------------------------------------------------------------- |
---|
295 | cd "$local_d" |
---|
296 | |
---|
297 | # Utilisation des .def_iso pour LMDZ-ISOtopes |
---|
298 | if [[ $phylmd = "lmdiso" ]]; then |
---|
299 | for file_iso in $(ls DEF | grep _iso); do |
---|
300 | cp DEF/"$file_iso" DEF/"${file_iso%%_iso}" |
---|
301 | done |
---|
302 | fi |
---|
303 | |
---|
304 | ###################################################################### |
---|
305 | # Choix de la grille verticale |
---|
306 | ###################################################################### |
---|
307 | if [ ! -f "DEF/L$lm.def" ]; then |
---|
308 | echo "STOP: Résolution verticale non prévue - créer un fichier DEF/L$lm.def"; exit 1 |
---|
309 | else |
---|
310 | sed -i'' -e "s/INCLUDEDEF=L.*.def/INCLUDEDEF=L$lm.def/" DEF/run.def |
---|
311 | fi |
---|
312 | |
---|
313 | ###################################################################### |
---|
314 | # Changements dans les fichiers DEF/*def |
---|
315 | # (ils vont se repercuter dans les repertoires de simulation $local_d/$SIM et de run $SIMRUNDIR) |
---|
316 | ###################################################################### |
---|
317 | |
---|
318 | # Choix du fichier tracer.def coherent avec l'option "aerosols" |
---|
319 | # NOTE : Le nouveau tracer.def_nospla par defaut n'inclut pas Rn-Pb; |
---|
320 | # si on les veut, il faut utiliser ci-dessous; a la place, tracer_RN_PB.def |
---|
321 | #--------------------------------------------------------------------- |
---|
322 | # NB : Les traceurs absents de start* files sont initialises=0 dans le code |
---|
323 | if [[ $aerosols = "spla" ]]; then |
---|
324 | # nouveau tracer.def (remplace "traceur.def") |
---|
325 | cp DEF/tracer.def_spla DEF/tracer.def |
---|
326 | elif [[ $phylmd = "lmdiso" ]]; then |
---|
327 | # déjà copié si 'y' |
---|
328 | cp DEF/tracer.def_nospla DEF/tracer.def |
---|
329 | fi |
---|
330 | |
---|
331 | # TEMPORAIREMENT pour spla on force l'utilisation de gcm.def_zNAfrica_BiJe (avec resolution 128x88x79) |
---|
332 | #---------------------------------------------------------------------- |
---|
333 | if [[ $aerosols = "spla" ]]; then |
---|
334 | cp DEF/gcm.def_zNAfrica_BiJe DEF/gcm.def; fi |
---|
335 | |
---|
336 | # Inscription du choix ok_guide dans DEF/guide.def |
---|
337 | #--------------------------------------------------------------------- |
---|
338 | sed -i'' -e 's/ok_guide=.*.$/ok_guide='$ok_guide'/' DEF/guide.def |
---|
339 | |
---|
340 | # Inscription du type de calendrier (qui est fonction de $climato) dans DEF/run.def |
---|
341 | #--------------------------------------------------------------------- |
---|
342 | # NB Contrairement a ce qui est ecrit dans les fichiers run.def standard, |
---|
343 | # dans ce tutorial le choix earth_365d n'est pas disponible, et earth_366d s'appelle gregorian |
---|
344 | if [[ $climato = 0 ]]; then calend="gregorian"; else calend="earth_360d"; fi |
---|
345 | sed -i'' -e 's/calend=.*.$/calend='$calend'/' DEF/run.def |
---|
346 | |
---|
347 | # Changements dans config.def (pre-choisi, et regle pour output si utilisation avec IOIPSL) |
---|
348 | # cf options veget, aerosols, cosp, xios |
---|
349 | #--------------------------------------------------------------------- |
---|
350 | if [[ $veget = "none" ]]; then VEGET="n"; else VEGET="y"; fi |
---|
351 | sed -i'' -e 's/VEGET=.*.$/VEGET='$VEGET'/' DEF/config.def |
---|
352 | |
---|
353 | ok_cdnc=y ; ok_ade=y ; ok_aie=y ; ok_alw=y |
---|
354 | case $aerosols in |
---|
355 | clim) flag_aerosol=6 ;; |
---|
356 | spla) flag_aerosol=1 ;; |
---|
357 | n) flag_aerosol=0 ; ok_cdnc=n ; ok_ade=n ; ok_aie=n ; ok_alw=n ;; |
---|
358 | *) echo Option aerosols=$aerosols not available ; exit 1 |
---|
359 | esac |
---|
360 | sed -i'' -e 's/^ok_cdnc=.*.$/ok_cdnc='$ok_cdnc'/' \ |
---|
361 | -e 's/^ok_ade=.*.$/ok_ade='$ok_ade'/' \ |
---|
362 | -e 's/^ok_aie=.*.$/ok_aie='$ok_aie'/' \ |
---|
363 | -e 's/^ok_alw=.*.$/ok_alw='$ok_alw'/' \ |
---|
364 | -e 's/^flag_aerosol=.*.$/flag_aerosol='$flag_aerosol'/' DEF/config.def |
---|
365 | pwd |
---|
366 | |
---|
367 | # COSP : ok_cosp desactive COSP si on a compile avec; il ne l'active pas si on a compile sans |
---|
368 | sed -i'' -e 's/ok_cosp.*.$/ok_cosp='$cosp'/' DEF/config.def |
---|
369 | if [[ $cosp = "y" ]]; then \cp -f "$MODEL"/DefLists/cosp*.txt "$local_d"/DEF/; fi |
---|
370 | |
---|
371 | # Sorties LMDZ en fonction de l'option "xios" |
---|
372 | sed -i'' -e 's/ok_all_xml=.*.$/ok_all_xml='$xios'/' DEF/config.def |
---|
373 | |
---|
374 | # Ajuster physiq.def en fonction de radiative code (default: values for rad=rrtm) |
---|
375 | # Pour isotopes=y , mettre iflag_ice_thermo=0 au lieu de 1 |
---|
376 | #--------------------------------------------------------------------- |
---|
377 | sed -i'' -e "s/iflag_rrtm=.*.$/iflag_rrtm=$iflag_rrtm/" -e "s/NSW=.*.$/NSW=$NSW/" DEF/physiq.def |
---|
378 | sed -i"" -e "s:directory_name.*$:directory_name=\"$MODEL/libf/phylmd/ecrad/data\",:" DEF/namelist_ecrad |
---|
379 | |
---|
380 | if [[ $phylmd = "lmdiso" ]]; then iflag_ice_thermo=0; else iflag_ice_thermo=1; fi |
---|
381 | sed -i -e 's/iflag_ice_thermo=.*.$/iflag_ice_thermo='$iflag_ice_thermo'/' DEF/physiq.def |
---|
382 | |
---|
383 | # Choix de orchidee.def en fonction de orchidee_rev; modification pour xios |
---|
384 | # NOTE separate orchidee_pft.def file for ORCHIDEE trunk post-CMIP6 |
---|
385 | #--------------------------------------------------------------------- |
---|
386 | orchidee_def=orchidee.def_6.1 |
---|
387 | orchidee_pft_def="" |
---|
388 | if [[ $veget = "7983" ]]; then |
---|
389 | orchidee_def=orchidee.def_6.2work |
---|
390 | elif [[ $veget = "7994" ]]; then |
---|
391 | orchidee_def=orchidee.def_6.4work |
---|
392 | orchidee_pft_def=orchidee_pft.def_6.4work |
---|
393 | if ! grep "INCLUDEDEF=orchidee_pft.def" DEF/run.def; then |
---|
394 | sed -i'' -e 's/INCLUDEDEF=orchidee.def/INCLUDEDEF=orchidee.def\nINCLUDEDEF=orchidee_pft.def/' DEF/run.def; fi |
---|
395 | fi |
---|
396 | cp -f DEF/$orchidee_def DEF/orchidee.def |
---|
397 | if [[ $orchidee_pft_def != "" ]]; then cp -f DEF/$orchidee_pft_def DEF/orchidee_pft.def; fi |
---|
398 | |
---|
399 | # Only for veget=CMIP6 it is still possible to use IOIPSL; newer versions of orchidee.def have XIOS_ORCHIDEE_OK = y |
---|
400 | sed -i'' -e 's/XIOS_ORCHIDEE_OK =.*.$/XIOS_ORCHIDEE_OK = '$xios'/' DEF/orchidee.def |
---|
401 | |
---|
402 | ###################################################################### |
---|
403 | # Si on tourne avec XIOS, mise a jour des fichiers context et field* dans XMLfilesLMDZ |
---|
404 | # (ils vont se repercuter dans les repertoires de simulation $local_d/$SIM et de run $SIMRUNDIR) |
---|
405 | ###################################################################### |
---|
406 | if [[ $xios = y ]]; then |
---|
407 | cp -f "$MODEL"/DefLists/context_lmdz.xml "$local_d"/DEF/XMLfilesLMDZ/. |
---|
408 | cp -f "$MODEL"/DefLists/field_def_lmdz.xml "$local_d"/DEF/XMLfilesLMDZ/. |
---|
409 | if [[ $cosp = y ]]; then cp -f "$MODEL"/DefLists/field_def_cosp1.xml "$local_d"/DEF/XMLfilesLMDZ/.; fi |
---|
410 | fi |
---|
411 | } |
---|
412 | |
---|
413 | #--------------------------------------------------------------------------- |
---|
414 | function setup_ce0l() { # Verification de l'existance de l'état initial, compilation eventuelle pour sa creation |
---|
415 | #--------------------------------------------------------------------------- |
---|
416 | if [[ ! -d $INIT ]]; then |
---|
417 | if [[ $init = 0 ]]; then |
---|
418 | echo "STOP: Récuperer les repertoires $INIT ou lancer avec option -init"; exit 1 |
---|
419 | else |
---|
420 | # Compile ce0l |
---|
421 | cd "$MODEL" |
---|
422 | sed -e 's/gcm/ce0l/g' compile.sh > compile_ce0l.sh; chmod +x compile_ce0l.sh |
---|
423 | echo "Compiling ce0l" |
---|
424 | if ! ./compile_ce0l.sh &> ce0l.log; then echo "STOP: ce0l compilation failed, see $MODEL/ce0l.log"; exit 1; fi |
---|
425 | echo "Compiled ce0l" |
---|
426 | ce0l=${gcm/gcm/ce0l} |
---|
427 | |
---|
428 | cd "$local_d" |
---|
429 | fi |
---|
430 | elif [[ $init = 1 ]]; then |
---|
431 | echo "STOP: Vous essayez d initialiser le modele mais $INIT existe deja"; exit 1 |
---|
432 | fi |
---|
433 | } |
---|
434 | |
---|
435 | #--------------------------------------------------------------------------- |
---|
436 | function setup_simu() { |
---|
437 | #--------------------------------------------------------------------------- |
---|
438 | #SIMRUNTOPDIR="$SIMRUNBASEDIR/$(basename "$local_d")" |
---|
439 | SIMRUNTOPDIR="$SIMRUNBASEDIR" |
---|
440 | SIMRUNDIR=$SIMRUNTOPDIR |
---|
441 | mkdir -p "$SIMRUNDIR" |
---|
442 | cd "$SIMRUNDIR" |
---|
443 | echo "La simulation s'exécutera sur $SIMRUNDIR" |
---|
444 | |
---|
445 | ##################################################################### |
---|
446 | # Creation du repertoire $SIM s'il n'existe pas deja |
---|
447 | ##################################################################### |
---|
448 | if [[ ! -d $local_d/$SIM ]]; then |
---|
449 | mkdir "$local_d/$SIM" |
---|
450 | cd "$local_d" |
---|
451 | |
---|
452 | # Edit reb.sh |
---|
453 | cp reb.sh "$local_d/$SIM/reb.sh"; chmod +x "$local_d/$SIM/reb.sh" |
---|
454 | sed -i'' -e "s:^rebuild=.*.$:rebuild=$LMDZD/$LMDZname/modipsl/bin/rebuild:" "$local_d/$SIM/reb.sh" |
---|
455 | enable_platform "$local_d/$SIM/reb.sh" |
---|
456 | |
---|
457 | # Copy .def |
---|
458 | cp lmdz_env.sh "$local_d/$SIM/" |
---|
459 | mkdir "$local_d/$SIM/DEF"; cp DEF/*def DEF/namelis* "$local_d/$SIM/DEF/" |
---|
460 | #Pour XIOS, respectivement COSP, copier aussi les fichiers *xml / *txt |
---|
461 | if [[ $cosp = "y" ]]; then cp DEF/cosp*txt "$local_d/$SIM/DEF/"; fi |
---|
462 | if [[ $xios = "y" ]]; then |
---|
463 | cp DEF/XMLfilesLMDZ/*xml "$local_d/$SIM/DEF/" |
---|
464 | if [[ $veget != 'none' ]]; then cp DEF/XMLfilesOR$veget/*xml "$local_d/$SIM/DEF/"; fi |
---|
465 | fi |
---|
466 | chmod u+w "$local_d/$SIM"/DEF/* |
---|
467 | |
---|
468 | # Gestion du calendrier |
---|
469 | ####################### |
---|
470 | cd "$SIM" |
---|
471 | sed -i'' -e "s/anneeref=.*.$/anneeref=$yearini/" DEF/run.def |
---|
472 | if [[ $freq = "yr" ]]; then date=$yearini; else date=$mthini; fi |
---|
473 | echo "$date a faire" >| etat |
---|
474 | |
---|
475 | # Recuperation des fichiers : executable initiaux et forcages |
---|
476 | ############################################################# |
---|
477 | echo "date: $date" |
---|
478 | for f in start startphy; do |
---|
479 | inf=../$INIT/$f.$date.nc |
---|
480 | if [[ -f $inf || $init = 1 ]]; then ln -s "$inf" ./; else echo "STOP: $inf missing"; exit ; fi; |
---|
481 | done |
---|
482 | for f in sechiba stomate; do |
---|
483 | if [[ -f ../$INIT/start_$f.$date.nc ]]; then ln -sf "../$INIT/start_$f.$date.nc" .; fi |
---|
484 | done |
---|
485 | cp "$gcm" gcm.e |
---|
486 | fi |
---|
487 | cd "$local_d"/.. |
---|
488 | |
---|
489 | ##################################################################### |
---|
490 | echo "Modification du script de lancement" |
---|
491 | ##################################################################### |
---|
492 | local cput |
---|
493 | if [[ $freq = "yr" ]]; then cput="04:00:00"; else cput="01:00:00"; fi |
---|
494 | local isotopes="n" |
---|
495 | if [[ $phylmd = "lmdiso" ]]; then isotopes="y"; fi |
---|
496 | sed -e "s/NOM_SIMU/$SIM/" \ |
---|
497 | -e "s/time=.*.$/time=$cput/" \ |
---|
498 | -e "s/ntasks=.*.$/ntasks=$mpi/" \ |
---|
499 | -e "s/ntasks-per-node=.*.$/ntasks-per-node=$mpi_per_node/" \ |
---|
500 | -e "s/cpus-per-task=.*.$/cpus-per-task=$omp/" \ |
---|
501 | -e "s/nthreads=.*./nthreads=$omp/" \ |
---|
502 | -e "s/MAINDIR=.*.$/MAINDIR=$(basename "$local_d")/" \ |
---|
503 | -e "s:STORED=.*.*:STORED=$(dirname "$local_d"):" \ |
---|
504 | -e "s:SCRATCHD=.*.*:SCRATCHD=$SIMRUNBASEDIR:" \ |
---|
505 | -e "s/stopsim=.*.$/stopsim=$stopsim/" \ |
---|
506 | -e "s/^veget=.*.$/veget=$veget/" \ |
---|
507 | -e "s/^aerosols=.*.$/aerosols=$aerosols/" \ |
---|
508 | -e "s/^isotopes=.*.$/isotopes=$isotopes/" \ |
---|
509 | -e "s/^climato=.*.$/climato=$climato/" \ |
---|
510 | -e "s/^ok_guide=.*.$/ok_guide=$ok_guide/" \ |
---|
511 | "$local_d/script_SIMU" >| "$SIMRUNDIR/tmp_$SIM" |
---|
512 | |
---|
513 | enable_platform "$SIMRUNDIR/tmp_$SIM" |
---|
514 | |
---|
515 | if [[ $testmode = "y" ]]; then |
---|
516 | sed -i'' -e "s/time=.*.$/time=00:10:00/" -e "s/#nday=1/nday=1/" -e "s/#@TESTQ//" "$SIMRUNTOPDIR/tmp_$SIM" |
---|
517 | fi |
---|
518 | } |
---|
519 | |
---|
520 | #---------------------------------------------------------------------- |
---|
521 | function list_yrmth() { |
---|
522 | #---------------------------------------------------------------------- |
---|
523 | local liste="" |
---|
524 | local mthini=$1 |
---|
525 | local mthend=$2 |
---|
526 | local mo_=$mthini |
---|
527 | while [[ $mo_ != $mthend ]] ; do |
---|
528 | liste="$liste $mo_" |
---|
529 | yr__=$( echo $mo_ | cut -c 1-4 ) |
---|
530 | mo__=$( echo $mo_ | cut -c 5-6 ) |
---|
531 | echo YM $yr__ $mo__ |
---|
532 | if [ $(( $mo__ +1 )) == 12 ] ; then |
---|
533 | yr__=$(( $yr__ + 1 )) ; mo_=$yr__$mo__ |
---|
534 | else |
---|
535 | mo_=$(( $mo_ + 1 )) |
---|
536 | fi |
---|
537 | done |
---|
538 | echo $liste |
---|
539 | |
---|
540 | } |
---|
541 | |
---|
542 | #---------------------------------------------------------------------- |
---|
543 | increment_month() { |
---|
544 | #---------------------------------------------------------------------- |
---|
545 | local year=$( echo $1 | cut -c 1-4 ) |
---|
546 | local month=$(( $1 - ${year}00 )) |
---|
547 | if [ $(( $month - 12 )) -eq 0 ]; then |
---|
548 | year=$((year + 1)) |
---|
549 | month=1 |
---|
550 | else |
---|
551 | month=$((month + 1)) |
---|
552 | fi |
---|
553 | if [[ $month -le 9 ]] ; then month=0$month ; fi |
---|
554 | echo $year$month |
---|
555 | } |
---|
556 | |
---|
557 | #---------------------------------------------------------------------- |
---|
558 | function fetch_simu_init_files() { |
---|
559 | #---------------------------------------------------------------------- |
---|
560 | ##################################################################### |
---|
561 | echo "Recuperation eventuelle de certains fichiers sur http:lmdz.lmd.jussieu.fr/pub" |
---|
562 | ##################################################################### |
---|
563 | |
---|
564 | # ORCHIDEE input files |
---|
565 | get_input_files wget_pub Orchidee |
---|
566 | |
---|
567 | # Files for aerosols and chemistry |
---|
568 | if [[ $aerosols = "clim" ]]; then |
---|
569 | get_input_files wget_pub AerChem ; fi |
---|
570 | |
---|
571 | # Files for SPLA |
---|
572 | if [[ $aerosols = "spla" ]]; then |
---|
573 | get_input_files wget_pub SPLA_WA/emissions |
---|
574 | mo_=$mthini |
---|
575 | while [[ $mo_ != $mthend ]] ; do |
---|
576 | # Code horrible duplique a cause de 08 (FH) |
---|
577 | local yr__=$( echo $mo_ | cut -c 1-4 ) |
---|
578 | local mo__=$(( $mo_ - ${yr__}00 )) |
---|
579 | if [[ $mo__ -le 9 ]] ; then mo__=0$mo__ ; fi |
---|
580 | for var in u10m v10m u v ; do |
---|
581 | echo wget_pub 3DInputData/SPLA_WA/ERA5/$yr__/$mo__ $var.nc |
---|
582 | wget_pub 3DInputData/SPLA_WA/ERA5/$yr__/$mo__ $var.nc |
---|
583 | done |
---|
584 | mo_=$( increment_month $mo_ ) |
---|
585 | done |
---|
586 | cd $local_d ; ln -sf $LMDZ_INIT/3DInputData/SPLA_WA/ERA5 GUIDE |
---|
587 | fi |
---|
588 | } |
---|
589 | |
---|
590 | #---------------------------------------------------------------------- |
---|
591 | function run_sim_or_init() { |
---|
592 | #---------------------------------------------------------------------- |
---|
593 | cd "$local_d" |
---|
594 | |
---|
595 | if [[ $init = 1 ]]; then |
---|
596 | ##################################################################### |
---|
597 | echo "Creation de l etat initial" |
---|
598 | ##################################################################### |
---|
599 | |
---|
600 | # Creation du repertoire INIT et mise en place de liens logiques vers les starts |
---|
601 | # en anticipation de leur création : |
---|
602 | mkdir "$local_d/$INIT"; cd "$local_d/$INIT" |
---|
603 | for an in $mthini $yearini; do for f in start startphy; do ln -s "$f.nc" "$f.$an.nc"; done; done |
---|
604 | |
---|
605 | # Creation du repertoire INIT temporaire et rapatriement des fichiers necessaires |
---|
606 | if [[ -d $SIMRUNDIR/$INIT ]]; then mv "$SIMRUNDIR/$INIT" "$SIMRUNDIR/$INIT$$"; fi |
---|
607 | mkdir "$SIMRUNDIR/$INIT"; cp -r "$local_d/DEF" "$SIMRUNDIR/$INIT/" |
---|
608 | cd "$SIMRUNDIR/$INIT"; cp DEF/*.def .; cp "$local_d/lmdz_env.sh" . |
---|
609 | if [[ $xios = "y" ]]; then |
---|
610 | cp DEF/XMLfilesLMDZ/*xml . |
---|
611 | if [[ $veget != 'none' ]]; then cp DEF/XMLfilesOR$veget/*xml .; fi |
---|
612 | fi |
---|
613 | sed -e "s/anneeref=.*.$/anneeref=$yearini/" DEF/run.def >| run.def |
---|
614 | |
---|
615 | #------------------------------------------------------------------- |
---|
616 | # Fichiers Limit |
---|
617 | #------------------------------------------------------------------- |
---|
618 | local yrs suf |
---|
619 | if [[ $climato = 0 ]]; then |
---|
620 | # calend est choisi plus haut dans "Changements dans les fichiers DEF/*def" et ecrit dans $MAINDIR/DEF/run.def |
---|
621 | yrini=$(echo "$mthini" | cut -c-4) |
---|
622 | yrend=$(echo "$mthend" | cut -c-4) |
---|
623 | yrs=""; yr=$yrini |
---|
624 | while [[ $yr -le $yrend ]]; do yrs="$yrs $yr"; (( yr = yr + 1 )); done |
---|
625 | suf="360x180_" |
---|
626 | else |
---|
627 | yrs=2000 |
---|
628 | suf="1x1_clim" |
---|
629 | fi |
---|
630 | |
---|
631 | liste_get="Albedo.nc Relief.nc Rugos.nc landiceref.nc" |
---|
632 | for yr in $yrs; do |
---|
633 | if [[ $climato = 0 ]]; then sufyr=$suf$yr; else sufyr=$suf; fi |
---|
634 | liste_get="$liste_get amipbc_sic_$sufyr.nc amipbc_sst_$sufyr.nc" |
---|
635 | done |
---|
636 | echo LISTEGET "$liste_get" |
---|
637 | for file in $liste_get; do |
---|
638 | wget_pub 3DInputData/Limit $file |
---|
639 | ln_from_pub 3DInputData/Limit $file |
---|
640 | done |
---|
641 | #------------------------------------------------------------------- |
---|
642 | # Initial state ECDYN |
---|
643 | #------------------------------------------------------------------- |
---|
644 | wget_pub 3DInputData/Init ECDYN.nc |
---|
645 | ln_from_pub 3DInputData/Init ECDYN.nc |
---|
646 | ln -sf ECDYN.nc ECPHY.nc |
---|
647 | |
---|
648 | # Creation du script d'initialisation |
---|
649 | if [ "$MPICMD" = "" ] ; then mpicmd='' ; else mpicmd='OMP_NUM_THREADS=1 '"$MPICMD"' 1' ; fi |
---|
650 | cat << ...eod >| tmp |
---|
651 | #!/bin/bash |
---|
652 | #@JZ#JeanZay |
---|
653 | #@JZ#SBATCH --job-name=Init # nom du job |
---|
654 | #@JZ#SBATCH --ntasks=1 # Nombre de processus MPI |
---|
655 | #@JZ#SBATCH --cpus-per-task=1 # nombre de threads OpenMP |
---|
656 | #@JZ# /!\ Attention, la ligne suivante est trompeuse mais dans le vocabulaire |
---|
657 | #@JZ# de Slurm "multithread" fait bien référence à l'hyperthreading. |
---|
658 | #@JZ#SBATCH --hint=nomultithread # 1 thread par coeur physique (pas d'hyperthreading) |
---|
659 | #@JZ#SBATCH --time=00:10:00 # Temps d'exécution maximum demandé (HH:MM:SS) |
---|
660 | #@JZ#SBATCH --output=Init%j.out # Nom du fichier de sortie |
---|
661 | #@JZ#SBATCH --error=Init%j.out # Nom du fichier d'erreur (ici commun avec la sortie) |
---|
662 | #@JZ# To submit to dev queue; "time" (above) must be max 2h |
---|
663 | #@JZ#TESTQ#SBATCH --qos=qos_cpu-dev |
---|
664 | #@SP#Spirit |
---|
665 | #@SP#SBATCH --job-name=Init |
---|
666 | #@SP#SBATCH --ntasks=1 |
---|
667 | #@SP#SBATCH --cpus-per-task=1 |
---|
668 | #@SP#SBATCH --hint=nomultithread |
---|
669 | #@SP#SBATCH --time=00:10:00 |
---|
670 | #@SP#SBATCH --output=Init%j.out |
---|
671 | #@SP#SBATCH --error=Init%j.out |
---|
672 | #@ADS#Adastra |
---|
673 | #@ADS#SBATCH --job-name=Init |
---|
674 | #@ADS#SBATCH --ntasks=1 |
---|
675 | #@ADS#SBATCH --cpus-per-task=1 |
---|
676 | #@ADS#SBATCH --nodes=1 |
---|
677 | #@ADS#SBATCH --hint=nomultithread |
---|
678 | #@ADS#SBATCH --time=00:10:00 |
---|
679 | #@ADS#SBATCH --output=Init%j.out |
---|
680 | #@ADS#SBATCH --error=Init%j.out |
---|
681 | |
---|
682 | set -eu |
---|
683 | |
---|
684 | # ANCIEN MULTI STEP case \${LOADL_STEP_NAME} in |
---|
685 | |
---|
686 | # ANCIEN MULTI STEP init ) |
---|
687 | |
---|
688 | if [ ! -f lmdz_env.sh ]; then echo "manque fichier lmdz_env.sh"; ls; exit 1; fi |
---|
689 | . lmdz_env.sh |
---|
690 | ulimit -s unlimited |
---|
691 | cd $SIMRUNDIR/$INIT |
---|
692 | echo "Executable : $ce0l" |
---|
693 | for yr in $yrs; do |
---|
694 | if [ $climato = 0 ]; then sufyr=$suf\$yr; else sufyr=$suf; fi |
---|
695 | ln -sf amipbc_sic_\$sufyr.nc amipbc_sic_1x1.nc |
---|
696 | ln -sf amipbc_sst_\$sufyr.nc amipbc_sst_1x1.nc |
---|
697 | sed -e 's/anneeref=.*.$/anneeref='\$yr'/' DEF/run.def >| run.def |
---|
698 | echo Starting initialisation |
---|
699 | # Runing ce0l.e |
---|
700 | $mpicmd $ce0l # ce0l requires MPI=OMP=1 |
---|
701 | if [ $climato = 0 ]; then mv limit.nc limit.\$yr.nc; fi |
---|
702 | done |
---|
703 | # ANCIEN MULTI STEP ;; |
---|
704 | |
---|
705 | # ANCIEN MULTI STEP interp ) |
---|
706 | if [[ $aerosols = clim ]]; then |
---|
707 | cp $local_d/interp_aerosols.sh .; chmod +x interp_aerosols.sh |
---|
708 | # Les aerosols de l'annee 2000 ont été remplacés par "9999" qui pointe vers un fichier moyen sur 1995-2014 |
---|
709 | #for year in 2000 1850; do ./interp_aerosols.sh \$year; done |
---|
710 | #mv aerosols.2000.nc aerosols.clim.nc; mv aerosols.1850.nc aerosols.nat.nc |
---|
711 | for year in 9999 1850; do ./interp_aerosols.sh \$year; done |
---|
712 | mv aerosols.9999.nc aerosols.clim.nc; mv aerosols.1850.nc aerosols.nat.nc |
---|
713 | fi |
---|
714 | |
---|
715 | for f in sta* gri*nc; do cp \$f $local_d/$INIT/\$f; done |
---|
716 | if [[ $climato = 1 ]]; then cp limit.nc $local_d/$INIT/limit.nc; fi |
---|
717 | mkdir -p $local_d/$LIMIT |
---|
718 | for f in limit*.nc ; do cp \$f $local_d/$LIMIT/\$f; done |
---|
719 | if [ $aerosols = clim ]; then for f in aerosols[.0-9]*nc; do cp \$f $local_d/$LIMIT/\$f; done; fi |
---|
720 | # |
---|
721 | cd $SIMRUNDIR |
---|
722 | ...eod |
---|
723 | if [[ $ok_guide != "y" ]]; then # Running first simulation automatically except for nudging |
---|
724 | cat << ...eod >> tmp |
---|
725 | echo "Submitting job tmp_$SIM" |
---|
726 | #echo "\$SUBMITCMD tmp_$SIM" |
---|
727 | #\$SUBMITCMD tmp_$SIM |
---|
728 | echo submitcmd tmp_$SIM |
---|
729 | submitcmd tmp_$SIM |
---|
730 | ...eod |
---|
731 | fi |
---|
732 | cat << ...eod >> tmp |
---|
733 | # ANCIEN MULTI STEP esac |
---|
734 | ...eod |
---|
735 | enable_platform tmp |
---|
736 | echo "#################################################################" |
---|
737 | #echo "Submitting initialisation job <$SUBMITCMD tmp> from $(pwd)" |
---|
738 | echo "Submitting initialisation job <submitcmd tmp> from $(pwd)" |
---|
739 | chmod +x tmp |
---|
740 | #$SUBMITCMD tmp |
---|
741 | submitcmd tmp |
---|
742 | echo "#################################################################" |
---|
743 | |
---|
744 | else #case [ $init != 1 ] |
---|
745 | cd "$SIMRUNDIR" |
---|
746 | echo "################################################################" |
---|
747 | echo "Submitting job tmp_$SIM" |
---|
748 | #echo "$SUBMITCMD tmp_$SIM" |
---|
749 | #$SUBMITCMD "tmp_$SIM" |
---|
750 | echo "submitcmd tmp_$SIM" |
---|
751 | submitcmd "tmp_$SIM" |
---|
752 | echo '################################################################' |
---|
753 | fi |
---|
754 | } |
---|
755 | |
---|
756 | #--------------------------------------------------------------------------- |
---|
757 | function message_post_submit() { |
---|
758 | #--------------------------------------------------------------------------- |
---|
759 | if [[ $ok_guide = "y" && $init = 1 ]]; then |
---|
760 | cd "$local_d" |
---|
761 | enable_platform era2gcm_tuto.sh |
---|
762 | echo "Once initialisation is finished, you have to create nudging files" |
---|
763 | echo "Edit era2gcm_tuto.sh and set the desired parameters in section <User choices>" |
---|
764 | echo "Make sure you have acces to the chosen ERA files, and the required modules are loaded, then run : ./era2gcm_tuto.sh" |
---|
765 | if [[ $aerosols = "spla" ]]; then |
---|
766 | echo "Your aerosol choice is <spla>, so you need ERA 10m-winds interpolated on LMDZ grid. Use script era2gcm_uv10m.sh" |
---|
767 | fi |
---|
768 | else |
---|
769 | echo "Si tout se passe bien, vous avez initialisé et lancé automatiquement la simulation." |
---|
770 | echo "Le job qui a été lancé se trouve sur $SIMRUNTOPDIR/tmp_$SIM" |
---|
771 | fi |
---|
772 | } |
---|
773 | |
---|
774 | #--------------------------------------------------------------------------- |
---|
775 | function setup_and_load_lmdz_env() { |
---|
776 | #--------------------------------------------------------------------------- |
---|
777 | if [[ ! -f .lmdz_setup_root_dir ]]; then echo "STOP: setup.sh is not located in the root dir ??!!"; exit 1; fi |
---|
778 | # sed root_dir in lmdz_env.sh |
---|
779 | sed -i'' "s<root_dir=.*<root_dir=$local_d<" lmdz_env.sh |
---|
780 | |
---|
781 | # Set up the appropriate environment |
---|
782 | source lmdz_env.sh |
---|
783 | } |
---|
784 | |
---|
785 | local_d=$(pwd) |
---|
786 | |
---|
787 | setup_and_load_lmdz_env |
---|
788 | load_install_lib |
---|
789 | define_expert_options |
---|
790 | set_default_params |
---|
791 | read_cmdline_args "$@" |
---|
792 | ensure_correct_option_combinations |
---|
793 | install_model |
---|
794 | setup_def |
---|
795 | setup_ce0l |
---|
796 | setup_simu |
---|
797 | fetch_simu_init_files |
---|
798 | run_sim_or_init |
---|
799 | message_post_submit |
---|