#!/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 createZones
runApplication createPatch
runApplication decomposePar
runParallel    foamRun
runApplication reconstructPar

# Create plots
( cd validation && ./createGraphs )

# Verify results
latestTime=$(foamListTimes -latestTime)
cp "validation/reference/2/divPhi.gz" \
    "$latestTime/divPhi.ref.gz"
runApplication foamPostProcess \
    -func "deviation(field=divPhi, reference=divPhi.ref, maxAbsDev=1e-8)" \
    -latestTime

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