#!/bin/bash
cd ${0%/*} || exit 1 # Run from this directory

# Source PATO run functions
. $PATO_DIR/src/applications/utilities/runFunctions/RunFunctions

# Initialize the script
pato_init

eval `tutoInDevel.sh` # Tutorial in development. Usage: ./Allrun <continue_flag> <error_msg>

# source OpenFOAM and PATO if darwin 
if [ "$(uname)" = "Darwin" ]; then
    source $FOAM_ETC/bashrc
    source $PATO_DIR/bashrc
fi

scp -r aero.0/ 0/
scp -r system/blockMeshDict.aero system/blockMeshDict

# create mesh
blockMesh 

# run case
# domain decomposition
decomposePar 

# run case on 2 processors
mpirun -np 2 rhoCentralFoam -parallel

# reconstruct domain
reconstructPar -withZero

# obtain Mach Number 

rhoCentralFoam -postProcess -func MachNo

# sample

rhoCentralFoam -postProcess -func sampleDict


# -----------------------------------------------------------------------------
