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

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions


cloneParallelCase()
{
    if [ -d $2 ]
    then
        echo "Case already cloned: remove case directory $2 to clone"
    else
        echo "Cloning $2 case from $1 in parallel mode"
        mkdir $2
        cpfiles="processor* system constant"
        for f in $cpfiles
        do
            cp -r $1/$f $2
        done
    fi
}


# Do the Spalart-Allmaras steady-state case
(cd motorBike && foamRunTutorials)

if ! isTest $@
then
    # Clone the steady-state case to the LES case
    cloneParallelCase motorBike motorBikeLES

    # Do the LES case
    cp lesFiles/Allrun motorBikeLES/
    (cd motorBikeLES && foamRunTutorials)
fi

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