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

# Source PATO run functions
. $PATO_DIR/src/applications/utilities/runFunctions/RunFunctions

# Initialize the script
pato_init

# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions

cleanCase
rm -rf constant/porousMat/polyMesh

# Clean optimisation
for i in "[0-9]*\.[0-9]*" "[0-9]*"; # float and integer
do
    $(sed_cmd) -i "s/Hv0[[:space:]]*Hv0[[:space:]]*\[1 -1 -3 -1 0 0 0\][[:space:]]*${i};/Hv0             Hv0             [1 -1 -3 -1 0 0 0]      10000;/g" constant/CarbonFiberPreform/constantProperties
    $(sed_cmd) -i "s/kiCoef[[:space:]]*kiCoef[[:space:]]*\[0 0 0 0 0 0 0\][[:space:]]*${i};/kiCoef          kiCoef             [0 0 0 0 0 0 0]      0.1;/g" constant/CarbonFiberPreform/constantProperties
    $(sed_cmd) -i "s/kjCoef[[:space:]]*kjCoef[[:space:]]*\[0 0 0 0 0 0 0\][[:space:]]*${i};/kjCoef          kjCoef             [0 0 0 0 0 0 0]      0.1;/g" constant/CarbonFiberPreform/constantProperties
    $(sed_cmd) -i "s/kkCoef[[:space:]]*kkCoef[[:space:]]*\[0 0 0 0 0 0 0\][[:space:]]*${i};/kkCoef          kkCoef             [0 0 0 0 0 0 0]      0.1;/g" constant/CarbonFiberPreform/constantProperties
done

find . -name '*~' -ls -delete
