source: trunk/MESOSCALE/LMDZ.MARS/in_lmdz_mars/deftank/run0 @ 3241

Last change on this file since 3241 was 57, checked in by aslmd, 14 years ago

mineur LMD_MM_MARS: ajout du GCM ancienne physique, systeme maintenant complet sur SVN (ne manque que la base de donnees d'etats initiaux)

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