ldc.FVSolver#

class ldc.FVSolver(**kwargs)[source]#

Bases: LidDrivenCavitySolver

Finite volume solver for lid-driven cavity problem.

This solver uses a collocated grid arrangement with Rhie-Chow interpolation for pressure-velocity coupling using the SIMPLE algorithm.

Parameters:
paramsFVParameters

Parameters with physics (Re, lid velocity, domain size) and FV-specific settings (nx, ny, convection scheme, etc.).

Methods

__init__

Initialize FV solver.

mlflow_end

End MLflow run and log final metrics.

mlflow_log_artifact

Log an artifact (e.g., saved HDF5 file) to MLflow.

mlflow_start

Start MLflow run and log parameters.

save

Save complete solver state to HDF5 file.

solve

Solve the lid-driven cavity problem using iterative stepping.

step

Perform one SIMPLE iteration.

Attributes

rho

Examples using ldc.FVSolver#

Lid-Driven Cavity Flow - Finite Volume SIMPLE

Lid-Driven Cavity Flow - Finite Volume SIMPLE
Parameters#

alias of FVParameters

mlflow_end()#

End MLflow run and log final metrics.

mlflow_log_artifact(filepath: str)#

Log an artifact (e.g., saved HDF5 file) to MLflow.

Parameters:
filepathstr

Path to the file to log as artifact.

mlflow_start(experiment_name: str, run_name: str, parent_run_name: str = None)#

Start MLflow run and log parameters.

Parameters:
experiment_namestr

Name of the MLflow experiment.

run_namestr

Name of the run within the experiment.

parent_run_namestr, optional

If specified, creates a nested run under a parent with this name. Parent is created if it doesn’t exist, or resumed if it does.

rho = 1.0#
save(filepath)#

Save complete solver state to HDF5 file.

Saves params, metrics, time_series, and fields for later analysis.

Parameters:
filepathstr or Path

Output file path (use .h5 extension).

solve(tolerance: float = None, max_iter: int = None)#

Solve the lid-driven cavity problem using iterative stepping.

This method implements the common iteration loop with residual calculation. Subclasses implement step() to define one iteration.

Stores results in solver attributes: - self.fields : Fields dataclass with solution fields - self.time_series : TimeSeries dataclass with time series data - self.metrics : Metrics dataclass with solver metrics

Parameters:
tolerancefloat, optional

Convergence tolerance. If None, uses params.tolerance.

max_iterint, optional

Maximum iterations. If None, uses params.max_iterations.

step()[source]#

Perform one SIMPLE iteration.

Returns:
u, v, pnp.ndarray

Updated velocity and pressure fields