Skip to content

PN-CourseWork/02689-AdvancedNumericalAlgorithmP3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project 3: Lid-Driven Cavity Flow

Comparing Finite Volume and Spectral methods for the incompressible Navier-Stokes equations.

Documentation

Read the full documentation

Installation

uv sync

Usage

# Run solver + generate plots (default)
uv run python main.py -m +experiment/validation/ghia=fv

# Regenerate plots only (no solving)
uv run python main.py -m +experiment/validation/ghia=fv plot_only=true

# Single run (testing)
uv run python main.py solver=fv N=32 Re=100

# Custom sweeps
uv run python main.py -m solver=fv N=16,32,64 Re=100,400

Configuration

The project uses Hydra for configuration. Structure:

conf/
├── config.yaml              # Main config (N, Re, tolerance)
├── solver/
│   ├── fv.yaml              # Finite Volume settings
│   └── spectral/            # Spectral solver variants
├── experiment/
│   └── validation/ghia/     # Ghia benchmark experiments
└── mlflow/
    ├── local.yaml           # File-based tracking (default)
    └── coolify.yaml         # Remote server

MLflow

Results are tracked with MLflow:

# Local UI
uv run mlflow ui

# Remote server
# https://kni.dk/mlflow-ana-p3/

Hyperparameter Optimization

Optimize corner_smoothing using Optuna + Hydra:

# Minimize L2 error vs FV reference (default objective)
uv run python main.py -m +experiment/optimization=corner_smoothing \
    'solver.corner_smoothing=interval(0.02,0.35)' Re=1000 N=30

# Minimize vortex error vs Botella & Peyret reference
uv run python main.py -m +experiment/optimization=corner_smoothing \
    'solver.corner_smoothing=interval(0.02,0.35)' Re=1000 N=30 \
    optuna.objective=botella_vortex

# Customize trials and parallelism
uv run python main.py -m +experiment/optimization=corner_smoothing \
    'solver.corner_smoothing=interval(0.02,0.35)' Re=1000 N=30 \
    hydra.sweeper.n_trials=20 hydra.sweeper.n_jobs=8

View results in MLflow under Optuna-CornerSmoothing-{objective}. See docs/optuna_optimization.md for details.

References

About

Spectral Solver for the Lid Driven Cavity Problem

Resources

License

Stars

Watchers

Forks

Contributors