ldc.LidDrivenCavitySolver#
- class ldc.LidDrivenCavitySolver(config=None, **kwargs)[source]#
Bases:
ABCAbstract base solver for lid-driven cavity problem.
Handles: - Configuration management - Iteration loop with residual computation - Result storage
Subclasses must: - Set Config and ResultFields class attributes - Implement step() - perform one iteration - Implement _create_result_fields() - create result dataclass - Extend __init__() for solver-specific setup
Methods
__init__Initialize solver with configuration.
Save results to HDF5 file.
Solve the lid-driven cavity problem using iterative stepping.
Perform one iteration/time step of the solver.
Attributes
- Config = None#
- ResultFields = None#
- 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.metadata : Metadata dataclass with solver metadata
- abstractmethod step()[source]#
Perform one iteration/time step of the solver.
This method should: 1. Update the solution fields (u, v, p) 2. Return the updated fields as a tuple (u, v, p)
The fields should be stored as instance variables that can be accessed for residual computation.
- Returns:
- u
np.ndarray Updated u velocity field
- v
np.ndarray Updated v velocity field
- p
np.ndarray Updated pressure field
- u