group4
Transcript of group4
Lattice Boltzmann Simulations
with moving objects
Stefan Werner, Maximilian Walther, Jannis Greifenstein
Simulation and Scientific Computing II
Summer Term 2008 Project
21. Juli 2008
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 1 / 25
Outline
1 Basic concepts
Two model coupling
A short introduction to the Rigid Body Physics Engine
The basic algorithm
2 The algorithm in detail
The flag calculation step
Curved boundary treatment
Force calculations
3 Difficulties and solutions
Visualization
Lubrication
4 Results and Simulations
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 2 / 25
Outline
1 Basic concepts
Two model coupling
A short introduction to the Rigid Body Physics Engine
The basic algorithm
2 The algorithm in detail
The flag calculation step
Curved boundary treatment
Force calculations
3 Difficulties and solutions
Visualization
Lubrication
4 Results and Simulations
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 2 / 25
Outline
1 Basic concepts
Two model coupling
A short introduction to the Rigid Body Physics Engine
The basic algorithm
2 The algorithm in detail
The flag calculation step
Curved boundary treatment
Force calculations
3 Difficulties and solutions
Visualization
Lubrication
4 Results and Simulations
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 2 / 25
Outline
1 Basic concepts
Two model coupling
A short introduction to the Rigid Body Physics Engine
The basic algorithm
2 The algorithm in detail
The flag calculation step
Curved boundary treatment
Force calculations
3 Difficulties and solutions
Visualization
Lubrication
4 Results and Simulations
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 2 / 25
Basic concepts Two model coupling
Coupling of two independent simulation systems
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 3 / 25
Basic concepts A short introduction to the Rigid Body Physics Engine
The Rigid Body Physics Engine - Overview
used rigid bodies: spheres, boxes and unions
important functions:
velFromWF(x, y, z)
addForceAtPos(f, x, y, z)
initWorld()
simulationStep(t)
getAABB()
concept of axis-aligned bounding-boxes
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 4 / 25
Basic concepts A short introduction to the Rigid Body Physics Engine
The Rigid Body Physics Engine - Overview
used rigid bodies: spheres, boxes and unions
important functions:
velFromWF(x, y, z)
addForceAtPos(f, x, y, z)
initWorld()
simulationStep(t)
getAABB()
concept of axis-aligned bounding-boxes
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 4 / 25
Basic concepts A short introduction to the Rigid Body Physics Engine
The Rigid Body Physics Engine - Overview
used rigid bodies: spheres, boxes and unions
important functions:
velFromWF(x, y, z)
addForceAtPos(f, x, y, z)
initWorld()
simulationStep(t)
getAABB()
concept of axis-aligned bounding-boxes
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 4 / 25
Basic concepts A short introduction to the Rigid Body Physics Engine
The Rigid Body Physics Engine - Overview
used rigid bodies: spheres, boxes and unions
important functions:
velFromWF(x, y, z)
addForceAtPos(f, x, y, z)
initWorld()
simulationStep(t)
getAABB()
concept of axis-aligned bounding-boxes
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 4 / 25
Basic concepts A short introduction to the Rigid Body Physics Engine
The Rigid Body Physics Engine - Overview
used rigid bodies: spheres, boxes and unions
important functions:
velFromWF(x, y, z)
addForceAtPos(f, x, y, z)
initWorld()
simulationStep(t)
getAABB()
concept of axis-aligned bounding-boxes
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 4 / 25
Basic concepts A short introduction to the Rigid Body Physics Engine
The Rigid Body Physics Engine - Overview
used rigid bodies: spheres, boxes and unions
important functions:
velFromWF(x, y, z)
addForceAtPos(f, x, y, z)
initWorld()
simulationStep(t)
getAABB()
concept of axis-aligned bounding-boxes
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 4 / 25
Basic concepts A short introduction to the Rigid Body Physics Engine
The pe-BodyReader
Initial status of the rigid bodies is stored in a configuration file
box {
id x // User -specific ID of the box
center <x,y,z> // Global position of the box
lengths <lx,ly ,lz> // Side lengths of the box
material name // Material of the box
// optional parameters :
linear <vx,vy,vz > // Sets the linear velocity of the box
angular <ax,ay ,az> // Sets the angular velocity of the box
translate <dx ,dy,dz> // Translation of the box
rotate <xangle ,yangle ,zangle > // Euler rotation of the box
fixed // Fixes the box ’s position
}
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 5 / 25
Basic concepts The basic algorithm
Extensions to the LB algorithm
initialize_lattice ();
initalize_world ();
for (int t = 0; t < timesteps; ++t) {
flag_step ();
collide_step ();
stream_step ();
force_step ();
simulation_step ();
}
Recall the original LB algorithm:
initialize_lattice ();
for (int t = 0; t < timesteps; ++t) {
collide_step ();
stream_step ();
}
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 6 / 25
The algorithm in detail The flag calculation step
Flag calculations
for each cell in the grid {
save old_flag
if (old_flag != NO_SLIP)
set new_flag to initial value (e.g. FLUID ,INFLOW ,...)
}
for each cell inside a bounding box of a non -fixed object {
if (cell is inside a particle)
set new_flag to OBJECT
// Treatment for state change from OBJECT to FLUID
// be aware of some exceptional cases
if (old_flag == OBJECT && new_flag != OBJECT)
restore the distribution functions with correct density & velocity
}
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 7 / 25
The algorithm in detail The flag calculation step
How to restore distribution functions
to restore the density take an average value from all neighbouring
cells wich were already fluid in the last step
take the velocity from the nearest surface point of an object
−→ critical issue for mass conservation in the simulation system
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 8 / 25
The algorithm in detail The flag calculation step
How to restore distribution functions
to restore the density take an average value from all neighbouring
cells wich were already fluid in the last step
take the velocity from the nearest surface point of an object
−→ critical issue for mass conservation in the simulation system
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 8 / 25
The algorithm in detail The flag calculation step
How to restore distribution functions
to restore the density take an average value from all neighbouring
cells wich were already fluid in the last step
take the velocity from the nearest surface point of an object
−→ critical issue for mass conservation in the simulation system
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 8 / 25
The algorithm in detail The flag calculation step
How to restore distribution functions
to restore the density take an average value from all neighbouring
cells wich were already fluid in the last step
take the velocity from the nearest surface point of an object
−→ critical issue for mass conservation in the simulation system
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 8 / 25
The algorithm in detail Curved boundary treatment
Curved boundary treatment
curved particle surfaces are only approximated very roughly by the
cubical lattice cells
⇒ calculate exact distance in order to obtain higher accuracy
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 9 / 25
The algorithm in detail Curved boundary treatment
Curved boundary treatment
curved particle surfaces are only approximated very roughly by the
cubical lattice cells
⇒ calculate exact distance in order to obtain higher accuracy
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 9 / 25
The algorithm in detail Curved boundary treatment
Curved boundary treatment
curved particle surfaces are only approximated very roughly by the
cubical lattice cells
⇒ calculate exact distance in order to obtain higher accuracy
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 9 / 25
The algorithm in detail Curved boundary treatment
Curved boundary treatment
curved particle surfaces are only approximated very roughly by the
cubical lattice cells
⇒ calculate exact distance in order to obtain higher accuracy
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 9 / 25
The algorithm in detail Curved boundary treatment
Delta calculations
take center of fluid cell as start value: (x, y, z)
set delta = 0.0, distance = 1.0
// iterative approximation of the real surface point in direction
// (x_o , y_o , z_o) of the neighbouring object cell
while (iter < max_it && (x, y, z) is no surface point) {
if ((x, y, z) is already inside the object)
distance = - 0.5 * distance
else
distance = 0.5 * distance;
(x, y, z) += distance * (x_o , y_o , z_o)
delta += distance;
++iter;
}
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 10 / 25
The algorithm in detail Force calculations
How to calculate fluid forces acting on objects -
The momentum exchange method
before stream step after stream step
Fobject =∑all xb
18∑α=0
eα[fα(xb) + fα(xf )]
sum only over directions α where the object has a fluid neighbour
|fα(xb) + fα(xf )| is the impulse change for reflected fluid particles,
i.e. distribution functions
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 11 / 25
The algorithm in detail Force calculations
How to calculate fluid forces acting on objects -
The momentum exchange method
before stream step after stream step
Fobject =∑all xb
18∑α=0
eα[fα(xb) + fα(xf )]
sum only over directions α where the object has a fluid neighbour
|fα(xb) + fα(xf )| is the impulse change for reflected fluid particles,
i.e. distribution functions
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 11 / 25
The algorithm in detail Force calculations
How to calculate fluid forces acting on objects -
The momentum exchange method
before stream step after stream step
Fobject =∑all xb
18∑α=0
eα[fα(xb) + fα(xf )]
sum only over directions α where the object has a fluid neighbour
|fα(xb) + fα(xf )| is the impulse change for reflected fluid particles,
i.e. distribution functions
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 11 / 25
The algorithm in detail Force calculations
How to calculate fluid forces acting on objects -
The momentum exchange method
before stream step after stream step
Fobject =∑all xb
18∑α=0
eα[fα(xb) + fα(xf )]
sum only over directions α where the object has a fluid neighbour
|fα(xb) + fα(xf )| is the impulse change for reflected fluid particles,
i.e. distribution functions
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 11 / 25
The algorithm in detail Force calculations
Calculation of the reflected distribution functions
Noncritical cells:
fα(xf ) =1
1 + ∆[(1−∆)fα(xf ) + ∆fα(xb) + ∆fα(xf 2) + 6wαρweα · uw ]
Critical cells:
fα(xf ) = fα(xb) + 6wαρweα · uw
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 12 / 25
The algorithm in detail Force calculations
Calculation of the reflected distribution functions
Noncritical cells:
fα(xf ) =1
1 + ∆[(1−∆)fα(xf ) + ∆fα(xb) + ∆fα(xf 2) + 6wαρweα · uw ]
Critical cells:
fα(xf ) = fα(xb) + 6wαρweα · uw
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 12 / 25
The algorithm in detail Force calculations
Calculation of the reflected distribution functions
Noncritical cells:
fα(xf ) =1
1 + ∆[(1−∆)fα(xf ) + ∆fα(xb) + ∆fα(xf 2) + 6wαρweα · uw ]
Critical cells:
fα(xf ) = fα(xb) + 6wαρweα · uw
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 12 / 25
The algorithm in detail Force calculations
The force step
for each cell inside a bounding box of a non -fixed object {
if( flag == OBJECT ) {
for each direction with FLUID neighbor {
// Calculate the reflected distribution function
calculate delta in order to obtain the exact point on the particle surface
calculate surface velocity with getVelFromWF ()
if ( FLUID cell is noncritical cell )
use standard formula to calculate the reflected distribution functions
else if ( FLUID cell is critical cell )
ignore the calculated delta , take the standard bounce -back condition
// Calculate force from FLUID neighbor on OBJECT cell
apply momentum exchange method to the FLUID -OBJECT pair
add force to the corresponding particle with addForceAtPos ()
}
}
}
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 13 / 25
Difficulties and solutions Visualization
Visualization - Problems
saving object data in PovRay files is implemented in the pe, but
rendering the simulations takes a lot of time and there are no
functions for visualizing flows
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 14 / 25
Difficulties and solutions Visualization
Visualization - Solutions
ParaView can visualize flows very easily but the pe has no vtk-writer
implemented and therefore no objects can be visualized
⇒ implementation of our own vtk-writer for spheres, boxes and unions
setup of the bodies around the origin, after that calculation of
rotation and translation
approximation of the surfaces by triangles and rectangles
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 15 / 25
Difficulties and solutions Visualization
Visualization - Solutions
ParaView can visualize flows very easily but the pe has no vtk-writer
implemented and therefore no objects can be visualized
⇒ implementation of our own vtk-writer for spheres, boxes and unions
setup of the bodies around the origin, after that calculation of
rotation and translation
approximation of the surfaces by triangles and rectangles
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 15 / 25
Difficulties and solutions Visualization
Visualization - Solutions
ParaView can visualize flows very easily but the pe has no vtk-writer
implemented and therefore no objects can be visualized
⇒ implementation of our own vtk-writer for spheres, boxes and unions
setup of the bodies around the origin, after that calculation of
rotation and translation
approximation of the surfaces by triangles and rectangles
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 15 / 25
Difficulties and solutions Visualization
Visualization - Solutions
ParaView can visualize flows very easily but the pe has no vtk-writer
implemented and therefore no objects can be visualized
⇒ implementation of our own vtk-writer for spheres, boxes and unions
setup of the bodies around the origin, after that calculation of
rotation and translation
approximation of the surfaces by triangles and rectangles
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 15 / 25
Difficulties and solutions Lubrication
First results ...
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 16 / 25
Difficulties and solutions Lubrication
Adding a lubrication term
if there is only little space between two objects an additional repulsive
force acts on both of them because the fluid film can not move away
fast enough (the so-called lubrication effect)
it can happen that there is no lattice cell between two objects
although in the physics engine is still space in between
⇒ no repulsive force added to the objects
in order to make the behaviour of the objects more realistic, an
additional lubrication force is added to both objects at the end of the
force-step if they are next to each other
if an OBJECT cell is next to another OBJECT cell
lubrication force = 2 * weighting factor in direction of the other OBJECT cell
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 17 / 25
Difficulties and solutions Lubrication
Adding a lubrication term
if there is only little space between two objects an additional repulsive
force acts on both of them because the fluid film can not move away
fast enough (the so-called lubrication effect)
it can happen that there is no lattice cell between two objects
although in the physics engine is still space in between
⇒ no repulsive force added to the objects
in order to make the behaviour of the objects more realistic, an
additional lubrication force is added to both objects at the end of the
force-step if they are next to each other
if an OBJECT cell is next to another OBJECT cell
lubrication force = 2 * weighting factor in direction of the other OBJECT cell
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 17 / 25
Difficulties and solutions Lubrication
Adding a lubrication term
if there is only little space between two objects an additional repulsive
force acts on both of them because the fluid film can not move away
fast enough (the so-called lubrication effect)
it can happen that there is no lattice cell between two objects
although in the physics engine is still space in between
⇒ no repulsive force added to the objects
in order to make the behaviour of the objects more realistic, an
additional lubrication force is added to both objects at the end of the
force-step if they are next to each other
if an OBJECT cell is next to another OBJECT cell
lubrication force = 2 * weighting factor in direction of the other OBJECT cell
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 17 / 25
Difficulties and solutions Lubrication
Adding a lubrication term
if there is only little space between two objects an additional repulsive
force acts on both of them because the fluid film can not move away
fast enough (the so-called lubrication effect)
it can happen that there is no lattice cell between two objects
although in the physics engine is still space in between
⇒ no repulsive force added to the objects
in order to make the behaviour of the objects more realistic, an
additional lubrication force is added to both objects at the end of the
force-step if they are next to each other
if an OBJECT cell is next to another OBJECT cell
lubrication force = 2 * weighting factor in direction of the other OBJECT cell
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 17 / 25
Difficulties and solutions Lubrication
It works !
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 18 / 25
Results and Simulations
Comparison between theoretical results and simulation
in order to estimate the accuracy of the simulation, the results are
compared with theoretical predictions
there exists an analytical solution for the drag force acting on a single
sphere in laminar flows (Stokes flow):
FD = 3πν∗d vin ν∗ =2τ − 1
6=
1
6(
2
ω− 1)
where ν∗ is the viscosity, d is the diameter of the sphere and vin is the
difference between the fluid and the sphere velocity (all quantities are
lattice quantities here)
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 19 / 25
Results and Simulations
Comparison between theoretical results and simulation
in order to estimate the accuracy of the simulation, the results are
compared with theoretical predictions
there exists an analytical solution for the drag force acting on a single
sphere in laminar flows (Stokes flow):
FD = 3πν∗d vin ν∗ =2τ − 1
6=
1
6(
2
ω− 1)
where ν∗ is the viscosity, d is the diameter of the sphere and vin is the
difference between the fluid and the sphere velocity (all quantities are
lattice quantities here)
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 19 / 25
Results and Simulations
Comparison between theoretical results and simulation
in order to estimate the accuracy of the simulation, the results are
compared with theoretical predictions
there exists an analytical solution for the drag force acting on a single
sphere in laminar flows (Stokes flow):
FD = 3πν∗d vin ν∗ =2τ − 1
6=
1
6(
2
ω− 1)
where ν∗ is the viscosity, d is the diameter of the sphere and vin is the
difference between the fluid and the sphere velocity (all quantities are
lattice quantities here)
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 19 / 25
Results and Simulations
Comparison between theoretical results and simulation (2)
setup: domainsize 1003, inflow,
a single Sphere at (50.0, 50.0, 50.0) with d = 10 lattice cells
Drag Force
calculated simulated Deviation
vin = 0.02
ω = 0.5 1.299933 1.036314 -20.28 %
ω = 1.0 0.433311 0.388293 -10.39 %
ω = 1.5 0.144437 0.156958 8.67 %
vin = 0.08
ω = 0.5 5.199733 4.366672 -16.02 %
ω = 1.0 1.733244 1.914352 10.45 %
ω = 1.5 0.577748 0.897909 55.42 %
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 20 / 25
Results and Simulations
Comparison between theoretical results and simulation (2)
setup: domainsize 1003, inflow,
a single Sphere at (50.0, 50.0, 50.0) with d = 10 lattice cells
Drag Force
calculated simulated Deviation
vin = 0.02
ω = 0.5 1.299933 1.036314 -20.28 %
ω = 1.0 0.433311 0.388293 -10.39 %
ω = 1.5 0.144437 0.156958 8.67 %
vin = 0.08
ω = 0.5 5.199733 4.366672 -16.02 %
ω = 1.0 1.733244 1.914352 10.45 %
ω = 1.5 0.577748 0.897909 55.42 %
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 20 / 25
Results and Simulations
Mixing still water
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 21 / 25
Results and Simulations
Bypassed canal flow
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 22 / 25
Results and Simulations
Rotating agglomerate
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 23 / 25
Results and Simulations
Some gravity games
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 24 / 25
Results and Simulations
Thank you for your attention !
S. Werner, M. Walther, J. Greifenstein (LSS)Lattice Boltzmann - Moving objects 21. Juli 2008 25 / 25