source: trunk/LMDZ.MARS/deftank/adastra/run_year1 @ 3977

Last change on this file since 3977 was 3856, checked in by jbclement, 5 months ago

Mars PCM:
Addition of the "run_year1" file to launch jobs "year by year" instead of "month by month" for Adastra in the deftank folder.
JBC

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/bash
2#SBATCH --job-name=run_year1
3#SBATCH --account=cin0391
4#SBATCH --constraint=GENOA
5#SBATCH --nodes=1
6#SBATCH --ntasks-per-node=24
7#SBATCH --cpus-per-task=8
8#SBATCH --threads-per-core=1 # --hint=nomultithread
9#SBATCH --exclusive
10#SBATCH --output=run_year1_%A.out
11#SBATCH --time=16:00:00
12
13## Script to run chained simulations
14## (uses script "run0" and reference file "run.def.ref")
15## Set values of "num_now" and "num_end" in the script below
16## to set initial year # and final year # of the simulation
17
18# A few parameters that might need be changed depending on your setup:
19# Path to the arch.env to source
20source ../trunk/LMDZ.COMMON/arch.env
21# Number of threads to use (must be the same as "#SBATCH --cpus-per-task=" above)
22export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
23export OMP_STACKSIZE=400M
24#
25########################################################################
26set -exv
27ls -al
28trap 'echo -e "Error at line $LINENO!"' ERR
29
30# Set starting year and ending year below:
31num_now=1
32num_end=10
33num_previous=$(( num_now - 1 ))
34
35echo "$num_previous" > num_run
36# next year number
37num_next=$(( num_now + 1 ))
38
39# Check if required files exist
40\rm -f  error; touch error
41
42if [ ! -f run.def.ref ]; then
43  echo "Error: file \"run.def.ref\" not found in current directory!" > error
44  exit 1
45fi
46
47if [ ! -x run0 ]; then
48  echo "Error: file \"run0\" not found or not executable in current directory!" > error
49  exit 1
50fi
51
52if [ ! -f run_year$num_now ]; then
53  echo "Error: file \"run_year${num_now}\" not found in current directory!" > error
54  exit 1
55fi
56
57# Run model for a year (669 sols)
58sed s/9999/669/ run.def.ref > run.def ; ./run0 >> error
59
60# Launch job for next year
61if (( num_next <= num_end )) ; then
62  cp -f run_year$num_now tmp
63  sed -e "s@run_year${num_now}@run_year${num_next}@" \
64      -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_year$num_next
65  rm tmp
66  sbatch run_year$num_next
67fi
Note: See TracBrowser for help on using the repository browser.