Alopez LPT OFW11
Alopez LPT OFW11
method
11th OpenFOAM Workshop, Guimarães, Portugal
University of Strathclyde, Glasgow, UK
Alejandro López
alejandro.glasgow@gmail.com
Mechanical and Aerospace Engineering
University of Strathclyde
Glasgow, UK
Outline
Simulations with
particles, using the
Lagrangian method
Alejandro Lopez
Theory
SolidParticle Class Theory
SolidParticle Class
Intermediate Library Intermediate Library
Templates
Templates Simulating Lagrangian
Particles in OF 3.0.x
Simulating Lagrangian Particles in OF 3.0.x Preprocessing
Running
Preprocessing PostProcessing
Running References
PostProcessing Extras
Create and compile a new
cloudFunctionObject
References Include
couldFunctionObjects in
the dictionary
Implementing additional
Extras Rebound models
I Eulerian-Lagrangian
Fluid -> Particles 2 Theory
SolidParticle Class
I Single particles I Two way coupling Intermediate Library
I Computational parcels Fluid <-> Particles Templates
Simulating Lagrangian
Euler-Euler I Four way coupling
Particles in OF 3.0.x
I Fluid and Particles both treated as Fluid <-> Particles + Particle Preprocessing
dt Intermediate Library
Templates
The drag force on spherical particles is then calculated as: Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
18µ CD Re(Re) Running
FD = mp (u − up ) (2) PostProcessing
ρp dp2 24 References
Extras
Where the drag coefficient CD is usually obtained from the Create and compile a new
cloudFunctionObject
24
CD = (1 + 0.15Rep0.687 ) if 1 ≤ Rep ≤ 1000
Rep
0.44 if Rep > 1000
Mechanical and Aerospace
Engineering
University of Strathclyde
40 Glasgow, UK
Simulating Lagrangian Particles in Open-
FOAM 3.0.x
Simulations with
particles, using the
Lagrangian method
Alejandro Lopez
4 Theory
SolidParticle Class
Intermediate Library
Options Templates
Simulating Lagrangian
Particles in OF 3.0.x
I SolidParticle Class: Implement solid particles and couple Preprocessing
how the particles are implemented and their behaviour Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
I Function Foam::solidParticle::move implementation of Running
References
velocity. New velocity -> affected by the parameters
Extras
yielded by the operations performed on the eulerian Create and compile a new
cloudFunctionObject
phase. Carrier phase properties represented inside the Include
couldFunctionObjects in
code by rhoc for (density) ,Uc (velocity) and nuc (viscosity) the dictionary
Implementing additional
I Additional functions -> What happens when a patch is hit Rebound models
DPMFoam Theory
SolidParticle Class
I Templates Very convenient for 6 Intermediate Library
Templates
implementing several models Simulating Lagrangian
and testing them all at once Particles in OF 3.0.x
Preprocessing
libraries References
...
I Solver verified against Ansys
Fluent 15 (1) Mechanical and Aerospace
Engineering
University of Strathclyde
40 Glasgow, UK
Templates in OpenFOAM (3-6)
Simulations with
particles, using the
Lagrangian method
Functions or classes that are written for one or more types not yet Alejandro Lopez
specified. When using a template, the types are passed as
Theory
arguments, explicitly or implicitly. SolidParticle Class
Intermediate Library
Function Templates 7 Templates
Example: Function that returns the greater one of two objects Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
template <typename T> Running
{ References
Extras
return a<b?b:a; Create and compile a new
} cloudFunctionObject
Include
couldFunctionObjects in
The template parameters have to be announced with a syntax like: the dictionary
Implementing additional
Rebound models
In the example, the type parameter is T. This type parameter can have
any identifier. T represents an arbitrary type that is going to be Mechanical and Aerospace
Engineering
University of Strathclyde
specified when the function is called. 40 Glasgow, UK
Templates in OpenFOAM (3-6)
Simulations with
particles, using the
The process of replacing the template parameters by concrete types Lagrangian method
Alejandro Lopez
is called instantiation.
Function Templates in OpenFOAM Theory
SolidParticle Class
Functions used inside the KinematicParcel class to interpolate the Intermediate Library
8 Templates
density and the velocity.
Simulating Lagrangian
Particles in OF 3.0.x
template<class ParcelType> Preprocessing
template<class CloudType> Running
inline const Foam::interpolation<Foam::scalar>& PostProcessing
The first one defines the template type specification, and the second Running
PostProcessing
one is the C++ class declaration References
This allows the definition of a specific implementation when the Mechanical and Aerospace
Engineering
argument is of type char. University of Strathclyde
40 Glasgow, UK
Types of Clouds and Particle forces
Simulations with
particles, using the
Particle Forces Lagrangian method
Alejandro Lopez
I Drag
Theory
I DistortedSphereDrag SolidParticle Class
I ErgunWenYuDrag Intermediate Library
10 Templates
I NonSphereDrag
Clouds I PlessisMasliyahDrag
Simulating Lagrangian
Particles in OF 3.0.x
I PressureGradient
I SRF
I VirtualMass Mechanical and Aerospace
Engineering
University of Strathclyde
40 Glasgow, UK
Injection models
Simulations with
particles, using the
Lagrangian method
Alejandro Lopez
I CellZoneInjection 11
Intermediate Library
Templates
References
I InflationInjection Extras
Create and compile a new
I KinematicLookupTableInjec- cloudFunctionObject
Include
tion couldFunctionObjects in
the dictionary
I PatchFlowRateInjection
I PatchInjection
Mechanical and Aerospace
Engineering
Figure: Tangential Cone Nozzle Configuration (2) University of Strathclyde
40 Glasgow, UK
Distribution models
Simulations with
particles, using the
Lagrangian method
Alejandro Lopez
Theory
SolidParticle Class
Distribution Models 12
Intermediate Library
Templates
Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
Running
PostProcessing
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
References
I ParticleTracks: Records all particle variables on each call
Extras
to postFace Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
References
I ParticleTracks: Records all particle variables on each call
Extras
to postFace Create and compile a new
cloudFunctionObject
I ParticleTrap: Traps the particles within a given phase Include
couldFunctionObjects in
fraction for multiphase cases the dictionary
Implementing additional
Rebound models
References
I ParticleTracks: Records all particle variables on each call
Extras
to postFace Create and compile a new
cloudFunctionObject
I ParticleTrap: Traps the particles within a given phase Include
couldFunctionObjects in
fraction for multiphase cases the dictionary
Implementing additional
I PatchPostProcessing: Standard post-processing. It Rebound models
References
I ParticleTracks: Records all particle variables on each call
Extras
to postFace Create and compile a new
cloudFunctionObject
I ParticleTrap: Traps the particles within a given phase Include
couldFunctionObjects in
fraction for multiphase cases the dictionary
Implementing additional
I PatchPostProcessing: Standard post-processing. It Rebound models
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
Theory
SolidParticle Class
Preprocessing Intermediate Library
Templates
0 Directory Simulating Lagrangian
Particles in OF 3.0.x
I Reach steady state without particles 15 Preprocessing
Running
I mapFields /Path-To-Steady-State-Case-Directory PostProcessing
-consistent References
Extras
I Use steady state as the initial condition Create and compile a new
cloudFunctionObject
I Copy files and rename U, k, epsilon, omega -> Include
couldFunctionObjects in
the dictionary
*.continuous_phase_name Implementing additional
Rebound models
Theory
SolidParticle Class
Intermediate Library
Preprocessing Templates
Simulating Lagrangian
constant Directory Particles in OF 3.0.x
16 Preprocessing
I transportProperties Running
PostProcessing
I g References
Extras
I turbulenceProperties.continuous_phase_name Create and compile a new
cloudFunctionObject
I kinematicCloudProperties Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
Theory
Preprocessing SolidParticle Class
Intermediate Library
Simulating Lagrangian
Particles in OF 3.0.x
continuousPhaseName water; 17 Preprocessing
Running
PostProcessing
Extras
Create and compile a new
transportModel Newtonian; cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
nu 1e-06; Implementing additional
Rebound models
Preprocessing Theory
SolidParticle Class
turbulenceProperties.water Dictionary Intermediate Library
Templates
{ References
Theory
SolidParticle Class
Intermediate Library
Templates
Theory
kinematicCloudProperties Dictionary SolidParticle Class
Intermediate Library
I Coupling Templates
phase PostProcessing
References
I Particle properties: density, poissons ratio, youngs Extras
modulus.... Create and compile a new
cloudFunctionObject
Include
I Particle forces couldFunctionObjects in
the dictionary
Theory
SolidParticle Class
cloudFunctions Intermediate Library
{ Templates
timePrecision 6;
runTimeModifiable true;
Theory
SolidParticle Class
Intermediate Library
Simulating Lagrangian
Particles in OF 3.0.x
I DPMFoam > logDPMFoam & Preprocessing
26 Running
I pyFoamPlotWatcher.py logDPMFoam PostProcessing
References
I http:
Extras
//www.cfd-online.com/Forums/openfoam-solving/ Create and compile a new
cloudFunctionObject
64146-tutorial-how-plot-residuals.html Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
Theory
Running the case SolidParticle Class
Intermediate Library
Script for monitoring the number of particles in the system Templates
Simulating Lagrangian
set grid y Particles in OF 3.0.x
set title "Number of particles" Preprocessing
set ylabel ’Number of particles’ 27 Running
set xlabel ’Time’
PostProcessing
plot "< cat out.226970 | grep ’ Current number of parcels
= ’ | cut -c 39-43 " every 2 u ($0/100000):1 title ’Particles in system’ with lines References
pause 1
reread Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
Theory
Running the case SolidParticle Class
Intermediate Library
Script for monitoring the number of particles in the system Templates
Simulating Lagrangian
set grid y Particles in OF 3.0.x
set title "Number of particles" Preprocessing
set ylabel ’Number of particles’ 27 Running
set xlabel ’Time’
PostProcessing
plot "< cat out.226970 | grep ’ Current number of parcels
= ’ | cut -c 39-43 " every 2 u ($0/100000):1 title ’Particles in system’ with lines References
pause 1
reread Extras
Create and compile a new
cloudFunctionObject
Include
I gedit particlesInSystem couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
Theory
Running the case SolidParticle Class
Intermediate Library
Script for monitoring the number of particles in the system Templates
Simulating Lagrangian
set grid y Particles in OF 3.0.x
set title "Number of particles" Preprocessing
set ylabel ’Number of particles’ 27 Running
set xlabel ’Time’
PostProcessing
plot "< cat out.226970 | grep ’ Current number of parcels
= ’ | cut -c 39-43 " every 2 u ($0/100000):1 title ’Particles in system’ with lines References
pause 1
reread Extras
Create and compile a new
cloudFunctionObject
Include
I gedit particlesInSystem couldFunctionObjects in
the dictionary
Implementing additional
I gnuplot particlesInSystem Rebound models
Theory
SolidParticle Class
Simulating Lagrangian
I paraFoam Particles in OF 3.0.x
Preprocessing
I Name of the cloud (kinematicCloud -lagrangian) will Running
28 PostProcessing
become available in Mesh Parts at the time step the
References
injection starts Extras
I See the particles, Create and compile a new
cloudFunctionObject
Include
I Plot fields, apply filters, plot variables over lines..... couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
Theory
SolidParticle Class
Intermediate Library
Templates
Post-processing with paraFoam Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
Running
29 PostProcessing
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
Theory
SolidParticle Class
Intermediate Library
Templates
Post-processing with paraFoam Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
Running
30 PostProcessing
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
Theory
I (1) Alejandro López, Dr. Matthew Stickland and Dr. William Dempster, CFD study of SolidParticle Class
Intermediate Library
Jet Impingement Test erosion using Ansys Fluent and OpenFOAM, Computer
Templates
Physics Communications, Vol. 197 (2015) pp. 88-95.
Simulating Lagrangian
I (2) http://www.fluidproducts.com/fullcone.htm Particles in OF 3.0.x
I (3) http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2013/ Preprocessing
Running
AlejandroLopez/LPT_for_erosionModelling_report.pdf PostProcessing
I (4) Nicolai M. Josuttis David Vandevoorde. C++ Templates. Addison Wesley, 2002. 31 References
I (5) OpenFOAM Foundation. Openfoam c++ documentation
Extras
I (6) OpenFOAM Foundation. Openfoam user guide Create and compile a new
cloudFunctionObject
I (7) Alister Forder, Martin Thew, David Harrison. Anumerical investigation of solid Include
couldFunctionObjects in
particle erosion experienced within oilfield control valves, Wear, Vol 216, pp. the dictionary
184-193 Implementing additional
Rebound models
Thank you!
Questions?
Create and compile a new cloudFunc-
tionObject
Simulations with
particles, using the
Lagrangian method
I New cloudFunctionObject placed in the same directory as particleErosion Alejandro Lopez
Theory
SolidParticle Class
Intermediate Library
Templates
Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
Running
PostProcessing
References
Extras
33 Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
References
Extras
33 Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
them and add the new erosion model to the list of cloudFunctionObjects PostProcessing
References
Extras
33 Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
them and add the new erosion model to the list of cloudFunctionObjects PostProcessing
References
I Header file responsible for compilation of cloudFunctionObjects:
Extras
makeParcelCloudFunctionObjects.H, inside the parcels/include 33 Create and compile a new
directory. cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
them and add the new erosion model to the list of cloudFunctionObjects PostProcessing
References
I Header file responsible for compilation of cloudFunctionObjects:
Extras
makeParcelCloudFunctionObjects.H, inside the parcels/include 33 Create and compile a new
directory. cloudFunctionObject
Include
couldFunctionObjects in
I Add two lines to the file: the dictionary
Implementing additional
Rebound models
them and add the new erosion model to the list of cloudFunctionObjects PostProcessing
References
I Header file responsible for compilation of cloudFunctionObjects:
Extras
makeParcelCloudFunctionObjects.H, inside the parcels/include 33 Create and compile a new
directory. cloudFunctionObject
Include
couldFunctionObjects in
I Add two lines to the file: the dictionary
Implementing additional
I #include "NandakumarParticleErosion.H" Rebound models
makeCloudFunctionObjectType(NandakumarParticleErosion, CloudType);
them and add the new erosion model to the list of cloudFunctionObjects PostProcessing
References
I Header file responsible for compilation of cloudFunctionObjects:
Extras
makeParcelCloudFunctionObjects.H, inside the parcels/include 33 Create and compile a new
directory. cloudFunctionObject
Include
couldFunctionObjects in
I Add two lines to the file: the dictionary
Implementing additional
I #include "NandakumarParticleErosion.H" Rebound models
makeCloudFunctionObjectType(NandakumarParticleErosion, CloudType);
I Change name to the class -> Substitute every ’ParticleErosion’ by
’NandakumarErosion’
Mechanical and Aerospace
Engineering
University of Strathclyde
40 Glasgow, UK
Create and compile a new cloudFunc-
tionObject
Simulations with
particles, using the
Lagrangian method
I New cloudFunctionObject placed in the same directory as particleErosion Alejandro Lopez
them and add the new erosion model to the list of cloudFunctionObjects PostProcessing
References
I Header file responsible for compilation of cloudFunctionObjects:
Extras
makeParcelCloudFunctionObjects.H, inside the parcels/include 33 Create and compile a new
directory. cloudFunctionObject
Include
couldFunctionObjects in
I Add two lines to the file: the dictionary
Implementing additional
I #include "NandakumarParticleErosion.H" Rebound models
makeCloudFunctionObjectType(NandakumarParticleErosion, CloudType);
I Change name to the class -> Substitute every ’ParticleErosion’ by
’NandakumarErosion’
I Recompile the library Mechanical and Aerospace
Engineering
University of Strathclyde
40 Glasgow, UK
Create and compile a new cloudFunc-
tionObject
Simulations with
particles, using the
Lagrangian method
I kinematicCloudProper- Alejandro Lopez
ties (when using
Theory
kinematicParcelCloud) SolidParticle Class
Intermediate Library
Templates
Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
Running
PostProcessing
References
Extras
Create and compile a new
cloudFunctionObject
34 Include
couldFunctionObjects in
the dictionary
Implementing additional
Rebound models
{ Simulating Lagrangian
Particles in OF 3.0.x
ParticleErosion Preprocessing
Running
{ PostProcessing
patches Extras
Create and compile a new
( cloudFunctionObject
34 Include
walls couldFunctionObjects in
the dictionary
); Implementing additional
Rebound models
p 2000000000;
psi 2;
K 2;
Mechanical and Aerospace
} Engineering
University of Strathclyde
40 Glasgow, UK
Create and compile a new cloudFunc-
tionObject
Simulations with
particles, using the
Lagrangian method
I kinematicCloudProper- Alejandro Lopez
ties (when using
Theory
kinematicParcelCloud) I NandakumarErosion SolidParticle Class
Intermediate Library
I cloudFunctions { Templates
patches ); Extras
Create and compile a new
( p 2000000000; cloudFunctionObject
34 Include
walls psi 2; couldFunctionObjects in
the dictionary
); K 2; Implementing additional
Rebound models
p 2000000000; }
psi 2; }
K 2;
Mechanical and Aerospace
} Engineering
University of Strathclyde
40 Glasgow, UK
Implementing additional Rebound models
Simulations with
particles, using the
Lagrangian method
Alejandro Lopez
I Rebound, escape and stick conditions
Theory
SolidParticle Class
Intermediate Library
Templates
Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
Running
PostProcessing
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
35 Implementing additional
Rebound models
Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
Running
PostProcessing
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
35 Implementing additional
Rebound models
Simulating Lagrangian
I The new models will be available if Particles in OF 3.0.x
Preprocessing
StandardWallInteraction is chosen in the Running
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
35 Implementing additional
Rebound models
Simulating Lagrangian
I The new models will be available if Particles in OF 3.0.x
Preprocessing
StandardWallInteraction is chosen in the Running
References
I PatchInteractionModel.C and Extras
PatchInteractionModel.H , LocalInteraction.H need Create and compile a new
cloudFunctionObject
Simulating Lagrangian
I The new models will be available if Particles in OF 3.0.x
Preprocessing
StandardWallInteraction is chosen in the Running
References
I PatchInteractionModel.C and Extras
PatchInteractionModel.H , LocalInteraction.H need Create and compile a new
cloudFunctionObject
Theory
SolidParticle Class
I Definition of stick condtion -> Intermediate Library
Templates
case PatchInteractionModel<CloudType>::itStick: Simulating Lagrangian
Particles in OF 3.0.x
Preprocessing
Running
PostProcessing
References
Extras
Create and compile a new
cloudFunctionObject
Include
couldFunctionObjects in
the dictionary
36 Implementing additional
Rebound models
Theory
SolidParticle Class
I Definition of stick condtion -> Intermediate Library
Templates
case PatchInteractionModel<CloudType>::itStick: Simulating Lagrangian
Particles in OF 3.0.x
I case PatchInteractionModel<CloudType>::itStick: Preprocessing
Running
{ PostProcessing
Extras
// determine impact angle, alpha
const scalar alpha = mathematical::pi/2.0 - acos(nw & Udir); Create and compile a new
cloudFunctionObject
//determine the normal and tangential restitution coefficients
//normal coefficient of restitution Include
couldFunctionObjects in
scalar e_n = 0.988-0.78*alpha+0.19*sqr(alpha)-0.024*pow(alpha,3)+0.0027*pow(alpha,4); the dictionary
//tangential coefficient of restitution
37 Implementing additional
scalar e_t = 1.0-0.78*alpha+0.84*sqr(alpha)-0.21*pow(alpha,3)+0.28*pow(alpha,4)-0.022*pow(alpha,5); Rebound models
return it;
}
Mechanical and Aerospace
Engineering
University of Strathclyde
40 Glasgow, UK
Implementing additional Rebound models
Simulations with
particles, using the
PatchInteractionModel.C Lagrangian method
Alejandro Lopez
template<class CloudType>
typename Foam::PatchInteractionModel<CloudType>::interactionType
Theory
Foam::PatchInteractionModel<CloudType>::wordToInteractionType
( SolidParticle Class
const word& itWord Intermediate Library
) Templates
{
if (itWord == "rebound") Simulating Lagrangian
{ Particles in OF 3.0.x
return itRebound; Preprocessing
} Running
else if (itWord == "stick") PostProcessing
{
return itStick; References
}
else if (itWord == "escape") Extras
{ Create and compile a new
return itEscape; cloudFunctionObject
} Include
else if (itWord == "Forder") couldFunctionObjects in
the dictionary
{
return itForder; 39 Implementing additional
Rebound models
}
else
{
return itOther;
}
}
Mechanical and Aerospace
Engineering
University of Strathclyde
40 Glasgow, UK
Implementing additional Rebound models
Simulations with
particles, using the
Lagrangian method
Alejandro Lopez
PatchInteractionModel.H
Theory
template<class CloudType> SolidParticle Class
class PatchInteractionModel
Intermediate Library
:
Templates
public SubModelBase<CloudType>
{ Simulating Lagrangian
public: Particles in OF 3.0.x
Preprocessing
// Public enumerations
Running
// Interaction types PostProcessing
enum interactionType
{ References
itRebound, Extras
itStick,
Create and compile a new
itEscape, cloudFunctionObject
itForder,
Include
itSommerfeldHubber, couldFunctionObjects in
itOther the dictionary
}; 40 Implementing additional
Rebound models
LocalInteraction.C