mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
TUT: fix Allrun script for bump2D
- use sed instead of foamDictionary and avoid log file - ensure consistent behaviour with plot script GIT: added missing 0/k field : inlet values still need adjustment
This commit is contained in:
committed by
Andrew Heather
parent
46d7db79aa
commit
979a12e521
58
tutorials/incompressible/simpleFoam/bump2D/0/k
Normal file
58
tutorials/incompressible/simpleFoam/bump2D/0/k
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1906 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object k;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 2 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 1.08e-3;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue $internalField;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
top
|
||||||
|
{
|
||||||
|
type symmetryPlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(symUp|symDown)"
|
||||||
|
{
|
||||||
|
type symmetryPlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
bump
|
||||||
|
{
|
||||||
|
type kqRWallFunction;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
frontAndBack
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -4,6 +4,8 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
cleanCase
|
cleanCase
|
||||||
|
|
||||||
|
rm -f constant/turbulenceProperties
|
||||||
rm -rf *.png
|
rm -rf *.png
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -12,36 +12,73 @@ kOmegaSST
|
|||||||
SpalartAllmaras
|
SpalartAllmaras
|
||||||
"
|
"
|
||||||
|
|
||||||
for model in $models
|
# Extract a value (Eg, from boundaryField/bump/value)
|
||||||
do
|
#
|
||||||
echo "Processing model: $model"
|
# $1 = dictEntry
|
||||||
|
# $2 = inputFile
|
||||||
|
# $3 = outputFile
|
||||||
|
#
|
||||||
|
# only retain values between, but not including the ( ) delimiters.
|
||||||
|
# For example,
|
||||||
|
# ----
|
||||||
|
# value nonuniform List<scalar>
|
||||||
|
# 110
|
||||||
|
# (
|
||||||
|
# 0.0041520092
|
||||||
|
# 0.012577691
|
||||||
|
# 0.021250264
|
||||||
|
# 0.030176962
|
||||||
|
# )
|
||||||
|
# ;
|
||||||
|
# ----
|
||||||
|
extractVal()
|
||||||
|
{
|
||||||
|
if [ -f "$2" ]
|
||||||
|
then
|
||||||
|
foamDictionary -entry "$1" -value "$2" | \
|
||||||
|
sed -n '/(/,/)/{ s/[()]//g; /^ *$/d; p}' \
|
||||||
|
> "$3"
|
||||||
|
else
|
||||||
|
# Or some other tag?
|
||||||
|
echo "Not such file: $2" 1>&2
|
||||||
|
echo "0" > "$3"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
\cp constant/turbulenceProperties.template constant/turbulenceProperties
|
|
||||||
runApplication -s "$model" foamDictionary -entry RAS.RASModel \
|
|
||||||
-set "$model" constant/turbulenceProperties
|
|
||||||
|
|
||||||
runApplication $(getApplication)
|
# Possibly disable for test: if notTest $@
|
||||||
|
|
||||||
timeDir=$(foamListTimes -latestTime)
|
if :
|
||||||
|
then
|
||||||
|
for model in $models
|
||||||
|
do
|
||||||
|
echo "Processing model: $model"
|
||||||
|
|
||||||
# Create datasets for benchmark comparisons
|
sed -e "s/RAS_MODEL/$model/g" \
|
||||||
echo "# ccx tau_xx tau_yy tau_zz cp" > profiles.dat
|
constant/turbulenceProperties.template \
|
||||||
foamDictionary -entry boundaryField.bump.value -value $timeDir/Cx | \
|
> constant/turbulenceProperties
|
||||||
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > Cx.$$
|
|
||||||
foamDictionary -entry boundaryField.bump.value -value $timeDir/wallShearStress | \
|
|
||||||
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > tau.$$
|
|
||||||
foamDictionary -entry boundaryField.bump.value -value $timeDir/Cp | \
|
|
||||||
sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' > cp.$$
|
|
||||||
\paste -d ' ' Cx.$$ tau.$$ cp.$$ >> profiles.dat
|
|
||||||
\rm -f Cx.$$ tau.$$ cp.$$
|
|
||||||
|
|
||||||
# Store model results
|
runApplication $(getApplication)
|
||||||
modelDir="$model"
|
|
||||||
\rm -rf "$modelDir"
|
|
||||||
\mkdir "$modelDir"
|
|
||||||
\mv log* profiles.dat "$timeDir" postProcessing "$modelDir"
|
|
||||||
|
|
||||||
cleanTimeDirectories
|
timeDir=$(foamListTimes -latestTime)
|
||||||
done
|
|
||||||
|
# Create datasets for benchmark comparisons
|
||||||
|
extractVal boundaryField.bump.value "$timeDir/Cx" "Cx.$$"
|
||||||
|
extractVal boundaryField.bump.value "$timeDir/wallShearStress" "tau.$$"
|
||||||
|
extractVal boundaryField.bump.value "$timeDir/Cp" "cp.$$"
|
||||||
|
|
||||||
|
echo "# ccx tau_xx tau_yy tau_zz cp" > profiles.dat
|
||||||
|
paste -d ' ' Cx.$$ tau.$$ cp.$$ >> profiles.dat
|
||||||
|
rm -f Cx.$$ tau.$$ cp.$$
|
||||||
|
|
||||||
|
# Store results in directory of the same name as the model
|
||||||
|
modelDir="$model"
|
||||||
|
rm -rf "$modelDir"
|
||||||
|
mkdir "$modelDir"
|
||||||
|
mv -f log* profiles.dat "$timeDir" postProcessing "$modelDir"
|
||||||
|
|
||||||
|
cleanTimeDirectories
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -19,7 +19,7 @@ simulationType RAS;
|
|||||||
|
|
||||||
RAS
|
RAS
|
||||||
{
|
{
|
||||||
RASModel TURB_MODE;
|
RASModel RAS_MODEL;
|
||||||
turbulence on;
|
turbulence on;
|
||||||
printCoeffs on;
|
printCoeffs on;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Turbulence closure models
|
||||||
|
models=('kOmegaSST' 'SpalartAllmaras')
|
||||||
|
|
||||||
# Note: CFL3D data available from:
|
# Note: CFL3D data available from:
|
||||||
# https://turbmodels.larc.nasa.gov/bump_sa.html
|
# https://turbmodels.larc.nasa.gov/bump_sa.html
|
||||||
# The CFL3D-SpalartAllmaras datasets of Cf and Cp:
|
# The CFL3D-SpalartAllmaras datasets of Cf and Cp:
|
||||||
# Cf = https://turbmodels.larc.nasa.gov/Bump/SA/cf_bump.dat
|
# Cf = https://turbmodels.larc.nasa.gov/Bump/SA/cf_bump.dat
|
||||||
# Cp = https://turbmodels.larc.nasa.gov/Bump/SA/cp_bump.dat
|
# Cp = https://turbmodels.larc.nasa.gov/Bump/SA/cp_bump.dat
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
plotCf() {
|
plotCf() {
|
||||||
declare -a resultSet=("${!1}")
|
declare -a resultSet=("${!1}")
|
||||||
@ -104,9 +108,6 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Turbulence closure models
|
|
||||||
models=('kOmegaSST' 'kEpsilon')
|
|
||||||
|
|
||||||
modelResults=()
|
modelResults=()
|
||||||
n=0
|
n=0
|
||||||
for model in "${models[@]}"
|
for model in "${models[@]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user