Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Example: cavity_validation

Figure 16.2 — Example: Cavity Validation

Crate: cfd-suite (workspace root)
Run: cargo run --example cavity_validation
Source: examples/cavity_validation.rs

What This Example Demonstrates

Validates the vorticity-stream solver against Ghia, Ghia & Shin (1982) benchmark data for lid-driven cavity flow at Re = 100.

ConceptAPI
Unit-square structured gridStructuredGrid2D::<f64>::unit_square(nx, ny)
Vorticity-stream configurationVorticityStreamConfig::<f64>::default()
Lid-driven boundary conditionssolver.initialize_lid_driven_cavity(1.0)
Time-marchingsolver.step()

Key Code Snippet

use cfd_2d::grid::StructuredGrid2D;
use cfd_2d::physics::vorticity_stream::{VorticityStreamConfig, VorticityStreamSolver};

let grid = StructuredGrid2D::<f64>::unit_square(41, 41)?;

let mut config = VorticityStreamConfig::<f64>::default();
config.base.convergence.max_iterations = 10000;
config.base.convergence.tolerance = 1e-6;

let mut solver = VorticityStreamSolver::new(config, &grid, 100.0); // Re = 100
solver.initialize_lid_driven_cavity(1.0)?;

for _ in 0..1000 { solver.step()?; }

Validation Data

The Ghia et al. Re = 100 vertical-centreline u-velocity benchmark points used here:

y/Hu (ref)
1.0001.00000 (lid)
0.9530.68717
0.500−0.20581 (centre)
0.055−0.03717
0.0000.00000 (wall)

Generated Figure

Book Chapter

← Canonical Incompressible Benchmarks