#!/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

# remove time folders
rm -rf [0-9]*

# remove all the *.pdf files
rm -f plots/*.pdf

# remove mesh
rm -f constant/cellToRegion
rm -rf constant/polyMesh
rm -rf constant/porousMat/polyMesh
rm -rf constant/flow/polyMesh
rm -rf system/blockMeshDict

# remove data
rm -f constant/thermophysicalProperties
rm -f constant/turbulenceProperties

# remove output folder and add an empty file for git repository
if [ -d output ]; then
    rm -rf output
    mkdir output
    touch output/empty
fi

# remove the processor* folders
rm -rf processor*

# remove paraview files
rm -f *.OpenFOAM
rm -f *.blockMesh

# remove temporary files
find . -name '*~' -ls -delete
