tud_lbm.operators.differential
Differential operators — composite builder and primitives.
Public API: build_diff_ops()
Implementation modules are internal; use the factory to access.
Example
from operators.differential import build_diff_ops
gradient_standard, gradient, laplacian = build_diff_ops(config, mp_params, lattice)
Functions
Return a differential operator satisfying DifferentialOperator protocol. |
|
|
Build gradient/laplacian closures, wetting-aware if applicable. |
Package Contents
- tud_lbm.operators.differential.build_differential_fn(scheme: str) tud_lbm.operators.protocols.DifferentialOperator[source]
Return a differential operator satisfying DifferentialOperator protocol.
- Parameters:
scheme – Differential operator name.
- Returns:
A callable satisfying the DifferentialOperator protocol.
- Raises:
ValueError – If scheme is not registered.
- tud_lbm.operators.differential.build_diff_ops(config: tud_lbm.config.simulation_config.SimulationConfig, mp_params: tud_lbm.operators.macroscopic.MultiphaseParams | None, lattice: tud_lbm.lattice.lattice.Lattice) tuple[collections.abc.Callable, collections.abc.Callable, collections.abc.Callable, collections.abc.Callable | None, collections.abc.Callable | None][source]
Build gradient/laplacian closures, wetting-aware if applicable.
Ensures boundary-condition modules are imported so that their
@boundary_conditiondecorators have fired before we query pad-edge-mode metadata.Returns five items:
gradient_standard:
(grid) → result. Standard gradient ∇μ.gradient_density: Density gradient ∇ρ, used in source terms.
laplacian_density: Laplacian ∇²ρ, used in chemical potential.
gradient_density_wetting: Parametric density gradient
(grid, phi_l, phi_r, d_rho_l, d_rho_r) → result.Noneunless hysteresis is configured.laplacian_density_wetting: Parametric Laplacian
(grid, phi_l, phi_r, d_rho_l, d_rho_r) → result.Noneunless hysteresis is configured.
Design:
Non-wetting: All returned closures accept only
(grid).gradient_density_wettingandlaplacian_density_wettingareNone.Fixed wetting (wetting config but no hysteresis): Same behavior as non-wetting.
gradient_densityandlaplacian_densityclose over static wetting parameters.gradient_density_wettingandlaplacian_density_wettingareNone.Hysteresis:
gradient_densityandlaplacian_densityare initial closures seeded with wetting parameters (explicit or neutral defaults).gradient_density_wettingandlaplacian_density_wettingare the parametric factories used by the hysteresis optimizer to build trial-step operators.
- Parameters:
config – Validated simulation configuration.
mp_params – Multiphase parameters (
Nonefor single-phase).lattice – The simulation
Lattice(weights, velocities).
- Returns:
(gradient_standard, gradient_density, laplacian_density, gradient_density_wetting, laplacian_density_wetting)