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: pipe_flow_validation

Figure 16.3 — Example: Pipe Flow Validation

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

What This Example Demonstrates

Validates a cylindrical-pipe FEM simulation against the analytical Hagen-Poiseuille solution (Batchelor 1967 §4.2).

ConceptAPI
Cylindrical pipe meshcreate_pipe_mesh(R, L, n_circ, n_axial)
Stokes solverStokesFlowProblem, FemConfig
Parabolic profile validationComparison with v_z(r) = −(dp/dz)R²/4μ·(1 − (r/R)²)

Key Code Snippet

use cfd_3d::fem::{StokesFlowProblem, StokesFlowSolution};
use cfd_3d::FemConfig;
use cfd_core::prelude::{BoundaryCondition, ConstantPropertyFluid};

// R = 10 mm, L = 100 mm
let pipe_mesh = create_pipe_mesh(0.01, 0.1, 8, 10)?;
let fluid     = ConstantPropertyFluid::<f64>::water_20c()?;
let problem   = StokesFlowProblem::new(&pipe_mesh, &fluid)?;
let solution  = StokesFlowProblem::solve(&problem, &FemConfig::default())?;

Theorem Validated

Hagen-Poiseuille (laminar, fully developed, circular pipe):

v_z(r) = −(dp/dz) · R² / (4μ) · (1 − (r/R)²)
Q       = π R⁴ (−dp/dz) / (8μ)

The numerical peak velocity at the centreline should match the analytical value to within the FEM discretisation error.

Generated Figure

Book Chapter

← Canonical Incompressible Benchmarks