mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
TUT: reorganise the scripts and dicts in turbulentInflow
This commit is contained in:
committed by
Andrew Heather
parent
87250cb770
commit
80681eeb2b
@ -31,11 +31,11 @@ boundaryField
|
||||
type fixedValue;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
sides_half0
|
||||
left
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
sides_half1
|
||||
right
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
|
||||
@ -29,11 +29,11 @@ boundaryField
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
sides_half0
|
||||
left
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
sides_half1
|
||||
right
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
|
||||
@ -29,11 +29,11 @@ boundaryField
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
sides_half0
|
||||
left
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
sides_half1
|
||||
right
|
||||
{
|
||||
type cyclic;
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cleanCase0
|
||||
rm -rf constant/boundaryData/inlet
|
||||
rm -rf results
|
||||
\rm -rf system/controlDict constant/boundaryData/inlet results
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -4,31 +4,92 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Test with different synthetic inflow models
|
||||
modelTypes="reducedDigitalFilter digitalFilter DFSEM"
|
||||
endTime=10
|
||||
\cp system/controlDict.template system/controlDict
|
||||
if notTest $@
|
||||
then
|
||||
endTime=85
|
||||
fi
|
||||
\sed -i "s|END_TIME|$endTime|g" system/controlDict
|
||||
|
||||
runApplication blockMesh
|
||||
restore0Dir
|
||||
|
||||
# Compute (serial) and collect data
|
||||
for modelType in $modelTypes
|
||||
do
|
||||
echo
|
||||
echo "Running with model: $modelType"
|
||||
(cd 0 && ln -snf "inlet.$modelType" inlet)
|
||||
(cd constant/boundaryData && ln -snf "inlet.$modelType" inlet)
|
||||
|
||||
runApplication -s "$modelType" pimpleFoam
|
||||
./createGraphs
|
||||
|
||||
# Collect data in 'results' directory
|
||||
results="results/$modelType"
|
||||
echo "Placing summary in $results"
|
||||
mkdir -p "$results"
|
||||
mv -f log.* *.png postProcessing "$results" 2>/dev/null
|
||||
# Collect data into the 'results' directory,
|
||||
# and clean the case for the next run
|
||||
#
|
||||
# $1 = model
|
||||
# ----
|
||||
collectData(){
|
||||
model=$1
|
||||
\echo " Moving results into 'results/$model'"
|
||||
results="results/$model"
|
||||
\mkdir -p "$results"
|
||||
timeDir=$(foamListTimes -latestTime)
|
||||
\mv -f log* *.png postProcessing "$timeDir" "$results" 2>/dev/null
|
||||
|
||||
cleanTimeDirectories
|
||||
rm -rf processor*
|
||||
done
|
||||
\rm -rf processor* > /dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
# Compute the case in 'serial' mode,
|
||||
# and collect the data
|
||||
#
|
||||
# $* = models
|
||||
# ----
|
||||
serialRun(){
|
||||
models=$*
|
||||
for model in $models
|
||||
do
|
||||
\echo " Running with the synthetic turbulence model: $model"
|
||||
(\cd 0 && \ln -snf "inlet.$model" inlet)
|
||||
(\cd constant/boundaryData && \ln -snf "inlet.$model" inlet)
|
||||
|
||||
runApplication -s "$model" $(getApplication)
|
||||
./plot
|
||||
collectData $model
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Compute the case in 'parallel' mode,
|
||||
# and collect the data
|
||||
#
|
||||
# $* = models
|
||||
# ----
|
||||
parallelRun(){
|
||||
models=$*
|
||||
for model in $models
|
||||
do
|
||||
\echo " Running with the synthetic turbulence model: $model"
|
||||
(\cd 0 && \ln -snf "inlet.$model" inlet)
|
||||
(\cd constant/boundaryData && \ln -snf "inlet.$model" inlet)
|
||||
|
||||
runApplication -s "$model" decomposePar
|
||||
runParallel -s "$model" $(getApplication)
|
||||
./plot
|
||||
|
||||
collectData $model
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Synthetic inflow models
|
||||
models="
|
||||
reducedDigitalFilter
|
||||
digitalFilter
|
||||
DFSEM
|
||||
"
|
||||
|
||||
# Prepare the numerical setup
|
||||
runApplication blockMesh
|
||||
restore0Dir
|
||||
\rm -rf "results"
|
||||
|
||||
# Run with the synthetic turbulence models
|
||||
serialRun $models
|
||||
#parallelRun $models
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Test with different synthetic inflow models
|
||||
modelTypes="reducedDigitalFilter digitalFilter DFSEM"
|
||||
|
||||
runApplication blockMesh
|
||||
restore0Dir
|
||||
|
||||
# Compute (parallel) and collect data
|
||||
for modelType in $modelTypes
|
||||
do
|
||||
echo
|
||||
echo "Running with model: $modelType"
|
||||
(cd 0 && ln -snf "inlet.$modelType" inlet)
|
||||
(cd constant/boundaryData && ln -snf "inlet.$modelType" inlet)
|
||||
|
||||
runApplication -s "$modelType" decomposePar
|
||||
runParallel -s "$modelType" pimpleFoam
|
||||
./createGraphs
|
||||
|
||||
# Collect data in 'results' directory
|
||||
results="results/$modelType"
|
||||
echo "Placing summary in $results"
|
||||
mkdir -p "$results"
|
||||
mv -f log.* *.png postProcessing "$results" 2>/dev/null
|
||||
|
||||
cleanTimeDirectories
|
||||
rm -rf processor*
|
||||
done
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -10,25 +10,25 @@ examined through a single-cell-domain smooth-wall plane channel flow setup:
|
||||
|
||||
The input statistics are obtained from:
|
||||
|
||||
Moser, Kim & Mansour
|
||||
"DNS of Turbulent Channel Flow up to Re_tau=590",
|
||||
Physics of Fluids (1999) vol 11, 943-945.
|
||||
doi.org/10.1063/1.869966
|
||||
Moser, R. D., Kim, J., & Mansour, N. N. (1999).
|
||||
Direct numerical simulation of turbulent channel flow up to Reτ=590.
|
||||
Physics of fluids, 11(4), 943-945.
|
||||
DOI:10.1063/1.869966
|
||||
|
||||
from which the input first-/second-order turbulence statistics data for the
|
||||
smooth-wall plane channel flow at Re=395 were used.
|
||||
smooth-wall plane channel flow at ReTau=395 were used.
|
||||
|
||||
The data is available online from (Retrieved: 21-06-2019):
|
||||
|
||||
http://turbulence.ices.utexas.edu/MKM_1999.html
|
||||
https://turbulence.oden.utexas.edu/data/MKM/chan395/
|
||||
|
||||
Serial executing:
|
||||
Serial executing (comment out 'parallelRun'):
|
||||
|
||||
./Allrun
|
||||
|
||||
Parallel (decompositionMethod=scotch) executing:
|
||||
Parallel (decompositionMethod=scotch) executing (comment out 'serialRun'):
|
||||
|
||||
./Allrunparallel
|
||||
./Allrun
|
||||
|
||||
Both scripts run the test case, and collect the OpenFOAM samples, and plots into
|
||||
The script will run the test case, and collect the plots and samples into
|
||||
the 'results' directory.
|
||||
|
||||
@ -17,15 +17,12 @@ FoamFile
|
||||
|
||||
transportModel Newtonian;
|
||||
|
||||
// Re_tau = u_tau L / nu
|
||||
// Re_tau = 395
|
||||
// L = half channel height = 1
|
||||
// Ubulk/u_tau = 17.55
|
||||
// U_bulk = 17.55 -> u_tau = 1
|
||||
// -> nu = 1*1/395 = 2.532e-3
|
||||
|
||||
nu nu [ 0 2 -1 0 0 0 0 ] 2.532e-3;
|
||||
// ReTau = uTau delta / nuFluid
|
||||
// ReTau = 395 [-]
|
||||
// delta = half channel height = 1 [m]
|
||||
// -> nuFluid = 1*1/395 = 2.532e-3 [m2/s]
|
||||
|
||||
nu 2.532e-3;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -19,19 +19,14 @@ simulationType LES;
|
||||
|
||||
LES
|
||||
{
|
||||
turbulence on;
|
||||
|
||||
LESModel Smagorinsky;
|
||||
SmagorinskyCoeffs
|
||||
{
|
||||
Ce 1.05;
|
||||
Ck 0.0266; // Updated to give Cs = 0.065
|
||||
Ce 1.048;
|
||||
Ck 0.02654; // Updated to give Cs = 0.065
|
||||
}
|
||||
|
||||
printCoeffs on;
|
||||
|
||||
delta vanDriest;
|
||||
|
||||
vanDriestCoeffs
|
||||
{
|
||||
delta cubeRootVol;
|
||||
@ -42,6 +37,9 @@ LES
|
||||
Aplus 26;
|
||||
Cdelta 0.158;
|
||||
}
|
||||
|
||||
printCoeffs on;
|
||||
turbulence on;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Require gnuplot
|
||||
command -v gnuplot >/dev/null || {
|
||||
echo "gnuplot not found - skipping graph creation" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# The latestTime in postProcessing/inletSampling
|
||||
timeDir=$(foamListTimes -case postProcessing/inletSampling -latestTime 2>/dev/null)
|
||||
|
||||
[ -n "$timeDir" ] || {
|
||||
echo "No postProcessing/inletSampling found - skipping graph creation" 1>&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
timeDir="postProcessing/inletSampling/$timeDir"
|
||||
|
||||
echo "Creating graphs"
|
||||
|
||||
gnuplot<<GNUPLOT
|
||||
|
||||
set terminal png size 1000,800 enhanced font "Helvetica,24"
|
||||
|
||||
set xrange [0:1]
|
||||
set yrange [-1:8]
|
||||
set xlabel "Channel height"
|
||||
set ylabel "<u_i u_i>"
|
||||
|
||||
set offset .05, .05
|
||||
set style data linespoints
|
||||
|
||||
set grid
|
||||
set linetype 1 lc rgb 'black' lw 2
|
||||
set linetype 2 lc rgb 'red' lw 2
|
||||
set linetype 3 lc rgb 'blue' lw 2
|
||||
set linetype 4 lc rgb 'green' lw 2
|
||||
set linetype 5 lc rgb 'black' pi -8 pt 4 ps 1.5
|
||||
set linetype 6 lc rgb 'red' pi -8 pt 4 ps 1.5
|
||||
set linetype 7 lc rgb 'blue' pi -8 pt 4 ps 1.5
|
||||
set linetype 8 lc rgb 'green' pi -8 pt 4 ps 1.5
|
||||
|
||||
|
||||
set title "Stress in cell"
|
||||
input = "$timeDir/inletCell_UPrime2Mean.xy"
|
||||
set output 'stress-cell.png'
|
||||
plot \
|
||||
input u 1:2 w lines t "<uu>" lt 1, \
|
||||
input u 1:5 w lines t "<vv>" lt 2, \
|
||||
input u 1:7 w lines t "<ww>" lt 3, \
|
||||
input u 1:3 w lines t "<uv>" lt 4
|
||||
|
||||
|
||||
set title "Stress on patch"
|
||||
input = "$timeDir/inletPatch_UPrime2Mean.xy"
|
||||
set output 'stress-patch.png'
|
||||
plot \
|
||||
input u 1:2 w lines t "<uu>" lt 1, \
|
||||
input u 1:5 w lines t "<vv>" lt 2, \
|
||||
input u 1:7 w lines t "<ww>" lt 3, \
|
||||
input u 1:3 w lines t "<uv>" lt 4
|
||||
|
||||
GNUPLOT
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
73
tutorials/verificationAndValidation/turbulentInflow/plot
Executable file
73
tutorials/verificationAndValidation/turbulentInflow/plot
Executable file
@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
plotStresses() {
|
||||
timeDir=$1
|
||||
\echo " Plotting the normal and Reynolds stresses"
|
||||
|
||||
gnuplot<<PLT_STRESSES
|
||||
set terminal pngcairo font "helvetica,20" size 1000, 800
|
||||
set xrange [0:1]
|
||||
set yrange [-1:8]
|
||||
set grid
|
||||
set key top right
|
||||
set xlabel "Channel height from the bottomWall [m]"
|
||||
set ylabel "<u_i^' u_i^'>"
|
||||
set offset .05, .05
|
||||
|
||||
set style data linespoints
|
||||
set linetype 1 lc rgb 'black' lw 2
|
||||
set linetype 2 lc rgb 'red' lw 2
|
||||
set linetype 3 lc rgb 'blue' lw 2
|
||||
set linetype 4 lc rgb 'green' lw 2
|
||||
set linetype 5 lc rgb 'black' pi -8 pt 4 ps 1.5
|
||||
set linetype 6 lc rgb 'red' pi -8 pt 4 ps 1.5
|
||||
set linetype 7 lc rgb 'blue' pi -8 pt 4 ps 1.5
|
||||
set linetype 8 lc rgb 'green' pi -8 pt 4 ps 1.5
|
||||
|
||||
set title "Normal and Reynolds stresses on cell"
|
||||
input="$timeDir/inletCell_UPrime2Mean.xy"
|
||||
set output 'stress-cell.png'
|
||||
plot \
|
||||
input u 1:2 w lines t "<u^' u^'>" lt 1, \
|
||||
input u 1:5 w lines t "<v^' v^'>" lt 2, \
|
||||
input u 1:7 w lines t "<w^' w^'>" lt 3, \
|
||||
input u 1:3 w lines t "<u^' v^'>" lt 4
|
||||
|
||||
set title "Normal and Reynolds stresses on patch"
|
||||
input = "$timeDir/inletPatch_UPrime2Mean.xy"
|
||||
set output 'stress-patch.png'
|
||||
plot \
|
||||
input u 1:2 w lines t "<u^' u^'>" lt 1, \
|
||||
input u 1:5 w lines t "<v^' v^'>" lt 2, \
|
||||
input u 1:7 w lines t "<w^' w^'>" lt 3, \
|
||||
input u 1:3 w lines t "<u^' v^'>" lt 4
|
||||
|
||||
PLT_STRESSES
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Require gnuplot
|
||||
command -v gnuplot >/dev/null || {
|
||||
\echo "gnuplot not found - skipping graph creation" 1>&2
|
||||
\exit 1
|
||||
}
|
||||
|
||||
|
||||
# The latestTime in postProcessing/inletSampling
|
||||
timeDir=$(foamListTimes -case postProcessing/inletSampling -latestTime 2>/dev/null)
|
||||
|
||||
[ -n "$timeDir" ] || {
|
||||
\echo "No postProcessing/inletSampling found - skipping graph creation" 1>&2
|
||||
\exit 2
|
||||
}
|
||||
|
||||
timeDir="postProcessing/inletSampling/$timeDir"
|
||||
|
||||
plotStresses "$timeDir"
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -60,16 +60,16 @@ boundary
|
||||
type wall;
|
||||
faces ((4 3 9 10));
|
||||
}
|
||||
sides_half0
|
||||
left
|
||||
{
|
||||
type cyclic;
|
||||
neighbourPatch sides_half1;
|
||||
neighbourPatch right;
|
||||
faces ((1 2 5 0)(2 3 4 5));
|
||||
}
|
||||
sides_half1
|
||||
right
|
||||
{
|
||||
type cyclic;
|
||||
neighbourPatch sides_half0;
|
||||
neighbourPatch left;
|
||||
faces ((6 11 8 7)(11 10 9 8));
|
||||
}
|
||||
inlet
|
||||
|
||||
@ -23,7 +23,7 @@ startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 85;
|
||||
endTime END_TIME;
|
||||
|
||||
deltaT 4e-3;
|
||||
|
||||
@ -31,7 +31,7 @@ writeControl timeStep;
|
||||
|
||||
writeInterval 1250;
|
||||
|
||||
purgeWrite 0;
|
||||
purgeWrite 3;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
@ -47,11 +47,12 @@ runTimeModifiable false;
|
||||
|
||||
adjustTimeStep false;
|
||||
|
||||
// Allow 10% run-up before calculating mean
|
||||
// Allow 10% of time for initialisation before sampling
|
||||
timeStart #eval #{ 0.1 * ${/endTime} #};
|
||||
|
||||
functions
|
||||
{
|
||||
#include "fieldAverage"
|
||||
#include "sampling"
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 6;
|
||||
numberOfSubdomains 3;
|
||||
|
||||
method scotch;
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
/*--------------------------------*- 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 dictionary;
|
||||
location "system";
|
||||
object fieldAverage;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
fieldAverage1
|
||||
{
|
||||
type fieldAverage;
|
||||
libs (fieldFunctionObjects);
|
||||
writeControl writeTime;
|
||||
timeStart $/timeStart;
|
||||
|
||||
fields
|
||||
(
|
||||
U
|
||||
{
|
||||
mean on;
|
||||
prime2Mean on;
|
||||
base time;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -15,25 +15,6 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
fieldAverage1
|
||||
{
|
||||
type fieldAverage;
|
||||
libs (fieldFunctionObjects);
|
||||
writeControl writeTime;
|
||||
timeStart $/timeStart;
|
||||
|
||||
fields
|
||||
(
|
||||
U
|
||||
{
|
||||
mean on;
|
||||
prime2Mean on;
|
||||
base time;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inletSampling
|
||||
{
|
||||
type sets;
|
||||
@ -56,7 +37,7 @@ inletSampling
|
||||
}
|
||||
inletCell
|
||||
{
|
||||
type face;
|
||||
type midPoint;
|
||||
axis y;
|
||||
start (0.062832 0 1.57);
|
||||
end (0.062832 2 1.57);
|
||||
|
||||
Reference in New Issue
Block a user