ldc.SpectralSolver#
- class ldc.SpectralSolver(**kwargs)[source]#
Bases:
LidDrivenCavitySolverPseudospectral solver for lid-driven cavity problem.
Uses explicit time-stepping with artificial compressibility to solve the incompressible Navier-Stokes equations on a Legendre-Gauss-Lobatto grid.
- Parameters:
- params
SpectralParameters Parameters with physics (Re, lid velocity, domain size) and spectral-specific settings (Nx, Ny, CFL, beta_squared, etc.).
- params
Methods
__init__Initialize spectral solver.
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 RK4 pseudo time-step.
Examples using
ldc.SpectralSolver#- Parameters#
alias of
SpectralParameters
- 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:
- filepath
str Path to the file to log as artifact.
- filepath
- mlflow_start(experiment_name: str, run_name: str, parent_run_name: str = None)#
Start MLflow run and log parameters.
- save(filepath)#
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)#
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
- step()[source]#
Perform one RK4 pseudo time-step.
PN-PN-2: Updates u, v on full grid and p on inner grid.
- Returns:
- u, v, p
np.ndarray Updated velocities (full grid) and pressure (inner grid)
- u, v, p