utils.LDCPlotter#

class utils.LDCPlotter(runs: dict | str | Path | list)[source]#

Bases: object

Plotter for lid-driven cavity simulation results.

Handles both single and multiple runs for comparison using HDF5 files.

Parameters:
runsdict, str, Path, or list

Single run or list of runs. Can be: - str/Path: Path to HDF5 file - dict: Dictionary with ‘h5_path’ (and optionally ‘label’) - list: List of any of the above (requires ‘label’ in dicts)

Examples

>>> # Single run
>>> plotter = LDCPlotter('run.h5')
>>> plotter.plot_convergence()
>>> # Multiple runs with labels
>>> plotter = LDCPlotter([
...     {'h5_path': 'run1.h5', 'label': '32x32'},
...     {'h5_path': 'run2.h5', 'label': '64x64'}
... ])

Methods

__init__

Initialize plotter and load data.

plot_convergence

Plot convergence history using seaborn.

plot_pressure

Plot pressure field using matplotlib tricontourf.

plot_velocity_fields

Plot velocity components using matplotlib tricontourf.

Examples using utils.LDCPlotter#

Lid-Driven Cavity Flow Visualization

Lid-Driven Cavity Flow Visualization
plot_convergence(output_path: Path | str | None = None, show: bool = False)[source]#

Plot convergence history using seaborn.

Automatically handles single or multiple runs using hue.

Parameters:
output_pathPath or str, optional

Path to save figure. If None, figure is not saved.

showbool, default False

Whether to show the plot.

plot_pressure(output_path: Path | str | None = None, show: bool = False)[source]#

Plot pressure field using matplotlib tricontourf.

Parameters:
output_pathPath or str, optional

Path to save figure. If None, figure is not saved.

showbool, default False

Whether to show the plot.

plot_velocity_fields(output_path: Path | str | None = None, show: bool = False)[source]#

Plot velocity components using matplotlib tricontourf.

Parameters:
output_pathPath or str, optional

Path to save figure. If None, figure is not saved.

showbool, default False

Whether to show the plot.