#!/bin/sh
cd ${0%/*} || exit 1  # Run script from its own directory

. $WM_PROJECT_DIR/bin/tools/RunFunctions  # Load OpenFOAM run functions

# Create mesh
runApplication blockMesh

runApplication checkMesh 

#copy the files from 0.orig to 0
runApplication cp -r 0.orig 0

#select the points over the domain 
runApplication topoSet

#create the patches over the domain 
runApplication createPatch -overwrite

# Decompose domain for parallel execution (5 cores)
runApplication decomposePar 
 
# Run solver in parallel with overRhoPimpleDyMFoam
 mpirun -np 5 $(getApplication) -parallel 

# Reconstruct results after parallel run
runApplication reconstructPar







