tud_lbm.pipeline.state
Dynamic simulation state for TUD-LBM.
Provides State and WettingState — the pytree-compatible
carry objects used inside jax.lax.scan.
Also provides state builder functions build_optional_fields() and
build_extra_state() that orchestrate state composition.
Public API:
from state import State, WettingState, build_optional_fields, build_extra_state
Submodules
Functions
Build the optional |
|
|
Collect extra State fields initialised by active extra-state plugins. |
|
Apply plugin-driven extra-state updates after one step. |
Package Contents
- tud_lbm.pipeline.state.build_optional_fields(setup: tud_lbm.pipeline.setup.SimulationSetup, nx: int, ny: int, nz: int, d: int) tuple[jax.numpy.ndarray | None, jax.numpy.ndarray | None][source]
Build the optional
forceandforce_extfields.Returns zero-filled arrays for fields that will be written by the step function, and
Nonefor fields that remain unused. JAX’slax.scanrequires the pytree structure to be constant across iterations, so any field that transitions fromNone→ array must start as zeros.- Parameters:
setup –
SimulationSetup.nx – Grid size in x.
ny – Grid size in y.
nz – Grid size in z.
d – Lattice dimension (e.g. 2 for D2Q9).
- Returns:
force: Zeros(nx, ny, nz, 1, d)for multiphase runs,Noneotherwise.force_ext: Zeros(nx, ny, nz, 1, d)when forces are active,Noneotherwise.
- Return type:
A tuple
(force, force_ext)
See also
state._optional_fields._build_optional_fields()
- tud_lbm.pipeline.state.build_extra_state(setup: tud_lbm.pipeline.setup.SimulationSetup) dict[str, Any][source]
Collect extra State fields initialised by active extra-state plugins.
- Parameters:
setup –
SimulationSetup.- Returns:
A dictionary mapping field names to initialised arrays. Empty when no plugins are active.
See also
state._extra_state._build_extra_state()
- tud_lbm.pipeline.state.update_extra_state(setup: tud_lbm.pipeline.setup.SimulationSetup, prev_state: state.State, new_state: state.State, **context: dict[str, Any]) state.State[source]
Apply plugin-driven extra-state updates after one step.