CFD Simulation Mathematical Foundations

Overview

This document provides the mathematical foundations and references for each function in multigrid_corrected.c, which implements a lid-driven cavity flow simulation using the vorticity-streamfunction formulation of the Navier-Stokes equations.

1. Main Governing Equations

Mathematical Formulation:

Velocity-Streamfunction Relations:

References:

  • Ghia, U., Ghia, K.N., Shin, C.T. (1982). “High-Re solutions for incompressible flow using the Navier-Stokes equations and a multigrid method.” Journal of Computational Physics, 48(3), 387-411.
  • Peyret, R., Taylor, T.D. (1983). Computational Methods for Fluid Flow. Springer-Verlag.

2. Function-by-Function Analysis

2.1 compute_boundary_conditions()

Purpose: Apply no-slip boundary conditions for vorticity and streamfunction

Mathematical Foundation:
For no-slip walls, the vorticity boundary condition is derived from:

Discretized Forms:

Bottom Wall (stationary):

Top Wall (moving lid with ):

Left/Right Walls (stationary):

Streamfunction Boundary Conditions:

References:

  • Fletcher, C.A.J. (1988). Computational Techniques for Fluid Dynamics Vol. II. Springer-Verlag, Chapter 9.
  • Anderson, J.D. (1995). Computational Fluid Dynamics: The Basics with Applications. McGraw-Hill, Chapter 7.

2.2 solve_poisson_sor()

Purpose: Solve the Poisson equation using SOR method

Mathematical Foundation:
The 2D Poisson equation is discretized using a 5-point stencil:

SOR Update Formula:

where is the relaxation parameter.

References:

  • Young, D.M. (1971). Iterative Solution of Large Linear Systems. Academic Press.
  • Varga, R.S. (2000). Matrix Iterative Analysis. Springer-Verlag, Chapter 4.

2.3 compute_convection()

Purpose: Compute convection terms

Mathematical Foundation:
Using 2nd order central differences:

Velocity Computation:

Vorticity Gradients:

Convection Term:

References:

  • Roache, P.J. (1998). Fundamentals of Computational Fluid Dynamics. Hermosa Publishers, Chapter 3.
  • Hirsch, C. (1988). Numerical Computation of Internal and External Flows Vol. 1. John Wiley & Sons, Chapter 5.

2.4 solve_vorticity_adi()

Purpose: Solve vorticity transport equation using explicit method

Mathematical Foundation:
The vorticity transport equation is discretized as:

Diffusion Terms (2nd order central difference):

Update Formula:

Stability Condition:

References:

  • Smith, G.D. (1985). Numerical Solution of Partial Differential Equations: Finite Difference Methods. Oxford University Press, Chapter 3.
  • Morton, K.W., Mayers, D.F. (2005). Numerical Solution of Partial Differential Equations. Cambridge University Press, Chapter 2.

2.5 compute_velocities()

Purpose: Compute velocity components from streamfunction

Mathematical Foundation:
Direct application of velocity-streamfunction relations:

Interior Points:

Boundary Conditions:

  • Top wall (moving lid): ,
  • Bottom, left, right walls: , (no-slip)

References:

  • Batchelor, G.K. (2000). An Introduction to Fluid Dynamics. Cambridge University Press, Chapter 2.
  • White, F.M. (2006). Viscous Fluid Flow. McGraw-Hill, Chapter 3.

3. Numerical Method Classification

Method Type: Fractional Step Method with Vorticity-Streamfunction Formulation

Algorithm Structure:

  1. Step 1: Update vorticity using transport equation (explicit)
  2. Step 2: Apply vorticity boundary conditions
  3. Step 3: Solve Poisson equation for streamfunction (SOR)
  4. Step 4: Compute velocities from streamfunction
  5. Step 5: Check convergence and repeat

Overall Method References:

  • Chorin, A.J. (1967). “A numerical method for solving incompressible viscous flow problems.” Journal of Computational Physics, 2(1), 12-26.
  • Kim, J., Moin, P. (1985). “Application of a fractional-step method to incompressible Navier-Stokes equations.” Journal of Computational Physics, 59(2), 308-323.

4. Convergence and Stability Analysis

Stability Conditions

CFL Condition (Convection):

Diffusion Stability:

Current Parameters:

Convergence Criterion

References:

  • Courant, R., Friedrichs, K., Lewy, H. (1928). “Über die partiellen Differenzengleichungen der mathematischen Physik.” Mathematische Annalen, 100(1), 32-74.
  • Von Neumann, J., Richtmyer, R.D. (1950). “A method for the numerical calculation of hydrodynamic shocks.” Journal of Applied Physics, 21(3), 232-237.

5. Benchmark Problem

Ghia et al. (1982) Lid-Driven Cavity

Problem Setup:

  • Square cavity:
  • Top wall: , (moving lid)
  • Other walls: (no-slip)
  • Reynolds number:

Expected Results at :

Grid Resolution: (matching Ghia et al.)

References:

  • Ghia, U., Ghia, K.N., Shin, C.T. (1982). “High-Re solutions for incompressible flow using the Navier-Stokes equations and a multigrid method.” Journal of Computational Physics, 48(3), 387-411.

Summary

This implementation uses well-established numerical methods:

  • Time Integration: Explicit finite difference
  • Spatial Discretization: 2nd order central differences
  • Poisson Solver: SOR iterative method
  • Boundary Conditions: Accurate no-slip implementation

The code follows the mathematical formulations presented in the referenced literature and implements numerically stable algorithms suitable for high Reynolds number flows.