source: trunk/LMDZ.MARS/deftank/irene/run0

Last change on this file was 2776, checked in by emillour, 2 years ago

Mars GCM:
Add example scripts for the TGCC Irene cluster.
EM

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