Skip to content

khushalkottaru/airfoil-flow-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NACA Airfoil Solve (Vortex Panel Method)

"The airplane stays up because it doesn't have the time to fall." - Orville Wright

Overview

This is a Computational Fluid Dynamics (CFD) engine built from scratch in Python. It simulates aerodynamic flow over any NACA 4-digit airfoil using the Linear Strength Vortex Panel Method.

Unlike simple ballistic simulators, this engine solves the discretized flow field equations using linear algebra to determine lift, pressure distribution ($C_p$), and streamline trajectories in real-time.

Core Capabilities:

Procedural Geometry: Generates NACA 4-digit airfoils (e.g., 2412, 0015) using cosine spacing for high-resolution leading edges. Physics Engine: Solves the system of linear equations $A\mathbf{x} = \mathbf{b}$ to satisfy the Kutta Condition and flow tangency. Visualization: Renders full flow field streamlines and pressure coefficient heatmaps.

The Physics

The simulator assumes inviscid, incompressible, irrotational flow (Potential Flow).

  1. Geometry Discretization The airfoil surface is discretized into $N$ panels. To capture the extreme curvature of the leading edge, we use the cosine transformation: $$x = \frac{c}{2} (1 - \cos(\beta))$$

  2. Vortex Panel Method We place a vortex sheet of strength $\gamma(s)$ on the airfoil surface. The induced velocity potential $\phi$ must satisfy the Laplace equation: $$\nabla^2 \phi = 0$$ To enforce the No-Penetration Boundary Condition (air cannot flow through the wing), the normal velocity component $V_n$ at every control point must be zero: $$V_{n, \text{induced}} + V_{\infty} \cdot \mathbf{n} = 0$$

  3. The Influence Matrix This creates a system of $N+1$ linear equations, where $A_{ij}$ represents the aerodynamic influence of panel $j$ on panel $i$: $$[A] \cdot [\Gamma] = [RHS]$$ Solving this matrix yields the vortex strength $\Gamma$ for each panel, which is integrated to find the Coefficient of Pressure ($C_p$) and Lift ($C_l$). Note: Due to d'Alembert's paradox for inviscid flow, induced drag is theoretically zero.

Installation

  1. Clone the repository: git clone https://github.com/YOUR_USERNAME/airfoil-flow-sim.git

  2. Install dependencies pip install -r requirements.txt

Usage

CLI Version

Run the main simulation controller: python main.py

Follow the CLI prompts to input your flight parameters, including:

NACA number (e.g., 2412 for a cambered Cessna wing, 0012 for a symmetrical stabilizer) Angle of Attack: (e.g., 5.0 degrees) Chord Length: Scale the wing geometry.

Browser-Based Simulator (Interactive)

A fully interactive web version is available with real-time particle animation and instant parameter feedback.

  1. Navigate to the web directory:
    cd web
  2. Start a local server:
    python3 -m http.server 8080
  3. Open your browser and go to: http://localhost:8080

Web Features:

  • Real-time Controls: Adjust Camber, Thickness, and Angle of Attack on the fly.
  • Particle Animation: Visualize airflow dynamics with animated streamlines.
  • Modern UI: Dark-themed interface with live lift coefficient ($C_l$) updates.

Visualization

The engine produces one primary output:

Flow Field Heatmap: A full Navier-Stokes stlye visual showing velocity streamlines and pressure gradients (Coefficient of Pressure)

About

A python script that uses the vortex panel method and matplotlib to visualize pressure flows around a given NACA airfoil.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors