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

# Source case functions
. "$WM_PROJECT_SITE/$WM_PROJECT_VERSION/bin/tools/casesFunctions.sh"

case=$(foamDictionary caseParameterDict -entry case -value)
latestTime=$(foamListTimes -functionEntries | tail -n1)
targetDirectory="validation/reference/${case}"
rm -rf "$targetDirectory"
mkdir -p "$targetDirectory"

# Zip reference data
gzip -krf postProcessing/

# Copy results from latest run into reference directory
cp -f "postProcessing/bubbleProperties/0/bubbleProperties.dat.gz" \
    "${targetDirectory}"
cp -f "postProcessing/bubbleSurface/${latestTime}/isoSurface.xy.gz" \
    "${targetDirectory}"

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