Handling complex geometries in the massively parallel lattice Boltzmann framework waLBerla M.C. Mihoubi , Ulrich Rüde Chair for System Simulation University of Erlangen, Germany Parallel Numerics 09/Smolenice,Slovakia/October 2729
Outline
• Motivation • Geometric handling • Parallel implementation • Results • Current work
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Motivation
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Motivation
Aerodynamic
Medical applications
• Extend the framework by complex, 3D trianglebased geometries • Compute more accurate fluiddynamic forces and moments (second order boundary conditions) Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Advantages of using triangle meshes • TM are suitable to describe complexcurved geometries, and widely used in computer graphics and geometric modelling. • Triangle meshes “TM” can be generated or modified by CAD software. • Scale, and resize efficiency . • For medical applications, using TM instead of voxelbased format to describe the information present in the images, can speed the data processing time (dynamic simulation.) Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Lattice Boltzmann Method [4] The Boltzmann equation is an evolution equation for a single particle probability distribution function.
∂t f x ,t v∂ x f x ,t F ∂v f x ,t = ,
The Lattice Boltzmann equation (i.e. discretized in D3Q19 model: i=0, ... 19):
f i x Δt ci ,tΔt − f i x ,t F i=
Δt f i x ,t − f eq i ρ x,t ,u x ,t τ
Which can be solved in three main steps: Setup the boundary conditions Repeat (many times) Stream step
f ¿i x ,tΔt = f i x Δt ei ,t
Collide step
f i x ,t Δt=1−ω f i x ,tΔt ωf i
[
3 2 9 f eq =ω ρ3e ⋅u− u ei⋅u2 i i i 2 2
¿
]
Parallel Numerics 09/Smolenice,Slovakia/October 2729
eq
D3Q19 model Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Overview of stream and collide steps in LBM [6]
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Different types of wallBC in LBM [6]
Bounceback scheme (rigid wall) Parallel Numerics 09/Smolenice,Slovakia/October 2729
ElasticCollision scheme (movable wall) Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Second order BC representation [Bouzidi 7] Example:
j i
Representation
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Second order BC representation (suit) t
t +1
Formula [Bouzidi and all 7]: e i uw t1 t t f IA = 1−2q . f iF 2. q. f iA−6 2 f t1 IA =
c ei uw
2q−1 t 1 . f iA . f tiF −3 2 2q 2q qc
0.q0.5 0. 5≤q≤1.
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Geometry handling
It is based on three major steps: 4. Preprocessing the input data 5. Mapping of the surface 6. Fill the inner part of the volume
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
1. Preprocessing the input data
Format:
solid Hammer_triang facet normal n1 n2 n3 outer loop vertex v11 v12 v13 vertex v21 v22 v23 vertex v31 v32 v33 endloop endfacet … … facet normal n1 n2 n3 outer loop vertex v11 v12 v13 vertex v21 v22 v23 vertex v31 v32 v33 endloop endfacet end solid
T1
Using 3 steps : •Read the data (using only processor, and using MPI I/O) TN
•Check/repair, scale ... •Distributed data using bcast
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Requirements: a) Closed geometries (no holes)
d) No gaps or overlaps (repair by connecting nearby facets )
b) Facet orientation (normal directions )
c) Vertextovertex rule
Parallel Numerics 09/Smolenice,Slovakia/October 2729
f) No degenerate triangles
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
2. Mapping of the surface
Note:
Example of 3D cube
The state of any cells is defined by using different flags Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Triangle bounding box technique (TBB)
Triangulated surface
Trianglesboundingbox surrounding each triangle
Parallel Numerics 09/Smolenice,Slovakia/October 2729
triangle bounding box
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Mapping of the surface (setup the BC) Ray
Example: if the Ray (in x direction) intersect with triangle
x
a) the current cell (x,y,z)is outside the object: • PUSH_BACK (CELL(x,y,z)) to NearObstacleslist
qw
• Set the flag (x+1,y,z) to Obstacleflag
d Cell (x,y,z) Cell (x+1,y,z)
• q = d
b) the current cell (x,y,z) is inside the object:
qw
• PUSH_BACK (CELL(x1,y,z)) to NearObstacleslist
D Cell(x1,y,z) Cell (x,y,z)
• Set the flag (x,y,z) to Obstacleflag • q = 1d
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Advantage of using Mölleralgorithm:
• Reducing memory storage costs • Reduce number of intersections tests (18 to 9 tests) • All necessary computations for the intersections test are delayed until it is known that they are required, which can speedup the intersection test
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Insideoutside tests triangle meshes
Scalar (C,n) ouside
Scalar (C,n) >0 > inside
n C
Scalar (C,n) outside
n C
Parallel Numerics 09/Smolenice,Slovakia/October 2729
n C
n
Scalar (C,n) >0 > inside
C
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Parallel implementation details Process boundary
Allocated and calculated patches (fluid region)
Empty patch
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
The algorithm for detecting and set up the BC Find the triangle bounding box “TBB”. Scan through all voxels V(x,y,z) in TBB If Intersect Only if (patch is allocated with the current running processor) If V(x,y,z) inside the TBB Change the flag to insideflag Assign qvalue based on distance/direction of the intersection Else V(x,y,z) Outside the TBB Change the flag to Borderflag Assign qvalue based on distance/direction of the intersection Else Move to next voxel Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
3. FloodFill Algorithm object border a start node
Illustration of recursive flood fill algorithm with 4 directions
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
2D example with (2*2) processors Problem
Parallel Numerics 09/Smolenice,Slovakia/October 2729
•Solutions a) Manually b) Processorsboundaries
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Numerical results:
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
3d flow past a sphere asymmetrically placed in a channel 22 d
Use STL GE d=10
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
3d flow past a sphere asymmetrically placed in a channe (d = 10)
after 100 time step
after 700 time step
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Simulation of blood flow in aneurysm
dx =0.12 mm > 250,000 triangles
Simulation using real patient geometry (data from author of [5])
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Simulation of fluid flow around car
Domain ()
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Video
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Current work • Moving objects due to the fluid flow • Deformable objects (elasticcollision scheme)
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
References [1] waLBarla homepage“ http://www10.informatik.unierlangen.de/Research/Projects/walberla/walberla.shtml” [2] T. Möller and B. Trumbore. “Fast, minimum storage raytriangle intersection”. Journal of graphics tools, 2(1):21–28, 1997. [3] Paraview homepage “www.paraview.org/” [4] S. Succi, “The Lattice Boltzmann equation for fluid dynamics and beyond”. Oxford University Press, 2001 [5] J. Götz “Numerical simulation of blood flow in aneurysms using the lattice Boltzmann Method”. Master thesis, University of ErlangenNuremberg, Computer Science 10, Systemsimulation, 2005 [6] N. Thürey, "Physically based Animation of Free Surface Flows with the Lattice Boltzmann Method“. Ph.D thesis, University of ErlangenNuremberg, Computer Science 10, Systemsimulation, 2007 [7] M. Bouzidi, and All. “Momentum transfer of a Boltzmannlattice fluid with boundaries" Phys. Fluids, 13(11):34523459", 2001.
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla
Thank you for your attention
Parallel Numerics 09/Smolenice,Slovakia/October 2729
Handling Complex Geometries in the massively parallel lattice Boltzmann framework waLBerla