Order of Collision, Streaming and Boundary Conditions

Hi All,

I am slightly confused about the order of collision, streaming and boundary conditions. Right now I follow this order and this seems to work.

  1. Set macroscopic boundary conditions
  2. Set microscopic boundary conditions
  3. Calculate Macroscopic Variables
  4. Collide
  5. Stream

I have seen cylinder.m by Jonas Latt and found this order…

  1. Calculate Macroscopic Variables
  2. Set macroscopic boundary conditions
  3. Collide
  4. Set microscopic boundary conditions
  5. Stream

Does the order of these steps really matter. Someone please clarify



I definitely think that the “set microscopic boundary conditions” step in cylinder.m is before collide, and not after collide…

You can implement a boundary condition before collision (in which case you are working with incoming populations fIn) or after collision (in which case you are working with outgoing populations fOut). Both are possible, but the algorithm may not be the same in both cases, depending on which boundary condition you are using. It is important to read through the documentation of a boundary condition to know whether it acts on the incoming or outgoing populations.

Hi Dr.Latt,

Thanks for the reply. I am using Zou-He Boundary Conditions on all the four sides of a channel. So is it a must that I implement my boundary conditions before collision and not after collision. (I interpret that I am setting the incoming populations to set the boundary conditions and I am working with incoming f’s)

Case 1:
3.Boundary Conditions (Micro)
4.Compute Macro Variables (Macro Boundaries are set automatically)

Case 2:

  1. Boundary Conditions (Micro)
  2. Compute Macro Variables (Macro Boundaries are set automatically)
  3. Collide
  4. Stream

Please let me know which one is a good practice.

Thanks and Regards,

Dear Narender,

As it was indicated by Jonas you have to go through the documentation. However, particularly for Zou-He both variations are possible - you can do both ways - once I tested.

However, please make sure to comply with documentation first,

Dear Alex,

Thank you for the information.