General regularized boundary condition for multi-speed lattice Boltzmann models

7
General regularized boundary condition for multi-speed lattice Boltzmann models O. Malaspinas a,c,, B. Chopard c , J. Latt b a Institut Jean le Rond d’Alembert, Université Pierre et Marie Curie, 4 Place Jussieu, Case 162, F-75252 Paris cedex 5, France b Ecole Polytechnique Fédérale de Lausanne, 1015 Lausanne, Switzerland c Université de Genève, Comp. Sc. Dept., 1227 Carouge, Switzerland article info Article history: Received 25 June 2010 Received in revised form 18 April 2011 Accepted 20 April 2011 Available online 28 April 2011 Keywords: Lattice Boltzmann method Boundary conditions abstract The lattice Boltzmann method is nowadays a common tool for solving computational fluid dynamics prob- lems. One of the difficulties of this numerical approach is the treatment of the boundaries, because of the lack of physical intuition for the behavior of the density distribution functions close to the walls. A massive effort has been made by the scientific community to find appropriate solutions for boundaries. In this paper we present a completely generic way of treating a Dirichlet boundary for two- and three-dimensional flat walls, edges or corners, for weakly compressible flows, applicable for any lattice topology. The proposed algorithm is shown to be second-order accurate and could also be extended for compressible and thermal flows. Ó 2011 Elsevier Ltd. All rights reserved. 1. Introduction The lattice Boltzmann method (LBM) is a now commonly used solver in the field of computational fluid dynamics. It is applied to a wide range of physical phenomena ranging from Newtonian, non-Newtonian (see [1–3]), to multi-phase and multi-component incompressible fluids (see [4]). Recent research has shown how to apply the LBM to compressible and thermal flows (see [5]). One of the difficulties with the LBM is the boundary conditions (BCs) treatment, since some distribution functions are unknown and have therefore to be reconstructed in an ad-hoc manner. The community has developed a large variety of different algorithms that are used for Dirichlet BCs on flat walls (see [6–9] among others and a review of some of them can be found in [10]) and also on curved boundaries (see [11–13] for example). A problem of most of the current state of the art approaches is that interpolation is needed for geometries with corners and edges. In addition, no methodology has been proposed for multi-speed models, such as those containing up to 121 velocities in 3D. In this paper we propose a completely generic way of handling any 2D and 3D on-lattice geometries (including corner and edges). Although we only discuss incompressible flows and nearest-neigh- bor lattices, our procedure is also valid for extended lattices (as those proposed in [5]) in the case of thermal compressible flows. This article is organized as follows. In Section 2 the LBM is briefly described. In Section 3 the general regularized boundary condi- tions (GRBC) are described. It is then benchmarked in Section 4 against two 2D test cases, namely the Womersley and the dipole- wall collision flows and one 3D test case, the Poiseuille flow in a square duct. Finally we comment our results in Section 5. 2. Short lattice Boltzmann method introduction The aim of this section is to remind the reader the basics of the LBM and to introduce the notations used throughout this work. For more details on the LBM, the reader should refer to [5,1,2,14]. The LBM scheme for the BGK collision (for Bhatnagar, Gross, Krook [15]) is given by f i ðx þ n i Dt; t þ DtÞ¼ f i ðx; tÞ 1 s f i ðx; tÞ f ð0Þ i ðx; tÞ ; ð1Þ where f i is the discrete probability distribution to find a particle with velocity n i at position x at time t, f ð0Þ i is the discrete Max- well–Boltzmann distribution, s the relaxation time, and Dt the dis- crete time step. In this paper we are only interested in the weakly compressible case, therefore the discrete velocity set is given either by a D2Q9 (see Fig. 1) in 2D either by a D3Q15, D3Q19 or D3Q27 (see [5] for more details about lattices). The equilibrium distribu- tion is given by f ð0Þ i ¼ w i q 1 þ n i u c 2 s þ 1 2c 4 s Q i : uu ; ð2Þ where q is the density, u is the macroscopic velocity field, Q i ¼ n i n i c 2 s I , c s and w i the lattice speed of sound and the lattice weights, respectively. The density and the velocity fields are computed thanks to the following relations 0045-7930/$ - see front matter Ó 2011 Elsevier Ltd. All rights reserved. doi:10.1016/j.compfluid.2011.04.010 Corresponding author at: Institut Jean le Rond d’Alembert, Université Pierre et Marie Curie, 4 Place Jussieu, Case 162, F-75252 Paris cedex 5, France. E-mail addresses: [email protected] (O. Malaspinas), bastien.chopar [email protected] (B. Chopard), [email protected] (J. Latt). Computers & Fluids 49 (2011) 29–35 Contents lists available at ScienceDirect Computers & Fluids journal homepage: www.elsevier.com/locate/compfluid

Transcript of General regularized boundary condition for multi-speed lattice Boltzmann models

Page 1: General regularized boundary condition for multi-speed lattice Boltzmann models

Computers & Fluids 49 (2011) 29–35

Contents lists available at ScienceDirect

