ldc.base_solver.LidDrivenCavitySolver#
- class ldc.base_solver.LidDrivenCavitySolver(params=None, **kwargs)[source]#
Bases:
ABCAbstract base solver for lid-driven cavity problem.
Handles: - Parameter management (input configuration) - Metrics tracking (output results) - Iteration loop with residual computation - MLflow logging
Subclasses must: - Set Parameters class attribute (e.g., FVParameters) - Implement step() - perform one iteration - Call _init_fields(x, y) after setting up grid - Implement _compute_algebraic_residuals() for Ax-b residuals
Methods
__init__Initialize solver with parameters.
End MLflow run and log final metrics.
Log an artifact (e.g., saved HDF5 file) to MLflow.
Start MLflow run and log parameters.
Save complete solver state to HDF5 file.
Solve the lid-driven cavity problem using iterative stepping.
Perform one iteration/time step of the solver.
Attributes
- Parameters = None#
- mlflow_log_artifact(filepath: str)[source]#
Log an artifact (e.g., saved HDF5 file) to MLflow.
- Parameters:
- filepath
str Path to the file to log as artifact.
- filepath
- mlflow_start(experiment_name: str, run_name: str, parent_run_name: str = None)[source]#
Start MLflow run and log parameters.
- save(filepath)[source]#
Save complete solver state to HDF5 file.
Saves params, metrics, time_series, and fields for later analysis.
- Parameters:
- filepath
strorPath Output file path (use .h5 extension).
- filepath
- solve(tolerance: float = None, max_iter: int = None)[source]#
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
- abstractmethod step()[source]#
Perform one iteration/time step of the solver.
- Returns:
- u, v, p
np.ndarray Updated velocity and pressure fields
- u, v, p