tud_lbm.operators.boundary
Boundary condition operators — composite builder.
Public API: build_bc(), BCMasks, build_bc_masks
Implementation modules (_bounce_back.py, _periodic.py, _symmetry.py) are internal.
Example
from operators.boundary import build_bc, build_bc_masks
bc_fn = build_bc({“top”: “symmetry”, “bottom”: “bounce-back”}, lattice) masks = build_bc_masks((64, 64)) f = bc_fn(f_stream, f_col, masks)
Classes
Pre-computed boundary-condition masks — valid JAX pytree. |
Functions
|
Construct pre-computed boundary-condition masks. |
|
Build a composite BC closure from a bc_config dict. |
Package Contents
- class tud_lbm.operators.boundary.BCMasks[source]
Bases:
NamedTuplePre-computed boundary-condition masks — valid JAX pytree.
Each mask is a boolean
jax.Arrayof shape(nx, ny, nz, 1, 1)that isTrueon the corresponding edge row/column/plane.
- tud_lbm.operators.boundary.build_bc_masks(grid_shape: tuple[int, Ellipsis]) BCMasks[source]
Construct pre-computed boundary-condition masks.
Each mask is a boolean array of shape
(nx, ny, nz, 1, 1)that isTrueon the corresponding edge row/column/plane.- Parameters:
grid_shape – Spatial dimensions
(nx, ny, nz).- Returns:
A
BCMasksNamedTuple with 3D-shaped masks for all 6 faces.
- tud_lbm.operators.boundary.build_bc(bc_config: dict[str, Any] | None, lattice: tud_lbm.lattice.lattice.Lattice) tud_lbm.operators.protocols.BoundaryOperator[source]
Build a composite BC closure from a bc_config dict.
The returned function applies boundary conditions in order: bottom → top → left → right. Edges not present in bc_config or mapped to
"periodic"are no-ops.- Parameters:
bc_config – Mapping
{_edge: bc_type, ...}, e.g.{"top": "symmetry", "bottom": "bounce-back", "left": "periodic", "right": "periodic"}.Nonemeans all-periodic.lattice –
Lattice.
- Returns:
A callable satisfying the BoundaryOperator protocol,
bc_fn(f_stream, f_col, bc_masks) → f.