This is Ptera Software: a fast, easy-to-use, and open-source package for analyzing flapping-wing flight.
In late 2018, I became curious about biological flight. To sate this curiosity, I wanted to computationally simulate some flapping-wing fliers. I quickly realized I had two options:
Neither of these seemed like the right choice.
Thankfully, my friend, Peter Sharpe, had just released his own open-source aerodynamics solver: AeroSandbox. With his support, I have used AeroSandbox as a jumping-off point to develop a solver package capable of unsteady simulations.
Through the combined efforts of Peter Sharpe, Suhas Kodali, and me, Ptera Software was born. It is an easy-to-use, open-source, and actively-maintained UVLM package capable of analyzing flapping-wing flight. Moreover, it's written in Python, is well documented, tested, and validated.
Beginning with version 3.0.0, Ptera Software also includes a GUI developed by Zach Tait. Although it is still rudimentary, we hope that it will help make this tool accessible to even more users.
With your help, I hope we will increase the open-source community's interest and understanding of biological flight.
First things first, you will need a copy of Python 3.8. Python 3.9 is not yet supported due to a dependency issue in VTK. Download Python 3.8 from the official Python website. At this time, I do not recommend using a version from the Anaconda distribution as it could introduce compatibility issues with PyPI.
There are two ways to use Ptera Software. The first is by downloading GitHub release, which will provide you your own copy of the source code, in which you can get a feel for how it works (this can also be accomplished by forking the main branch). The second is by importing the Ptera Software package using PyPI, which will allow you to call Ptera Software's functions in your own scripts. If you are new to this tool, I recommend first downloading a release, as this will give you access to the "examples" directory.
Next, make sure you have an IDE in which you can run Ptera Software. I recommend using the Community Edition of PyCharm, which is free, powerful, and well documented. If you've never set up a Python project before, follow this guide to set up a new project in PyCharm. If you'll be downloading a release, follow that tutorial's "Open an existing project guide." Otherwise, follow the "Create a new project guide."
To download a release, navigate to the releases page and download the latest zipped directory. Extract the contents, and set up a python project as described in the PyCharm tutorial.
Then, open a command prompt window in your project's directory and enter:
pip install -r requirements.txt
via the command prompt in your fork's directory. You may also want to run:
pip install -r requirements_dev.txt
if you plan on making significant changes to the software.
Finally, open the "examples" folder, which contains several heavily commented scripts that demonstrate different features and simulations. Read through each example, and then run them to admire their pretty output!
If you wish to use this package as a dependency in your own project, simply run:
pip install pterasoftware
via the command prompt in your project's directory. Then, in a script that you'd like to use features from Ptera Software, add:
import pterasoftware as ps
If you haven't previously downloaded Ptera Software's source code, you can also learn about the available functions by reading their docstrings, which should be fetched automatically by many IDEs. Otherwise, you can return to the GitHub and read through the docstrings there.
I am hoping to implement a web-based documentation guide soon! If you'd like to contribute to this, feel free to open a feature request issue and start a conversation!
Not to worry! I've made a video that walks through getting Ptera Software up and running. It includes every step, from downloading Python for the first time to setting up your IDE to running the software. If you still run into problems, feel free to open an issue for guidance.
The following code snippet is all that is needed (after running pip install pterasoftware) to run the steady horseshoe solver on an airplane with custom geometry.
import pterasoftware as ps
airplane = ps.geometry.Airplane(
wings=[
ps.geometry.Wing(
symmetric=True,
wing_cross_sections=[
ps.geometry.WingCrossSection(
airfoil=ps.geometry.Airfoil(name="naca2412"),
),
ps.geometry.WingCrossSection(
y_le=5.0,
airfoil=ps.geometry.Airfoil(name="naca2412"),
),
],
),
],
)
operating_point = ps.operating_point.OperatingPoint()
problem = ps.problems.SteadyProblem(
airplanes=[airplane], operating_point=operating_point
)
solver = (
ps.steady_horseshoe_vortex_lattice_method.SteadyHorseshoeVortexLatticeMethodSolver(
steady_problem=problem
)
)
solver.run()
ps.output.draw(solver=solver, scalar_type="lift", show_streamlines=True)
This package currently supports three different solvers, a steady horseshoe vortex lattice method (VLM), a steady ring VLM, and an unsteady ring VLM (UVLM). Here are examples of the output you can expect to receive from each of them.
Here are the requirements necessary to run Ptera Software:
Additionally, these packages are useful for continued development of the software:
Since the release of version 1.0.0, Ptera Software is now validated against experimental flapping-wing data! See the "validation" directory to run the test case and read a report on the software's accuracy.
As I said before, the primary goal of this project is to increase the open-source community's understanding and appreciation for unsteady aerodynamics in general and flapping-wing flight in particular. This will only happen through your participation. Feel free to request features, report bugs or security issues, and provide suggestions. No comment is too big or small!
Here is a list of changes I would like to make in the coming releases. If you want to contribute and don't know where to start, this is for you!
Here is a list of all the people and packages that helped me created Ptera Software in no particular order. Specific citations can be found in the source code's docstrings where applicable.
To the best of my ability, I am following SemVer conventions in naming my releases. I am also using the GitFlow method of branching for this project's development. This means that nightly builds will be available on the develop branch. The latest stable releases can be found on the master branch.