1 |
# This is a script in Bash. |
# This is a script in Bash. |
2 |
|
|
3 |
# This script collects input files necessary for the program "gcm" and |
# This script runs "gcm". |
|
# runs "gcm". Run this script in the directory where you want "gcm" to run. |
|
|
# The "ln" command does not report missing targets, so we check them first. |
|
4 |
|
|
5 |
trap 'echo -e \\a; exit 1' ERR |
trap 'echo -e \\a; exit 1' ERR |
|
|
|
|
# Specify directories: |
|
|
|
|
|
REL_dir=/usr/local/guez/LMDZ_work/LMDZE/Results_etat0_lim |
|
|
##REL_dir=$workdir/LMDZE/Results_etat0_lim |
|
|
|
|
|
IGCM_dir=~/Documents/Around_LMDZ/Around_LMDZE/Input_gcm |
|
|
##IGCM_dir=~ |
|
|
|
|
|
executable_dir=/usr/local/guez/LMDZ_work/LMDZE/Compil_prod_g95 |
|
|
##executable_dir=$workdir/LMDZE/Compil_prod |
|
|
|
|
|
RGCM_dir=/usr/local/guez/LMDZ_work/LMDZE/Results_gcm |
|
|
##RGCM_dir=$workdir/LMDZE/Results_gcm |
|
|
# (used only for a restart or a comparison) |
|
|
|
|
|
set -x |
|
|
|
|
|
test -d $REL_dir |
|
|
test -d $IGCM_dir |
|
|
test -d $executable_dir |
|
|
|
|
|
set +x |
|
|
|
|
|
read -p \ |
|
|
"Identifier for the set of parameters (\"*.def\" files and namelists)? " \ |
|
|
igcm_id |
|
|
read -p \ |
|
|
"Run number of \"etat0_lim\", for \"limit.nc\" and \"coefoz_LMDZ.nc\"? " \ |
|
|
numb_cr |
|
|
|
|
|
read -p \ |
|
|
"Do you want to restart from the end of a previous \"gcm\" run? (y/[n]) " \ |
|
|
restart |
|
|
if [[ $restart = y ]] |
|
|
then |
|
|
echo "Previous run number of \"gcm\" for \"start.nc\" and \"startphy.nc\ ?" |
|
|
read prev_gcm |
|
|
fi |
|
|
|
|
6 |
set -x |
set -x |
7 |
|
|
8 |
my_host=`hostname` |
# This is only useful if the program was compiled with G95: |
9 |
|
G95_FPU_UNDERFLOW=${G95_FPU_UNDERFLOW:+No} |
10 |
if [[ $my_host = vierne ]] |
G95_FPU_INVALID=${G95_FPU_INVALID:+No} |
|
then |
|
|
# This is only useful if the program was compiled with G95: |
|
|
G95_FPU_UNDERFLOW=${G95_FPU_UNDERFLOW:+No} |
|
|
G95_FPU_INVALID=${G95_FPU_INVALID:+No} |
|
|
fi |
|
|
|
|
|
test -f $REL_dir/$numb_cr/limit.nc |
|
|
ln -f -s $REL_dir/$numb_cr/limit.nc . |
|
11 |
|
|
|
if [[ -f $REL_dir/$numb_cr/coefoz_LMDZ.nc ]] |
|
|
then |
|
|
ln -f -s $REL_dir/$numb_cr/coefoz_LMDZ.nc . |
|
|
fi |
|
|
|
|
|
if [[ $restart != y ]] |
|
|
then |
|
|
# Start-up files come from "etat0_lim": |
|
|
ln -f -s $REL_dir/$numb_cr/start*.nc . |
|
|
else |
|
|
ln -f -s $RGCM_dir/$prev_gcm/restart.nc start.nc |
|
|
ln -f -s $RGCM_dir/$prev_gcm/restartphy.nc startphy.nc |
|
|
fi |
|
|
|
|
|
rm -f *.def |
|
|
test -f $IGCM_dir/$igcm_id/run.def |
|
|
ln -s $IGCM_dir/$igcm_id/*.def . |
|
12 |
date |
date |
13 |
|
time gcm <gcm_nml.txt >gcm_out.txt 2>gcm_err.txt |
|
if [[ $my_host = brodie ]] |
|
|
then |
|
|
rsh brodie01 \ |
|
|
export F_PROGINF=YES\; \ |
|
|
cd $PWD\; \ |
|
|
$executable_dir/gcm <$IGCM_dir/$igcm_id/gcm_nml.txt >gcm_out.txt \ |
|
|
2>gcm_err.txt |
|
|
elif [[ $my_host = zahir* ]] |
|
|
then |
|
|
hpmcount $executable_dir/gcm \ |
|
|
<$IGCM_dir/$igcm_id/gcm_nml.txt >gcm_out.txt 2>gcm_err.txt |
|
|
else |
|
|
time $executable_dir/gcm \ |
|
|
<$IGCM_dir/$igcm_id/gcm_nml.txt >gcm_out.txt 2>gcm_err.txt |
|
|
fi |
|
|
|
|
14 |
echo -e '\a' # beep |
echo -e '\a' # beep |
|
set +x |
|
|
read -p "Previous run number for comparison [none] ? " |
|
|
if [[ -n $REPLY ]] |
|
|
then |
|
|
selective_diff.sh $RGCM_dir/$REPLY . |
|
|
fi |
|