#!/bin/bash

########################################
## Simulation of an elongating lineaar dune
## -------------------------------------
## Average duration: ~18h (on 8 Xeon cores)
########################################

## 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="finger.par"
echo PAR_FILE=$PAR_FILE

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

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

## generation of binary cellular space 
./genesis -f $PAR_FILE -s 2000 > $GENESIS_LOG_FILE

## run simulation without GUI (no window mode)
./rescal $PAR_FILE -cv0 -ls 45 -vel -dlog 100t0 -dpng 4500t0 -dcsp 4500t0 -stop 450000t0 -nv >> $RESCAL_LOG_FILE

## run simulation with GUI (window mode)
#./rescal $PAR_FILE -cv0 -ls 45 -vel -dlog 100t0 -dpng 4500t0 -dcsp 4500t0 -stop 450000t0 >> $RESCAL_LOG_FILE

