#!/bin/bash

###################################
## Lattice gas simulation
###################################

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

## make an archive from the sources
#./dobackup > BACKUP.log


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

## parameters file (input)
PAR_FILE="lgca.par"

### 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 
## 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 vector field
#nice ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel2 >> $RESCAL_LOG_FILE

## generation of png images every 10 seconds and HPP data every minute
#nice ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -dpng 10 -dcsphpp 1 -dlog 10 >> $RESCAL_LOG_FILE

## generation of png images every 1000 t0 and HPP data every 5000 t0
nice ./rescal $PAR_FILE -cv0 -lc -ls 45 -vel -dpng 1000t0 -dcsphpp 5000t0 -dlog 1000t0 >> $RESCAL_LOG_FILE