Computers & Fluids

journal homepage: www.elsevier .com/ locate /compfluid

General regularized boundary condition for multi-speed lattice Boltzmann models

O. Malaspinas a,c,⇑, B. Chopard c, J. Latt b

a Institut Jean le Rond d’Alembert, Université Pierre et Marie Curie, 4 Place Jussieu, Case 162, F-75252 Paris cedex 5, Franceb Ecole Polytechnique Fédérale de Lausanne, 1015 Lausanne, Switzerlandc Université de Genève, Comp. Sc. Dept., 1227 Carouge, Switzerland

a r t i c l e i n f o

Article history:Received 25 June 2010Received in revised form 18 April 2011Accepted 20 April 2011Available online 28 April 2011

Keywords:Lattice Boltzmann methodBoundary conditions

0045-7930/$ - see front matter � 2011 Elsevier Ltd. Adoi:10.1016/j.compfluid.2011.04.010

⇑ Corresponding author at: Institut Jean le Rond d’AMarie Curie, 4 Place Jussieu, Case 162, F-75252 Paris

E-mail addresses: [email protected] ([email protected] (B. Chopard), [email protected] (J. Lat

a b s t r a c t

The lattice Boltzmann method is nowadays a common tool for solving computational fluid dynamics prob-lems. One of the difficulties of this numerical approach is the treatment of the boundaries, because of thelack of physical intuition for the behavior of the density distribution functions close to the walls. A massiveeffort has been made by the scientific community to find appropriate solutions for boundaries. In this paperwe present a completely generic way of treating a Dirichlet boundary for two- and three-dimensional flatwalls, edges or corners, for weakly compressible flows, applicable for any lattice topology. The proposedalgorithm is shown to be second-order accurate and could also be extended for compressible and thermalflows.

� 2011 Elsevier Ltd. All rights reserved.

1. Introduction

The lattice Boltzmann method (LBM) is a now commonly usedsolver in the field of computational fluid dynamics. It is appliedto a wide range of physical phenomena ranging from Newtonian,non-Newtonian (see [1–3]), to multi-phase and multi-componentincompressible fluids (see [4]). Recent research has shown howto apply the LBM to compressible and thermal flows (see [5]).

One of the difficulties with the LBM is the boundary conditions(BCs) treatment, since some distribution functions are unknownand have therefore to be reconstructed in an ad-hoc manner. Thecommunity has developed a large variety of different algorithmsthat are used for Dirichlet BCs on flat walls (see [6–9] among othersand a review of some of them can be found in [10]) and also oncurved boundaries (see [11–13] for example). A problem of mostof the current state of the art approaches is that interpolation isneeded for geometries with corners and edges. In addition, nomethodology has been proposed for multi-speed models, such asthose containing up to 121 velocities in 3D.

In this paper we propose a completely generic way of handlingany 2D and 3D on-lattice geometries (including corner and edges).Although we only discuss incompressible flows and nearest-neigh-bor lattices, our procedure is also valid for extended lattices (asthose proposed in [5]) in the case of thermal compressible flows.This article is organized as follows. In Section 2 the LBM is brieflydescribed. In Section 3 the general regularized boundary condi-

ll rights reserved.

lembert, Université Pierre etcedex 5, France.Malaspinas), bastien.chopar

t).

tions (GRBC) are described. It is then benchmarked in Section 4against two 2D test cases, namely the Womersley and the dipole-wall collision flows and one 3D test case, the Poiseuille flow in asquare duct. Finally we comment our results in Section 5.

2. Short lattice Boltzmann method introduction

The aim of this section is to remind the reader the basics of theLBM and to introduce the notations used throughout this work. Formore details on the LBM, the reader should refer to [5,1,2,14].

The LBM scheme for the BGK collision (for Bhatnagar, Gross,Krook [15]) is given by

fiðxþ niDt; t þ DtÞ ¼ fiðx; tÞ �1s

fiðx; tÞ � f ð0Þi ðx; tÞ� �

; ð1Þ

where fi is the discrete probability distribution to find a particlewith velocity ni at position x at time t, f ð0Þi is the discrete Max-well–Boltzmann distribution, s the relaxation time, and Dt the dis-crete time step. In this paper we are only interested in the weaklycompressible case, therefore the discrete velocity set is given eitherby a D2Q9 (see Fig. 1) in 2D either by a D3Q15, D3Q19 or D3Q27(see [5] for more details about lattices). The equilibrium distribu-tion is given by

f ð0Þi ¼ wiq 1þ ni � uc2

sþ 1

2c4s

Q i : uu� �

; ð2Þ

where q is the density, u is the macroscopic velocity field,Q i ¼ nini � c2

s I, cs and wi the lattice speed of sound and the latticeweights, respectively. The density and the velocity fields arecomputed thanks to the following relations

Page 2: General regularized boundary condition for multi-speed lattice Boltzmann models

Fig. 1. The D2Q9 lattice with the vectors representing the microscopic velocity setni. A rest velocity n0 = (0,0) is added to this set.

30 O. Malaspinas et al. / Computers & Fluids 49 (2011) 29–35

q ¼Xq�1

i¼0

fi ¼Xq�1

i¼0

f ð0Þi ; ð3Þ

qu ¼Xq�1

i¼0

nifi ¼Xq�1

i¼0

nifð0Þi ; ð4Þ

where q is the number of discrete velocities. Doing a multi-scaleChapman–Enskog (CE) expansion (see [16,17] for more details)one can show that the LBM–BGK scheme is asymptotically equiva-lent to the incompressible Navier–Stokes equations

$ � u ¼ 0; ð5Þ

@tuþ ðu � $Þu ¼ �1q

$pþ m$2u; ð6Þ

with m ¼ c2s ðs� 1

2Þ being the kinematic viscosity and p the pressure.The CE expansion is done under the assumption that fi is given

by a perturbation of the equilibrium distribution

fi ¼ f ð0Þi þ ef ð1Þi þOðe2Þ; ð7Þ

where e� 1 can be identified with the Knudsen number (see [18]).One can also show that f(1) is given by (see [8] for example)

ef ð1Þi ¼ wi

2c4s

Q i : Pð1Þ; ð8Þ

where the tensor Pð1Þ �P

ininifð1Þi is related to the strain rate tensor,

S ¼ ð$uþ ð$uÞTÞ=2 through the relation

Pð1Þ ¼ �2c2s qsS: ð9Þ

Therefore the fi can be approximated by

fi ¼ wiq 1þ ni � uc2

sþ 1

2c4s

Q i : uu� �

þ wi

2c4s

Q i : Pð1Þ: ð10Þ

3. Description of the general regularized boundary condition

In this section we assume that the velocity is prescribed on theboundary (Dirichlet BC). This BC can be applied for flat walls or forcorners. From the algorithmic point of view the LBM scheme isdecomposed in two steps:

1. The collision

f outi ðx; tÞ ¼ 1� 1

s

� �fiðx; tÞ þ

1s

f ð0Þi ðx; tÞ: ð11Þ

2. The propagation

fiðxþ ni; t þ 1Þ ¼ f outi ðx; tÞ: ð12Þ

Fig. 2. A boundary node for the D2Q9 lattice. The dashed arrows represent theunknown populations.

Therefore on a boundary node there are populations that areunknown before the collision since they are incoming from outsidethe computational domain as depicted in Fig. 2. Thus they have tobe computed.

The idea is to compute all the unknown macroscopic moments,namely q and P(1), from the known fis (using expression (10)), thevelocity field and the equation for the density (see Eq. (3)). Wethen construct a system of equations which is usually over-deter-mined and solve it numerically.

We first define two sets of indices: the ‘‘known indices’’, K, andthe ‘‘unknown indices’’, U , defined as

K ¼ fijfi is knowng; U ¼ fijfi is unknowng: ð13Þ

3.1. Construction of the linear system of equations

The first equation we use is the definition of q from Eq. (3)

q ¼X

i

fi ¼Xi2K

fi þXi2U

fi: ð14Þ

We then replace the unknown fis by their CE expansion (see Eq.(10))

q ¼ qK þXi2U

qwigiðuÞ þwi

2c4s

Q i : Pð1Þ� �

;

qK ¼ q 1�Xi2U

wigiðuÞ !

�Xi2U

wi

2c4s

Q i

!: Pð1Þ: ð15Þ

where we defined qK �P

i2Kfi and gi as

giðuÞ � 1þ ni � uc2

sþ 1

2c4s

Q i : uu: ð16Þ

The other equations are just given by the assumption that theknown fi are given by their CE expansion

fi ¼ wiqgiðuÞ þwi

2c4s

Q i : Pð1Þ� �

i2K: ð17Þ

This usually gives an over-determined system of equations for qand P(1). This system is usually solved by using optimization tech-niques such as the least squares method, as discussed hereafter.Once the density and P(1) are known, all the populations are recom-puted using expression (10).

To illustrate the procedure we will consider a 2D flat boundaryas depicted in Fig. 2. The two sets of indices, K and U are given by

K ¼ f0;1;2;6;7;8g; U ¼ f3;4;5g: ð18Þ

Thus the system of equations to solve will be

Page 3: General regularized boundary condition for multi-speed lattice Boltzmann models

O. Malaspinas et al. / Computers & Fluids 49 (2011) 29–35 31

qKf0

f1

f2

f6

f7

f8

0BBBBBBBBBBBBBB@

1CCCCCCCCCCCCCCA

|fflfflfflffl{zfflfflfflffl}b

¼

56þ 1

2uyð1�uyÞ 0 0 �12

49� 2

3ðu2x þu2

yÞ �23 0 �2

3

136� 1

12ðux�uy�u2x þ3uxuy�u2

yÞ 112 �1

41

12

19� 1

6ð2ux�2u2x þu2

yÞ 13 0 �1

6

19þ 1

6ð2uxþ2u2x �u2

