#!/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 run functions
#. $WM_PROJECT_DIR/bin/tools/RunFunctions

# generate mesh with blockMesh
# blockMesh

eval `tutoInDevel.sh` # Tutorial in development. Usage: ./Allrun <continue_flag> <error_msg>

if ! command -v gmsh &> /dev/null
then
    echo "gmsh not found" 
    exit 1
fi

# use mesh from gmsh
gmsh -3 verification/unstructured_gmsh/2D_square.geo verification/unstructured_gmsh/2D_square.msh
gmshToFoam verification/unstructured_gmsh/2D_square.msh
transformPoints -scale "(0.01 0.01 0.01)"
renumberMesh -overwrite

# run application
heatTransfer

# paraview
# paraFoam

# -----------------------------------------------------------------------------
