diff --git a/tutorials/incompressible/simpleFoam/bump2D/0/k b/tutorials/incompressible/simpleFoam/bump2D/0/k new file mode 100644 index 0000000000..da3960b55f --- /dev/null +++ b/tutorials/incompressible/simpleFoam/bump2D/0/k @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/bump2D/0/omega b/tutorials/incompressible/simpleFoam/bump2D/0/omega index a164441ca2..634ceff708 100644 --- a/tutorials/incompressible/simpleFoam/bump2D/0/omega +++ b/tutorials/incompressible/simpleFoam/bump2D/0/omega @@ -46,7 +46,7 @@ boundaryField bump { - type omegaWallFunction; + type omegaWallFunction; value $internalField; } diff --git a/tutorials/incompressible/simpleFoam/bump2D/Allclean b/tutorials/incompressible/simpleFoam/bump2D/Allclean index 941541a11f..02236aa62b 100755 --- a/tutorials/incompressible/simpleFoam/bump2D/Allclean +++ b/tutorials/incompressible/simpleFoam/bump2D/Allclean @@ -4,6 +4,8 @@ cd ${0%/*} || exit 1 # Run from this directory #------------------------------------------------------------------------------ cleanCase + +rm -f constant/turbulenceProperties rm -rf *.png #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/simpleFoam/bump2D/Allrun b/tutorials/incompressible/simpleFoam/bump2D/Allrun index 1233420b53..d14b8a8733 100755 --- a/tutorials/incompressible/simpleFoam/bump2D/Allrun +++ b/tutorials/incompressible/simpleFoam/bump2D/Allrun @@ -12,36 +12,73 @@ kOmegaSST SpalartAllmaras " -for model in $models -do - echo "Processing model: $model" +# Extract a value (Eg, from boundaryField/bump/value) +# +# $1 = dictEntry +# $2 = inputFile +# $3 = outputFile +# +# only retain values between, but not including the ( ) delimiters. +# For example, +# ---- +# value nonuniform List +# 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 - echo "# ccx tau_xx tau_yy tau_zz cp" > profiles.dat - foamDictionary -entry boundaryField.bump.value -value $timeDir/Cx | \ - 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.$$ + sed -e "s/RAS_MODEL/$model/g" \ + constant/turbulenceProperties.template \ + > constant/turbulenceProperties - # Store model results - modelDir="$model" - \rm -rf "$modelDir" - \mkdir "$modelDir" - \mv log* profiles.dat "$timeDir" postProcessing "$modelDir" + runApplication $(getApplication) - cleanTimeDirectories -done + timeDir=$(foamListTimes -latestTime) + + # 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 #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties.template b/tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties.template index 0ac8b36c26..50f69bcb8b 100644 --- a/tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties.template +++ b/tutorials/incompressible/simpleFoam/bump2D/constant/turbulenceProperties.template @@ -19,7 +19,7 @@ simulationType RAS; RAS { - RASModel TURB_MODE; + RASModel RAS_MODEL; turbulence on; printCoeffs on; } diff --git a/tutorials/incompressible/simpleFoam/bump2D/plot b/tutorials/incompressible/simpleFoam/bump2D/plot index 56598d6c47..326db01bf4 100755 --- a/tutorials/incompressible/simpleFoam/bump2D/plot +++ b/tutorials/incompressible/simpleFoam/bump2D/plot @@ -1,14 +1,18 @@ -#!/bin/sh +#!/bin/bash cd ${0%/*} || exit 1 # Run from this directory . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions #------------------------------------------------------------------------------ +# Turbulence closure models +models=('kOmegaSST' 'SpalartAllmaras') + # Note: CFL3D data available from: # https://turbmodels.larc.nasa.gov/bump_sa.html # The CFL3D-SpalartAllmaras datasets of Cf and Cp: # Cf = https://turbmodels.larc.nasa.gov/Bump/SA/cf_bump.dat # Cp = https://turbmodels.larc.nasa.gov/Bump/SA/cp_bump.dat +#------------------------------------------------------------------------------ plotCf() { declare -a resultSet=("${!1}") @@ -104,9 +108,6 @@ then exit 1 } - # Turbulence closure models - models=('kOmegaSST' 'kEpsilon') - modelResults=() n=0 for model in "${models[@]}"