Boundary Conditions

class LbBoundary(name=None)

Base class that all boundaries should derive from.

Parameters

name – optional name of the boundary.

property additional_data

Return a list of (name, type) tuples for additional data items required in this boundary These data items can either be initialized in separate kernel see additional_data_kernel_init or by Python callbacks - see additional_data_callback

property additional_data_init_callback

Return a callback function called with a boundary data setter object and returning a dict of data-name to data for each element that should be initialized

get_additional_code_nodes(lb_method)

Return a list of code nodes that will be added in the generated code before the index field loop.

Parameters

lb_method – lattice Boltzmann method. See lbmpy.creationfunctions.create_lb_method()

class NoSlip(name=None)

No-Slip, (half-way) simple bounce back boundary condition, enforcing zero velocity at obstacle. Extended for use with any streaming pattern.

Parameters

name – optional name of the boundary.

class UBB(velocity, adapt_velocity_to_force=False, dim=None, name=None)

Velocity bounce back boundary condition, enforcing specified velocity at obstacle

Parameters
  • velocity – can either be a constant, an access into a field, or a callback function. The callback functions gets a numpy record array with members, ‘x’,’y’,’z’, ‘dir’ (direction) and ‘velocity’ which has to be set to the desired velocity of the corresponding link

  • adapt_velocity_to_force – adapts the velocity to the correct equilibrium when the lattice Boltzmann method holds a forcing term. If no forcing term is set and adapt_velocity_to_force is set to True it has no effect.

  • dim – number of spatial dimensions

  • name – optional name of the boundary.

property additional_data

In case of the UBB boundary additional data is a velocity vector. This vector is added to each cell to realize velocity profiles for the inlet.

property additional_data_init_callback

Initialise additional data of the boundary. For an example see tutorial 02 or lbmpy.geometry.add_pipe_inflow_boundary

get_additional_code_nodes(lb_method)

Return a list of code nodes that will be added in the generated code before the index field loop.

Parameters

lb_method – Lattice Boltzmann method. See lbmpy.creationfunctions.create_lb_method()

Returns

list containing LbmWeightInfo and NeighbourOffsetArrays

class SimpleExtrapolationOutflow(normal_direction, stencil, name=None)

Simple Outflow boundary condition [GSchonherrPK15], equation F.1 (listed below). This boundary condition extrapolates missing populations from the last layer of fluid cells onto the boundary by copying them in the normal direction.

\[f_{\overline{1}jkxyzt} = f_{\overline{1}jk(x - \Delta x)yzt}\]
Parameters
  • normal_direction – direction vector normal to the outflow

  • stencil – stencil used for the lattice Boltzmann method

  • name – optional name of the boundary.

class ExtrapolationOutflow(normal_direction, lb_method, dt=1, dx=1, name=None, streaming_pattern='pull', zeroth_timestep=<Timestep.BOTH: 2>, initial_density=None, initial_velocity=None)

Outflow boundary condition [GSchonherrPK15], equation F.2, with u neglected (listed below). This boundary condition interpolates missing on the boundary in normal direction. For this interpolation, the PDF values of the last time step are used. They are interpolated between fluid cell and boundary cell. To get the PDF values from the last time step an index array is used which stores them.

\[f_{\overline{1}jkxyzt} = f_{\overline{1}jk(x - \Delta x)yz(t - \Delta t)} c \theta^{\frac{1}{2}} \frac{\Delta t}{\Delta x} + \left(1 - c \theta^{\frac{1}{2}} \frac{\Delta t}{\Delta x} \right) f_{\overline{1}jk(x - \Delta x)yzt}\]
Parameters
  • normal_direction – direction vector normal to the outflow

  • lb_method – the lattice boltzman method to be used in the simulation

  • dt – lattice time step size

  • dx – lattice spacing distance

  • name – optional name of the boundary.

  • streaming_pattern – Streaming pattern to be used in the simulation

  • zeroth_timestep – for in-place patterns, whether the initial setup corresponds to an even or odd time step

  • initial_density – floating point constant or callback taking spatial coordinates (x, y [,z]) as positional arguments, specifying the initial density on boundary nodes

  • initial_velocity – tuple of floating point constants or callback taking spatial coordinates (x, y [,z]) as positional arguments, specifying the initial velocity on boundary nodes

property additional_data

Used internally only. For the ExtrapolationOutflow information of the precious PDF values is needed. This information is added to the boundary

property additional_data_init_callback

The initialisation of the additional data is implemented internally for this class. Thus no callback can be provided

class FixedDensity(density, name=None)

Boundary condition that fixes the density/pressure at the obstacle.

Parameters
  • density – value of the density which should be set.

  • name – optional name of the boundary.

class NeumannByCopy(name=None)

Neumann boundary condition which is implemented by coping the PDF values to achieve similar values at the fluid and the boundary node

get_additional_code_nodes(lb_method)

Return a list of code nodes that will be added in the generated code before the index field loop.

Parameters

lb_method – Lattice Boltzmann method. See lbmpy.creationfunctions.create_lb_method()

Returns

list containing NeighbourOffsetArrays

class StreamInConstant(constant, name=None)

Boundary condition that takes a constant and overrides the boundary PDFs with this value. This is used for debugging mainly.

Parameters
  • constant – value which should be set for the PDFs at the boundary cell.

  • name – optional name of the boundary.

get_additional_code_nodes(lb_method)

Return a list of code nodes that will be added in the generated code before the index field loop.

Parameters

lb_method – Lattice Boltzmann method. See lbmpy.creationfunctions.create_lb_method()

Returns

list containing NeighbourOffsetArrays