A 2D panel code with integral boundary layer based on Mark Drela's tools - modern, high-performance airfoil analysis engine written in Rust, compiling to WebAssembly for real-time (60 Hz) web-based interaction.
FlexFoil (RustFoil core) is a ground-up rewrite of Mark Drela's XFOIL, architected from the start to support:
- Multi-body configurations (slats, main wing, flaps)
- Real-time feedback during geometry manipulation
- WebAssembly output for browser-based UIs
- Modern Rust idioms with strong type safety
┌─────────────────────────────────────────────────────────────────┐
│ Applications │
├─────────────────────┬─────────────────────┬─────────────────────┤
│ rustfoil-wasm │ rustfoil-cli │ flexfoil-ui │
│ WASM/JS bindings │ Dev/testing CLI │ React frontend │
├─────────────────────┴─────────────────────┴─────────────────────┤
│ rustfoil-solver │
│ • Inviscid panel method (Phase 2) │
│ • Boundary layer equations (Phase 3) │
│ • Viscous-inviscid interaction (Phase 4) │
├─────────────────────────────────────────────────────────────────┤
│ rustfoil-core │
│ • Geometry types (Point, Panel, Body) │
│ • Cubic spline interpolation │
│ • Coordinate I/O │
└─────────────────────────────────────────────────────────────────┘
flexfoil/
├── Cargo.toml # Workspace root
├── crates/
│ ├── rustfoil-core/ # Geometry, splines, core types
│ ├── rustfoil-solver/ # Panel method, BL, VII
│ ├── rustfoil-wasm/ # WebAssembly bindings
│ └── rustfoil-cli/ # Command-line tool
├── flexfoil-ui/ # React + TypeScript frontend
└── testdata/ # Sample airfoil files
# Build all crates
cargo build --release
# Run tests
cargo test
# Build WASM (requires wasm-pack)
cd crates/rustfoil-wasm
wasm-pack build --target webcd flexfoil-ui
npm install
npm run dev# Analyze an airfoil at 5° angle of attack
cargo run --bin rustfoil -- analyze testdata/naca0012.dat --alpha 5.0
# Generate a polar
cargo run --bin rustfoil -- polar testdata/naca0012.dat --alpha-start -5 --alpha-end 15
# Repanel with cosine spacing
cargo run --bin rustfoil -- repanel testdata/naca0012.dat --panels 100import init, { RustFoil, analyze_airfoil } from 'rustfoil-wasm';
await init();
// Quick one-shot analysis
const coords = [1.0, 0.0, 0.5, 0.1, 0.0, 0.0, 0.5, -0.1, 1.0, 0.0];
const result = analyze_airfoil(coords, 5.0);
console.log(`Cl = ${result.cl}`);
// Interactive usage
const foil = new RustFoil();
foil.set_coordinates(coords);
foil.set_alpha(5.0);
const solution = foil.solve();- Geometry types (
Point,Panel,Body) - Cubic spline interpolation
- XFOIL-exact NACA generator
- XFOIL-exact paneling (PANGEN)
- WASM bridge
- Coordinate file I/O (Selig, Lednicer formats)
- Linear vorticity panel method (PSILIN)
- Kutta condition
- Blunt TE handling
- XFOIL-exact Cl/Cm
- Wake modeling
- Multi-body interactions
- Real-time Cp display
- Thwaites method (laminar)
- Head/Green method (turbulent)
- Transition prediction (eN)
- Separation detection
- Global Newton-Raphson
- Transpiration velocity
- Convergence acceleration
- Multi-body viscous
- Wake interaction
- Inverse design
- X-axis: Downstream (freestream direction). LE at x≈0, TE at x≈1.
- Y-axis: Upward. Upper surface has positive y.
- Panel ordering: Counter-clockwise from TE lower to TE upper.
nalgebra- Linear algebra (SIMD-optimized)wasm-bindgen- JavaScript interopserde- Serialization for WASM
- Inviscid solve: < 16ms for 200 panels (60 Hz capable)
- WASM bundle: < 500 KB gzipped
- Drela, M. "XFOIL: An Analysis and Design System for Low Reynolds Number Airfoils" (1989)
- Katz, J. & Plotkin, A. "Low-Speed Aerodynamics" (2001)
- Cebeci, T. & Bradshaw, P. "Momentum Transfer in Boundary Layers" (1977)
FlexFoil is licensed under the MIT License.
Copyright (c) 2026 Flexcompute, Inc. and Harry Smith.
This repository includes third-party components and references commercial dependencies. See THIRD_PARTY_NOTICES.md for details on AG Grid Enterprise, the TWK Everett typeface, and other attributions.