ENH: Lagrangian - added tutorial case for particle Tomiyama drag model

This commit is contained in:
Andrew Heather 2024-06-03 22:10:32 +01:00 committed by Kutalmis Bercin
parent 8950c9b0c6
commit d3861a5dcc
21 changed files with 848 additions and 0 deletions

View File

@ -0,0 +1,7 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
rm -rf parcelInBox-* *.png
#------------------------------------------------------------------------------

View File

@ -0,0 +1,16 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
BASE="parcelInBox"
for cont in "pure" "slight" "full"
do
cp -rf "$BASE" "$BASE-$cont"
(cd ./$BASE-$cont && ./Allrun $cont)
done
./plot
#------------------------------------------------------------------------------

View File

@ -0,0 +1,7 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
echo "--- Skipping testing of tutorials in : $PWD" 1>&2
#------------------------------------------------------------------------------

View File

@ -0,0 +1,14 @@
Test case for Tomiyama particle drag model
Based on the `parcelInBox` tutorial
- Makes use of the `FreezeParticles` cloud function object to keep the particle
location fixed in space
- Iterates across a range of particle velocities for different contamination
levels to reproduce the validation figure from the reference publication
Reference
Tomiyama, A., Kataoka, I., Zun, I., & Sakaguchi, T. (1998).
Drag coefficients of single bubbles under normal and micro gravity conditions.
JSME International Journal Series B Fluids and Thermal Engineering, 41(2), 472-479.

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
back
{
type symmetryPlane;
}
front
{
type symmetryPlane;
}
walls
{
type noSlip;
}
outlet
{
type zeroGradient;
}
inlet
{
type fixedValue;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
back
{
type symmetryPlane;
}
front
{
type symmetryPlane;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
walls
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase0
rm -rf logs D_VS_U.txt *.png
#------------------------------------------------------------------------------

View File

@ -0,0 +1,41 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allclean
mkdir logs
D_VS_U="D_VS_U.txt"
contamination="${1:-pure}"
runApplication blockMesh
APP=$(getApplication)
for d in $(seq -f "%06.4f" 0.0002 0.0002 0.04)
do
foamListTimes -rm
restore0Dir
echo "Setting diameter: $d"
sed -e "s/DIAMETER/$d/g" -e "s/CONTAMINATION/$contamination/g" constant/kinematicCloudProperties.TEMPLATE > constant/kinematicCloudProperties
runApplication $APP
mv log.$APP logs/log.${APP}_t$d
./process > logs/log.velocity_t$d
#U=$(tail -5 logs/log.velocity_t$d | awk '{SUM += $2; if (++C == 5) {print SUM/C; exit}}')
U=$(tail -1 logs/log.velocity_t$d | awk '{print $2}')
echo "$d $U" >> $D_VS_U
done
#------------------------------------------------------------------------------

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 -9.81 0);
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object kinematicCloudProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solution
{
active true;
coupled no;
transient yes;
cellValueSourceCorrection no;
maxCo 0.3;
sourceTerms
{
schemes
{
U semiImplicit 1;
}
}
interpolationSchemes
{
rho cell;
U cellPoint;
muc cell;
p cell;
curlUcDt cellPoint;
}
integrationSchemes
{
U Euler;
}
}
constantProperties
{
rho0 1.2;
}
subModels
{
particleForces
{
gravity;
TomiyamaDrag
{
sigma 0.07;
contamination CONTAMINATION;
}
}
injectionModels
{
model1
{
type manualInjection;
massTotal 1; // unused - calculated by number of particles
parcelBasisType fixed;
nParticle 1;
SOI 0;
positionsFile "parcelPositions";
U0 (0 0 0);
sizeDistribution
{
type fixedValue;
fixedValueDistribution
{
value DIAMETER;
}
}
}
}
dispersionModel none;
patchInteractionModel none;
stochasticCollisionModel none;
surfaceFilmModel none;
}
cloudFunctions
{
FreezeParticles
{
type FreezeParticles;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class vectorField;
object parcelPositions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
(
(0.05 0.05 0.005)
)
// ************************************************************************* //

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 1e-06;
rhoInf 1000;
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
gnuplot<<EOF
set terminal pngcairo font "helvetica,20" size 1200, 627
set output "velocity.png"
set logscale x
set logscale y
set xrange [0.1:100]
set yrange [1:100]
set format x '10^{%T}'
set format y '10^{%T}'
set xlabel "Diameter / [mm]"
set ylabel "Terminal velocity / [cm/s]"
plot "D_VS_U.txt" u (\$1*1000):(\$2*100) t "Results" w lines
EOF
#------------------------------------------------------------------------------

View File

@ -0,0 +1,11 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
for t in $(foamListTimes)
do
U=$(awk '/1\(\(/{print $2}' "$t/lagrangian/kinematicCloud/U")
echo "$t $U"
done
#------------------------------------------------------------------------------

View File

@ -0,0 +1,89 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.1;
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 0.1)
(1 0 0.1)
(1 1 0.1)
(0 1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (5 5 5) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
outlet
{
type wall;
faces
(
(3 7 6 2)
);
}
inlet
{
type wall;
faces
(
(1 5 4 0)
);
}
walls
{
type wall;
faces
(
(0 4 7 3)
(2 6 5 1)
);
}
back
{
type symmetryPlane;
faces
(
(0 3 2 1)
);
}
front
{
type symmetryPlane;
faces
(
(4 5 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application kinematicParcelFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.1;
deltaT 0.001;
writeControl adjustable;
writeInterval 0.02;
purgeWrite 0;
writeFormat ascii;
writePrecision 10;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
adjustTimeStep yes;
maxCo 5;
maxDeltaT 1e-3;
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss upwind;
div(phi,K) Gauss upwind;
div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind;
div(phi,omega) Gauss upwind;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //

View File

@ -0,0 +1,70 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"(U|k|epsilon)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0.1;
}
"(U|k|epsilon)Final"
{
$U;
tolerance 1e-05;
relTol 0;
}
p
{
solver GAMG;
tolerance 0;
relTol 0.1;
smoother GaussSeidel;
maxIter 20;
}
pFinal
{
$p;
tolerance 1e-06;
relTol 0;
}
}
PIMPLE
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
momentumPredictor yes;
pRefCell 0;
pRefValue 0;
solvePrimaryRegion no;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,33 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
# Require gnuplot
command -v gnuplot >/dev/null || {
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
exit 1
}
#------------------------------------------------------------------------------
gnuplot<<EOF
set terminal pngcairo font "helvetica,20" size 1200, 627
set output "velocity-all.png"
set logscale x
set logscale y
set xrange [0.1:100]
set yrange [1:100]
set format x '10^{%T}'
set format y '10^{%T}'
set xlabel "Diameter / [mm]"
set ylabel "Terminal velocity / [cm/s]"
set key bottom right
plot "parcelInBox-pure/D_VS_U.txt" u (\$1*1000):(\$2*100) w lines lw 2 t "Pure", \
"parcelInBox-slight/D_VS_U.txt" u (\$1*1000):(\$2*100) w lines lw 2 t "Slight", \
"parcelInBox-full/D_VS_U.txt" u (\$1*1000):(\$2*100) w lines lw 2 t "Full", \
"reference.dat" w points ps 1.5 pt 6 lw 2 t "Reference"
EOF
#------------------------------------------------------------------------------

View File

@ -0,0 +1,133 @@
0.23165101120517492 2.1732780450024016
0.2786631410991471 2.7554435877275303
0.31515405186588796 3.277250219184025
0.31886520638584326 3.5902134819203972
0.4978239202916686 4.942987804512482
0.4676150366190196 5.17315663478947
0.6619921926307331 5.774038478986354
0.7126355937667286 6.501402977557853
0.6610628611729201 6.866357210111907
0.8370505701073748 7.254777453922249
0.5904419261961209 7.729417543954037
0.5900055251010418 8.467404459440496
0.7282245608167323 9.711289880017386
0.8137593798629431 10.935174992075732
0.9006865413556834 8.628069378407506
0.9229787505679002 9.113601233170218
0.8779584829617016 9.365749545622034
1.0061805423494876 10.076364347300366
0.9809354792026469 10.740192528563373
0.9684440612161139 11.241045328313858
0.7931662069226446 11.978846567813266
0.773380028323336 12.537256146456983
0.9092735998230909 12.426101889245032
0.8535921282048915 13.988908480817003
0.9310208142063753 14.51025998543782
1.1648114905293085 14.514552073234752
1.1091428316485272 13.128381987289988
0.8308229564337555 18.22299739902968
0.98860499126058 19.077500879260405
1.1923177540005803 17.57864258431216
1.268687107568668 17.90365589267156
1.3002796861863217 18.56938019922389
1.2368557564382168 19.083143942086448
1.0774039588371362 21.87644441480781
1.0506825972403409 22.482444334007745
0.9504729461553073 24.4022360263223
1.1748738107474148 23.321107095659826
1.2039522210317675 24.633467936384264
1.2960563817107371 27.73658373979171
1.364229713919241 23.113964341791714
1.3649359780109478 21.68462736014056
1.4695729381364084 23.975002889223052
1.564394669867641 23.11814228994263
1.9599847486630102 19.446195923303094
2.423441825934615 17.91895926989588
2.7790183988404484 17.922198198607575
1.8679698156044853 15.765871408835274
1.1154204807714807 30.378818282070274
1.232473890918246 29.562890943806565
1.3612070046903368 30.386805667113173
1.2312898095053275 33.28369232462191
1.1856365436426777 35.153794797654214
1.359497109974116 35.482242560145025
1.4836934021925274 34.21524044054916
1.5596594378452673 33.59908357572838
1.7440119709056936 34.85243040056519
1.6797207455234935 35.817289914583135
1.5609284572804127 30.39229821251436
1.6416984467099933 27.99941142614912
1.7253716846940905 28.257764337258006
1.8572278954709418 32.10891013161875
1.977062413852472 30.961345724442516
1.7233317560557992 32.69666497025472
1.3775416734000945 32.39027682401308
2.0040446434815276 27.003599607874264
1.9796954153373971 26.274439681552593
1.9543410934478054 27.751626977870593
2.15783566787852 29.5847573118874
2.296217350703592 29.858228930341827
2.3546156284462203 29.053419450979717
2.506543256981503 28.01505751555313
2.3863976489540977 25.805946495094368
2.3577514457085824 24.655333902523985
2.7724509467327523 23.99510156728321
3.101073064604044 23.998650141460843
3.0611307106833245 25.580095073641456
2.9836650670570997 28.02150256390747
2.767944828660806 29.32583406357721
3.2977492237579575 26.29214567446453
3.509752366187053 26.05561659895924
3.6902723615878426 24.895917143417048
3.468134284308305 24.44397009729808
3.8809379450247494 23.14588781506479
4.445759528069668 26.30251569408809
4.179689373311847 24.673975774787817
4.286305742022923 23.790961322628167
4.616603382692932 25.131414170626826
4.913755298669292 24.679246684101443
5.296709631239145 23.581582461886754
5.040586919016832 22.943693976492987
4.9192080391357305 21.524178961745047
2.8057207341882155 25.577153146629186
5.707399207390559 23.583907351182233
6.002283837346771 21.92610421406726
6.547714573315105 22.33223203948944
7.147463547975362 20.95364619571266
8.091794963612895 21.93475220095214
7.414450890782723 22.747003617969234
7.4117103396422435 23.80816726002665
7.407875269752266 25.377476861935904
6.707787946910021 24.46526586984581
9.747658509920964 23.38633920785961
10.501130569943498 24.037324156745406
11.0330832155357 25.160335710872054
10.365874203823042 25.62131759999305
12.79993734016203 27.820565335612148
13.127411333538197 26.581436934213123
13.802604334726778 25.39833394284629
14.689935448804953 25.16984576537851
13.981670145905074 24.046409737539996
12.345411673306193 24.04245906313136
13.138092473094165 24.044434319195126
13.134207417179638 24.93767603393331
14.4975104376071 27.572551401799
16.21232215792386 28.34146123410482
15.622755153061773 27.32495252117466
17.2622236746448 26.591047220060872
17.253291615617243 28.34378968324605
17.03232554887369 29.93731885292788
19.532817098527627 29.670922059622974
19.54148435521353 28.091111324854964
21.584207513879484 28.611901043506922
18.35295647779691 29.94027034917495
18.574567765516946 31.62459520176675
22.944636449551577 32.808599943161525
24.72003288529783 33.4157505206007
23.50730689166101 35.61600079207824
25.632054756888756 38.31580302071371
26.954395049516194 35.94876702219261
31.667232345313366 39.03192290876572
30.493087504485278 41.22499977196252
33.67812057650644 42.37393626619761
35.38937597655966 43.552031042597214