#!/bin/sh

cd "${0%/*}" || exit                                # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions        # Tutorial run functions
#------------------------------------------------------------------------------

#Mesh generation
runApplication blockMesh
runApplication surfaceFeatureExtract

#Decompose the openfoam case
runApplication decomposePar

#Run the mesh generation using snappyHexMesh
runParallel snappyHexMesh -overwrite

runParallel redistributePar -withZero -reconstruct -overwrite

#Initial conditions
restore0Dir

#Remove the decomposed folders and the log file of the previous decomposition process
rm -r processor* log.decomposePar

#Decompose the openfoam case
runApplication decomposePar

#run the case
runParallel $(getApplication)

