utils.GhiaValidator#

class utils.GhiaValidator(h5_path: Path | str, Re: float | None = None, validation_data_dir: Path | str | None = None)[source]#

Bases: object

Validator for lid-driven cavity results against Ghia et al. (1982) benchmark.

Parameters:
Refloat

Reynolds number of the simulation (can also be inferred from HDF5 file).

h5_pathPath or str

Path to HDF5 file with solution fields.

validation_data_dirPath or str, optional

Directory containing Ghia CSV files. If None, uses default location.

Methods

__init__

Initialize validator and load solution fields from HDF5 file.

compute_errors

Compute error metrics against Ghia benchmark data.

plot_validation

Plot velocity validation against Ghia benchmark using seaborn.

print_summary

Print validation summary with error metrics.

Attributes

Examples using utils.GhiaValidator#

Lid-Driven Cavity Flow Visualization

Lid-Driven Cavity Flow Visualization
AVAILABLE_RE = [100, 400, 1000, 3200, 5000, 7500, 10000]#
compute_errors()[source]#

Compute error metrics against Ghia benchmark data.

Returns:
dict

Dictionary containing error metrics for u and v velocities: - ‘u_l2’: L2 norm of u error - ‘u_linf’: L∞ (maximum) norm of u error - ‘u_rms’: Root mean square error for u - ‘v_l2’: L2 norm of v error - ‘v_linf’: L∞ (maximum) norm of v error - ‘v_rms’: Root mean square error for v

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

Plot velocity validation against Ghia benchmark using seaborn.

Creates a two-panel figure with u and v velocity validation side-by-side.

Parameters:
output_pathPath or str, optional

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

showbool, default False

Whether to show the plot.

print_summary()[source]#

Print validation summary with error metrics.