#!/bin/sh

currDir=`pwd`
application=`basename $currDir`
cases="flange"

tutorialPath=`dirname $0`/..
. $tutorialPath/RunFunctions

runIdeasToFoam ()
{
    if [ -f $1/log.ideasToFoam ] ; then
        echo "ansysToFoam already run on $1: remove log file to run"
    else
        echo "ansysToFoam: converting mesh $2"
        ansysToFoam . $1 $2 -scale $3 > $1/log.ansysToFoam 2>&1
    fi
}

for case in $cases
do
    if [ "$case" = "flange" ] ; then
        runIdeasToFoam $case ${case}/${case}.ans 0.001
    fi
    runApplication $application $case
    runApplication foamToFieldview $case
    runApplication foamToEnsight $case
done 