yÞ 13 0 �1

6

136þ 1

12ðuxþuyþu2x þ3uxuyþu2

yÞ 112

14

112

19þ 1

6ð2uy�u2x þ2u2

yÞ �16 0 1

3

0BBBBBBBBBBBBBBBB@

1CCCCCCCCCCCCCCCCA

|fflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl}A

q

Pð1Þxx

Pð1Þxy

Pð1Þyy

0BBBBBB@

1CCCCCCA

|fflfflfflfflffl{zfflfflfflfflffl}x

;

where qK ¼ f0 þ f1 þ f2 þ f6 þ f7 þ f8. The standard approach to solvethis kind of overdetermined systems is to solve the following min-imization problem (see Björck [19])

min kA � x� bk: ð19Þ

This problem has as a solution of the form

x ¼ ðAT � AÞ�1 � ðAT � bÞ: ð20Þ

Although this last step involves more computations that standardboundary conditions, the overhead is small since the amount ofnodes where the boundary conditions are applied is usually smallcompared to the total amount of nodes in a standard simulation.

Similarly, one can construct a ‘‘mass conserving’’ BC. To do sowe only need to replace Eq. (15) by the mass conservationconstrain

qin ¼ qout; ð21Þ

where qin and qout are defined as

qin ¼X

i2oppðUÞfi; ð22Þ

qout ¼Xi2U

f outi ¼

Xi2U

1� 1s

� �fiðx; tÞ þ

1s

f ð0Þi ðx; tÞ

;

¼Xi2U

1� 1s

� �f ð1Þi ðx; tÞ þ f ð0Þi ðx; tÞ

; ð23Þ

where oppðUÞ stands for all indices of the microscopic velocitiesthat are pointing in the opposite direction than those that are pres-ent in the U ensemble (in the case of Fig. 2, oppðUÞ ¼ f1;7;8g).Using Eq. (8) it is easy to put (21) is a form similar to Eq. (15)

qin ¼ qXi2U

wigiðuÞ !

þ 1� 1s

� � Xi2U

wi

2c4s

Q i

!: Pð1Þ: ð24Þ

The reader should be aware, that this boundary condition will notensure exact mass conservation on the wall, but will have as an ef-fect to reduce the mass exchange between the wall and the fluid.

The method presented above can be used on two- and three-dimensional lattices for flat walls, edges and corners. The onlylimitation concerns the implementation of the corners for D3Q15lattices since there are only five known fis in such cases and there-fore not enough information is available locally.

Finally it is possible to write a system of equations to imposepressure BCs. For pressure boundary conditions one actually im-poses the density q through the perfect gas law p ¼ c2

s q. We thenchose, for the construction of our system of equations, the equationfor the velocity instead of Eq. (15)

u ¼ 1qX

i

nifi ¼ uK þ1qXi2U

ni qwigiðuÞ þwi

2c4s

Q i : Pð1Þ� �

; ð25Þ

and the known populations that are written in terms of Eq. (17).This system is non-linear and therefore more difficult (and expen-sive) to solve.

3.2. Link with other boundary conditions

In the previous subsection we described a completely genericalgorithm for implementing boundary conditions for flat walls,edges and corners. We constructed an over-determined system ofequations and solved it with a numerical method. A natural ques-tion would be to know if the number of equations could not be re-duced by simple symmetry considerations in order to have asmany equations as unknowns. To keep this discussion as simpleas possible, we will again use the example of the preceding subsec-tion of the wall depicted in Fig. 2. As in the preceding subsectionwe have four unknowns: q and P(1). We therefore need four equa-tions to compute them. The first equation to be used is expression(15). Then, similarly to what we did in Section 3.1, we use Eq. (17)for the three remaining equations needed in order to compute qand P(1). From simple symmetry constraints we see that only fourcombinations of indices are possible

K026 ¼ f0;2;6g; ð26ÞK017 ¼ f0;1;7g; ð27ÞK268 ¼ f2;6;8g; ð28ÞK178 ¼ f1;7;8g: ð29Þ

The system of equation to solve would then be

qK ¼ q 1�Xi2U

wigiðuÞ !

þXi2U

wi

2c4s

Q i

!: Pð1Þ;

fi ¼ wiqgiðuÞ þwi

2c4s

Q i : Pð1Þ� �

i2Kj

;

where the index j stands for 026, 017, 268 or 178. The systems withK268 and K026 have no solution since they contain no informationabout the off diagonal terms of the deviatoric stress tensor Pð1Þxy .The two remaining systems yield the following solutions

j = 017:

q ¼ ð3=2Þð4f 7 þ f0 þ 4f 1Þ=ð1þ uyÞ; ð30ÞPð1Þxx ¼ � u2

x þ ð2=3Þðuy þ 1Þ� �

qþ 2ðf6 þ f8 þ f2Þ; ð31ÞPð1Þxy ¼ �ðuy þ ð1=3ÞÞqux � 2ðf1 � f7Þ; ð32ÞPð1Þyy ¼ ð�u2

