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

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

application=`getApplication`

# create mesh
runApplication blockMesh

# create sets
#setSet -batch system/sets.setSet > log.setSet1 2>&1
runApplication topoSet

# convert sets to zones
setsToZones -noFlipMap > log.setsToZones 2>&1

# create the first cyclic - lhs of porous zone
# Note that we don't know what value to give these patches-out-of-nothing so
# - use binary writing to avoid 'nan'
# - use setFields to set values
unset FOAM_SIGFPE
createBaffles cycLeft '(cycLeft_half0 cycLeft_half1)' -overwrite > log.createBaffles1 2>&1

# create the second cyclic - rhs of porous zone
createBaffles cycRight '(cycRight_half0 cycRight_half1)' -overwrite > log.createBaffles2 2>&1

# Initialise newly created patchFields to 0
runApplication changeDictionary

runApplication $application

# ----------------------------------------------------------------- end-of-file
