Skip to content
Merged

Hpc #40

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .readthedocs.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions Experiments/01-Validation/README.rst

This file was deleted.

Empty file.
4 changes: 0 additions & 4 deletions Experiments/GALLERY_HEADER.rst

This file was deleted.

76 changes: 27 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,75 +12,53 @@ Comparing Finite Volume and Spectral methods for the incompressible Navier-Stoke
uv sync
```

## Running Solvers
## Usage

The project uses [Hydra](https://hydra.cc/) for configuration management. Run solvers via `run_solver.py`:
```bash
# Run solver + generate plots (default)
uv run python main.py -m +experiment/validation/ghia=fv

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

Pre-defined experiment configurations are in `conf/experiment/`:
# Single run (testing)
uv run python main.py solver=fv N=32 Re=100

```bash
uv run python run_solver.py -m +experiment=fv_validation
# Custom sweeps
uv run python main.py -m solver=fv N=16,32,64 Re=100,400
```

for only plots: pass plot_only=true

Overwriting at runtime:
uv run python run_solver.py -m +experiment=fv_validation N=16,32,64 Re=100
## Configuration


### Configuration Structure
The project uses [Hydra](https://hydra.cc/) for configuration. Structure:

```
conf/
├── config.yaml # Main config (N, Re, tolerance, etc.)
├── config.yaml # Main config (N, Re, tolerance)
├── solver/
│ ├── fv.yaml # FV-specific (alpha_uv, alpha_p, scheme)
│ └── spectral.yaml # Spectral-specific (CFL, beta_squared)
│ ├── fv.yaml # Finite Volume settings
│ └── spectral/ # Spectral solver variants
├── experiment/
│ ├── quick_test.yaml # Fast debugging runs
│ ├── fv_validation.yaml # FV benchmark settings
│ └── spectral_validation.yaml
├── mlflow/
│ ├── local.yaml # File-based tracking (default)
│ └── coolify.yaml # Remote server (Coolify)
└── hydra/
└── launcher/
└── joblib.yaml # Parallel launcher (all cores)
│ └── validation/ghia/ # Ghia benchmark experiments
└── mlflow/
├── local.yaml # File-based tracking (default)
└── coolify.yaml # Remote server
```

## MLflow

Results are tracked with [MLflow](https://mlflow.org/). Two tracking modes are available:

### Local Files (Default)

File-based tracking in `./mlruns` - no setup required:
Results are tracked with [MLflow](https://mlflow.org/):

```bash
uv run python run_solver.py solver=fv mlflow=local
# Local UI
uv run mlflow ui

# View UI
uv run main.py --mlflow-ui
# Remote server
# https://kni.dk/mlflow-ana-p3/
```

### Remote Server (Coolify)

[mlflow-server](https://kni.dk/mlflow-ana-p3/#/experiments)
```bash
# Setup credentials (one-time)
cp .env.template .env
# Edit .env with your credentials

# Run solver
uv run python run_solver.py solver=fv mlflow=coolify
```


## References

- [High-Re solutions for incompressible flow (Ghia et al.)](https://www.sciencedirect.com/science/article/pii/0021999182900584) - Benchmark data
- [Chebyshev pseudospectral multigrid method](https://www.sciencedirect.com/science/article/pii/S0045793009001121) - Spectral method
- [The 2D lid-driven cavity problem revisited](https://www.researchgate.net/publication/222433759_The_2D_lid-driven_cavity_problem_revisited) - Conserved quantities
- [P_N-P_{N-2} spectral method](https://www.sciencedirect.com/science/article/pii/S0743731518305549) - Pressure formulation
- [High-Re solutions for incompressible flow (Ghia et al.)](https://www.sciencedirect.com/science/article/pii/0021999182900584)
- [Chebyshev pseudospectral multigrid method](https://www.sciencedirect.com/science/article/pii/S0045793009001121)
- [The 2D lid-driven cavity problem revisited](https://www.researchgate.net/publication/222433759_The_2D_lid-driven_cavity_problem_revisited)
40 changes: 12 additions & 28 deletions conf/config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
# Main Hydra configuration for LDC solvers
#
# STANDARD USAGE - Always use -m (multirun mode):
#
# Validation:
# uv run python run_solver.py -m +experiment=validation/ghia
#
# Benchmarking:
# uv run python run_solver.py -m +experiment=benchmarking/multigrid_comparison
#
# Quick testing:
# uv run python run_solver.py -m +experiment=testing/quick_test
#
# Custom sweeps:
# uv run python run_solver.py -m solver=fv N=16,32,64 Re=100,400
#
# Override machine for HPC:
# uv run python run_solver.py -m machine=hpc +experiment=validation/ghia
#
# Regenerate plots (separate tool):
# uv run python plot_runs.py +experiment=validation/ghia
#
# Single runs (testing only, no -m flag needed):
# uv run python run_solver.py solver=fv N=32 Re=100
# Usage:
# uv run python main.py -m +experiment/validation/ghia=fv # solve + plot
# uv run python main.py -m +experiment/validation/ghia=fv plot_only=true # plot only
# uv run python main.py solver=fv N=32 Re=100 # single run

defaults:
- problem: ldc
Expand All @@ -30,22 +12,24 @@ defaults:
- machine: local
- _self_

# Grid size (must be set by experiment or command line)
# Grid size
N: 32

# Solver control (taken from solver config)
tolerance: ${solver.tolerance}
max_iterations: ${solver.max_iterations}
# Solver control
tolerance: 1.0e-6
max_iterations: 100000

# Default experiment name (typically overridden by experiment config)
# Experiment naming
experiment_name: LDC-Dev
sweep_name: dev-run

# Plot-only mode (skip solving, regenerate plots from existing runs)
plot_only: false

# =============================================================================
# Hydra output paths and callbacks
# =============================================================================
hydra:
# Always use multirun mode by default
mode: MULTIRUN
run:
dir: hydra_outputs/runs/${now:%d-%m-%y}/${now:%H:%M:%S}
Expand Down
27 changes: 0 additions & 27 deletions conf/experiment/validation/corner_treatment.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion conf/experiment/validation/ghia/fv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ hydra:
sweeper:
params:
# Sweep over FV grid sizes
N: 32,64
N: 32
Re: 100
4 changes: 2 additions & 2 deletions conf/experiment/validation/ghia/spectral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ hydra:
sweeper:
params:
# Sweep over spectral solver types
solver: spectral/sg,spectral/fsg
solver: spectral/fsg #,spectral/fsg
Re: 100
N: 15
N: 27
17 changes: 17 additions & 0 deletions conf/experiment/validation/hpc-fv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @package _global_
# Ghia validation - Finite Volume solver

defaults:
- override /solver: fv

# MLflow experiment
experiment_name: LDC-Validation
sweep_name: Hpc-baseline-fv

hydra:
sweeper:
params:
N: 128
Re: 100, 400, 1000
# Relaxation parameter sweep

20 changes: 14 additions & 6 deletions conf/solver/fv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
_target_: solvers.fv.solver.FVSolver
name: fv

# Problem parameters (interpolated from root config)
Re: ${Re}
lid_velocity: ${lid_velocity}
Lx: ${Lx}
Ly: ${Ly}
nx: ${N}
ny: ${N}

# Solver control
tolerance: 1.0e-6
max_iterations: 10000 # FV typically needs more iterations than spectral
tolerance: ${tolerance}
max_iterations: ${max_iterations}

# FV-specific parameters
convection_scheme: Upwind
convection_scheme: TVD
limiter: MUSCL
alpha_uv: 0.6 # velocity under-relaxation
alpha_p: 0.4 # pressure under-relaxation
linear_solver_tol: 1.0e-6 # SciPy linear solver tolerance
alpha_uv: 0.4 # velocity under-relaxation
alpha_p: 0.2 # pressure under-relaxation
linear_solver_tol: 1.0e-9
12 changes: 10 additions & 2 deletions conf/solver/spectral/sg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
_target_: solvers.spectral.sg.SGSolver
name: spectral

# Problem parameters (interpolated from root config)
Re: ${Re}
lid_velocity: ${lid_velocity}
Lx: ${Lx}
Ly: ${Ly}
nx: ${N}
ny: ${N}

# Solver control
tolerance: 1.0e-6
max_iterations: 30000 # Spectral methods converge slowly for high Re
tolerance: ${tolerance}
max_iterations: ${max_iterations}

# Spectral-specific parameters
basis_type: chebyshev # "chebyshev" or "legendre"
Expand Down
2 changes: 1 addition & 1 deletion docs/reports/TexReport
Submodule TexReport updated from 7b5c1f to 5a8cb0
4 changes: 0 additions & 4 deletions docs/source/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,3 @@
{% endif %}
{% endblock %}

{% block examples %}
.. include:: ../gen_modules/backreferences/{{ fullname }}.examples
:start-line: 1
{% endblock %}
12 changes: 0 additions & 12 deletions docs/source/api/base_solver.rst

This file was deleted.

19 changes: 0 additions & 19 deletions docs/source/api/datastructures.rst

This file was deleted.

12 changes: 0 additions & 12 deletions docs/source/api/fv_solver.rst

This file was deleted.

14 changes: 0 additions & 14 deletions docs/source/api/solvers.rst

This file was deleted.

12 changes: 0 additions & 12 deletions docs/source/api/spectral_solver.rst

This file was deleted.

Loading
Loading