# Basic reaction-diffusion with LBM questions

Hello everyone,

I’m struggling to get a working LBM reaction-diffusion implementation. I have a pretty weak mathematics and physics background, and thus I’m having a hard time understanding the notations around the BGK operator. I would like to know if I understood the basics correctly.

Right now, what I’m doing is the following (v is the diffusive species I’m interested in), on a D2Q5 grid, in pseudo-code:

``````
v[0, :] = initial_condition
t = 0
while t < t_max:
for each node x:
compute a pseudo (pre-collision?) dv[x]/dt using the forward euler method
for each node x:
real dv[x]/dt = 1/3 * dv[x]/dt
+ 1/6 * dv[left of x]/dt
+ 1/6 * dv[right of x]/dt
+ 1/6 * dv[above x]/dt
+ 1/6 * dv[below x]/dt
(if x is on a domain boudary, use bounce-back condition)
v[t, x] += dv[x]/dt
t += dt

``````

Is this correct, theory-wise, or am I missing something?

Thanks for any help. I’m happy to share my code if anyone wants to go this far to help me. Once I’ll have it working (probably in python), I will distribute it without conditions, so it could for instance be added to the example sections of palabos.