source: trunk/LMDZ.PLUTO.old/deftank/gcm/runpluto

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