This project implements panel methods for simulating 2D potential flow around airfoils, written in Rust. Panel methods are a popular numerical technique in aerodynamics, offering a way to compute flow fields, lift, and other aerodynamic properties for streamlined bodies.
Having primarily worked with Rust to build CLI and system-level tools, mainly for embedded devices; this project allows me to expand into scientific and graphical applications using Rust. The purpose of this project is to experiment with a relatively complex task that blends mathematics, aerodynamics, and programming.
Status: This is a Work in Progress (WIP).
-
Airfoil Generation:
- Generates 2D airfoil shapes from NACA 4-digit series (e.g.,
NACA 0012
). - Uses mean camber line and thickness distribution equations to build airfoil surfaces.
- Generates 2D airfoil shapes from NACA 4-digit series (e.g.,
-
Panel Definition:
- Divides airfoil geometry into panels with control points and normal vectors.
-
Panel Method Solver:
- Implements a source-panel method for potential flow.
- Solves a linear system of equations to compute panel strengths.
- Includes freestream influence and angle of attack.
-
Pressure Distribution:
- Calculates pressure coefficients (
$C_p$ ) along the airfoil surface. - Differentiates between upper and lower surfaces.
- Calculates pressure coefficients (
-
Performance Metrics:
- Computes aerodynamic coefficients:
- Lift Coefficient (
$C_L$ ) -
Drag Coefficient (
$C_D$ ) (from panel solutions, viscous effects not included) -
Moment Coefficient (
$C_M$ ) (about the quarter-chord).
- Lift Coefficient (
- Computes aerodynamic coefficients:
-
Streamline Visualization:
- Calculates streamlines starting from specified points in the flow field.
- Displays velocity variations along streamlines.
- 4th order Runge-Kutta (RK4) numerical integration for solving streamlines and velocity fields.
-
Velocity Field Visualization:
- Generates a velocity field using a user-defined grid density.
- Displays vectors scaled by velocity magnitude.
-
Graphical Interface:
- Built with
eframe
/egui
for an interactive UI. - Includes adjustable sliders for parameters like:
- Angle of attack.
- Freestream velocity.
- Grid density for velocity fields.
- Interactive plots using
egui_plot
.
- Built with
-
Improved Solver:
- Extend panel method to include vortex panels for handling lifting flows more accurately.
- Account for leading-edge and trailing-edge flow features.
-
Boundary Conditions:
- Improve influence coefficient calculations for higher precision.
-
Viscous Effects:
- Implement an approximation for boundary layer and drag due to viscosity.
-
3D Extension:
- Experiment with lifting-line theory or a 3D panel method for finite wings.
-
Interactive Airfoil Design:
- Allow users to define custom airfoil shapes or load geometry from files.
-
Performance Visualization:
- Add visual comparisons of lift and drag for different airfoils and flow conditions.
-
Optimized Numerical Methods:
- Use parallel computing for large grids or higher panel resolutions.
-
Validation:
- Compare results with CFD software or analytical solutions for benchmark cases.
-
Clone the repository:
git clone https://github.com/boulama/flowvisualizer.rs cd flowvisualizer.rs
-
Build and run the application:
cargo run --release
-
Use the interactive GUI to:
- Input a NACA code (e.g.,
0012
) to generate an airfoil. - Adjust flow conditions, such as angle of attack and velocity.
- Visualize results like streamlines, pressure distribution, and velocity fields.
- Input a NACA code (e.g.,
-
eframe
andegui
: For GUI and plotting. -
nalgebra
: For vector and matrix operations. -
egui_plot
: For creating interactive plots. -
std::f64::consts
: For constants like$\pi$ .
This project is open for contributions! If you have ideas for enhancements or want to tackle a specific feature, feel free to fork the repository and submit a pull request.
- NACA equations
- VI. The Panel Method: An Introduction
- Inspiration for panel methods from classic the classic Fundamentals of Aerodynamics by John D. Anderson.
This project is licensed under GLWTPL. See LICENSE for details.