y þ ð1� uyÞ=3Þqþ 6ðf1 þ f7Þ � 2ðf2 þ f6 þ f8Þ: ð33Þ

j = 178:

q ¼ ð2ðf7 þ f1 þ f8Þ þ f0 þ f2 þ f6Þ=ð1þ uyÞ; ð34ÞPð1Þxx ¼ 4ðf1 þ f7Þ � 2f 8 � qu2

x ; ð35ÞPð1Þxy ¼ �ðuy þ ð1=3ÞÞqux � 2ðf1 � f7Þ; ð36ÞPð1Þyy ¼ �ðu2

y þ 1=3þ uyÞqþ 2ðf1 þ f7 þ f8Þ: ð37Þ

A first remark is that in the case of j = 178 we get the same value forthe density q as the one found by the method used by Zou and He in[6]. Nevertheless, there is no way to make an a priori choice aboutthe correct system to solve. We implemented both possibilities andthe solution with j = 017 showed to be very unstable numerically.And therefore the solution yielding the ‘‘Zou–He’’-like solution forthe computation of the density must be chosen as the ‘‘correct’’system to solve, which seems natural since this procedure is usedfor a long time to evaluate the density on boundary nodes.

We also see that there is no unique and consistent choice to apriori select the set of indices that one should use. Our approachtherefore offers a completely generic alternative by solving theoptimization problem of Eq. (19).

Page 4: General regularized boundary condition for multi-speed lattice Boltzmann models

Fig. 3. The error of the Womersley solution with respect to the resolution in latticeunits.

32 O. Malaspinas et al. / Computers & Fluids 49 (2011) 29–35

3.3. Extension to the multi-speed models

The LBM has been shown to be applicable in a very elegant fash-ion to thermal flows by extending the discrete velocity set at eachlattice point (see [5]). In this framework, the neighborhood of eachgrid point is not anymore restricted to its nearest neighbors. Thisextension increases dramatically the number of unknown fis whileadding only a very limited number of constraints. In 2D there are37 populations at each grid point (the number of unknowns for aflat wall is 15). There are only two more constraints for a Dirichletno slip wall, namely mass and energy conservation (which makes atotal of four in 2D). Therefore the way of computing the density ina ‘‘Zou–He’’ fashion is not applicable anymore (see [6] for the‘‘Zou–He’’ fashion of computing q on a wall). Our approach wouldbe completely generic in this case too and the construction of asystem of equation similar of the one presented in Section 3.1 willremain similar. The Chapman–Enskog expansion of distributionfunctions is in this case given by

fi ¼ wiqgiðu; hÞ þ1

2c4s

Q i : Pð1Þ þ 16c6

sRi : T ð1Þ; ð38Þ

where

gi ¼ 1þ ni � uc2

l

þ 12c4

l

ðni � uÞ2 � c2

l u2 þ c2l ðh� 1Þðn2

i � c2l DÞ

h i�

þ ni � u6c6

l

ðni � uÞ2 � 3c2

l u2 þ 3c2l ðh� 1Þðn2

i � c2l ðDþ 2ÞÞ

h iþ 1

24c8l

ðni � uÞ4 � 6c2

l u2ðni � uÞ2 þ 3c4

l u4 þ 6c2l ðh� 1Þ

hðni � uÞ

2ðn2i � c2

l ðDþ 4ÞÞ þ c2l u2ðc2

l ðDþ 2Þ � n2i Þ

� �þ3c4

l ðh� 1Þ2 n4i � 2c2

l ðDþ 2Þn2i þ c4

l DðDþ 2Þ� �i�

; ð39Þ

Rabc � nanbnc � c2s ðnadbc þ ncdba þ nbdacÞ, and T(1) is a fully symmetric

rank three tensor. Therefore there will be, for a flat wall case, 22equations for each known fi and two additional equations for massand energy conservation, for a total of 24 equations with nine un-knowns (the density, the temperature, P(1) and T(1)).

Furthermore the extended neighborhood of these ‘‘multi-speed’’ lattices require that some unknown distribution functionshave to be recovered away from the wall. A similar approach canbe applied here, with the major difference that the velocity is nota known quantity anymore. The boundary conditions for such ex-tended lattices are currently an active research topic and will beaddressed in a future paper.

4. Benchmarks

In this section two- and three-dimensional benchmarks havebeen implemented in order to test the numerical accuracy of thegeneral regularized boundary condition. The GRBC is also com-pared with the existing and popular Regularized BC, where thepopulations are reconstructed form their Chapman–Enskog expan-sion (see Eq. (10)) and using the symmetries of the lattice to com-pute q and P(1) (see [8,10] for details). The choice of theRegularized BC for comparison is done because it has already beimplemented in many test cases and compared with numerousother existing BC (see the review paper [10]). For completeness acomparison with the half-way bounce back method is also donein one of the benchmarks proposed in this section.

The planar 2D Womersley, the planar 2D Kovasznay and thesquare 3D channel flows are compared to the analytical solutionsof these flows, and for the case of the self propelled dipole the pres-ent simulations are compared with results obtained in Clercx andBruneau [20] by a high accuracy pseudo-spectral method.

