#!/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}"
mkdir -p "$targetDirectory"

# Copy results from latest run into reference directory
cp -f "postProcessing/python/${latestTime}/H3-depthAvg_UMean.bubbles.csv" \
    "${targetDirectory}"
cp -f "postProcessing/python/${latestTime}/H3-depthAvg_alphaMean.bubbles.csv" \
    "${targetDirectory}"
cp -f "postProcessing/sampleLine/${latestTime}/line.csv" "${targetDirectory}"
cp -f "postProcessing/residuals/0/residuals.dat" "${targetDirectory}"

# Remove tabs from result files
cd "${targetDirectory}" && removeTabsFromColumns residuals.dat

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