Files
OpenFOAM-12/tutorials/fluid/helmholtzResonance/Allrun
Will Bainbridge 303e3d1f60 tutorials: Consistency of All* scripts
Various minor changes to tutorial scripts. In particular, ensuring that
they all change to the containing directory so that batches of tutorials
can be run easily from the root of the installation.
2024-06-28 14:31:05 +01:00

56 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Run function links the appropriate mesh files and clones the case
run()
{
(
cd system
rm -f blockMeshDict.caseBlocks blockMeshDict.caseBoundary
ln -s blockMeshDict.${1}Blocks blockMeshDict.caseBlocks
ln -s blockMeshDict.${1}Boundary blockMeshDict.caseBoundary
)
cloneCase . ${1}
(
cd ${1}
runApplication blockMesh
runApplication decomposePar
runParallel $(getApplication)
)
}
# Run with a fully resolved plenum
run resolved
# Run with the plenum modelled by a boundary condition
run modelled
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
exit 1
fi
# Plot a comparison of the pressure in the neck
cat << EOF | gnuplot -persist
set terminal postscript eps size 5,4 enhanced color
set xlabel "Time (s)"
set ylabel "Gauge pressure in the neck (Pa)"
set output "pressure.eps"
plot \
"resolved/postProcessing/probes/0/p" us 1:(\$4-1e5) t "Resolved Plenum" w l, \
"modelled/postProcessing/probes/0/p" us 1:(\$4-1e5) t "Modelled Plenum" w l
EOF
#------------------------------------------------------------------------------