#!/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 setFields

runApplication -s filmThickness foamPostProcess \
    -func "filmThickness(field=alpha.water, patch=walls, \
                         result=filmThickness)"

runApplication -s patchSurface  foamPostProcess \
    -func "patchSurface(patch=walls, fields=(filmThickness), \
                        surfaceFormat=raw, name=filmThickness)"

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

# Compare to reference solution
case=$(basename "$PWD")
mpytest --suffix "${case}" almostequal validation/patch.xy \
    postProcessing/filmThickness/0/patch.xy

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