#!/bin/sh

###########################################################
#  Script for evaluation of the CHIMERE model RAM size    #
########################################################### 
clear
echo "Script for evaluation of the CHIMERE model RAM size"

TMP=./tmpsize
export TMP

echo "  o Temporary directory "$TMP

\rm -r $TMP
mkdir $TMP


echo "  o Copy of source code "
\cp src/* src/*.* $TMP


#######################################
# Definition of simulation parameters #
#######################################

echo "  o Affectation of variables "
nzo=2
nme=2
nspec=3000
nreac=20000
nemisa=16
nemisb=3
nlayers=6

ivs=1
show=100
phys=1
step=6
ngs=1
nhours=2
nfam=5
nlevemis=2

cat << EOD > $TMP/chimere.h.sed-commands
s,_NVE_,${nlayers},
s,_IVS_,${ivs},
s,_NZO_,${nzo},
s,_NME_,${nme},
s,_SHO_,${show},
s,_NPH_,${phys},
s,_NST_,${step},
s,_NGS_,${ngs},
s,_NHR_,${nhours},
s,_NSP_,${nspec},
s,_NRE_,${nreac},
s,_NFA_,${nfam},
s,_NEA_,${nemisa},
s,_NEB_,${nemisb},
s,_NLE_,${nlevemis},
EOD
sed -f $TMP/chimere.h.sed-commands src/chimere.h.sed > $TMP/chimere.h

# Compiling of libraries and main program

echo "Compiling the chimere code..."
tcompile chimere

size $TMP/chimere.e
