| 1 | #!/bin/bash |
|---|
| 2 | ## Headers managed by sed |
|---|
| 3 | #@JZ#JeanZay |
|---|
| 4 | #@JZ#SBATCH --job-name=NOM_SIMU # nom du job |
|---|
| 5 | #@JZ# Nombre de processus MPI : |
|---|
| 6 | #@JZ#SBATCH --ntasks=8 |
|---|
| 7 | #@JZ##### number of MPI processes per node : 40(procs/node on Jean-Zay) / cpus-per-task (ex : =5 for 8 OMP) |
|---|
| 8 | #@JZ####SBATCH --ntasks-per-node=5 # if specified, also add "#SBATCH --nodes= ..." with nodes=ntasks/(ntasks-per-node) |
|---|
| 9 | #@JZ# nombre de threads OpenMP |
|---|
| 10 | #@JZ#SBATCH --cpus-per-task=8 |
|---|
| 11 | #@JZ# de Slurm "multithread" fait bien reference a l'hyperthreading. |
|---|
| 12 | #@JZ#SBATCH --hint=nomultithread # 1 thread par coeur physique (pas d'hyperthreading) |
|---|
| 13 | #@JZ#SBATCH --time=00:30:00 # Temps d execution maximum demande (HH:MM:SS) |
|---|
| 14 | #@JZ#SBATCH --output=outNOM_SIMU%j # Nom du fichier de sortie |
|---|
| 15 | #@JZ#SBATCH --error=outNOM_SIMU%j # Nom du fichier d'erreur (ici commun avec la sortie) |
|---|
| 16 | #@JZ# To submit to test queue ; "time" (above) must be max 30 min |
|---|
| 17 | #@JZ#TESTQ#SBATCH --qos=qos_cpu-dev |
|---|
| 18 | #@SP#Spirit |
|---|
| 19 | #@SP#SBATCH --job-name=NOM_SIMU |
|---|
| 20 | #@SP#SBATCH --ntasks=8 |
|---|
| 21 | #@SP#SBATCH --cpus-per-task=8 |
|---|
| 22 | #@SP#SBATCH --time=00:30:00 |
|---|
| 23 | #@SP#SBATCH --output=outNOM_SIMU%j |
|---|
| 24 | #@SP#SBATCH --error=outNOM_SIMU%j |
|---|
| 25 | #@ADS#Adastra |
|---|
| 26 | #@ADS#SBATCH --job-name=NOM_SIMU |
|---|
| 27 | #@ADS#SBATCH --ntasks=8 |
|---|
| 28 | #@ADS#SBATCH --cpus-per-task=8 |
|---|
| 29 | #@ADS#SBATCH --ntasks-per-node=8 |
|---|
| 30 | #@ADS#SBATCH --time=00:30:00 |
|---|
| 31 | #@ADS#SBATCH --output=outNOM_SIMU%j |
|---|
| 32 | #@ADS#SBATCH --error=outNOM_SIMU%j |
|---|
| 33 | |
|---|
| 34 | set -eux |
|---|
| 35 | |
|---|
| 36 | # Number of MPI processes : |
|---|
| 37 | ntasks=8 |
|---|
| 38 | # number of OpenMP threads |
|---|
| 39 | nthreads=8 |
|---|
| 40 | export OMP_NUM_THREADS=$nthreads |
|---|
| 41 | #@JZ#export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK # For Jean-Zay (replacing the next 3 lines, commented out) |
|---|
| 42 | # private memory for each thread |
|---|
| 43 | export OMP_STACKSIZE=800M |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | #@JZ#export OMP_PLACES=cores # "binding" present in old script_SIMU, but terribly reduces performance on Spirit... |
|---|
| 47 | ulimit -s unlimited |
|---|
| 48 | #@SP ulimit -Ss 8192 |
|---|
| 49 | |
|---|
| 50 | simul=NOM_SIMU |
|---|
| 51 | |
|---|
| 52 | reseau_local=0 |
|---|
| 53 | #veget=y |
|---|
| 54 | veget=CMIP6 |
|---|
| 55 | if [[ $veget = "none" ]] ; then VEGET=n ; else VEGET=y ; fi |
|---|
| 56 | |
|---|
| 57 | isotopes=n |
|---|
| 58 | # If isotopes=y, initialisation_iso will be changed to 0 in iso.def after the 1st run period, to read isotopes in restart files |
|---|
| 59 | |
|---|
| 60 | # Choice of aerosols : n / clim / spla |
|---|
| 61 | aerosols=clim |
|---|
| 62 | stopsim=201101 |
|---|
| 63 | ok_guide=y # y/n guidage ou non |
|---|
| 64 | climato=1 |
|---|
| 65 | |
|---|
| 66 | echo '##############################################################' |
|---|
| 67 | echo '# Gestion des repertoires de lancement ' |
|---|
| 68 | echo '##############################################################' |
|---|
| 69 | |
|---|
| 70 | # Repertoires de la simulation |
|---|
| 71 | SCRATCHD=$SCRATCH |
|---|
| 72 | STORED=$STORE |
|---|
| 73 | MAINDIR=LMDZOR96x95x79 |
|---|
| 74 | SIMU_dir=$MAINDIR/$simul |
|---|
| 75 | SIMUDIR=$STORED/$SIMU_dir |
|---|
| 76 | |
|---|
| 77 | # Repertoires de travail |
|---|
| 78 | WWORKD=$SCRATCHD/$SIMU_dir$$ |
|---|
| 79 | if [[ -d $WWORKD ]]; then # useful when running on local computer, where jobs aren't submitted |
|---|
| 80 | rm -rf "$WWORKD" |
|---|
| 81 | fi |
|---|
| 82 | mkdir -p $WWORKD |
|---|
| 83 | cd $WWORKD |
|---|
| 84 | SCRIPTDIR=$SCRATCHD/$MAINDIR |
|---|
| 85 | |
|---|
| 86 | cp $STORED/$MAINDIR/lmdz_env.sh . ; . lmdz_env.sh |
|---|
| 87 | ERADIR=$STORED/$MAINDIR/GUIDE |
|---|
| 88 | if [ "$aerosols" = "spla" ] ; then ERA10mDIR=$STORED/$MAINDIR/ERA10m ; fi |
|---|
| 89 | LIMITDIR=$STORED/$MAINDIR/LIMIT |
|---|
| 90 | SPLADIR=$STORED/$MAINDIR/INPUT_SPLA |
|---|
| 91 | DEFDIR=$SIMUDIR/DEF |
|---|
| 92 | |
|---|
| 93 | GET='ln -s' |
|---|
| 94 | PUT='mv ' |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | echo '##################################################################' |
|---|
| 98 | echo 'Gestion des mois et annees' |
|---|
| 99 | echo '##################################################################' |
|---|
| 100 | |
|---|
| 101 | $GET $SIMUDIR/etat |
|---|
| 102 | year=`tail -1 etat | awk ' { print $1 } ' | cut -c1-4` |
|---|
| 103 | month=`tail -1 etat | awk ' { print $1 } ' | cut -c5-` |
|---|
| 104 | echo year $year month $month |
|---|
| 105 | |
|---|
| 106 | if [ "$month" = "" ] ; then |
|---|
| 107 | paran=1 |
|---|
| 108 | ym=$year |
|---|
| 109 | next=`expr $ym + 1` |
|---|
| 110 | else |
|---|
| 111 | paran=0 |
|---|
| 112 | if [ $month = 12 ] ; then |
|---|
| 113 | nextmonth=1 |
|---|
| 114 | nextyear=`expr $year + 1` |
|---|
| 115 | else |
|---|
| 116 | nextmonth=`expr $month + 1` |
|---|
| 117 | nextyear=$year |
|---|
| 118 | fi |
|---|
| 119 | if [ `echo $nextmonth | wc -m` = 2 ] ; then |
|---|
| 120 | nextmonth=0$nextmonth |
|---|
| 121 | fi |
|---|
| 122 | ym=$year$month |
|---|
| 123 | next=$nextyear$nextmonth |
|---|
| 124 | fi |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | echo ym $ym |
|---|
| 128 | echo mois ancien : $ym |
|---|
| 129 | echo mois nouveau : $next |
|---|
| 130 | |
|---|
| 131 | INI=${SPLADIR}/INITIAL |
|---|
| 132 | PERIOD=${SPLADIR}/PERIOD00${month}/SUB |
|---|
| 133 | |
|---|
| 134 | echo '#################################################################' |
|---|
| 135 | echo 'Modification de run.def et gcm.def pour prendre en compte la duree du' |
|---|
| 136 | echo 'du mois en question.' |
|---|
| 137 | echo 'le dayref est modifie pour tricher avec le calendrier (ecrit pour' |
|---|
| 138 | echo 'une annee de 260 jours dans le modele).' |
|---|
| 139 | echo 'On passe donc comme jour de reference le numero du jour du mois dans' |
|---|
| 140 | echo 'une annee en 360 jours.' |
|---|
| 141 | echo '#################################################################' |
|---|
| 142 | |
|---|
| 143 | # Choix du calendrier |
|---|
| 144 | #AS: La condition if "$climato" = "0" suffit, car "$ok_guide" = "y" est interdit avec $climato" = "1" dans setup.sh (exit ligne 160) |
|---|
| 145 | ##calend=earth_360d |
|---|
| 146 | ##if [ "$ok_guide" = "y" -o "$climato" = "0" ] ; then calend=gregorian ; fi |
|---|
| 147 | if [ "$climato" = "0" ] ; then calend=gregorian ; else calend=earth_360d ; fi |
|---|
| 148 | bisextile=0 |
|---|
| 149 | if [[ $(( year % 4 )) = 0 && $calend = gregorian ]] ; then bisextile=1 ; fi |
|---|
| 150 | if [ $paran = 0 ] ; then |
|---|
| 151 | if [ "$calend" = "gregorian" ] ; then |
|---|
| 152 | ndays=( 31 28 31 30 31 30 31 31 30 31 30 31 ) |
|---|
| 153 | if [ $bisextile = 1 ] ; then ndays[1]=29 ; fi |
|---|
| 154 | else |
|---|
| 155 | ndays=( 30 30 30 30 30 30 30 30 30 30 30 30 ) |
|---|
| 156 | fi |
|---|
| 157 | #Constants with a leading 0 are interpreted as octal numbers. |
|---|
| 158 | # You can remove the leading zero by parameter expansion: hour=${hour#0} |
|---|
| 159 | |
|---|
| 160 | nday=${ndays[(( ${month#0} - 1 ))]} |
|---|
| 161 | ndayh=$nday |
|---|
| 162 | dayref=1 ; mm=1 ; while [ $mm -lt ${month#0} ] ; do |
|---|
| 163 | (( dayref = $dayref + ${ndays[(( $mm - 1 ))]} )) ; (( mm = $mm + 1 )) ; done |
|---|
| 164 | else |
|---|
| 165 | dayref=1 |
|---|
| 166 | if [ "$calend" = "gregorian" ] ; then |
|---|
| 167 | if [ $bisextile = 0 ] ; then nday=365 ; else nday=366 ; fi |
|---|
| 168 | else |
|---|
| 169 | nday=360 ; ndayh=30 |
|---|
| 170 | fi |
|---|
| 171 | fi |
|---|
| 172 | |
|---|
| 173 | echo CALENDRIER $calend : longueur du mois vrai $year $month $nday dayref=$dayref |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | echo '####################################################################' |
|---|
| 177 | echo '# On va chercher les fichiers necessaires a la simulation' |
|---|
| 178 | echo '####################################################################' |
|---|
| 179 | #Reminder : we are in $WWORKD = $SCRATCHD/$SIMU_dir = $SCRATCHD/$MAINDIR/$simul |
|---|
| 180 | |
|---|
| 181 | echo DEFDIR $DEFDIR |
|---|
| 182 | echo SIMUDIR $SIMUDIR |
|---|
| 183 | echo simul $simul |
|---|
| 184 | |
|---|
| 185 | if [ $reseau_local = 0 ] ; then mkdir DEF ; cd DEF ; $GET $DEFDIR/* . ; cd .. ; fi |
|---|
| 186 | |
|---|
| 187 | cp -f DEF/* . |
|---|
| 188 | #---The following changes in .def files will only be visible in the running directory (on SCRATCH if $reseau_local = 0) |
|---|
| 189 | # They concern variables that change during runtime : nday, dayref, anneeref, ndayh |
|---|
| 190 | # The other "sed" were totally or partially moved in setup.sh, to be done in $MAINDIR/DEF/*.def, before creating $MAINDIR/$SIMU (more transparent) |
|---|
| 191 | #sed -e 's/ok_guide=.*.$/ok_guide='$ok_guide'/' DEF/guide.def >| guide.def |
|---|
| 192 | #sed -e 's/nday=.*.$/nday='$nday'/' -e 's/dayref=.*.$/dayref='${dayref}'/' -e 's/calend=.*.$/calend='$calend'/' -e 's/anneeref=.*.$/anneeref='$year'/' DEF/run.def >| run.def |
|---|
| 193 | |
|---|
| 194 | #=====!!!!!!!!====!!!!!!====!!!!+++====!!!!!!====!!!!!!!=====!!!!!!====z!!!====!!!!========!!!!!========!!! |
|---|
| 195 | ##POUR que des TESTS soyent tres RAPIDES (pour ex, verifier fichiers input), ON FORCE nday=1 jour !!! |
|---|
| 196 | #nday=1 |
|---|
| 197 | #=====!!!!!!!!====!!!!!!====!!!!+++====!!!!!!====!!!!!!!=====!!!!!!====z!!!====!!!!========!!!!!========!!! |
|---|
| 198 | |
|---|
| 199 | sed -e 's/nday=.*.$/nday='$nday'/' -e 's/dayref=.*.$/dayref='${dayref}'/' -e 's/anneeref=.*.$/anneeref='$year'/' DEF/run.def >| run.def |
|---|
| 200 | sed -e 's/phys_out_filetimesteps=[[:space:]]*[0-9][0-9]day/phys_out_filetimesteps= '$ndayh'day/' DEF/config.def >| config.def |
|---|
| 201 | #--- End of *.def changes in the $WWORKD only |
|---|
| 202 | |
|---|
| 203 | ${GET} $SIMUDIR/start.$ym.nc start.nc |
|---|
| 204 | ${GET} $SIMUDIR/startphy.$ym.nc startphy.nc |
|---|
| 205 | if [ $climato = 1 ] ; then |
|---|
| 206 | ${GET} $LIMITDIR/limit.nc limit.nc |
|---|
| 207 | else |
|---|
| 208 | ${GET} $LIMITDIR/limit.$year.nc limit.nc |
|---|
| 209 | fi |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | echo '####################################################################' |
|---|
| 213 | echo '# Imports des fichiers aerosols si flag_aerosol>0 dans config.def, ' |
|---|
| 214 | echo '# et si dans setup.sh on a "aerosols=clim" ou "aerosols=spla". ' |
|---|
| 215 | echo '# NOTE: Si "aerosols=n" dans setup.sh, script_SIMU met flag_aerosol=0 et on tourne SANS aerosols' |
|---|
| 216 | echo '####################################################################' |
|---|
| 217 | if [ "`grep 'flag_aerosol=' config.def | head -1 | cut -d= -f2`" != 0 ] ; then |
|---|
| 218 | if [ $aerosols = clim ] ; then |
|---|
| 219 | # if [ $climato = 1 ] ; then suf=clim ; else suf=$year ; fi |
|---|
| 220 | suf=clim |
|---|
| 221 | # Le script pourrait être sophistique pour prendre des aerosols interannuels |
|---|
| 222 | ${GET} $LIMITDIR/aerosols.$suf.nc aerosols$year.nc |
|---|
| 223 | if [ ! -f aerosols1980.nc ] ; then ${GET} $LIMITDIR/aerosols.$suf.nc aerosols1980.nc ; fi |
|---|
| 224 | ${GET} $LIMITDIR/aerosols.nat.nc aerosols.nat.nc |
|---|
| 225 | fi |
|---|
| 226 | |
|---|
| 227 | ## Ca doit etre la meme liste de fichiers rapatriee par setup.sh dans $LMDZ_INIT/SPLA_Init |
|---|
| 228 | ## et interpolee (setup.sh aussi) dans $SPLADIR |
|---|
| 229 | if [ $aerosols = spla ] ; then |
|---|
| 230 | inputf="wth.dat cly.dat donnees_lisa.nc SOILSPEC.data \ |
|---|
| 231 | carbon_emissions.nc sulphur_emissions_antro.nc \ |
|---|
| 232 | sulphur_emissions_nat.nc sulphur_emissions_volc.nc" |
|---|
| 233 | for file in $inputf ; do ${GET} $INI/$file . ; done |
|---|
| 234 | |
|---|
| 235 | change="dust.nc " |
|---|
| 236 | for file in $change ; do ${GET} $PERIOD/$file . ; done |
|---|
| 237 | |
|---|
| 238 | # Le calcul d'emissions de sels marins utilise les vents ERA-10m interpoles sur grille_s (lonv,latu) avec le script era2gcm_uv10m.sh |
|---|
| 239 | # NB : GET=ln -s ; ERA10mDIR contient lui-meme le lien ERA10m vers le repertoire des vents interpoles $REA_uv10m (REA=ERA5, ERAI ou OPERA) |
|---|
| 240 | ventl="u10m.nc v10m.nc" |
|---|
| 241 | for file in $ventl ; do ${GET} $ERA10mDIR/${year}/${month}/$file . ; done |
|---|
| 242 | fi |
|---|
| 243 | fi |
|---|
| 244 | |
|---|
| 245 | #---------------------------------------- |
|---|
| 246 | # Noveaux forcages a activer a l'avenir |
|---|
| 247 | # (commentes en attendant) : |
|---|
| 248 | #---------------------------------------- |
|---|
| 249 | #for file in climoz_LMDZ.nc solarforcing.nc taulwstrat.2D.nc tauswstrat.2D.nc ; do |
|---|
| 250 | # ${GET} $LIMITDIR/$file $file |
|---|
| 251 | #done |
|---|
| 252 | #---------------------------------------- |
|---|
| 253 | |
|---|
| 254 | ${GET} $SIMUDIR/gcm.e gcm.e ; chmod +x gcm.e |
|---|
| 255 | |
|---|
| 256 | |
|---|
| 257 | if [ $VEGET = y ] ; then |
|---|
| 258 | set +e ; for t in stomate sechiba ; do cp $SIMUDIR/start_$t.$ym.nc ${t}_rest_in.nc ; done ; set -e |
|---|
| 259 | if [ "`grep RIVER_ROUTING orchidee.def |grep -i y`" ] ; then |
|---|
| 260 | set +e ; ln -s $LMDZ_INIT/routing_simple.nc . ; ln -s $LMDZ_INIT/routing.nc . |
|---|
| 261 | cp $SIMUDIR/start_routing.$ym.nc routing_start.nc ; set -e |
|---|
| 262 | fi |
|---|
| 263 | |
|---|
| 264 | #For Orchidee trunk (post-CMIP6), orchidee_pft.def must be copied in addition to orchidee.def |
|---|
| 265 | \cp -f DEF/orchidee*.def . |
|---|
| 266 | |
|---|
| 267 | # Test sur sechiba_rest_in.nc, |
|---|
| 268 | # supposant que les restarts pour sechiba, stomate, et routing le cas echeant, |
|---|
| 269 | # sont soit tous dispo, soit tous absents |
|---|
| 270 | if [ ! -f sechiba_rest_in.nc ] ; then |
|---|
| 271 | echo '#########################################################' |
|---|
| 272 | echo "Autoinitialisation d'orchidee au besoin" |
|---|
| 273 | echo '#########################################################' |
|---|
| 274 | get="ln -s $LMDZ_INIT/" |
|---|
| 275 | for file in cartepente2d_15min.nc \ |
|---|
| 276 | lai2D.nc soils_param.nc soil_bulk_and_ph.nc alb_bg_modisopt_2D_ESA_v2.nc reftemp.nc ; do ${get}$file ; done |
|---|
| 277 | |
|---|
| 278 | ln -sf alb_bg_modisopt_2D_ESA_v2.nc alb_bg.nc |
|---|
| 279 | |
|---|
| 280 | echo ATTENTION : ON UTILISE LES FICHIERS DE L ANNEE 2000 |
|---|
| 281 | ${get}PFTmap_15PFT.v1_2000.nc PFTmap.nc |
|---|
| 282 | ${get}woodharvest_2000.nc woodharvest.nc |
|---|
| 283 | |
|---|
| 284 | sed -e 's/^SECHIBA_restart_in.*./SECHIBA_restart_in=NONE/' \ |
|---|
| 285 | -e 's/^STOMATE_RESTART_FILEIN.*./STOMATE_RESTART_FILEIN=NONE/' \ |
|---|
| 286 | -i orchidee.def |
|---|
| 287 | |
|---|
| 288 | if [ $veget = 7994 ] ; then |
|---|
| 289 | get="ln -s $LMDZ_INIT/" |
|---|
| 290 | for file in ndep_nhx.nc ndep_noy.nc nfert_cropland.nc nfert_pasture.nc nmanure_cropland.nc nmanure_pasture.nc bnf.nc ; do ${get}$file ; done |
|---|
| 291 | fi |
|---|
| 292 | |
|---|
| 293 | fi |
|---|
| 294 | |
|---|
| 295 | fi |
|---|
| 296 | |
|---|
| 297 | |
|---|
| 298 | echo '#################################################################' |
|---|
| 299 | echo 'Repertoire contenant les fichiers de reanalyses' |
|---|
| 300 | echo '#################################################################' |
|---|
| 301 | |
|---|
| 302 | if [ "$ok_guide" = "y" ] ; then |
|---|
| 303 | \rm -f u.nc v.nc T.nc hur.nc |
|---|
| 304 | if [ -f u.nc ] ; then |
|---|
| 305 | echo PROBLEME D EFFACEMENT DES FICHIERS DE REANALYSES |
|---|
| 306 | exit 1 |
|---|
| 307 | fi |
|---|
| 308 | for var in u v T hur ; do $GET $ERADIR/$year/$month/$var.nc $var.nc ; done |
|---|
| 309 | echo Fin du rapatriement des fichiers de guidage |
|---|
| 310 | fi |
|---|
| 311 | |
|---|
| 312 | echo '##################################################################' |
|---|
| 313 | echo 'liste des fichiers avant le lancement de la simulation' |
|---|
| 314 | echo '##################################################################' |
|---|
| 315 | ls -lrt |
|---|
| 316 | #diff DEF ./ |
|---|
| 317 | |
|---|
| 318 | echo '##################################################################' |
|---|
| 319 | echo 'Lancement de la simulation' |
|---|
| 320 | echo '##################################################################' |
|---|
| 321 | |
|---|
| 322 | time $MPICMD $ntasks ./gcm.e > listing |
|---|
| 323 | if [ ! -f restartphy.nc ] ; then |
|---|
| 324 | echo PROBLEME PAS DE FICHIER RESTARTPHY |
|---|
| 325 | exit |
|---|
| 326 | fi |
|---|
| 327 | |
|---|
| 328 | echo '##################################################################' |
|---|
| 329 | echo 'sauvegarde des fichiers de sortie' |
|---|
| 330 | echo '##################################################################' |
|---|
| 331 | |
|---|
| 332 | # listing |
|---|
| 333 | ${PUT} listing ${SIMUDIR}/list$ym |
|---|
| 334 | # if the listing for Orchidee is also needed, then uncomment the following line : |
|---|
| 335 | #if [ $VEGET = y ] ; then ${PUT} out_orchidee_0000.0000 ${SIMUDIR}/out_orchidee$ym ; fi |
|---|
| 336 | |
|---|
| 337 | # restart(s) |
|---|
| 338 | ${PUT} restart.nc ${SIMUDIR}/start.$next.nc |
|---|
| 339 | ${PUT} restartphy.nc ${SIMUDIR}/startphy.$next.nc |
|---|
| 340 | if [ $VEGET = y ] ; then for t in sechiba stomate ; do |
|---|
| 341 | f=${t}_rest_out.nc ; if [ -f $f ] ; then ${PUT} $f ${SIMUDIR}/start_$t.$next.nc ; fi ; done |
|---|
| 342 | f=routing_restart.nc ; if [ -f $f ] ; then ${PUT} $f ${SIMUDIR}/start_routing.$next.nc ; fi |
|---|
| 343 | fi |
|---|
| 344 | |
|---|
| 345 | # fichiers "histoires" |
|---|
| 346 | # Si on tourne avec xios (et type="one_file") au lieu de ioipsl, on n'a pas besoin de rebuild, on doit juste copier les fichiers |
|---|
| 347 | liste_out="histmth histday histhf histmthCOSP Xhistins XhistLES sechiba_history sechiba_history_4dim sechiba_out_2 stomate_history stomate_ipcc_history diag_routing dynzon" |
|---|
| 348 | xios_used=0 |
|---|
| 349 | |
|---|
| 350 | for fileout in $liste_out ; do |
|---|
| 351 | if [ -f $fileout.nc ] ; then |
|---|
| 352 | ${PUT} $fileout.nc ${SIMUDIR}/$fileout.$ym.nc |
|---|
| 353 | xios_used=1 |
|---|
| 354 | fi |
|---|
| 355 | done |
|---|
| 356 | |
|---|
| 357 | if [ $xios_used = 0 ] ; then |
|---|
| 358 | $GET $SIMUDIR/reb.sh |
|---|
| 359 | chmod +x reb.sh |
|---|
| 360 | ./reb.sh $ym $SIMUDIR $liste_out |
|---|
| 361 | fi |
|---|
| 362 | |
|---|
| 363 | if [ -f guide_ins.nc ] ; then ${PUT} guide_ins.nc ${SIMUDIR}/guide_ins.$ym.nc ; fi |
|---|
| 364 | |
|---|
| 365 | echo '##################################################################' |
|---|
| 366 | echo 'preparation et lancement de la simulation suivante' |
|---|
| 367 | echo '##################################################################' |
|---|
| 368 | |
|---|
| 369 | # Gestion du fichier etat de controle de la simulation |
|---|
| 370 | echo $ym OK >> etat |
|---|
| 371 | echo $next a faire >> etat |
|---|
| 372 | # ${PUT} etat $SIMUDIR/etat # Pas necessaire car etat est un lien vers $SIMUDIR/etat |
|---|
| 373 | |
|---|
| 374 | # set initialisation_iso to 0 for next run to read isotopes from restart files |
|---|
| 375 | if [ $isotopes = y ] ; then |
|---|
| 376 | sed -i 's/^initialisation_iso=.*.$/initialisation_iso=0/' $SIMUDIR/DEF/iso.def |
|---|
| 377 | fi |
|---|
| 378 | set +e ; \rm out* sec* sta* list* rest* gcm.e aer* ; set -e |
|---|
| 379 | |
|---|
| 380 | # Arret si on est arrive au bout |
|---|
| 381 | if [ $next = $stopsim ] ; then |
|---|
| 382 | echo 'On arrive au bout, simulation next:'$next', stopsim:'$stopsim |
|---|
| 383 | # Cas particulier ou on veut chainer plusieurs simulations multi annuelles. |
|---|
| 384 | # pour le tuning automatique. |
|---|
| 385 | # Ici on passe de SCM_1-019 a SCM_1-029 |
|---|
| 386 | if [ "${simul:0:3}" = "SCM" ] ; then |
|---|
| 387 | pre="SCM_1-" |
|---|
| 388 | num=`echo $simul | sed -e 's/'$pre'//'` |
|---|
| 389 | # (( num = $num + 10 )) change a cause d un probleme avec 008 |
|---|
| 390 | num=`echo $num | awk ' { print $1 + 10 } '` |
|---|
| 391 | num=`printf "%03d\n" $num` |
|---|
| 392 | simul_new=$pre$num |
|---|
| 393 | cd $SCRIPTDIR |
|---|
| 394 | if [ $num -le 250 ] ; then |
|---|
| 395 | sed -e 's/^simul=.*.$/simul='$simul_new'/' -e 's/^\# @ job_nam.*.=.*.$/\# @ job_name = '$simul_new'/' tmp_$simul >| tmp_$simul_new |
|---|
| 396 | $SUBMITCMD tmp_$simul_new |
|---|
| 397 | fi |
|---|
| 398 | fi |
|---|
| 399 | exit |
|---|
| 400 | fi |
|---|
| 401 | |
|---|
| 402 | |
|---|
| 403 | echo '##################################################################' |
|---|
| 404 | echo 'lancement de la simulation suivante tmp_'$simul' depuis :' |
|---|
| 405 | echo '##################################################################' |
|---|
| 406 | pwd |
|---|
| 407 | |
|---|
| 408 | |
|---|
| 409 | cd $SCRIPTDIR |
|---|
| 410 | $SUBMITCMD tmp_$simul |
|---|