Skip to content

About

An interactive 2D airfoil aerodynamics simulator built from scratch in Python. It solves the incompressible potential-flow field around an airfoil with a Hess–Smith panel method and lets you explore lift, pressure, and streamlines in real time in your browser.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

44 Commits

Folders and files

Repository files navigation

aerosim — Aerodynamic Simulation 2D

License: MIT Python 3.12+

An interactive 2D airfoil aerodynamics simulator built from scratch in Python. It solves the incompressible potential-flow field around an airfoil with a Hess–Smith panel method and lets you explore lift, pressure, and streamlines in real time in your browser. The solver is the Python package aerosim, in src/aerosim/.

preview

Flow around the bundled golf ball at zero angle of attack

Quick start

You need uv; on first run it fetches Python 3.12 and every dependency for you.

git clone https://github.com/markccchiang/Aerodynamic-Simulation-2D.git
cd Aerodynamic-Simulation-2D
uv run python src/web.py         # launch the web UI -> http://127.0.0.1:8000
uv run python src/validate.py    # run the physics validation suite

Drag the sliders to change the angle of attack, Reynolds number, and the NACA 4-digit shape (MPXX = camber %, camber position, thickness %), or load your own airfoil (see Loading airfoils). The flow field, surface pressure plot, and the lift/drag/moment coefficients all update live.

To drive the solver from your own script or notebook instead, see Using the solver from Python.

Documentation

Guide What it covers
Web UI how to use the browser front-end, control by control, with screenshots
Using the solver from Python importing aerosim in scripts and notebooks, a worked example, and what a solve returns
Loading airfoils Selig and Lednicer .dat files, the bundled samples, and the circle / golf-ball pair
How it works the panel method, the viscous drag correction, and two-way coupling
Architecture the three layers, how data flows through them, and the design decisions behind them
Validation what src/validate.py checks, group by group
Development project layout and possible next steps
References the textbooks, papers and data sources behind each method

Building the Sphinx docs

The aerodynamic theory behind all of it — the governing equations, why a panel method solves them, the integral boundary-layer method, the viscous–inviscid coupling, and how the validation cases are chosen — is written up in full as Sphinx documentation under docs/. Sphinx and its theme are in the project's dev dependency group, so uv sync installs them:

uv sync                                        # installs the docs toolchain (dev group)
uv run sphinx-build -M html docs docs/_build   # build -> docs/_build/html/index.html
./open-html.sh                                 # open it in a browser (macOS or Linux)

cd docs && uv run make html does the same build through the Makefile. The figures are generated by running the solver at build time, so they always match the code — which also means that after changing the physics you should rebuild from clean (rm -rf docs/_build first), or figures cached by the previous build survive. A clean build should finish with zero warnings.

License

Released under the MIT License — free to use, modify and redistribute, including in commercial and closed-source work, provided the copyright notice travels with it. Every dependency is permissively licensed as well (NumPy, SciPy and uvicorn under BSD, FastAPI and pydantic under MIT, matplotlib under the PSF licence, and Plotly.js under MIT), so there is no copyleft obligation anywhere in the stack.

About

An interactive 2D airfoil aerodynamics simulator built from scratch in Python. It solves the incompressible potential-flow field around an airfoil with a Hess–Smith panel method and lets you explore lift, pressure, and streamlines in real time in your browser.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages