#!/bin/bash

## remove all previously generated files
./clean -f
#./clean

## make an archive from the sources
./dobackup


if [ ! -e genesis ]; then
  ln -s ../src/genesis .
fi
if [ ! -e rescal ]; then
  ln -s ../src/rescal .
fi

## parameters file (input)
PAR_FILE="dun_bench.par"
#PAR_FILE="dun_bench_acd.par"

## general log files (output)
GENESIS_LOG_FILE="GENESIS.log"
RESCAL_LOG_FILE="RESCAL.log"

### number of OpenMP threads
export OMP_NUM_THREADS=2
echo OMP_NUM_THREADS=$OMP_NUM_THREADS

## generation of binary cellular space 
## with python code
#./genesis.py -f $PAR_FILE > $GENESIS_LOG_FILE
## or with C code
./genesis -f $PAR_FILE -s 2000 > $GENESIS_LOG_FILE

## default execution with light shading, vertical layers of cells and velocity of the flow
#nice ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel >> $RESCAL_LOG_FILE

## generation of png images, data files and info logs, then stop after 30 minutes
#nice ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -vss -info -dpng 10 -dcsp 5 -stop 30 >> $RESCAL_LOG_FILE

## generation of png images with delay in t0 unit
(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -dlog 1000t0 -dpng 100t0 -dcsp 1000t0 -fr 15 -stoptime 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out
#(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -dlog 1000t0 -dpng 100t0 -dcsp 1000t0 -pat -fr 15 -stoptime 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out
#(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -dlog 0.1t0 -dpng 1t0 -dcsp 1000t0 -fr 15 -stoptime 10t0 >> $RESCAL_LOG_FILE ) 2> time.out
#(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -fr 15 -stoptime 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out
#(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -dpng 100t0 -dcsp 1000t0 -fr 15 -stoptime 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out
#(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -vss2 -dlog 1000t0 -dpng 100t0 -dcsp 1000t0 -fr 15 -stoptime 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out
#(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -dlog 1000t0 -dpng 100t0 -dcsp 1000t0 -fr 15 -stoptime 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out
#(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -info -dpng 100t0 -pat -fr 15 -stoptime 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out
#(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -info -dpng 100t0 -nv -stop 1000t0 >> $RESCAL_LOG_FILE ) 2> time.out
#(time ./rescal $PAR_FILE -cv0 -lc -al -vel -info -dpng 100t0 -fr 15 -stop 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out
#nice ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -info -dpng 100t0 -stop 5000t0 >> $RESCAL_LOG_FILE
#(time ./bench136.c2/src2/rescal $PAR_FILE -cv0 -lc -ls 45 -vel -dlog 1000t0 -dpng 100t0 -dcsp 1000t0 -fr 15 -stoptime 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out

## generation of png images with delay in t0 unit and no window
#(time ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -info -dpng 100t0 -nv -stop 5000t0 >> $RESCAL_LOG_FILE ) 2> time.out

## plot probability function between shear stress and erosion
#./plot_cgv

