This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/tutorials/incompressible/simpleFoam/ERCOFTAC_ConicalDiffuser/Case1.1_mixingPlane/Allrun

81 lines
2.8 KiB
Bash
Executable file

#!/bin/bash
#
#set -x
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Load additional RunFunctions
. ./RunFunctionsSupplemental
export caseName=`basename $PWD`
#We stop this script when we encounter a problem
#trap "exit -1" ERR
echo "$caseName: Creating the file blockMeshDict using m4"
(cd constant/polyMesh; m4 -P blockMeshDict.m4 > blockMeshDict)
echo "$caseName: Running blockMesh"
runApplicationAndReportOnError blockMesh
echo "$caseName: Updating the boundary file"
# Let's see if pyFoamChangeMixingPlaneBoundary.py is available
command -v pyFoamChangeMixingPlaneBoundary.py >/dev/null
if [ $? -eq 0 ];
then
echo "Using pyFoamChangeMixingPlaneBoundary.py"
pyFoamChangeMixingPlaneBoundary.py . B_UPSTREAM \
--shadowPatch B_DOWNSTREAM \
--assembly both \
--orientation dirR_spanTheta \
--coordinateSystemType cylindrical \
--coordinateSystemOrigin "(0 0 0)" \
--coordinateSystemE1 "(1 0 0)" \
--coordinateSystemE3 "(0 0 1)"
pyFoamChangeMixingPlaneBoundary.py . B_DOWNSTREAM \
--shadowPatch B_UPSTREAM \
--assembly both \
--orientation dirR_spanTheta \
--coordinateSystemType cylindrical \
--coordinateSystemOrigin "(0 0 0)" \
--coordinateSystemE1 "(1 0 0)" \
--coordinateSystemE3 "(0 0 1)"
else
echo "pyFoamChangeMixingPlaneBoundary.py is missing. Using the file constant/polyMesh/boundary.preconfigured"
cp constant/polyMesh/boundary.preconfigured constant/polyMesh/boundary
fi
echo "$caseName: Creating the starting time directory"
cp -r 0_orig 0
echo "$caseName: Running addSwirlAndRotation"
runApplicationAndReportOnError addSwirlAndRotation
echo "$caseName: Running simpleFoam"
runApplicationAndReportOnError simpleFoam
echo "$caseName: Postprocessing"
cd postProcessing
# Find latest time directory
latestAvailTimeDir=`foamInfoExec -case .. -times | tail -1`
echo "Analysing results for time: $latestAvailTimeDir"
# Run sample
runApplicationAndReportOnError sample -case .. -latestTime
# Adjust compareAll.gplt: replace "Case1.1" "??" by "Case1.1_mixingPlane" "$latestAvailTimeDir"
sed -i.old "s/\"Case1.1\".*$/\"$caseName\" \"$latestAvailTimeDir\"/g" compareAll.gplt
# Run gnuplot to generate the comparison charts
runApplicationAndReportOnError gnuplot compareAll.gplt ; mv log.gnuplot log.gnuplotCompareAll
# Run foamLog
runApplicationAndReportOnError foamLog ../log.simpleFoam
# Run gnuplot for the residuals
runApplicationAndReportOnError gnuplot plotResiduals.gplt; mv log.gnuplot log.gnuplotPlotResiduals