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

# Source run functions
. "$WM_PROJECT_SITE/$WM_PROJECT_VERSION/bin/tools/RunFunctions"

runApplication blockMesh
runApplication topoSet
runApplication decomposePar
runParallel -a "$(getApplication)"
runApplication -a reconstructPar -latestTime

# Post process
i=0
while [ $i -ne 10 ]
do
    i=$((i+1))
    runApplication -a foamPostProcess -func "                                \
        volAverage                                                           \
        (                                                                    \
            name=H3_cell${i}.average, select=cellZone, cellZone=H3_cell${i}, \
            fields=( alphaMean.air1 UMean.air1 )                             \
        )"
done

# Create plots
( cd validation && python collectDepthAvg.py && ./createGraphs )

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