Lecture 12 18.086 533 6.7 Fluid Flow and Navier-Stokes No-slip along a u = 0 (from viscosity) and v = 0 (no crossing) horizontal boundary (8) Navier-Stokes /NAVIER-STOKES Flow problems FLUID FLOW Along a sloping boundary,AND the velocity vector is separated into normal and tangen- 6.7 tial components. The inflow and no-slip conditions st ill prescribe both components, and d/dx in (7) changes to d l d n for outflow (like a free end). Our examples will incompressible fluid is governed by horizontal the Navier-Stokes equashow other possibilities, staying with and vertical boundaries. • Tricky equation, tricky numerics… form brings the importance ofuthe Reynolds number then Re.div u = 0 would If weout prescribe the outward flow - n on the whole boundary, ds =Navier-Stokes 0. Please note equation: the u n and duldn = Vu n, nce-free vectoruu= nand the pressure is difference a scalarbetween p: •require Incompressible a normal component and a normal derivative. du 1 -+(u-V)u=-Vp+-nu+ dt Re f divu=V=u=O momentum balance (1) The Reynolds Number continuity/incompr. (2) equation To reach the Reynolds number Re, the Navier-Stokes equations have been made Physical with conservation laws have normalized dimensions.is The key •dimensionless. Inthe this momentum dimensionless form, the onlydensity physical parameter the Law for mass to Reynolds 1. to the physics is number the relative importance of inertial forces and viscous forces. Re ften absent. Four terms deserve immediate comments: - inertial forces (a velocity U ) (a length L) pplies toReynoldsnumber each component ofR eu=. viscous Viscosity produces dissipation. forces (kinematic viscosity v) u nd % (9) Pressure 1 p is Flow a Lagrange multiplier, adjusted such that the incompressibility Example Here L would be the width of the channel, and in a long channel = 0condition (no time derivative in this equation) comes from fulfilled. U could beisthe inflow velocity. The number v is a ratio p l p of the material constant p conservation of mass : const ant density. (the dynamic viscosity) t o the density p. • Poisson for p U* = of a drag region u"+'+ grad(pn+' - Poisson is the equation we know best (also th a divergence-free part Un+' and a curl-free are orthogonal complements, with correct bo p on a finite difference grid is usually called Example: 2D flow in a lid-driven cavity change to a backwards facing step endent geometries selected streamlines with an• advection-di↵usion equation Consider 2D box, with no-slip boundary conditions at three boundaries: domain ⌦ =Navier-Stokes [0, lx ]⇥[0, ly ]. TheEquations four domain boundaries are denoted North, pressible d East. The domain is fixed in time, and we consider no-slip boundary • In 2D, we can write the NS equations in e incompressible Navier-Stokes equations in two space dimensions ch wall, component i.e. form as 1 + uyy (1) =pux N=(x)(u )x (uv)y + Re (uxxv(x, ly))Figure = 0 6.20: Lid-driven cavity u(x, lyu)t + flow u =(4) (u, on a rectangular domain ⌦= [0, lx ]⇥[0, four boundaries a on a rectangular domain ⌦ =l[0, ]⇥[0, ly ].domain The four domain bo y ]. lThe xLecture 1 2 u(x, 0) =puy S=(x) v(x, 0) = 0 (5) vt + (uv) (v ) + (v + v ) (2) x South, y West, xx East. yy The South, West, and East. and The domain is domain fixed in istime, we consider fixedand in time, and we Re conditions conditions on each wall, on i.e. eachv(0, wall,y) i.e.= vW (y) u(0, y) = 0 (6) ux + vy = 0 (3) on an actua Those steps need to be executed 2 u(lx , y) = 0 , y) =different (y)points, asv(x, in Figure uvNE(x) lThe ly )at= uu(x, ly ) =6.20. 0v(x,(7) u(x, ly ) =v(l y) Nx(x) of the i,j cell. The horizontal velocity U is • The boundary conditions will be (x)(p and U arev(x, v(x, u(x, 0) = uu(x, 0) = 0on S (x)0) of = theuScell staggered row0)2 2 he Navier-Stokes equations can be in [2]. momentum (againv(0, on the cellvv(0, edges so y)below = The 0 the center y) u(0,found y) = 0u(0, y)equations = W (y) The three gridsinertial for p, U, V and bring many conve ibe the time evolution of the velocity field (u, v) under viscous u(lx , y) = 0u(lx , y) = 0 v(lx , y) = vv(l x , y) E (y) A first question is notationcondition for the grid va sure p is a Lagrange multiplier to satisfy the incompressibility change to a backwards facing step Easiest numerical scheme: FD with projection with an advection-di↵usion equation ndent geometries • The incompressibility equation is not time-dependent, but needs to be satisfied pressible Navier-Stokes Equations at every point in time. => Cannot simply integrate NS equation in time… e incompressible Navier-Stokes equations in two space dimensions • Also, we have advective and diffusive terms (i.e. time step problems!) e.g.: 1 (uxx + uyy ) ut + px = (u )x (uv)y + Re 1 2 (v )y + (vxx + vyy ) t + py = (uv) x • vNumerical approach: Re ux + vy = 0 2 • Treat nonlinear terms (advection) explicitly in time first (1) (2) (3) 2 • Add linear diffusive terms using an implicit scheme • Correct the pressure to satisfy incompressibility, update velocities to be divergence-free The termsSolution are treatedApproach explicitly. This circumvents the sol 4 nonlinear Numerical terms system, but introduces a CFL condition which limits the time step The general approachthe of solution the code of is described in Section 6.7 in the book sSolution are treated Approach explicitly.the This circumvents a nonlinear spacial resolution. pressible Navier-Stokes Equations Science and Engineering [4]. uces a CFL condition which limits the time step by times ⇤a constant n U U h of the code is described inWhile Section the qbook Computational u, 6.7 v, pinand are the solutions to then Navier-Stokes equations, 2 n n = ((U ) ) (U V )y x on. ering incompressible Navier-Stokes equations in two space dimensions [4]. numerical approximations by capital Assume we have the velocity fi t letters. th time step ⇤ solutions ⇤and n the (3) is satisfied. We find the d q areUthe to the Navier-Stokes equations, we denote atnthe n (time t), condition Un V V 2 n n n n n 2 n n = ((U ) ) (U V ) (12) = (U V ) ((V ) )y st 1 xwetime y x step approach: ations by capital letters. Assume havestep the (time velocity field Uby and V (n + 1) t + t) the following three 2 (uxx + uyy )t (1) ut t+ px = (u )x (uv)y + (time t),⇤and condition (3) is satisfied. We the solution at the Refind terms V Vn 1. Treat nonlinear n n 2will detail how to discretize the nonlinear terms. 5 we time t + t) by the=following three step approach: (UInn VSection )The ((V ) 1)terms (13) x nonlinear y 2 are treated explicitly. This circumvents vt t+ py = (uv)x (v )y + (vxx + vyy ) (2) the solutio ear terms Re system, but introduces a CFL condition which limits the time step by a 2. Implicit viscosity lerms detail toexplicitly. discretize the nonlinear terms. are how treated This circumvents the of a nonlinear the spacial resolution. ux + vy = 0 The viscosity terms solution (3) treated e are treated implicitly. If they were condition which limits the time step by a constant times ⇤ n U U yroduces a• CFL have a time step restriction proportional to)2 )the (U spacial discretiz n nand U* = ((Uestimate V n )V*: olution. Nonlinear advection is solved explicitly in time (Euler) to obtain x y t implicit s are treated implicitly. If they were treated explicitly, we would have no such limitation for the treatment. The price t ⇤ n ⇤ n 2 n n U U V V n 2 n n n 2 = ((U ) ) (U V ) (12) estriction proportional to the spacial discretization squared. We = (U V ) ((V ) )y systems in each time step. x to be solved y x and t t ⇤ ation for Vthe implicit treatment. The price to pay⇤⇤is two ⇤ linear Vn 1 the nonlinear U n n In Section n 25 we will detail U how to discretize ⇤⇤ ⇤⇤ terms. = (U V ) ((V ) ) (13) x y =V**: (Uxx + Uyy ) d in each timet step. • Implicit diffusion is is added to obtain estimate U** and t Re 2. Implicit viscosity ⇤⇤ toUdiscretize ⇤ ⇤⇤ ⇤ e will detailUhow nonlinear terms. 1 theThe V V 1If they ⇤⇤ viscosity ⇤⇤ ⇤⇤ were⇤⇤ terms are treated implicitly. treated expli = (Uxx + Uyy ) (14) = (V and xx + Vyy ) t Re have a time step restriction proportional t Re osity to the spacial discretizatio V ⇤⇤ implicitly. V⇤ 1 If they erms are treated treated explicitly, we would have no ⇤⇤ such limitation for the implicit treatment. The price to pa ⇤⇤ were 3.=Pressure (V +correction Vyy )be solved in each (15) xx ep restriction proportional to the spacial discretization squared. We systems to time step. • The current estimate U** and V** does not yet satisfy incompressibility, t Re ⇤⇤ , V ⇤⇤ ) by the gra We correct the intermediate velocity field (U imitation for the implicit treatment. The price to pay is two ⇤⇤ linear ⇤ which is corrected in the last step 1 U U ⇤⇤ ⇤⇤ n+1 ion in each time step. P = (Uxx + Uyy ) to enforce incompressibility. solved t Re ⇤⇤ ⇤⇤ ⇤⇤ ⇤ ⇤⇤ 1 ermediate velocity ) by the gradientVof a Vpressure n+1 U ⇤⇤ U ⇤field1(U ⇤⇤, V ⇤⇤ U = (Uxx + Uyy ) (14)U= (V ⇤⇤ +n+1 V ⇤⇤ ) Nonlinear and diffusive terms xx yy to be solved insquared. each timeWe step. striction proportional to the systems spacial discretization ⇤⇤ tion for the implicit treatment. The price to pay is twoU linear 1 U⇤ ⇤⇤ ⇤⇤ = (U + U xx yy ) d in each time step. pressible Navier-Stokes Equations ⇤⇤ t ⇤ Re V V 1 1 U ⇤⇤ U ⇤ ⇤⇤ ⇤⇤ ⇤⇤ ⇤⇤ (Vxx + Vyy ) = (Uxx + Uyy ) (14) = t Re t Re e incompressible Navier-Stokes equations in two space dimensions V ⇤⇤ V ⇤ 1 ⇤⇤Pressure ⇤⇤ = (V3.xx + Vyy ) correction (15) 1 t Re 2 We correct the intermediate velocity field (U ⇤⇤ , V ⇤⇤ ) by the gradie (uxx + uyy ) (1) ut + px = (u )x (uv)y + Re incompressibility. P n+1 to enforce on 1 ⇤⇤ , V ⇤⇤ ) by 2 the gradient rmediate velocity field (U vt + py = (uv)x (v )y + (vxx +ofvayy pressure ) U n+1 U ⇤⇤ n+1 (2) • In the last step, U** and V** are = (P term: )x Recorrected by a pressure gradient ompressibility. t uUxn+1 + vy U=⇤⇤0 (3) V n+1 V ⇤⇤ n+1 = (P )x (16) = (P n+1 )y and t t n+1 n+1 , since it is only given implicitly. It is ob Vn+1 V ⇤⇤ n+1 2 The pressure is denoted n+1 P = (P needed )y (17) • P is tthe pressure to make U divergence-free. a linear system. In vector notation the correction equations read as • , The ted P n+1 sincecorrection it is only given implicitly. It isisobtained by 1solving in vector notation 1 n n+1 n+1 U U = rP vector notation the correction equations read as n+1 ⇤⇤ t t ~ ~ U U n+1 rPn+1 1 n+1 1 n = Applying the divergence to both sides yields the linear system U U = rP (18) t t t 1 n n+1n+1 P = r · U Applying the divergence, we obtain an equation for P : ence to •both sides yields the linear system t 1 1Hence, n+1 ⇤⇤ pressure correction step is the n+1 n· U ~ 4P = r P = r·U (19) t t correction step is 4 • This means we need to solve a Poisson-problem! Projection step Poisson problem • Pressure correction steps: (a) Compute F n = r r ·· U Un⇤⇤ (b) Solve Poisson equation P n+1 = 1 n F t (c) Compute Gn+1 = rP n+1 n+1 n+1 (d) Update velocity field UU == UnU⇤⇤ tGn+1 tGn+1 (b): question, Pij is a matrix withboundary nx∙ny components (nx,are ny :appropriate number of spatial (resolution) The which conditions for thecells Poisson equation for the pressure , is complicated. A standard approach is to prescribe homogeF can also beP written as a matrix with nx∙ny components neous Neumann boundary conditions for P wherever no-slip boundary conditions are ΔP can now be expressed using finite differences, resulting in a matrix prescribed for the velocity field. For the lid driven cavity problem this means that L. We then need to solve homogeneous Neumann boundary conditions are prescribed everywhere. This implies 1 nP is only defined up to a constant, which is fine, since n+1 in particular that the pressure LP = F only the gradient of P enters t the momentum equation. => Invert L matrix! Need a way to invert large matrices (see later) In addition to the solution steps, we have the visualization step, in which the stream function Qn is computed. Similarly to the pressure is is obtained by the following steps n n n Consider to have nx ⇥ ny cells. Figure 1 shows a staggered grid with nx = 5 and ny = 3. When speaking of the fields P , U and V (and Q), care has to be taken about interior and boundary points. Any point truly inside the domain is an interior point, while points on or outside boundaries are boundary points. Dark markers in Figure 1 stand for interior points, while light markers represent boundary points. The fields have the following sizes: Spatial discretization field quantity pressure P velocity component U velocity component V stream function Q interior resolution nx ⇥ ny (nx 1) ⇥ ny nx ⇥ (ny 1) (nx 1) ⇥ (ny 1) resolution with boundary points (nx + 2) ⇥ (ny + 2) (nx + 1) ⇥ (ny + 2) (nx + 2) ⇥ (ny + 1) (nx + 1) ⇥ (ny + 1) The values at boundary points are no unknown variables. For Dirichlet boundary conditions they are prescribed, and for Neumann boundry conditions they can be expressed in term Staggered of interior points. However, boundary points of U and V are used for the finitegrid di↵erence approximation of the nonlinear advection terms. Note that the boundary points of in cells the four nx,ny: Number corner are never used. interior U boundary U 5 interior V Uij Pij boundary V U P j Vij x pressure i • time and velocity memoryfield efficiency for large computations the centers, and UxPand canVbe approximated 1. The divergence of the F cell =r ·U computes y . Both 3. The gradient of added the pressure values then live in the cell centers, i.e. they can be directly.G = rP requires t The code qualifies as a basis for modifications and extensions. The followi 1 P . Again, a look at Figure 1 indicates that t 2. For the have pressure Poisson equation P = F , both sides are defined in y t already been applied to the code by MIT students and other users: position of U ,as while the latter live at the position the cell centers, and P can be approximated described above. update the velocity • external forces G = are 3. The gradient of the pressure rP needed requirestothe computation ofU PPxfield. and V Py . Again, a look at Figure 1 indicates that the former then live at the – Stream function • ,inflow and outflow boundaries • position Second of derivatives: Centered differences U while the latter live at the positions of V . grid Exactly where Similarly, theas staggered works fine both for the stream usual. => Consistent withvelocity staggered grid are needed to update the field. live on the cell corners, so the Poisson right hand side • addition of a drag region Figure 1: Staggered grid with bo P 2P + P P 2P + P yield instabilities, as shown in many textbooks on numerical anali 1,j stream i,j function i+1,j Q lives i,j 1 at the i,jcell corners. i,j+1 – Stream function 4Pij = Pxx,ij + Pyy,ij ⇡ + 2 5.1 Both Approximating derivatives xbackwards x2 Vx and gered Similarly, grid comes Assume, wefine not in step the • play. geometry toare afor facing theinto staggered gridchange works theinterested stream function. Uy – Nonlinear terms (central di↵erencing) • Second derivatives sitionlive of• Uon , but instead we want value in the middle cell corners, so the the Poisson right hand side between F = Vx points Uy and thus the First derivatives: “Centered” differences around half-grid (good i,j the Finite di↵erences can approximate second deriva The nonlinear terms are the stencil. onlyAtplace where the disc • time dependent geometries an interior point U we approximate t function Q livesnumerical at the cellinstabilities): corners. d Ui,jstream . Then the approximation accuracy, avoids Why staggered grid? i,j grid does not work directly. For instance, theU product 2U + U U = (U ) + (U ) ⇡ h – Nonlinear terms (central di↵erencing) • coupling with an advection-di↵usion equation Ui+1,j U since U and V live in di↵erent positions. The solutio i,j (U ) ⇡ (22) on 1 Here the one or staggered two of the 2 neighboring points migh The nonlinear x i+ ,j terms are the only place where the discretization backwards: For updating U ,formula we holds need (Ucomponent )x and 2 for the V , and(U for V the hx grid does not work directly. For instance, the product U V is not the directly defined, stream function Q. If the unknown quantity step isNavier-Stokes comparably slow, we wish toapproximation use thecansame cen then the above be represented 2 Incompressible Equations • approximation toV Ulive middle between the two points. In derivatives at center of cells => ideal choice pressure correction sinceFirst U and inthe di↵erent positions. The solution isfortothe take thefromarguments applied the left. Thus, solving the Poisson x in“live” 2 as before. This requires U tosolving be implicitly defined theterms cellin Ucen for thein viscosity and 2 (which lives at cell centers as well): backwards: For updating , we needof(U inaseach time his position happens to be theUposition Pi,j).x and (U V )y . If the flow be solved, detailed in Section 7. inuse thethe cellsame corners. We equations obtain these quantities by int We consider the incompressible Navier-Stokes in two space dimens step is comparably slow, we wish to centered staggered derivatives • First derivatives 1 n+1 ~ ⇤⇤ A first derivative in a grid point can be approxim 4P = r·U values. rection 2 as before. This requires U to be defined in the cell centers, and U V 1to the defined t U U ✓ ◆ 2 staggered (U ) ⇡ correction, the approximation of first derivatives on a (uinterpolating )x (uv)y +two (u Only terms in u yyi,j) + Ui+1,j2h in •the cellproblem: corners.Nonlinear We obtain these quantities neighboring xx + uU t + px = by 2 Re (U )i+ 1 ,j = perfectly: live at cell center, but are needed at edges! 6 values. 2 1 2 2 ✓ ◆ v + p = (uv) (v )y + (vxx + vyy ) t y Ux and V x2y . Both ence of the velocity field F = r · U computes Re Ui,j + Ui,j+1 Ui,j + Ui+1,j 2 = added directly. (23) (U )can U 1 = =>cell Interpolate, e.g.they and n live in the centers, i.e. i+ 21 ,jbe i,j+ ux + vy =2 0 2 2 1 essure Poisson equation P = sides are defined in Vi,j + Vi+1,j Ui,j + Ui,j+1 t F , both i,j xx i,j yy i,j i 1,j x i,j i,j 2 x i i+1,j x between them. At the points that lie on the boundary the value is dire as U at the west and east boundary, and V at the north and south bou north and south boundary and for V at west and east boundary, one between two data points. The idea is the same as above: average the For instance, the north boundary lies between points with velocity U below respectively above the boundary be Ui,j and Ui,j+1 , and let the value be UN . Then the boundary condition is Some notes • • • Ui,j+1accuracy (see code Centered differences can be “upwinded”Ui,j for+better = UN () Ui,j + Ui,j+1 = 2UN 2 documentation) Analogously at the south boundary, and for V at the west and east bo Boundary conditions: Need a bit of care due @P to the staggered grid… The normal derivative @n at the boundary is defined using two p Boundary conditions for pressure??? This isFor a delicate for no- presc boundary in their middle. instance,issue. at theNormally, north boundary, slip velocity BC, one employs Neumann BCs foryields pressure, i.e. Neumann boundary conditions @P Pi,j+1 Pi,j =0 thus, e.g. at the top boundary: = 0 () Pi,j+1 = Pi,j @~n @⌦ hy The stream function is defined on cell boundary points. Thus all its => “Mirror” pressure value in boundary cells on the domain boundary. We prescibe homogeneous Dirichlet bounda can be prescribed directly. 6 U P Solving the Linear Systems V The pressure correction and the implicit discretization of the viscosity systems to be solved in every time step. Additionally, the comput function requires another system to be solved whenever the data is p Figure 1: Staggered grid with boundary cells Demo • • CSE website has a demo implementation (and documentation)! Have a look at the code (you won’t yet understand how the Poisson problem is solved) Lattice-Boltzmann method • Poisson problem for FD (or, for that matter, finite volume etc.) discretization: Matrix inversion=>very costly in 3D, not easy to parallelize (non-local) Boltzmann’s equation (one for each fluid): • An alternative that is much easier to implement numerically is the LatticeBoltzmann method (LBM) • Starting point of LBM is kinetic gas theory: probability distribution function for particle at position x with speed v number density of molecules inside “volume” (x,x+dx) and (v,v+dv) at t f is the Probability Distributiontime Function of the particles in (x,v,t) space dN = f (x, v, t)dxdv • Z • 7 dimensional space (3 space, 3 velocity, 1 time)!! Can handle, if clever! • F:t)forces over the interfaces density ⇢(x, = betweenffluids (x, v, t)dv velocity • Collision term:ZThis is where VISCOSITY originates ~u(~x, t)⇢(~x, t) = ~v f (x, v, t)dv mean velocity at (x,t) velocity • In an equilibrium: f is the isotropic Maxwell-Boltzmann distribution Gaussian type of PDF)quantities etc. (aforsymmetric other macroscopic fluid Probability function (1D) Phase space (v,x) for 1 space dimension X PDF shown as contours: Question: How does the probability in a “volume” change over time? => Since its a probability: We expect a conservation law for f!!! V t 3 possibilities to change f(x,v,t) inside a small volume: t+Δt • Particle can move: x => x+v dt (v: current particle speed) • Particle can accelerate from v => v+F/m dt (F: external force, m: particle mass) • Particles can collide: (x1,v1,x2,v2) => (x’1,v’1,x’2,v’2) X We can express this (in 3D) as: Integration over V gives hydrodynamic quantities at chosen X 3 3 3 ~ t)d xd v = f (~x, ~v , t)d xd3 v + Collisions f (~x + ~v t, ~v + F /m t, t + By Taylor-expansion of the LHS, one can derive the famous Boltzmann equation: @f @f @f ~ + ~v · +F · @t @~x @~v ✓ @f @t ◆ =0 coll. Boltzmann equation From Boltzmann to NavierStokes • It can be shown: Boltzmann equation => Navier Stokes equation • => instead of solving Navier-Stokes (a PDE for average molecule velocities), we could solve the Boltzmann equation (a PDE for probabilities f(x,v,t)), and then obtain the average velocities by integrating f(x,v,t), e.g. ~u(~x, t)⇢(~x, t) = • Z ~v f (x, v, t)dv velocity Lattice-Boltzmann method: Discretize f(x,v,t), then numerically integrate Boltzmann equation! Lattice Boltzmann method • Let’s consider the previous equation for the prob. density function f(x,v,t), in absence of a force F: f (~x + ~v t, ~v , t + t)d3 xd3 v = f (~x, ~v , t)d3 xd3 v + Collisions D2Q9 2 5 3 0 1 7 4 8 6 • Discretize position (xi) and velocities vj on a lattice • At each lattice site i, we have a value fj (~ xi , t) per = f (~xi , ~vj , t) discrete velocity j. We write fj (~xi , t) = f (~xi , ~vj , t) • One can show: Only very few discrete velocities are necessary! Simplest scheme (D2Q9): 9 velocities are sufficient: ~vj=5 v0 = |~v0 | =0 v1..4 =1 p v5..8 = 2 lattice lattice unit (lu) spacing Figure 2: Discrete lattice velocities for the D2Q9 m Lattice Boltzmann method D2Q9 • 6 2 5 3 0 1 7 4 8 ~vj=5 Macroscopic quantities: Integrals => sums: ⇢(x, t) = Z ⇢= f (x, v, t)dv velocity Z 9 X fj (~xi , t) j=1 8 X ~u(~x, t)⇢(~x, t) = ~v f (x, v, t)dv ~uthe ⇢= xi , t)~vj j (~ make sense to stream DFs from walls towards the fluid). For this reason, two steps f (streamvelocity j=0 ng & collision) are usually treated separately in actual numerical implementations. The streaming step, where the DFs are translated to the neighbouring sites according to • LBM algorithm: Velocities “stream” f from site i to neighboring he respective discrete velocity direction, is illustrated in Fig. (3), in the D2Q9 model for sites and collide: lattice unit (lu) f The(~xcollision vstepj (illustrated t, t +in Fig.t)[4])=consists fj (~ x , t) + Coll(f (~xi , t)) i +~ implicity. j of aire-distribution of the DFsj LBM owards the local discretized Maxwellian equilibrium DFs, but in such a way that local mass nd momentum are invariant5 . f (~x + ~v t, ~v , t + 3 3 3 3 t)d xd v = f (~x, ~v , t)d xd v + Collisions continuum Figure 2: Discrete lattice velocities f The macroscopic variables are defined as function streaming streaming (hereafter DFs) according to: length of arrow: value of fj ⇢= X1 fi i=0 and 1 (mac Collision term • Bhatnagar, Gross and Krook showed: Collision term can be approximated by the relaxation ansatz (BGK approximation): Coll(fj (~xi , t)) = • fjeq (~xi , t) fj (~xi , t) ⌧ wj=0 Equilibrium distribution for f: 2 ~ v · ~ u (~ u · ~ v ) j j eq fj (~xi , t) = wj ⇢ 1 + 2 + c 2c4 • ~u2 2c2 with weights wj=1..4 Side node: This equilibrium distribution is related to a series expansion of the Maxwell-Boltzmann velocity distribution for small velocities • 𝜏 is the relaxation time scale • c is the lattice speed of sound ⇢, ~v ⇢, ~v collision wj=5..8 4 = 9 1 = 9 1 = 36 Notes • 2 8 X The speed of sound is c = transported) j=0 wj ~vj2 1 = 3 (speed by which inform. can be ion of the collision process on a D2Q9 lattice. Note that the local den• The collision relaxation time is related to the viscosity of the fluid. For 2D9Q model: ✓ but the ◆ DFs change according to the relaxation-to-localy~ v are conserved, t (typically one chooses Δt=1; it’s an 2 ⌫=c ⌧ “artificial” time scale anyway) 2 For a given viscosity, the relaxation time is thus fixed: ⌧ = 3⌫ + t/2 6 7 8 e-mentioned assumption of a low Mach number, and further taking Kn , , t x (for 2D9Q scheme, c2=1/3) • vers the incompressible Navier-Stokes equations: • Note: It can be shown that the continuum limit of the 2D9Q model is the Navier-Stokes equation ⇢@tu ~ + ⇢~ ur · u ~ = • ! r·u ~ =0, (9) rP + ⇢⌫r2 u ~ (10) In other words: Viscosity in NS has its origin in collisions in the Boltzmann-picture equation of state: 2 has been proven to be only first-order accurate in time and space [Pan et al., 2006]. A straightFluid forward improvement is to consider the wall-fluid interface to be situated halfway between the Solid wall and fluid lattice nodes [Ziegler, 1993]. This simple translation (which is actually nothing more than a slightly different post-processing procedure), commonly referred to as half-way Boundary conditions bounce-back in the literature, is illustrated in Fig. (5). has been proven to be only first-order accurate in time and space [Pan et al., 2006]. A straight• Fluid forwardboundary improvement is to consider the wall-fluid interface to be situated halfway between the Possible conditions: Solid • wall and fluid lattice nodes [Ziegler, 1993]. This simple translation (which is actually nothing No slip Fluid before stream (t) Solid than a(straight slightly different post-processing procedure), commonly referred to as half-way • more Periodic forward) the literature, is illustratednormal in Fig. (5). • bounce-back Inlet/outletinvelocities (prescribe velocities • to boundary) Pressure difference (a bit more complex) o be only first-order accurate in time and space [Pan et al., 2006]. A straightFluid ment is to consider the wall-fluid interface to be situated halfway between the Fluid before stream (t) Solid Solid • No-slip boundary conditions: Addnothing a layer of ice nodes [Ziegler, 1993]. This simple translation (which is actually “ghost” sites. Fluid after stream Solid tly different post-processing procedure), commonly referred to as half-way e literature, is illustrated in Fig. (5). Fluid Fluid before stream (t) Solid Solid before “stream” at time t Fluid Solid after “stream” at time t: stream to ghosts Fluid after stream Solid Fluid after stream Solid Fluid after bounce-back Solid collide in bulk, bounce back, resulting in reverse values at the state at time t+Δt ghostsFigure sites5: Illustration of the half-way bounce-back algorit Fluid after bounce-back after Solid before stream (t + [Sukop and Thorne, 2006]). t) DEMO Demo shows flow through a 2D porous medium, inlet: left, outlet: right, top/bottom: no-slip BC Parallelization • Parallelization is simple: Domain-decomposition In each iteration - On each processor: Stream and collide - Exchange values at domain boundaries - Next iteration • Today’s (gaming) graphics cards often have >256 single cores! Cheap parallelization using GPUs (real time!) sailfish.us.edu.pl LBM: Easy to model multiphase-flow • Multiphase flow (water & oil, e.g.) is easily incorporated: Use two different prop. densities f (one per phase) https://www.youtube.com/watch?v=ucqgRo6Fd_c B. Ahrenholz https://www.youtube.com/watch?v=1tasbL39xds A. I. Kupershtokh, 2013 Disadvantages of LBM ⌫ Kn = L r ⇡m 2kB T • Only working for small Knudsen numbers Kn<<1. • L: char. length scale (i.e domain size), kB: Boltzmann constant, T: temperature r kB T Kinetic gas theory: Speed of sound of a medium is: cs ⇠ m Taking the problem domain, with N lattice sites spaced by 1 length unit as characteristic length, and c (lattice speed of sound) as maximal sound speed, we find • • ⌫ Kn ⇠ cN • Other problems: • No consistent thermo-hydrodynamic scheme • Similar to Kn condition: Problems for high Mach numbers