source: trunk/LMDZ.GENERIC/deftank/run0 @ 175

Last change on this file since 175 was 135, checked in by aslmd, 14 years ago

CHANGEMENT ARBORESCENCE ETAPE 2 -- NON COMPLET

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