tud_lbm.config.simulation_config

Validated, serialisable simulation configuration for TUD-LBM.

SimulationConfig is a frozen Python dataclass used for parsing, validation, and serialisation. It never enters a JIT boundary.

Usage:

from config.simulation_config import SimulationConfig

cfg = SimulationConfig(
    grid_shape=(128, 128, 1),
    tau=0.8,
    nt=5000,
    collision_scheme="bgk",
)

Attributes

CONFIG_SECTION

ARRAY_ELIGIBLE

NESTED_SWEEPABLE

MIN_GRID_DIMENSIONS

MIN_TAU_VALUE

Classes

SimulationConfig

Validated, serialisable simulation configuration for TUD-LBM.

Functions

array_field(→ dataclasses.field)

Field factory for array-eligible SimulationConfig fields.

get_array_eligible_fields(→ frozenset[str])

Get names of fields eligible for array expansion in configuration sweeps.

get_nested_sweepable_fields(→ frozenset[str])

Return field names whose dict sub-keys may carry list sweep values.

get_fields_for_section(→ frozenset[str])

Get field names belonging to a specific configuration section.

Module Contents

tud_lbm.config.simulation_config.CONFIG_SECTION: str = 'config_section'[source]
tud_lbm.config.simulation_config.ARRAY_ELIGIBLE: str = 'array_eligible'[source]
tud_lbm.config.simulation_config.NESTED_SWEEPABLE: str = 'nested_sweepable'[source]
tud_lbm.config.simulation_config.MIN_GRID_DIMENSIONS: int = 2[source]
tud_lbm.config.simulation_config.MIN_TAU_VALUE: float = 0.5[source]
tud_lbm.config.simulation_config.array_field(*, default: object = dataclasses.MISSING, default_factory: object = dataclasses.MISSING, section: str | None = None, nested_sweepable: bool = False, **kwargs: object) dataclasses.field[source]

Field factory for array-eligible SimulationConfig fields.

Parameters:
  • default – Default value for the field.

  • default_factory – Default factory function for the field.

  • section – Config section name for serialisation routing.

  • nested_sweepable – If True, sub-keys inside this dict field will also be inspected for list values during Cartesian-product expansion (e.g. gravity_force, wetting_config).

  • **kwargs – Additional keyword arguments passed to the field factory.

Returns:

A dataclass field with array-eligible metadata.

class tud_lbm.config.simulation_config.SimulationConfig[source]

Validated, serialisable simulation configuration for TUD-LBM.

This frozen dataclass is used for parsing, validation, and serialisation. It never enters a JIT boundary and serves as the configuration container for all simulation parameters including grid, collision, boundary conditions, and output settings.

sim_type: Literal['single_phase', 'multiphase', 'multiphase_wetting', 'multiphase_hysteresis', 'multiphase_hysteresis_chemical_step'] = 'single_phase'[source]
simulation_name: str | None = None[source]
lattice_type: str = 'D2Q9'[source]
grid_shape: tuple[int, Ellipsis][source]
nt: int[source]
tau: float[source]
collision_scheme: str[source]
k_diag: tuple[float, Ellipsis] | None[source]
bc_config: dict[str, Any] | None = None[source]
wetting_config: dict[str, Any] | None[source]
hysteresis_config: dict[str, Any] | None[source]
chemical_step_config: dict[str, Any] | None[source]
gravity_force: dict[str, Any] | None[source]
electric_force: dict[str, Any] | None[source]
gravity_masked_force: dict[str, Any] | None[source]
init_type: str = 'standard'[source]
init_dir: str | None = None[source]
initialisation: dict[str, Any][source]
results_dir: str = ''[source]
save_interval: int = 0[source]
skip_interval: int = 0[source]
save_fields: list[str] | None = None[source]
plot_fields: list[str] | None = None[source]
animate_fields: list[str] | None = None[source]
output_format: str | list[str] | None = 'numpy'[source]
output_dir: str | None = None[source]
eos: str | None[source]
kappa: float | None[source]
rho_l: float | None[source]
rho_v: float | None[source]
interface_width: int | None[source]
g: float | None[source]
extra: dict[str, Any][source]
__post_init__() None[source]

Validate and normalize configuration after initialization.

property is_single_phase: bool[source]

Check if simulation is single-phase.

property is_multiphase: bool[source]

Check if simulation is multiphase.

property force_enabled: bool[source]

Check if any force field is populated.

to_dict() dict[str, Any][source]

Convert configuration to dictionary format.

__repr__() str[source]

Return string representation of SimulationConfig.

tud_lbm.config.simulation_config.get_array_eligible_fields() frozenset[str][source]

Get names of fields eligible for array expansion in configuration sweeps.

tud_lbm.config.simulation_config.get_nested_sweepable_fields() frozenset[str][source]

Return field names whose dict sub-keys may carry list sweep values.

tud_lbm.config.simulation_config.get_fields_for_section(section: str) frozenset[str][source]

Get field names belonging to a specific configuration section.