#!/bin/sh

currDir=`pwd`
application=`basename $currDir`
cases="moriyoshiHomogeneous moriyoshiHomogeneousPart2"

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

setControlDict () {
    controlDict="$case/system/controlDict"
    sed \
    -e s/"\(deltaT[ \t]*\) 5e-06;"/"\1 1e-05;"/g \
    -e s/"\(endTime[ \t]*\) 0.005;"/"\1 0.015;"/g \
    -e s/"\(writeInterval[ \t]*\) 10;"/"\1 50;"/g \
    $controlDict > temp.$$
    mv temp.$$ $controlDict    
}

for case in $cases
do
    if [ "$case" = "moriyoshiHomogeneousPart2" ] ; then
        cloneCase moriyoshiHomogeneous $case
        cp -r moriyoshiHomogeneous/0.005 $case
        setControlDict
    else
        runApplication blockMesh $case
    fi
    runApplication $application $case
done
