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

Last change on this file since 3555 was 253, checked in by emillour, 13 years ago

Generic GCM

  • Massive update to version 0.7

EM+RW

  • Property svn:executable set to *
File size: 2.7 KB
Line 
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=5
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
51gcm.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 ########
69#mail -s "crash run GCM" $address <<ENDMAIL
70#The run on $machine in $dir has just crashed.
71#ENDMAIL
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 diagspec.nc ) then
81  \mv -f diagspec.nc diagspec${numnew}.nc
82endif
83if ( -f diagsoil.nc ) then
84  \mv -f diagsoil.nc diagsoil${numnew}.nc
85endif
86if ( -f stats.nc ) then
87  \mv -f stats.nc stats${numnew}.nc
88endif
89if ( -f profiles.dat ) then
90  \mv -f profiles.dat profiles${numnew}.dat
91  \mv -f profiles.hdr profiles${numnew}.hdr
92endif
93
94
95# Prepare things for upcoming runs by writing
96# value of computed season in file num_run
97echo ${numnew} >! num_run
98
99if ( -f rad_bal.out ) then
100    mv rad_bal.out rad_bal${numnew}.out
101endif
102
103if ( -f h2o_bal.out ) then
104    mv h2o_bal.out h2o_bal${numnew}.out
105endif
106
107# If we are over nummax : stop
108if ( `expr $numnew + 1 \> $nummax ` == 1) then
109   exit
110else
111   \cp -f run0 exe_planet
112   exe_planet
113endif 
Note: See TracBrowser for help on using the repository browser.