# Simulating Dirichlet Boundary Conditions for Lattice Boltzmann Method

So, I'm going through A.A. Mohammad's book "Lattice Boltzmann Method : Fundamentals and Engineering Applications with Computer Codes." And I'm currently coding the D2Q9 lattice with respect to pure heat diffusion in a two-dimensional plate.

My understanding from the book was that the Dirichlet Boundary Condition, when the temperature at a boundary is specified, for a "West Boundary" is as follows.

$$f_5 = (wi[5] + wi[7])\times t_{wall} - f_7$$ $$f_1 = (wi[1] + wi[3])\times t_{wall} - f_3$$ $$f_8 = (wi[8] + wi[6])\times t_{wall} - f_6$$

Where $$t_{wall}$$ is the temperature specified at the wall.

However I am not getting correct results from this while coding it in C++. The following are the results that I am getting for the west boundary of a 100x100 Lattice, which has been run for 400 time steps with an alpha of 0.25. The boundary temperature specified is 1.0.

0.810417991800000
0.929672597800000
0.973911324500000
0.990322136600000
0.996409896700000
0.998668214100000
0.999505960300000
0.999816730900000
0.999932014400000
0.999974780000000
0.999990644400000
0.999996529400000
0.999998712600000
0.999999522400000
0.999999822800000
0.999999934300000
0.999999975600000
0.999999991000000
0.999999996600000
0.999999998800000
0.999999999500000
0.999999999800000
0.999999999900000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0.999999999900000
0.999999999800000
0.999999999500000
0.999999998600000
0.999999996200000
0.999999989800000
0.999999972500000
0.999999925900000
0.999999800300000
0.999999461700000
0.999998548800000
0.999996087900000
0.999989454200000
0.999971571600000
0.999923365500000
0.999793415800000
0.999443109600000
0.998498787100000
0.995953170700000
0.989090936300000
0.970592367400000
0.920725657200000
0.786299647800000


If I modify the approach by adding another equation which is as follows,

$$f_2 = (wi[4] + wi[2])\times t_{wall} - f_4$$

Then I'm getting a uniform $$T = 1$$ at the boundary, but this is probably because of the fact that now the summation of all the functions will give summation of the weights times the temperature of the wall, where the summation of the weights is 1.

Please note that $$wi[k]$$ is the weight in the direction corresponding to $$k$$.

Any clarification as to why the original three equations based on the unknown populations do not give the correct boundary result will be helpful.

• It might be useful to indicate what $wi$ means and the particular indices Jun 2 at 20:28
• @KyleKanos Thank you for the tip. Edited. Jun 3 at 4:26