In all these benchmarks, the boundaries are flat walls or corners(in 2D) or flat walls, edges or corners (in 3D). They are all imple-mented with the method described in the preceding section. Thelattice used for the 3D benchmarks is the D3Q19.

Two different measures of the error are used in this section:

1. The L2 error, E2, which is defined as

E2 ¼ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi1M

Xi

kuaðxiÞ � usðxiÞk2

s; ð40Þ

2. The maximum error, Emax, which is computed as

Emax ¼ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffimax

ikuaðxiÞ � usðxiÞk2

r; ð41Þ

where ua and us stand, respectively, for the analytical and simu-lated solutions, the sum is carried out over the M nodes of the com-putational domain.

4.1. The 2D Womersley flow

The Womersley flow takes place in the same geometry as theplanar channel flow. The main difference is that the flow is drivenby a time periodic pressure gradient. The analytical solution wasproposed by Womersley [21]. Let the amplitude of the pressureoscillations be denoted by A, and the frequency by x, then

@xp ¼ �A cosðxtÞ: ð42Þ

The Reynolds number, Re = ULy/m, is defined with respect to thecharacteristic length L = Ly and to the velocity in the middle of thechannel when x ? 0. A second dimensionless parameter is definedto characterize the flow: the Womersley number, a, defined as

a ¼ Ly

2

ffiffiffiffiffixm

r: ð43Þ

With respect to the Reynolds and the Womersley numbers theWomersley profile is given by

uxðy; tÞ ¼

Re eia2

Ret 8ia2 1�

coshffiffiffi2pðaþ iaÞ y� 1

2

� �� �cosh

ffiffi2p

2 ðaþ iaÞ� �

0@

1A

0@

1A; ð44Þ

Page 5: General regularized boundary condition for multi-speed lattice Boltzmann models

(a) (b)

Fig. 4. The maximum and L2 errors for the (a) velocity and (b) pressure fields.

O. Malaspinas et al. / Computers & Fluids 49 (2011) 29–35 33

where i is the imaginary unit, and Re represent the real part of theexpression.

The flow is induced by imposing the analytical profile of Eq. (44)on the inlet and on the outlet. The error of the Womersley flow iscomputed as the average over a period of time

hE2i ¼1T

Xj

E2ðtjÞ; ð45Þ

where T is the period and the sum is made over each time-step of aperiod, and also in terms of the maximal temporal error

max E2 � maxi

E2ðtiÞ; ð46Þ

where i ranges on all the time increments in one period.The Reynolds number is taken to be Re = 1, the lattice velocity is

set to U = 0.01 at a reference resolution of N = 10 and a = 2. As canbe seen in Fig. 3 the error is of order two as expected.

4.2. The 2D Kovasznay flow

The Kovasznay flow (see [22]) is an analytical solution of thesteady incompressible Navier–Stokes equations where one consid-ers the flow behind a two-dimensional periodic grid with spacingLy. The Reynolds number is defined as Re = LyU/m, where U is theaverage x velocity. The analytical solution is given by

ux ¼ 1� expðkxÞ cosð2pyÞ; ð47Þ

uy ¼1

2pk expðkxÞ sinð2pyÞ; ð48Þ

p ¼ 12ð1� expð2kxÞÞ: ð49Þ

where k ¼ Re=2�ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiRe2=4þ 4p2

q. We use this benchmark to test the

accuracy not only of the velocity field but also of the pressure. Weconsider the computational domain to be of extent Ly in each direc-tion and impose the velocity on all boundaries. The L2 and maxi-mum errors on the pressure are computed as

E2ðpÞffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi1M

Xi

kuaðxiÞ � usðxiÞk2

s; ð50Þ

EmaxðpÞ ¼ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffimax

ikuaðxiÞ � usðxiÞk2

r: ð51Þ

The parameters of the simulation are chosen as Re = 40, and thereference velocity and resolution as U = 0.01 and N = 50. The numer-ical results in Fig. 4, shows that the GRBC yields a second-orderaccuracy for the velocity errors and first-order accuracy for thepressure.

4.3. The 2D dipole-wall collision

This benchmark, based on Refs. [20,23], analyzes the time evo-lution of a self-propelled dipole confined within a 2D box. Thegeometry of the box is a square domain [�L,L] � [�L,L], sur-rounded by no-slip walls. The initial condition describes two coun-ter-rotating monopoles, one with positive core vorticity at theposition (x1,y1) and the other one with negative core vorticity at(x2,y2). This is obtained with an initial velocity field u0 = (ux,uy)which reads as follows in dimensionless variables:

ux ¼ �12kxekðy� y1Þe�ðr1=r0Þ2 þ 1

2xek kðy� y2Þe�ðr2=r0Þ2 ; ð52Þ

uy ¼ þ12kxekðx� x1Þe�ðr1=r0Þ2 � 1

