tud_lbm.io.plotting.analysis

Analysis plot operators for saved simulation history.

Classes

MaxVelocityPlot

Plot maximum velocity magnitude over time.

DensityRatioPlot

Plot max/min density ratio over time.

AvgDensityPlot

Plot average density over time.

ContactAngleLeftPlot

Plot left contact angle over time.

ContactAngleRightPlot

Plot right contact angle over time.

ContactLineSpeedLeftPlot

Plot left contact-line speed over time.

ContactLineSpeedRightPlot

Plot right contact-line speed over time.

ContactAnglesPairPlot

Render paired left/right contact-angle history.

ContactLineSpeedsPairPlot

Render paired left/right contact-line speed history.

SimulationCsvExport

Export per-timestep droplet metrics to simulation_data.csv.

Functions

build_simulation_csv(→ pathlib.Path | None)

Compute per-timestep metrics and write simulation_data.csv.

compare_runs(→ None)

Generate 8 comparison scatter plots across all processed runs.

process_parent_dir(→ tuple[int, int])

Discover runs, export per-run CSVs, and generate comparison plots.

main(→ None)

Script entry point for batch CSV export and run comparison plots.

Module Contents

class tud_lbm.io.plotting.analysis.MaxVelocityPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: _BaseAnalysisPlot

Plot maximum velocity magnitude over time.

name = 'max_velocity'[source]
title = 'Maximum velocity vs timestep'[source]
ylabel = 'max(|u|)'[source]
color = 'tab:blue'[source]
required_keys = ('u',)[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Compute maximum velocity values for each timestep file.

class tud_lbm.io.plotting.analysis.DensityRatioPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: _BaseAnalysisPlot

Plot max/min density ratio over time.

name = 'density_ratio'[source]
title = 'Density ratio vs timestep'[source]
ylabel = 'max(rho) / min(rho)'[source]
color = 'tab:orange'[source]
ylog = True[source]
required_keys = ('rho',)[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Compute density ratio values for each timestep file.

class tud_lbm.io.plotting.analysis.AvgDensityPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: _BaseAnalysisPlot

Plot average density over time.

name = 'avg_density'[source]
title = 'Average density vs timestep'[source]
ylabel = 'mean(rho)'[source]
color = 'tab:green'[source]
required_keys = ('rho',)[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Compute average density values for each timestep file.

class tud_lbm.io.plotting.analysis.ContactAngleLeftPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: _BaseAnalysisPlot

Plot left contact angle over time.

name = 'contact_angle_left'[source]
title = 'Left contact angle vs timestep'[source]
ylabel = 'Contact angle (deg)'[source]
color = 'tab:purple'[source]
required_keys = ('ca_left',)[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Compute left contact angle values for each timestep file.

class tud_lbm.io.plotting.analysis.ContactAngleRightPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: _BaseAnalysisPlot

Plot right contact angle over time.

name = 'contact_angle_right'[source]
title = 'Right contact angle vs timestep'[source]
ylabel = 'Contact angle (deg)'[source]
color = 'tab:red'[source]
required_keys = ('ca_right',)[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Compute right contact angle values for each timestep file.

class tud_lbm.io.plotting.analysis.ContactLineSpeedLeftPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: _ContactLineSpeedBase

Plot left contact-line speed over time.

name = 'contact_line_speed_left'[source]
title = 'Left contact-line speed vs timestep'[source]
ylabel = 'd(cll_left)/dt'[source]
color = 'tab:brown'[source]
cl_key = 'cll_left'[source]
required_keys = ('cll_left',)[source]
class tud_lbm.io.plotting.analysis.ContactLineSpeedRightPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: _ContactLineSpeedBase

Plot right contact-line speed over time.

name = 'contact_line_speed_right'[source]
title = 'Right contact-line speed vs timestep'[source]
ylabel = 'd(cll_right)/dt'[source]
color = 'tab:pink'[source]
cl_key = 'cll_right'[source]
required_keys = ('cll_right',)[source]
class tud_lbm.io.plotting.analysis.ContactAnglesPairPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: tud_lbm.io.plotting.base.AnalysisPlot

Render paired left/right contact-angle history.

name = 'contact_angles_pair'[source]
required_keys = ('ca_left', 'ca_right')[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Compute left/right contact-angle arrays for all snapshots.

render(ax: matplotlib.axes.Axes, precomputed: dict[str, numpy.ndarray]) None[source]

Draw the paired contact-angle scatter plot.

class tud_lbm.io.plotting.analysis.ContactLineSpeedsPairPlot(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: tud_lbm.io.plotting.base.AnalysisPlot

Render paired left/right contact-line speed history.

name = 'contact_line_speeds_pair'[source]
required_keys = ('cll_left', 'cll_right')[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Compute left/right contact-line speed arrays for all snapshots.

render(ax: matplotlib.axes.Axes, precomputed: dict[str, numpy.ndarray]) None[source]

Draw the paired contact-line speed scatter plot.

class tud_lbm.io.plotting.analysis.SimulationCsvExport(config: tud_lbm.config.SimulationConfig | None = None)[source]

Bases: tud_lbm.io.plotting.base.AnalysisPlot

Export per-timestep droplet metrics to simulation_data.csv.

name = 'simulation_csv'[source]
required_keys = ('rho', 'u')[source]
export_only = True[source]
compute(files: list[pathlib.Path]) dict[str, numpy.ndarray][source]

Return an empty payload because this operator is export-only.

render(ax: matplotlib.axes.Axes, precomputed: dict[str, numpy.ndarray]) None[source]

Render a placeholder panel when this operator is selected for plotting.

export(run_dir: pathlib.Path) pathlib.Path | None[source]

Write simulation_data.csv for the configured run directory.

tud_lbm.io.plotting.analysis.build_simulation_csv(run_dir: str | pathlib.Path, config: tud_lbm.config.SimulationConfig) pathlib.Path | None[source]

Compute per-timestep metrics and write simulation_data.csv.

Skips silently (returns None) when config.sim_type is not a supported wetting variant. Saves the CSV directly to run_dir.

Parameters:
  • run_dir – Run directory (contains data/timestep_*.npz).

  • configSimulationConfig.

Returns:

Path to the written CSV, or None when skipped.

tud_lbm.io.plotting.analysis.compare_runs(parent_dir: str | pathlib.Path) None[source]

Generate 8 comparison scatter plots across all processed runs.

Reads simulation_data.csv files produced by build_simulation_csv() from every run directory under parent_dir and writes 8 plots to <parent_dir>/comparison_analysis/.

Parameters:

parent_dir – Parent directory that contains the individual run directories.

tud_lbm.io.plotting.analysis.process_parent_dir(parent_dir: str | pathlib.Path) tuple[int, int][source]

Discover runs, export per-run CSVs, and generate comparison plots.

Discovers runs by searching for config.toml files recursively. Skips directories whose path contains "init" or "comparison_analysis". Writes simulation_data.csv per run, then generates 8 comparison plots when at least one run produced CSV data.

Parameters:

parent_dir – Absolute or relative path to the parent directory.

Returns:

A tuple (n_runs_found, n_runs_with_csv).

tud_lbm.io.plotting.analysis.main(parent_dir: str | None = None) None[source]

Script entry point for batch CSV export and run comparison plots.