Changeset 3766 for trunk/LMDZ.MARS


Ignore:
Timestamp:
May 15, 2025, 6:26:24 PM (6 weeks ago)
Author:
jbclement
Message:

Mars PCM:
Cleaning and improvement of robustness for "run0" and "run_month1" scripts with file checks and clearer errors.
JBC

Location:
trunk/LMDZ.MARS
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/changelog.txt

    r3759 r3766  
    48384838== 12/05/2025 == JBC
    48394839Correction of a bug at compilation with ifort due to a missing module importation related to code tidying in r3727.
     4840
     4841== 14/05/2025 == JBC
     4842Cleaning and improvement of robustness for "run0" and "run_month1" scripts with file checks and clearer errors.
  • trunk/LMDZ.MARS/deftank/adastra/run0

    r3033 r3766  
    11#!/bin/bash
    2 ###########################################################################
     2########################################################################
    33# Script to perform several chained LMD Mars GCM simulations
    44# SET HERE the maximum total number of simulations
     
    99gcm=gcm_64x48x54_phymars_para.e
    1010#
    11 ###########################################################################
     11########################################################################
    1212set -x
    1313
    1414echo "---------------------------------------------------------"
    15 echo "starting run0"
     15echo "Starting run0..."
    1616
    1717dir=`pwd`
     
    1919address=`whoami`
    2020
    21 # Look for file "num_run" which should contain
     21# Check if GCM executable exists and is executable
     22if [ ! -x $gcm ]; then
     23  echo "Error: file \"$gcm\" not found or not executable in $dir!"
     24  exit 1
     25fi
     26
     27# Look for file "num_run" which should contain
    2228# the value of the previously computed season
    2329# (defaults to 0 if file "num_run" does not exist)
    2430if [[ -r num_run ]] ; then
    25   echo "found file num_run"
     31  echo "Found file \"num_run\""
    2632  numold=`cat num_run`
    2733else
    2834  numold=0
    2935fi
    30 echo "numold is set to" ${numold}
     36echo "numold is set to" $numold
    3137
    32 
    33 # Set value of current season
    34 (( numnew = ${numold} + 1 ))
    35 echo "numnew is set to" ${numnew}
     38# Set value of current season
     39numnew=$((numold + 1 ))
     40echo "numnew is set to" $numnew
    3641
    3742# Look for initialization data files (exit if none found)
     
    4045   \cp -f startfi${numold}.nc startfi.nc
    4146else
    42    if (( ${numold} == 99999 )) ; then
    43     echo "No run because previous run crashed ! (99999 in num_run)"
    44     exit
     47   if (( numold == 99999 )) ; then
     48     echo "Error: no run because previous run crashed! (99999 in \"num_run\")"
     49     exit 1
    4550   else
    46    echo "Where is file start"${numold}".nc??"
    47    exit
     51     echo "Error: missing input files \"start${numold}.nc\" or \"startfi${numold}.nc\" in $dir!"
     52     exit 1
    4853   fi
    4954fi
     
    5156
    5257# Run GCM
    53 srun --cpu-bind=threads --label -c${OMP_NUM_THREADS:=1} $gcm > lrun${numnew} 2>&1 
     58srun --cpu-bind=threads --label -c${OMP_NUM_THREADS:=1} $gcm > lrun${numnew} 2>&1
    5459
    5560
    5661# Check if run ended normaly and copy datafiles
    5762if [[ ( -r restartfi.nc  &&  -r restart.nc ) ]] ; then
    58   echo "Run seems to have ended normaly"
     63  echo "Run seems to have ended normally."
    5964  \mv -f restartfi.nc startfi${numnew}.nc
    6065  \mv -f restart.nc start${numnew}.nc
    6166else
     67  echo "Error: Run crashed or incomplete output!"
    6268  if [[ -r num_run ]] ; then
    6369    \mv -f num_run num_run.crash
    6470  else
    65     echo "No file num_run to build num_run.crash from !!"
     71    echo "No file num_run to build \"num_run.crash\" from!"
    6672    # Impose a default value of 0 for num_run
    6773    echo 0 > num_run.crash
    6874  fi
    69  echo 99999 > num_run
     75  echo 99999 > num_run
    7076############## To receive an Email message if the run crashes ########
    71 mail -s "crash run GCM" $address <<ENDMAIL
    72 The run on $machine in $dir has just crashed.
     77mail -s "Crash in GCM run" $address <<ENDMAIL
     78The GCM run on $machine in $dir has just crashed.
     79Check the output logs for more information.
    7380ENDMAIL
    74 ############################################""
    75  exit
     81#############################################
     82  exit 1
    7683fi
    7784
     
    93100# Prepare things for upcoming runs by writing
    94101# value of computed season in file num_run
    95 echo ${numnew} > num_run
     102echo $numnew > num_run
    96103
    97104# If we are over nummax : stop
    98105if (( $numnew + 1 > $nummax )) ; then
    99    exit
     106  exit 0
    100107else
    101    \cp -f run0 exe_mars
    102    ./exe_mars
    103 fi 
     108  \cp -f run0 exe_mars
     109  ./exe_mars
     110fi
  • trunk/LMDZ.MARS/deftank/adastra/run_month1

    r3033 r3766  
    44#SBATCH --constraint=GENOA
    55#SBATCH --nodes=1
    6 #SBATCH --ntasks-per-node=24 
     6#SBATCH --ntasks-per-node=24
    77#SBATCH --cpus-per-task=4
    88#SBATCH --threads-per-core=1 # --hint=nomultithread
    99#SBATCH --exclusive
    1010#SBATCH --output=run_month1_%A.out
    11 #SBATCH --time=01:25:00 
     11#SBATCH --time=01:25:00
    1212
    13 
     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 month # and final month # of the simulation
    1417
    1518# A few parameters that might need be changed depending on your setup:
    1619# Path to the arch.env to source
    1720source ../trunk/LMDZ.COMMON/arch.env
    18 # Number of threads to use (must be the same as "#SBATCH --cpus-per-task=" above) 
    19 export OMP_NUM_THREADS=4
     21# Number of threads to use (must be the same as "#SBATCH --cpus-per-task=" above)
     22export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
    2023export OMP_STACKSIZE=400M
     24#
     25########################################################################
     26set -exv
     27ls -al
     28trap 'echo -e "Error at line $LINENO!"' ERR
    2129
    22 set -xv
    23 ls -al
    24 
    25 ## set starting month and ending month below:
     30# Set starting month and ending month below:
    2631num_now=1
    2732num_end=12
    28 (( num_previous = $num_now - 1 ))
     33num_previous=$(( num_now - 1 ))
    2934
    3035echo "$num_previous" > num_run
    3136# next month number
    32 (( num_next = $num_now + 1 ))
     37num_next=$(( num_now + 1 ))
    3338# true (i.e. modulo 12) month number
    34 (( true_num = $num_now % 12 ))
     39true_num=$(( num_now % 12 ))
    3540
     41# Check if required files exist
    3642\rm -f  error; touch error
    3743
     44if [ ! -f run.def.ref ]; then
     45  echo "Error: file \"run.def.ref\" not found in current directory!" > error
     46  exit 1
     47fi
     48
     49if [ ! -x run0 ]; then
     50  echo "Error: file \"run0\" not found or not executable in current directory!" > error
     51  exit 1
     52fi
     53
     54if [ ! -f run_month$num_now ]; then
     55  echo "Error: file \"run_month${num_now}\" not found in current directory!" > error
     56  exit 1
     57fi
     58
     59# Run model depending on current month
    3860case $true_num in
    39   1 ) sed s/9999/61/ run.def.ref > run.def ; run0 >> error ;;    #1
    40   2 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #2
    41   3 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #3
    42   4 ) sed s/9999/65/ run.def.ref > run.def ; run0 >> error ;;    #4
    43   5 ) sed s/9999/60/ run.def.ref > run.def ; run0 >> error ;;    #5
    44   6 ) sed s/9999/54/ run.def.ref > run.def ; run0 >> error ;;    #6
    45   7 ) sed s/9999/50/ run.def.ref > run.def ; run0 >> error ;;    #7
    46   8 ) sed s/9999/46/ run.def.ref > run.def ; run0 >> error ;;    #8
    47   9 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #9
    48  10 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #10
    49  11 ) sed s/9999/51/ run.def.ref > run.def ; run0 >> error ;;    #11
    50   0 ) sed s/9999/56/ run.def.ref > run.def ; run0 >> error ;;    #12
    51   * ) echo "error" ;;
     61  1 ) sed s/9999/61/ run.def.ref > run.def ; ./run0 >> error ;;    #1
     62  2 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #2
     63  3 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #3
     64  4 ) sed s/9999/65/ run.def.ref > run.def ; ./run0 >> error ;;    #4
     65  5 ) sed s/9999/60/ run.def.ref > run.def ; ./run0 >> error ;;    #5
     66  6 ) sed s/9999/54/ run.def.ref > run.def ; ./run0 >> error ;;    #6
     67  7 ) sed s/9999/50/ run.def.ref > run.def ; ./run0 >> error ;;    #7
     68  8 ) sed s/9999/46/ run.def.ref > run.def ; ./run0 >> error ;;    #8
     69  9 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #9
     70 10 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #10
     71 11 ) sed s/9999/51/ run.def.ref > run.def ; ./run0 >> error ;;    #11
     72  0 ) sed s/9999/56/ run.def.ref > run.def ; ./run0 >> error ;;    #12
     73  * ) echo "Error: Invalid value of true_num ($true_num)" ; exit 1 ;;
    5274esac
    5375
    54 # launch job for next month
    55 if (( $num_next <= $num_end )) ; then
     76# Launch job for next month
     77if (( num_next <= num_end )) ; then
    5678  cp -f run_month$num_now tmp
    5779  sed -e "s@run_month${num_now}@run_month${num_next}@" \
    5880      -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_month$num_next
    5981  rm tmp
    60  
    6182  sbatch run_month$num_next
    6283fi
  • trunk/LMDZ.MARS/deftank/ciclad/run0

    r2216 r3766  
    11#!/bin/bash
    2 ###########################################################################
     2########################################################################
    33# Script to perform several chained LMD Mars GCM simulations
    44# SET HERE the maximum total number of simulations
     
    99gcm=gcm_64x48x32_phymars_para.e
    1010#
    11 ###########################################################################
    12 
     11########################################################################
     12set -x
    1313
    1414echo "---------------------------------------------------------"
    15 echo "starting run0"
     15echo "Starting run0..."
    1616
    1717dir=`pwd`
     
    1919address=`whoami`
    2020
    21 # Look for file "num_run" which should contain
     21# Check if GCM executable exists and is executable
     22if [ ! -x $gcm ]; then
     23  echo "Error: file \"$gcm\" not found or not executable in $dir!"
     24  exit 1
     25fi
     26
     27# Look for file "num_run" which should contain
    2228# the value of the previously computed season
    2329# (defaults to 0 if file "num_run" does not exist)
    2430if [[ -r num_run ]] ; then
    25   echo "found file num_run"
     31  echo "Found file \"num_run\""
    2632  numold=`cat num_run`
    2733else
    2834  numold=0
    2935fi
    30 echo "numold is set to" ${numold}
     36echo "numold is set to" $numold
    3137
    32 
    33 # Set value of current season
    34 (( numnew = ${numold} + 1 ))
    35 echo "numnew is set to" ${numnew}
     38# Set value of current season
     39numnew=$((numold + 1 ))
     40echo "numnew is set to" $numnew
    3641
    3742# Look for initialization data files (exit if none found)
     
    4045   \cp -f startfi${numold}.nc startfi.nc
    4146else
    42    if (( ${numold} == 99999 )) ; then
    43     echo "No run because previous run crashed ! (99999 in num_run)"
    44     exit
     47   if (( numold == 99999 )) ; then
     48     echo "Error: no run because previous run crashed! (99999 in \"num_run\")"
     49     exit 1
    4550   else
    46    echo "Where is file start"${numold}".nc??"
    47    exit
     51     echo "Error: missing input files \"start${numold}.nc\" or \"startfi${numold}.nc\" in $dir!"
     52     exit 1
    4853   fi
    4954fi
     
    5661# Check if run ended normaly and copy datafiles
    5762if [[ ( -r restartfi.nc  &&  -r restart.nc ) ]] ; then
    58   echo "Run seems to have ended normaly"
     63  echo "Run seems to have ended normally."
    5964  \mv -f restartfi.nc startfi${numnew}.nc
    6065  \mv -f restart.nc start${numnew}.nc
    6166else
     67  echo "Error: Run crashed or incomplete output!"
    6268  if [[ -r num_run ]] ; then
    6369    \mv -f num_run num_run.crash
    6470  else
    65     echo "No file num_run to build num_run.crash from !!"
     71    echo "No file num_run to build \"num_run.crash\" from!"
    6672    # Impose a default value of 0 for num_run
    6773    echo 0 > num_run.crash
    6874  fi
    69  echo 99999 > num_run
     75  echo 99999 > num_run
    7076############## To receive an Email message if the run crashes ########
    71 mail -s "crash run GCM" $address <<ENDMAIL
    72 The run on $machine in $dir has just crashed.
     77mail -s "Crash in GCM run" $address <<ENDMAIL
     78The GCM run on $machine in $dir has just crashed.
     79Check the output logs for more information.
    7380ENDMAIL
    74 ############################################""
    75  exit
     81#############################################
     82  exit 1
    7683fi
    7784
     
    93100# Prepare things for upcoming runs by writing
    94101# value of computed season in file num_run
    95 echo ${numnew} > num_run
     102echo $numnew > num_run
    96103
    97104# If we are over nummax : stop
    98105if (( $numnew + 1 > $nummax )) ; then
    99    exit
     106  exit 0
    100107else
    101    \cp -f run0 exe_mars
    102    ./exe_mars
    103 fi
    104 
    105 
     108  \cp -f run0 exe_mars
     109  ./exe_mars
     110fi
  • trunk/LMDZ.MARS/deftank/ciclad/run_month1

    r2510 r3766  
    88#PBS -l walltime=20:00:00
    99
    10 ## Script to run chained simulations on Ciclad
     10## Script to run chained simulations
    1111## (uses script "run0" and reference file "run.def.ref")
    1212## Set values of "num_now" and "num_end" in the script below
     
    1616cd $PBS_O_WORKDIR
    1717
    18 # source the environment (you might need to adapt this path to your case)
     18# A few parameters that might need be changed depending on your setup:
     19# Path to the arch.env to source
    1920source ../trunk/LMDZ.COMMON/arch.env
     21#
     22########################################################################
     23set -exv
     24ls -al
     25trap 'echo -e "Error at line $LINENO!"' ERR
    2026
    21 date
    22 
    23 ## set starting month and ending month below:
     27# Set starting month and ending month below:
    2428num_now=1
    2529num_end=12
    26 (( num_previous = $num_now - 1 ))
     30num_previous=$(( num_now - 1 ))
    2731
    2832echo "$num_previous" > num_run
    2933# next month number
    30 (( num_next = $num_now + 1 ))
     34num_next=$(( num_now + 1 ))
    3135# true (i.e. modulo 12) month number
    32 (( true_num = $num_now % 12 ))
     36true_num=$(( num_now % 12 ))
    3337
     38# Check if required files exist
    3439\rm -f  error; touch error
    3540
     41if [ ! -f run.def.ref ]; then
     42  echo "Error: file \"run.def.ref\" not found in current directory!" > error
     43  exit 1
     44fi
     45
     46if [ ! -x run0 ]; then
     47  echo "Error: file \"run0\" not found or not executable in current directory!" > error
     48  exit 1
     49fi
     50
     51if [ ! -f run_month$num_now ]; then
     52  echo "Error: file \"run_month${num_now}\" not found in current directory!" > error
     53  exit 1
     54fi
     55
     56# Run model depending on current month
    3657case $true_num in
    37   1 ) sed s/9999/61/ run.def.ref > run.def ; run0 >> error ;;    #1
    38   2 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #2
    39   3 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #3
    40   4 ) sed s/9999/65/ run.def.ref > run.def ; run0 >> error ;;    #4
    41   5 ) sed s/9999/60/ run.def.ref > run.def ; run0 >> error ;;    #5
    42   6 ) sed s/9999/54/ run.def.ref > run.def ; run0 >> error ;;    #6
    43   7 ) sed s/9999/50/ run.def.ref > run.def ; run0 >> error ;;    #7
    44   8 ) sed s/9999/46/ run.def.ref > run.def ; run0 >> error ;;    #8
    45   9 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #9
    46  10 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #10
    47  11 ) sed s/9999/51/ run.def.ref > run.def ; run0 >> error ;;    #11
    48   0 ) sed s/9999/56/ run.def.ref > run.def ; run0 >> error ;;    #12
    49   * ) echo "error" ;;
     58  1 ) sed s/9999/61/ run.def.ref > run.def ; ./run0 >> error ;;    #1
     59  2 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #2
     60  3 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #3
     61  4 ) sed s/9999/65/ run.def.ref > run.def ; ./run0 >> error ;;    #4
     62  5 ) sed s/9999/60/ run.def.ref > run.def ; ./run0 >> error ;;    #5
     63  6 ) sed s/9999/54/ run.def.ref > run.def ; ./run0 >> error ;;    #6
     64  7 ) sed s/9999/50/ run.def.ref > run.def ; ./run0 >> error ;;    #7
     65  8 ) sed s/9999/46/ run.def.ref > run.def ; ./run0 >> error ;;    #8
     66  9 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #9
     67 10 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #10
     68 11 ) sed s/9999/51/ run.def.ref > run.def ; ./run0 >> error ;;    #11
     69  0 ) sed s/9999/56/ run.def.ref > run.def ; ./run0 >> error ;;    #12
     70  * ) echo "Error: Invalid value of true_num ($true_num)" ; exit 1 ;;
    5071esac
    5172
    52 # launch job for next month
    53 if (( $num_next <= $num_end )) ; then
     73# Launch job for next month
     74if (( num_next <= num_end )) ; then
    5475  cp -f run_month$num_now tmp
    5576  sed -e "s@run_month${num_now}@run_month${num_next}@" \
  • trunk/LMDZ.MARS/deftank/irene/run0

    r2776 r3766  
    11#!/bin/bash
    2 ###########################################################################
     2########################################################################
    33# Script to perform several chained LMD Mars GCM simulations
    44# SET HERE the maximum total number of simulations
     
    99gcm=gcm_64x48x73_phymars_para.e
    1010#
    11 ###########################################################################
     11########################################################################
    1212set -x
    1313
    1414echo "---------------------------------------------------------"
    15 echo "starting run0"
     15echo "Starting run0..."
    1616
    1717dir=`pwd`
     
    1919address=`whoami`
    2020
    21 # Look for file "num_run" which should contain
     21# Check if GCM executable exists and is executable
     22if [ ! -x $gcm ]; then
     23  echo "Error: file \"$gcm\" not found or not executable in $dir!"
     24  exit 1
     25fi
     26
     27# Look for file "num_run" which should contain
    2228# the value of the previously computed season
    2329# (defaults to 0 if file "num_run" does not exist)
    2430if [[ -r num_run ]] ; then
    25   echo "found file num_run"
     31  echo "Found file \"num_run\""
    2632  numold=`cat num_run`
    2733else
    2834  numold=0
    2935fi
    30 echo "numold is set to" ${numold}
     36echo "numold is set to" $numold
    3137
    32 
    33 # Set value of current season
    34 (( numnew = ${numold} + 1 ))
    35 echo "numnew is set to" ${numnew}
     38# Set value of current season
     39numnew=$((numold + 1 ))
     40echo "numnew is set to" $numnew
    3641
    3742# Look for initialization data files (exit if none found)
     
    4045   \cp -f startfi${numold}.nc startfi.nc
    4146else
    42    if (( ${numold} == 99999 )) ; then
    43     echo "No run because previous run crashed ! (99999 in num_run)"
    44     exit
     47   if (( numold == 99999 )) ; then
     48     echo "Error: no run because previous run crashed! (99999 in \"num_run\")"
     49     exit 1
    4550   else
    46    echo "Where is file start"${numold}".nc??"
    47    exit
     51     echo "Error: missing input files \"start${numold}.nc\" or \"startfi${numold}.nc\" in $dir!"
     52     exit 1
    4853   fi
    4954fi
     
    5156
    5257# Run GCM
    53 ccc_mprun -l $gcm > lrun${numnew} 2>&1 
     58ccc_mprun -l $gcm > lrun${numnew} 2>&1
    5459
    5560
    5661# Check if run ended normaly and copy datafiles
    5762if [[ ( -r restartfi.nc  &&  -r restart.nc ) ]] ; then
    58   echo "Run seems to have ended normaly"
     63  echo "Run seems to have ended normally."
    5964  \mv -f restartfi.nc startfi${numnew}.nc
    6065  \mv -f restart.nc start${numnew}.nc
    6166else
     67  echo "Error: Run crashed or incomplete output!"
    6268  if [[ -r num_run ]] ; then
    6369    \mv -f num_run num_run.crash
    6470  else
    65     echo "No file num_run to build num_run.crash from !!"
     71    echo "No file num_run to build \"num_run.crash\" from!"
    6672    # Impose a default value of 0 for num_run
    6773    echo 0 > num_run.crash
    6874  fi
    69  echo 99999 > num_run
     75  echo 99999 > num_run
    7076############## To receive an Email message if the run crashes ########
    71 mail -s "crash run GCM" $address <<ENDMAIL
    72 The run on $machine in $dir has just crashed.
     77mail -s "Crash in GCM run" $address <<ENDMAIL
     78The GCM run on $machine in $dir has just crashed.
     79Check the output logs for more information.
    7380ENDMAIL
    74 ############################################""
    75  exit
     81#############################################
     82  exit 1
    7683fi
    7784
     
    93100# Prepare things for upcoming runs by writing
    94101# value of computed season in file num_run
    95 echo ${numnew} > num_run
     102echo $numnew > num_run
    96103
    97104# If we are over nummax : stop
    98105if (( $numnew + 1 > $nummax )) ; then
    99    exit
     106  exit 0
    100107else
    101    \cp -f run0 exe_mars
    102    ./exe_mars
    103 fi 
     108  \cp -f run0 exe_mars
     109  ./exe_mars
     110fi
  • trunk/LMDZ.MARS/deftank/irene/run_month1

    r2816 r3766  
    2323#MSUB -x
    2424
     25## Script to run chained simulations
     26## (uses script "run0" and reference file "run.def.ref")
     27## Set values of "num_now" and "num_end" in the script below
     28## to set initial month # and final month # of the simulation
     29
    2530# A few parameters that might need be changed depending on your setup:
    2631# Path to the arch.env to source
    2732source ../trunk/LMDZ.COMMON/arch.env
    28 # Number of threads to use (must be the same as "#MSUB -c" above) 
     33# Number of threads to use (must be the same as "#MSUB -c" above)
    2934export OMP_NUM_THREADS=5
    3035export OMP_STACKSIZE=400M
     36#
     37########################################################################
     38set -exv
     39ls -al
     40trap 'echo -e "Error at line $LINENO!"' ERR
    3141
    32 set -xv
    33 ls -al
    34 
    35 ## set starting month and ending month below:
     42# Set starting month and ending month below:
    3643num_now=1
    3744num_end=12
    38 (( num_previous = $num_now - 1 ))
     45num_previous=$(( num_now - 1 ))
    3946
    4047echo "$num_previous" > num_run
    4148# next month number
    42 (( num_next = $num_now + 1 ))
     49num_next=$(( num_now + 1 ))
    4350# true (i.e. modulo 12) month number
    44 (( true_num = $num_now % 12 ))
     51true_num=$(( num_now % 12 ))
    4552
     53# Check if required files exist
    4654\rm -f  error; touch error
    4755
     56if [ ! -f run.def.ref ]; then
     57  echo "Error: file \"run.def.ref\" not found in current directory!" > error
     58  exit 1
     59fi
     60
     61if [ ! -x run0 ]; then
     62  echo "Error: file \"run0\" not found or not executable in current directory!" > error
     63  exit 1
     64fi
     65
     66if [ ! -f run_month$num_now ]; then
     67  echo "Error: file \"run_month${num_now}\" not found in current directory!" > error
     68  exit 1
     69fi
     70
     71# Run model depending on current month
    4872case $true_num in
    49   1 ) sed s/9999/61/ run.def.ref > run.def ; run0 >> error ;;    #1
    50   2 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #2
    51   3 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #3
    52   4 ) sed s/9999/65/ run.def.ref > run.def ; run0 >> error ;;    #4
    53   5 ) sed s/9999/60/ run.def.ref > run.def ; run0 >> error ;;    #5
    54   6 ) sed s/9999/54/ run.def.ref > run.def ; run0 >> error ;;    #6
    55   7 ) sed s/9999/50/ run.def.ref > run.def ; run0 >> error ;;    #7
    56   8 ) sed s/9999/46/ run.def.ref > run.def ; run0 >> error ;;    #8
    57   9 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #9
    58  10 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #10
    59  11 ) sed s/9999/51/ run.def.ref > run.def ; run0 >> error ;;    #11
    60   0 ) sed s/9999/56/ run.def.ref > run.def ; run0 >> error ;;    #12
    61   * ) echo "error" ;;
     73  1 ) sed s/9999/61/ run.def.ref > run.def ; ./run0 >> error ;;    #1
     74  2 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #2
     75  3 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #3
     76  4 ) sed s/9999/65/ run.def.ref > run.def ; ./run0 >> error ;;    #4
     77  5 ) sed s/9999/60/ run.def.ref > run.def ; ./run0 >> error ;;    #5
     78  6 ) sed s/9999/54/ run.def.ref > run.def ; ./run0 >> error ;;    #6
     79  7 ) sed s/9999/50/ run.def.ref > run.def ; ./run0 >> error ;;    #7
     80  8 ) sed s/9999/46/ run.def.ref > run.def ; ./run0 >> error ;;    #8
     81  9 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #9
     82 10 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #10
     83 11 ) sed s/9999/51/ run.def.ref > run.def ; ./run0 >> error ;;    #11
     84  0 ) sed s/9999/56/ run.def.ref > run.def ; ./run0 >> error ;;    #12
     85  * ) echo "Error: Invalid value of true_num ($true_num)" ; exit 1 ;;
    6286esac
    6387
    64 # launch job for next month
    65 if (( $num_next <= $num_end )) ; then
     88# Launch job for next month
     89if (( num_next <= num_end )) ; then
    6690  cp -f run_month$num_now tmp
    6791  sed -e "s@run_month${num_now}@run_month${num_next}@" \
    6892      -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_month$num_next
    6993  rm tmp
    70  
    7194  ccc_msub run_month$num_next
    7295fi
  • trunk/LMDZ.MARS/deftank/occigen/run0

    r2216 r3766  
    11#!/bin/bash
    2 ###########################################################################
     2########################################################################
    33# Script to perform several chained LMD Mars GCM simulations
    44# SET HERE the maximum total number of simulations
     
    99gcm=gcm_64x48x73_phymars_para.e
    1010#
    11 ###########################################################################
     11########################################################################
    1212set -x
    1313
    1414echo "---------------------------------------------------------"
    15 echo "starting run0"
     15echo "Starting run0..."
    1616
    1717dir=`pwd`
     
    1919address=`whoami`
    2020
    21 # Look for file "num_run" which should contain
     21# Check if GCM executable exists and is executable
     22if [ ! -x $gcm ]; then
     23  echo "Error: file \"$gcm\" not found or not executable in $dir!"
     24  exit 1
     25fi
     26
     27# Look for file "num_run" which should contain
    2228# the value of the previously computed season
    2329# (defaults to 0 if file "num_run" does not exist)
    2430if [[ -r num_run ]] ; then
    25   echo "found file num_run"
     31  echo "Found file \"num_run\""
    2632  numold=`cat num_run`
    2733else
    2834  numold=0
    2935fi
    30 echo "numold is set to" ${numold}
     36echo "numold is set to" $numold
    3137
    32 
    33 # Set value of current season
    34 (( numnew = ${numold} + 1 ))
    35 echo "numnew is set to" ${numnew}
     38# Set value of current season
     39numnew=$((numold + 1 ))
     40echo "numnew is set to" $numnew
    3641
    3742# Look for initialization data files (exit if none found)
     
    4045   \cp -f startfi${numold}.nc startfi.nc
    4146else
    42    if (( ${numold} == 99999 )) ; then
    43     echo "No run because previous run crashed ! (99999 in num_run)"
    44     exit
     47   if (( numold == 99999 )) ; then
     48     echo "Error: no run because previous run crashed! (99999 in \"num_run\")"
     49     exit 1
    4550   else
    46    echo "Where is file start"${numold}".nc??"
    47    exit
     51     echo "Error: missing input files \"start${numold}.nc\" or \"startfi${numold}.nc\" in $dir!"
     52     exit 1
    4853   fi
    4954fi
     
    5661# Check if run ended normaly and copy datafiles
    5762if [[ ( -r restartfi.nc  &&  -r restart.nc ) ]] ; then
    58   echo "Run seems to have ended normaly"
     63  echo "Run seems to have ended normally."
    5964  \mv -f restartfi.nc startfi${numnew}.nc
    6065  \mv -f restart.nc start${numnew}.nc
    6166else
     67  echo "Error: Run crashed or incomplete output!"
    6268  if [[ -r num_run ]] ; then
    6369    \mv -f num_run num_run.crash
    6470  else
    65     echo "No file num_run to build num_run.crash from !!"
     71    echo "No file num_run to build \"num_run.crash\" from!"
    6672    # Impose a default value of 0 for num_run
    6773    echo 0 > num_run.crash
    6874  fi
    69  echo 99999 > num_run
     75  echo 99999 > num_run
    7076############## To receive an Email message if the run crashes ########
    71 mail -s "crash run GCM" $address <<ENDMAIL
    72 The run on $machine in $dir has just crashed.
     77mail -s "Crash in GCM run" $address <<ENDMAIL
     78The GCM run on $machine in $dir has just crashed.
     79Check the output logs for more information.
    7380ENDMAIL
    74 ############################################""
    75  exit
     81#############################################
     82  exit 1
    7683fi
    7784
     
    93100# Prepare things for upcoming runs by writing
    94101# value of computed season in file num_run
    95 echo ${numnew} > num_run
     102echo $numnew > num_run
    96103
    97104# If we are over nummax : stop
    98105if (( $numnew + 1 > $nummax )) ; then
    99    exit
     106  exit 0
    100107else
    101    \cp -f run0 exe_mars
    102    ./exe_mars
    103 fi 
     108  \cp -f run0 exe_mars
     109  ./exe_mars
     110fi
  • trunk/LMDZ.MARS/deftank/occigen/run_month1

    r2644 r3766  
    11#!/bin/bash
    2 #SBATCH --nodes=6                          #A
    3 #SBATCH --ntasks-per-node=4                #B
    4 #SBATCH --cpus-per-task=5                  #C
     2#SBATCH --nodes=6                           #A
     3#SBATCH --ntasks-per-node=4                 #B
     4#SBATCH --cpus-per-task=5                   #C
    55#SBATCH -J clim
    66#SBATCH --time=13:00:00
     
    1010#SBATCH --exclusive
    1111
    12 ## Script to run chained simulations on Occigen
     12## Script to run chained simulations
    1313## (uses script "run0" and reference file "run.def.ref")
    1414## Set values of "num_now" and "num_end" in the script below
    1515## to set initial month # and final month # of the simulation
    1616
    17 # source the environment (you might need to adapt this path to your case)
    18 source ../trunk/LMDZ.COMMON/arch/arch-X64_OCCIGEN.env
    19 
    20 set -xv
    21 ls -al
    22 
    23 ## set starting month and ending month below:
    24 num_now=1
    25 num_end=12
    26 (( num_previous = $num_now - 1 ))
    27 
    28 echo "$num_previous" > num_run
    29 # next month number
    30 (( num_next = $num_now + 1 ))
    31 # true (i.e. modulo 12) month number
    32 (( true_num = $num_now % 12 ))
    33 
    34 \rm -f  error; touch error
    35 
    36 # environment setup for OpenMP:
     17# A few parameters that might need be changed depending on your setup:
     18# Path to the arch.env to source
     19source ../trunk/LMDZ.COMMON/arch.env
     20# Environment setup for OpenMP:
    3721export I_MPI_DOMAIN=auto
    3822export I_MPI_PIN_RESPECT_CPUSET=0
    3923#Make sure that OMP_NUM_THREADS = cpus-per-task * KMP_HW_SUBSET
    4024export KMP_HW_SUBSET=1T
    41 export OMP_NUM_THREADS=5                    #C
     25export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK #C
    4226export OMP_STACKSIZE=400M
    4327export KMP_AFFINITY=granularity=fine,compact,1,0,verbose
     28#
     29########################################################################
     30set -exv
     31ls -al
     32trap 'echo -e "Error at line $LINENO!"' ERR
    4433
     34# Set starting month and ending month below:
     35num_now=1
     36num_end=12
     37num_previous=$(( num_now - 1 ))
     38
     39echo "$num_previous" > num_run
     40# next month number
     41num_next=$(( num_now + 1 ))
     42# true (i.e. modulo 12) month number
     43true_num=$(( num_now % 12 ))
     44
     45# Check if required files exist
     46\rm -f  error; touch error
     47
     48if [ ! -f run.def.ref ]; then
     49  echo "Error: file \"run.def.ref\" not found in current directory!" > error
     50  exit 1
     51fi
     52
     53if [ ! -x run0 ]; then
     54  echo "Error: file \"run0\" not found or not executable in current directory!" > error
     55  exit 1
     56fi
     57
     58if [ ! -f run_month$num_now ]; then
     59  echo "Error: file \"run_month${num_now}\" not found in current directory!" > error
     60  exit 1
     61fi
     62
     63# Run model depending on current month
    4564case $true_num in
    46   1 ) sed s/9999/61/ run.def.ref > run.def ; run0 >> error ;;    #1
    47   2 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #2
    48   3 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #3
    49   4 ) sed s/9999/65/ run.def.ref > run.def ; run0 >> error ;;    #4
    50   5 ) sed s/9999/60/ run.def.ref > run.def ; run0 >> error ;;    #5
    51   6 ) sed s/9999/54/ run.def.ref > run.def ; run0 >> error ;;    #6
    52   7 ) sed s/9999/50/ run.def.ref > run.def ; run0 >> error ;;    #7
    53   8 ) sed s/9999/46/ run.def.ref > run.def ; run0 >> error ;;    #8
    54   9 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #9
    55  10 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #10
    56  11 ) sed s/9999/51/ run.def.ref > run.def ; run0 >> error ;;    #11
    57   0 ) sed s/9999/56/ run.def.ref > run.def ; run0 >> error ;;    #12
    58   * ) echo "error" ;;
     65  1 ) sed s/9999/61/ run.def.ref > run.def ; ./run0 >> error ;;    #1
     66  2 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #2
     67  3 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #3
     68  4 ) sed s/9999/65/ run.def.ref > run.def ; ./run0 >> error ;;    #4
     69  5 ) sed s/9999/60/ run.def.ref > run.def ; ./run0 >> error ;;    #5
     70  6 ) sed s/9999/54/ run.def.ref > run.def ; ./run0 >> error ;;    #6
     71  7 ) sed s/9999/50/ run.def.ref > run.def ; ./run0 >> error ;;    #7
     72  8 ) sed s/9999/46/ run.def.ref > run.def ; ./run0 >> error ;;    #8
     73  9 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #9
     74 10 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #10
     75 11 ) sed s/9999/51/ run.def.ref > run.def ; ./run0 >> error ;;    #11
     76  0 ) sed s/9999/56/ run.def.ref > run.def ; ./run0 >> error ;;    #12
     77  * ) echo "Error: Invalid value of true_num ($true_num)" ; exit 1 ;;
    5978esac
    6079
    61 # launch job for next month
    62 if (( $num_next <= $num_end )) ; then
     80# Launch job for next month
     81if (( num_next <= num_end )) ; then
    6382  cp -f run_month$num_now tmp
    6483  sed -e "s@run_month${num_now}@run_month${num_next}@" \
    6584      -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_month$num_next
    6685  rm tmp
    67  
    6886  sbatch run_month$num_next
    6987fi
    70 
  • trunk/LMDZ.MARS/deftank/run0

    r1005 r3766  
    11#!/bin/bash
    2 ###########################################################################
     2########################################################################
    33# Script to perform several chained LMD Mars GCM simulations
    44# SET HERE the maximum total number of simulations
     
    66nummax=1
    77
    8 ###########################################################################
    9 
     8# Also, ensure that the gcm executable name is correct below:
     9gcm=gcm.e
     10#
     11########################################################################
     12set -x
    1013
    1114echo "---------------------------------------------------------"
    12 echo "starting run0"
     15echo "Starting run0..."
    1316
    1417dir=`pwd`
     
    1619address=`whoami`
    1720
    18 # Look for file "num_run" which should contain
     21# Check if GCM executable exists and is executable
     22if [ ! -x $gcm ]; then
     23  echo "Error: file \"$gcm\" not found or not executable in $dir!"
     24  exit 1
     25fi
     26
     27# Look for file "num_run" which should contain
    1928# the value of the previously computed season
    2029# (defaults to 0 if file "num_run" does not exist)
    2130if [[ -r num_run ]] ; then
    22   echo "found file num_run"
     31  echo "Found file \"num_run\""
    2332  numold=`cat num_run`
    2433else
    2534  numold=0
    2635fi
    27 echo "numold is set to" ${numold}
     36echo "numold is set to" $numold
    2837
    29 
    30 # Set value of current season
    31 (( numnew = ${numold} + 1 ))
    32 echo "numnew is set to" ${numnew}
     38# Set value of current season
     39numnew=$((numold + 1 ))
     40echo "numnew is set to" $numnew
    3341
    3442# Look for initialization data files (exit if none found)
     
    3745   \cp -f startfi${numold}.nc startfi.nc
    3846else
    39    if (( ${numold} == 99999 )) ; then
    40     echo "No run because previous run crashed ! (99999 in num_run)"
    41     exit
     47   if (( numold == 99999 )) ; then
     48     echo "Error: no run because previous run crashed! (99999 in \"num_run\")"
     49     exit 1
    4250   else
    43    echo "Where is file start"${numold}".nc??"
    44    exit
     51     echo "Error: missing input files \"start${numold}.nc\" or \"startfi${numold}.nc\" in $dir!"
     52     exit 1
    4553   fi
    4654fi
     
    4856
    4957# Run GCM
    50 gcm.e > lrun${numnew}
     58./$gcm > lrun${numnew}
    5159
    5260
    5361# Check if run ended normaly and copy datafiles
    5462if [[ ( -r restartfi.nc  &&  -r restart.nc ) ]] ; then
    55   echo "Run seems to have ended normaly"
     63  echo "Run seems to have ended normally."
    5664  \mv -f restartfi.nc startfi${numnew}.nc
    5765  \mv -f restart.nc start${numnew}.nc
    5866else
     67  echo "Error: Run crashed or incomplete output!"
    5968  if [[ -r num_run ]] ; then
    6069    \mv -f num_run num_run.crash
    6170  else
    62     echo "No file num_run to build num_run.crash from !!"
     71    echo "No file num_run to build \"num_run.crash\" from!"
    6372    # Impose a default value of 0 for num_run
    6473    echo 0 > num_run.crash
    6574  fi
    66  echo 99999 > num_run
     75  echo 99999 > num_run
    6776############## To receive an Email message if the run crashes ########
    68 mail -s "crash run GCM" $address <<ENDMAIL
    69 The run on $machine in $dir has just crashed.
     77mail -s "Crash in GCM run" $address <<ENDMAIL
     78The GCM run on $machine in $dir has just crashed.
     79Check the output logs for more information.
    7080ENDMAIL
    71 ############################################""
    72  exit
     81#############################################
     82  exit 1
    7383fi
    7484
     
    90100# Prepare things for upcoming runs by writing
    91101# value of computed season in file num_run
    92 echo ${numnew} > num_run
     102echo $numnew > num_run
    93103
    94104# If we are over nummax : stop
    95105if (( $numnew + 1 > $nummax )) ; then
    96    exit
     106  exit 0
    97107else
    98    \cp -f run0 exe_mars
    99    ./exe_mars
    100 fi
    101 
    102 
     108  \cp -f run0 exe_mars
     109  ./exe_mars
     110fi
  • trunk/LMDZ.MARS/deftank/spirit/run0

    r2922 r3766  
    11#!/bin/bash
    2 ###########################################################################
     2########################################################################
    33# Script to perform several chained LMD Mars GCM simulations
    44# SET HERE the maximum total number of simulations
     
    99gcm=gcm_64x48x54_phymars_para.e
    1010#
    11 ###########################################################################
     11########################################################################
    1212set -x
    1313
    1414echo "---------------------------------------------------------"
    15 echo "starting run0"
     15echo "Starting run0..."
    1616
    1717dir=`pwd`
     
    1919address=`whoami`
    2020
    21 # Look for file "num_run" which should contain
     21# Check if GCM executable exists and is executable
     22if [ ! -x $gcm ]; then
     23  echo "Error: file \"$gcm\" not found or not executable in $dir!"
     24  exit 1
     25fi
     26
     27# Look for file "num_run" which should contain
    2228# the value of the previously computed season
    2329# (defaults to 0 if file "num_run" does not exist)
    2430if [[ -r num_run ]] ; then
    25   echo "found file num_run"
     31  echo "Found file \"num_run\""
    2632  numold=`cat num_run`
    2733else
    2834  numold=0
    2935fi
    30 echo "numold is set to" ${numold}
     36echo "numold is set to" $numold
    3137
    32 
    33 # Set value of current season
    34 (( numnew = ${numold} + 1 ))
    35 echo "numnew is set to" ${numnew}
     38# Set value of current season
     39numnew=$((numold + 1 ))
     40echo "numnew is set to" $numnew
    3641
    3742# Look for initialization data files (exit if none found)
     
    4045   \cp -f startfi${numold}.nc startfi.nc
    4146else
    42    if (( ${numold} == 99999 )) ; then
    43     echo "No run because previous run crashed ! (99999 in num_run)"
    44     exit
     47   if (( numold == 99999 )) ; then
     48     echo "Error: no run because previous run crashed! (99999 in \"num_run\")"
     49     exit 1
    4550   else
    46    echo "Where is file start"${numold}".nc??"
    47    exit
     51     echo "Error: missing input files \"start${numold}.nc\" or \"startfi${numold}.nc\" in $dir!"
     52     exit 1
    4853   fi
    4954fi
     
    5156
    5257# Run GCM
    53 mpirun $gcm > lrun${numnew} 2>&1 
     58mpirun $gcm > lrun${numnew} 2>&1
    5459
    5560
    5661# Check if run ended normaly and copy datafiles
    5762if [[ ( -r restartfi.nc  &&  -r restart.nc ) ]] ; then
    58   echo "Run seems to have ended normaly"
     63  echo "Run seems to have ended normally."
    5964  \mv -f restartfi.nc startfi${numnew}.nc
    6065  \mv -f restart.nc start${numnew}.nc
    6166else
     67  echo "Error: Run crashed or incomplete output!"
    6268  if [[ -r num_run ]] ; then
    6369    \mv -f num_run num_run.crash
    6470  else
    65     echo "No file num_run to build num_run.crash from !!"
     71    echo "No file num_run to build \"num_run.crash\" from!"
    6672    # Impose a default value of 0 for num_run
    6773    echo 0 > num_run.crash
    6874  fi
    69  echo 99999 > num_run
     75  echo 99999 > num_run
    7076############## To receive an Email message if the run crashes ########
    71 mail -s "crash run GCM" $address <<ENDMAIL
    72 The run on $machine in $dir has just crashed.
     77mail -s "Crash in GCM run" $address <<ENDMAIL
     78The GCM run on $machine in $dir has just crashed.
     79Check the output logs for more information.
    7380ENDMAIL
    74 ############################################""
    75  exit
     81#############################################
     82  exit 1
    7683fi
    7784
     
    93100# Prepare things for upcoming runs by writing
    94101# value of computed season in file num_run
    95 echo ${numnew} > num_run
     102echo $numnew > num_run
    96103
    97104# If we are over nummax : stop
    98105if (( $numnew + 1 > $nummax )) ; then
    99    exit
     106  exit 0
    100107else
    101    \cp -f run0 exe_mars
    102    ./exe_mars
    103 fi 
     108  \cp -f run0 exe_mars
     109  ./exe_mars
     110fi
  • trunk/LMDZ.MARS/deftank/spirit/run_month1

    r2923 r3766  
    88#SBATCH --output %x.%j.out
    99
     10## Script to run chained simulations
     11## (uses script "run0" and reference file "run.def.ref")
     12## Set values of "num_now" and "num_end" in the script below
     13## to set initial month # and final month # of the simulation
     14
    1015# A few parameters that might need be changed depending on your setup:
    1116# Path to the arch.env to source
    1217source ../trunk/LMDZ.COMMON/arch.env
     18# Number of threads to use (must be the same as "#SBATCH --cpus-per-task=" above)
     19export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
     20export OMP_STACKSIZE=400M
     21#
     22########################################################################
     23set -exv
     24ls -al
     25trap 'echo -e "Error at line $LINENO!"' ERR
    1326
    14 # Number of threads to use (must be the same as "#MSUB -c" above)
    15 export OMP_NUM_THREADS=4
    16 export OMP_STACKSIZE=400M
    17 
    18 set -xv
    19 ls -al
    20 
    21 ## set starting month and ending month below:
     27# Set starting month and ending month below:
    2228num_now=1
    2329num_end=12
    24 (( num_previous = $num_now - 1 ))
     30num_previous=$(( num_now - 1 ))
    2531
    2632echo "$num_previous" > num_run
    2733# next month number
    28 (( num_next = $num_now + 1 ))
     34num_next=$(( num_now + 1 ))
    2935# true (i.e. modulo 12) month number
    30 (( true_num = $num_now % 12 ))
     36true_num=$(( num_now % 12 ))
    3137
     38# Check if required files exist
    3239\rm -f  error; touch error
    3340
     41if [ ! -f run.def.ref ]; then
     42  echo "Error: file \"run.def.ref\" not found in current directory!" > error
     43  exit 1
     44fi
     45
     46if [ ! -x run0 ]; then
     47  echo "Error: file \"run0\" not found or not executable in current directory!" > error
     48  exit 1
     49fi
     50
     51if [ ! -f run_month$num_now ]; then
     52  echo "Error: file \"run_month${num_now}\" not found in current directory!" > error
     53  exit 1
     54fi
     55
     56# Run model depending on current month
    3457case $true_num in
    35   1 ) sed s/9999/61/ run.def.ref > run.def ; run0 >> error ;;    #1
    36   2 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #2
    37   3 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;;    #3
    38   4 ) sed s/9999/65/ run.def.ref > run.def ; run0 >> error ;;    #4
    39   5 ) sed s/9999/60/ run.def.ref > run.def ; run0 >> error ;;    #5
    40   6 ) sed s/9999/54/ run.def.ref > run.def ; run0 >> error ;;    #6
    41   7 ) sed s/9999/50/ run.def.ref > run.def ; run0 >> error ;;    #7
    42   8 ) sed s/9999/46/ run.def.ref > run.def ; run0 >> error ;;    #8
    43   9 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #9
    44  10 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;;    #10
    45  11 ) sed s/9999/51/ run.def.ref > run.def ; run0 >> error ;;    #11
    46   0 ) sed s/9999/56/ run.def.ref > run.def ; run0 >> error ;;    #12
    47   * ) echo "error" ;;
     58  1 ) sed s/9999/61/ run.def.ref > run.def ; ./run0 >> error ;;    #1
     59  2 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #2
     60  3 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #3
     61  4 ) sed s/9999/65/ run.def.ref > run.def ; ./run0 >> error ;;    #4
     62  5 ) sed s/9999/60/ run.def.ref > run.def ; ./run0 >> error ;;    #5
     63  6 ) sed s/9999/54/ run.def.ref > run.def ; ./run0 >> error ;;    #6
     64  7 ) sed s/9999/50/ run.def.ref > run.def ; ./run0 >> error ;;    #7
     65  8 ) sed s/9999/46/ run.def.ref > run.def ; ./run0 >> error ;;    #8
     66  9 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #9
     67 10 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #10
     68 11 ) sed s/9999/51/ run.def.ref > run.def ; ./run0 >> error ;;    #11
     69  0 ) sed s/9999/56/ run.def.ref > run.def ; ./run0 >> error ;;    #12
     70  * ) echo "Error: Invalid value of true_num ($true_num)" ; exit 1 ;;
    4871esac
    4972
    50 # launch job for next month
    51 if (( $num_next <= $num_end )) ; then
     73# Launch job for next month
     74if (( num_next <= num_end )) ; then
    5275  cp -f run_month$num_now tmp
    5376  sed -e "s@run_month${num_now}@run_month${num_next}@" \
    5477      -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_month$num_next
    5578  rm tmp
    56  
    5779  sbatch run_month$num_next
    5880fi
Note: See TracChangeset for help on using the changeset viewer.