2xek kðx� x2Þe�ðr2=r0Þ2 : ð53Þ

Here, ri ¼ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiðx� xiÞ2 þ ðy� yiÞ

2q

, defines the distance to the mono-pole centers. The parameter r0 labels the diameter of a monopoleand xe its core vorticity.

The average kinetic energy of this system at a given time is de-fined by the expression

hEiðtÞ ¼ 12

Z 1

�1

Z 1

�1kuk2ðx; tÞd2x; ð54Þ

and the average enstrophy by

hXiðtÞ ¼ 12

Z 1

�1

Z 1

�1x2ðx; tÞd2x; ð55Þ

where x = @xuy � @yux is the flow vorticity.The dipole described by Eqs. (52) and (53), under the actions of

viscous forces, develops a net momentum in the positive x-direc-tion and is self-propelled towards the right wall. The collision be-tween the dipole and the wall is characterized by a turbulentdynamics where the wall acts as a source of small-scale vorticesthat originate from detached boundary layers. After the first colli-sion the monopoles under the action of viscosity are re-propelledagainst the wall. These collisions give rise to two peaks of enstro-phy. The value of these local maxima will be used for comparisonof our boundary condition with the results obtained with a spectralmethod in Ref. [20].

In the benchmark, the initial core vorticity of the monopoles isfixed to xe = 299.5286, which leads to an initial average kinetic en-ergy of Eð0Þ ¼ 2. Furthermore, the Reynolds number and the mono-pole radius are set to Re = 625 and r0 = 0.1. The monopoles arealigned symmetrically with the box, in such a way that the di-pole-wall collision is frontal and takes place in the middle of a wall.The positions of the monopole centers are (x1,y1) = (0,0.1) and(x2,y2) = (0,�0.1). The approach of Ref. [23] is used to set up the

Page 6: General regularized boundary condition for multi-speed lattice Boltzmann models

Fig. 5. Numerical accuracy in the 2D dipole-wall collision flow for the two enstrophy peaks: (a) x1 = 933.6 and (b) x2 = 305.2. The error curves for the enstrophy peakobtained with the Regularized and bounce-back BCs are also added for comparison purpose.

Fig. 6. Numerical accuracy in a 3D channel flow. The error curve of the RegularizedBC is also present for comparison purpose.

34 O. Malaspinas et al. / Computers & Fluids 49 (2011) 29–35

initial condition. The initial pressure is evaluated numerically, bysolving the Poisson equation with a successive over relaxation(SOR) scheme, using the algorithm described e.g. in Ref. [24]. Theoff-equilibrium parts of the particle populations are then com-puted with the help of Eq. (8), with numerically computed velocitygradients. The error, Ei = (xi �xi lb)/xi, (i = 1, 2 is the label of theenstrophy peak, and xi lb is the value computed with the LBM) iscomputed with respect to the values found in Ref. [20]:x1 = 933.6 and x2 = 305.2.

The numerical results in Fig. 5, for a Reynolds number Re = 625,indicate that the GRBC yields the expected second-order accuracyfor the first peak and yields indistinguishable results when com-pared to the Regularized BC. One can also see that when comparedwith the half-way bounce back BC, the results obtained by theGRBC and the Regularized BCs are of better accuracy since the errorfor the first peak is smaller by a factor of two and by an order ofmagnitude for the second peak. It is striking that the value of thesecond enstrophy peak is very much more accurately representedthan the first one, even when the first peak has a 5% error. It shouldalso be noted that at a resolution of N = 1500 the second enstrophypeak, x2 lb = 305.2, is exactly equal to the value found in [20].

4.4. The 3D square Poiseuille flow

This benchmark describes the steady flow in a 3D rectangularcylinder. The geometry of the channel extends in the z-direction.It has a rectangular cross section, with x = 0, . . . ,L and y = 0, . . . ,bLwhere b is the aspect ratio of the rectangle. The pressure is a line-arly decreasing function of z. By symmetry, the only non-null com-ponent of the velocity is along the z-direction and is dependingonly on x and y. The reference velocity U is taken as the maximumvelocity in the channel. The pressure drop is the same in the 3D asin the 2D case: @p/@z = �8/Re. The complete analytic solution tothis 3D channel flow is (see [25] for example)

uzðx; yÞ ¼ 4ðx� x2Þ þ 32p3

Xþ1n¼0

ð�1Þn

ð2nþ 1Þ3

cosðð2nþ 1ÞpxÞcosh ð2nþ 1Þ py

b

� �cosh ð2nþ 1Þ p2 b

� �1A: ð56Þ

Fig. 6 shows the numerical accuracy at Re = 10. The reference veloc-ity is U = 0.01 at N = 50, and the aspect ratio is b = 1. The numericalresults in this 3D benchmark are similar to those of the 2D applica-tion in Section 4.1 and the accuracy is again of second-order as ex-pected. Furthermore the results are very similar to those obtainedwith the Regularized BC.

5. Conclusion

