lbmpy.lattice.Collide

Contents

lbmpy.lattice.Collide#

class Collide(lattice, config_or_collision=None, /, *, name=None)#

Apply an LBM collision operator to a Lattice.

Collide performs an LBM collision operation on each node \(\boldsymbol{x}\) of a given Lattice \(\boldsymbol{f}\). It reads the pre-collision state \(\boldsymbol{f}(\boldsymbol{x})\), evaluates the collision operator, and then writes back the post-collision state \(\boldsymbol{f}^{\ast}(\boldsymbol{x})\) to the same lattice:

\[\boldsymbol{f}^{\ast}(\boldsymbol{x}) = \Omega \left( \boldsymbol{f}(\boldsymbol{x}) \right).\]

The collision operator can be an instance of LbmCollisionRule (as produced by create_lb_collision_rule); otherwise, Collide can receive an LBMConfig object which it passes to create_lb_collision_rule internally.

Collide is a pystencils.flow flowgraph. To use it, either convert it directly to an Operator, or embed it as a subgraph into a larger operator.

When running a simulation, an operator performing LB collision via Collide should be immediately followed by the streaming step, using the Advance operator.