
#!/bin/sh

echo "clearing results..."
rm -rf 0.* [1-9]* blockMesh.log makeFaMesh.log releaseAreaMapping.log faSavageHutterFoam.log 
rm -rf 0
cp -r org0 0



echo -n "creating FVMesh..."
if blockMesh > blockMesh.log; then
    echo "   OK"
else 
	echo "   FAILED"
	exit 1
fi

echo -n "creating FAMesh..."
if makeFaMesh > makeFaMesh.log; then
    echo "   OK"
else 
	echo "   FAILED"
	exit 1
fi

echo -n "setting releaseArea..."
if releaseAreaMapping > releaseAreaMapping.log; then
    echo "   OK"
else 
	echo "   FAILED"
	exit 1
fi

echo "running simulation..."
if faSavageHutterFoam > faSavageHutterFoam.log; then
    echo "\n\nSIMULATION FINISHED"
else 
	echo "\n\nSIMULATION FAILED"
	exit 1
fi

