File size: 2,548 Bytes
5a600cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #!/bin/sh
# Run from this directory
cd "${0%/*}" || exit 1
# Source tutorial run functions
. "$WM_PROJECT_DIR/bin/tools/RunFunctions"
usage () {
exec 1>&2
while [ "$#" -ge 1 ]; do printf "\n%s\n" "$1"; shift; done
cat <<USAGE
Usage: ${0##*/} [OPTIONS]
options:
-b | -baffle include baffle between cylinders
-h | -help help
-m | -mesh <S|M|L|XL> mesh size
- S: small
- M: medium (default)
- L: large
- XL: extra large
-p | -P1 use the P1 radiation model
Executes the following
+ 'blockMesh' to generate the mesh
+ 'createBaffles' to create a baffle (if -baffle is specified)
+ 'foamRun' to run the simulation
USAGE
exit 1
}
printMonitor () {
monitor="$(tail -1 postProcessing/"$1"/0/surfaceFieldValue.dat \
| awk '{print $2}')"
echo "$1 = $monitor"
}
setSize () {
_xCells="$1"
_nPhi="$2"
runApplication -a foamDictionary -entry cells -set "($_xCells 16 1)" \
system/blockMeshDict
runApplication -a foamDictionary -entry fvDOM/nPhi -set "$_nPhi" \
constant/radiationProperties
}
baffle=""
p1=""
while [ "$#" -gt 0 ]
do
case "$1" in
-b | -baffle)
baffle="yes"
shift 1
;;
-h | -help)
usage
;;
-m | -mesh)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
mesh=$2
shift 2
case "$mesh" in
S) setSize 5 20 ;;
M) ;;
L) setSize 20 80 ;;
XL) setSize 40 160 ;;
*) usage "Invalid argument '$mesh' to -m|-mesh <S|M|L|XL>." ;;
esac
;;
-p | -P1)
p1="yes"
shift 1
;;
-test)
shift
;;
-*)
usage "Invalid option '$1'"
;;
*)
break
;;
esac
done
runApplication blockMesh
[ "$baffle" ] && \
printf "Creating baffle ...\n" && \
runApplication createBaffles && \
runApplication -a foamDictionary \
system/controlDict \
-entry endTime \
-set 7000
[ "$p1" ] && \
printf "Selecting P1 radiation model ...\n" && \
runApplication -a foamDictionary \
constant/radiationProperties \
-entry radiationModel \
-set P1
runApplication foamRun
printMonitor qrInner
printMonitor qrOuter
printMonitor qInner
printMonitor qOuter
# ----------------------------------------------------------------- end-of-file
|