source: trunk/LMDZ.MARS/deftank/run0 @ 283

Last change on this file since 283 was 38, checked in by emillour, 14 years ago

Ajout du modè Martien (mon LMDZ.MARS.BETA, du 28/01/2011) dans le rértoire mars, pour pouvoir suivre plus facilement les modifs.
EM

  • 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 crashes ########
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 diagsoil.nc ) then
79  \mv -f diagsoil.nc diagsoil${numnew}.nc
80endif
81if ( -f stats.nc ) then
82  \mv -f stats.nc stats${numnew}.nc
83endif
84if ( -f profiles.dat ) then
85  \mv -f profiles.dat profiles${numnew}.dat
86  \mv -f profiles.hdr profiles${numnew}.hdr
87endif
88
89# Prepare things for upcoming runs by writing
90# value of computed season in file num_run
91echo ${numnew} >! num_run
92
93# If we are over nummax : stop
94if ( `expr $numnew + 1 \> $nummax ` == 1) then
95   exit
96else
97   \cp -f run0 exe_mars
98   exe_mars
99endif 
100
101
Note: See TracBrowser for help on using the repository browser.