In this work we presented a generic way of handling flat wallsand corners on boundaries for the lattice Boltzmann method. Theboundary conditions were applied in 2D and 3D benchmarks andall of them showed a second-order accuracy. Furthermore on twovery different benchmarks they not only showed to be second-or-der accurate but also to quantitatively give the same results as theRegularized BC, which is a widely used and validated BC. Thanks tothe genericity of the procedure, this boundary condition can be ap-plied to lattice Boltzmann method for thermal flows and we arecurrently working on this adaptation.

References

[1] Succi S. The lattice Boltzmann equation for fluid dynamics andbeyond. Oxford: Oxford University Press; 2001.

[2] Chopard B, Dupuis A, Masselot A, Luthi P. Cellular automata and LatticeBoltzmann techniques: an approach to model and simulate complex systems.Adv Compl Syst 2002;5:103–246. doi:10.1142/S0219525902000602.

[3] Malaspinas O. Lattice Boltzmann method for the simulation of viscoelasticfluid flows. PhD dissertation, EPFL, Lausanne, Switzerland; 2009. <http://library.epfl.ch/theses/?nr=4505>.

[4] Shan X, Chen H. Lattice Boltzmann model for simulating flows with multiplephases and components. Phys Rev E 1993;47:1815–9. doi:10.1103/PhysRevE.47.1815.

Page 7: General regularized boundary condition for multi-speed lattice Boltzmann models

O. Malaspinas et al. / Computers & Fluids 49 (2011) 29–35 35

[5] Shan X, Yuan X-F, Chen H. Kinetic theory representation of hydrodynamics: away beyond the Navier Stokes equation. J Fluid Mech 2006;550:413–41.doi:10.1017/S0022112005008153.

[6] Zou Q, He X. On pressure and velocity boundary conditions for the latticeBoltzmann BGK model. Phys Fluids 1997;9:1592–8.

[7] Skordos PA. Initial and boundary conditions for the lattice Boltzmann method.Phys Rev E 1993;48:4823–42.

[8] Latt J, Chopard B. Lattice Boltzmann method with regularized non-equilibriumdistribution functions. Math Comput Simul 2006;72:165–8.

[9] Verschaeve JCG. Analysis of the lattice Boltzmann Bhatnagar–Gross–Krook no-slip boundary condition: ways to improve accuracy and stability. Phys Rev E2009;80(3):036703. doi:10.1103/PhysRevE.80.036703.

[10] Latt J, Chopard B, Malaspinas O, Deville M, Michler A. Straight velocityboundaries in the lattice Boltzmann method. Phys Rev E2008;77(5):056703–+. doi:10.1103/PhysRevE.77.056703.

[11] Bouzidi M, Firdaouss M, Lallemand P. Momentum transfer of a Boltzmann-lattice fluid with boundaries. Phys Fluids 2001;13(11):3452–9. doi:10.1063/1.1399290.

[12] Junk M, Yang Z. One-point boundary condition for the lattice Boltzmannmethod. Phys Rev E 2005;72(6):066701. doi:10.1103/PhysRevE.72.066701.

[13] Ginzburg I, d’Humières D. Multireflection boundary conditions for latticeBoltzmann models. Phys Rev E 2003;68(6):066614. doi:10.1103/PhysRevE.68.066614.

[14] Wolf-Gladrow DA. Lattice-gas cellular automata and lattice Boltzmannmodels: an introduction. Berlin: Springer-Verlag; 2000.

[15] Bhatnagar PL, Gross EP, Krook M. A model for collision processes in gases. I.Small amplitude processes in charged and neutral one-component systems.Phys Rev 1954;94(3):511–25. doi:10.1103/PhysRev.94.511.

[16] Chapman S, Cowling TG. The mathematical theory of nonuniformgases. Cambridge: Cambridge University Press; 1960.

[17] Chopard B, Droz M. Cellular automata modeling of physicalsystems. Cambridge University Press; 1998.

[18] Huang K. Statistical mechanics. New York: J. Wiley; 1987.[19] Björck Å. Numerical methods for least squares problems. Philadelphia: SIAM;

1996.[20] Clercx HJH, Bruneau C-H. The normal and oblique collision of a dipole with a

no-slip boundary. Comput Fluids 2006;35:245–79.[21] Womersley JR, velocity Method for the calculation of. rate of flow and viscous

drag in arteries when the pressure gradient is known. J Physiol1955;127:553–63.

[22] Kovasznay LIG. Laminar flow behind a two-dimensional grid. Math ProcCambridge Philos Soc 1948;44:58–62. doi:10.1017/S0305004100023999.

[23] Latt J, Chopard B. A benchmark case for lattice Boltzmann: turbulent dipole-wall collision. Int J Mod Phys C 2007;18:619–26.

[24] Griebel M, Dornseifer T, Neunhoeffer T. Numerical simulation in fluiddynamics: a practical introduction. Society for Industrial and AppliedMathematics, Philadelphia, PA, USA; 1998. ISBN:0-89871-398-6.

[25] Yih C-S. Fluid mechanics. London: McGraw-Hill; 1969.