source: trunk/LMDZ.PLUTO.old/deftank/run0 @ 3438

Last change on this file since 3438 was 3175, checked in by emillour, 10 months ago

Pluto PCM:
Add the old Pluto LMDZ for reference (required prior step to making
an LMDZ.PLUTO using the same framework as the other physics packages).
TB+EM

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/bin/bash
2###########################################################################
3# Script to perform several chained LMD GCM simulations
4# SET HERE the maximum total number of simulations
5
6nummax=1
7
8###########################################################################
9
10
11echo "---------------------------------------------------------"
12echo "starting run0"
13
14dir=`pwd`
15machine=`hostname`
16address=`whoami`
17
18# Look for file "num_run" which should contain
19# the value of the previously computed run (earth year or diagfi number)
20# (defaults to 0 if file "num_run" does not exist)
21if [[ -r num_run ]] ; then
22  echo "found file num_run"
23  numold=`cat num_run`
24else
25  numold=0
26fi
27echo "numold is set to" ${numold}
28
29
30# Set value of current date
31(( numnew = ${numold} + 1 ))
32echo "numnew is set to" ${numnew}
33
34# Look for initialization data files (exit if none found)
35if [[ ( -r start${numold}.nc  &&  -r startfi${numold}.nc ) ]] ; then
36   \cp -f start${numold}.nc start.nc
37   \cp -f startfi${numold}.nc startfi.nc
38else
39   if (( ${numold} == 99999 )) ; then
40    echo "No run because previous run crashed ! (99999 in num_run)"
41    exit
42   else
43   echo "Where is file start"${numold}".nc??"
44   exit
45   fi
46fi
47
48
49# Run GCM
50gcm.e > lrun${numnew} 
51
52
53# Check if run ended normaly and copy datafiles
54if [[ ( -r restartfi.nc  &&  -r restart.nc ) ]] ; then
55  echo "Run seems to have ended normaly"
56  \mv -f restartfi.nc startfi${numnew}.nc
57  \mv -f restart.nc start${numnew}.nc
58else
59  if [[ -r num_run ]] ; then
60    \mv -f num_run num_run.crash
61  else
62    echo "No file num_run to build num_run.crash from !!"
63    # Impose a default value of 0 for num_run
64    echo 0 > num_run.crash
65  fi
66 echo 99999 > num_run
67############## To receive an Email message if the run crashes ########
68mail -s "crash run GCM" $address <<ENDMAIL
69The run on $machine in $dir has just crashed.
70ENDMAIL
71############################################""
72 exit
73fi
74
75# Copy other datafiles that may have been generated
76if [[ -r diagfi.nc ]] ; then
77  \mv -f diagfi.nc diagfi${numnew}.nc
78fi
79if [[ -r diagsoil.nc ]] ; then
80  \mv -f diagsoil.nc diagsoil${numnew}.nc
81fi
82if [[ -r stats.nc ]] ; then
83  \mv -f stats.nc stats${numnew}.nc
84fi
85if [[ -f profiles.dat ]] ; then
86  \mv -f profiles.dat profiles${numnew}.dat
87  \mv -f profiles.hdr profiles${numnew}.hdr
88fi
89
90# Prepare things for upcoming runs by writing
91# value of computed season in file num_run
92echo ${numnew} > num_run
93
94# If we are over nummax : stop
95if (( $numnew + 1 > $nummax )) ; then
96   exit
97else
98   \cp -f run0 exe_pluto
99   ./exe_pluto
100fi 
101
102
Note: See TracBrowser for help on using the repository browser.