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