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

# Restore initial fields
restore0Dir

# Apply automatic patch name and boundary condition changes
changeDictionary -dict system/changeDictionaryDict

# Decompose the domain for parallel run
decomposePar

# Run solver in parallel
nProcs=$(grep numberOfSubdomains system/decomposeParDict | sed 's/[^0-9]*//g')
mpirun -np $nProcs $(getApplication) -parallel 2>&1 | tee log.$(getApplication)

# Reconstruct results
reconstructPar

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