#!/bin/sh
cd "${0%/*}" || exit                                # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions        # Tutorial run functions
#------------------------------------------------------------------------------

# Run serial
for subcase in left right
do
(
    cd "$subcase" || exit
    runApplication blockMesh && restore0Dir
)
done

mpirun -app ./mpirun_left_right.schema

# Run with database
mv -f log.run_left log.run_left_direct
mv -f log.run_right log.run_right_direct

for subcase in left right
do
(
    cd "$subcase" || exit
    foamListTimes -rm
    restore0Dir
    foamDictionary 0/T -entry boundaryField.coupled.sampleDatabase -add true
)
done

mpirun -app ./mpirun_left_right.schema

## Run parallel
## for subcase in left right
## do
## (
##     cd "$subcase" || exit
##     runApplication blockMesh && runApplication decomposePar
## )
## done
## mpirun -app ./mpirun.schema

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