#!/bin/sh
cd ${0%/*} || exit 1                        # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions    # Tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions  # Tutorial clean functions

# Test with different synthetic inflow models
modelTypes="reducedDigitalFilter digitalFilter DFSEM"

runApplication blockMesh
restore0Dir

# Compute (serial) and collect data
for modelType in $modelTypes
do
    echo
    echo "Running with model: $modelType"
    (cd 0 && ln -snf "inlet.$modelType" inlet)
    (cd constant/boundaryData && ln -snf "inlet.$modelType" inlet)

    runApplication -s "$modelType" pimpleFoam
    ./createGraphs

    # Collect data in 'results' directory
    results="results/$modelType"
    echo "Placing summary in $results"
    mkdir -p "$results"
    mv -f log.* *.png postProcessing "$results" 2>/dev/null

    cleanTimeDirectories
    \rm -rf processor* >/dev/null 2>&1
done

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