Quick Start
Running FLOWFoil can be done simply with a single method: analyze
As an introductory example, we will do a quick analysis of a NACA 2412 airfoil, with coordinates from one of the available methods in the Airfoil Tools sub-module.
using FLOWFoil
# note: 2412 is default for the NACA 4-series implemenation
x, y = AirfoilTools.naca4()
Let's plot the geometry.
# plot geometry
using Plots
using LaTeXStrings
plot(x, y; aspectratio=1, xlabel=L"x", ylabel=L"y", label="")
AirfoilTools generates airfoil coordinates in the format required for FLOWFoil: starting at the trailing edge, and proceeding clockwise around the airfoil.
Let's finalize the required inputs and run the analysis.
# choose one or more angles of attack
angles_of_attack = range(-5.0, 15.0, step=1)
# analyze
outputs = analyze(x, y, angles_of_attack)
InviscidOutputs{Matrix{Float64}, Matrix{Float64}}([-0.692908072768445 -0.693410570940044 … -0.6665000542356019 -0.6630363805898698; -0.7421458177431778 -0.7424731035418649 … -0.7099266288458351 -0.7060179988575187; … ; 0.7437749192652325 0.7445314515351956 … 0.7194790365405201 0.715965790318729; 0.692908072768445 0.693410570940044 … 0.6665000542356019 0.6630363805898698], [0.5198784026923193 0.5191817801086023 … 0.5557776777039398 0.5603827580142853; 0.4492195852063099 0.44873369051691114 … 0.4960041816555879 0.5015385852892247; … ; 0.4467988694719969 0.4456729176748947 … 0.4823499159787249 0.48739298709327783; 0.5198784026923193 0.5191817801086023 … 0.5557776777039398 0.5603827580142853], [-0.34847343924627333; -0.22779847891023175; … ; 1.920635973633535; 2.036390246875408;;], [0.0005166916701355766; 0.00048227845938455583; … ; 0.0008839264682033214; 0.0009596330988955496;;], [-0.048888114413008735; -0.05019850205092147; … ; -0.07593956183481992; -0.07737833053996138;;])
And then we can plot some outputs, for example, the pressure distribution.
# plot pressure distribution at the 6th angle of attack.
plot(x, outputs.cp[:, 6]; xlabel=L"x", ylabel=L"c_p", yflip=true, label="")
Or the lift and drag polars.
# plot lift
pcl = plot(angles_of_attack, outputs.cl, xlabel=L"\alpha", ylabel=L"c_\ell", label="")
pcd = plot(angles_of_attack, outputs.cd, xlabel=L"\alpha", ylabel=L"c_d", label="")
plot(pcl, pcd; size=(900,300))
Output structures depend on the method selected, but in general you'll get lift (cl) and drag (cd) and some other values depending on the method. In this case, we are using the default Xfoil method and the outputs are an InviscidOutputs
type, which all of the non-wrapped methods use currently:
FLOWFoil.InviscidOutputs
— TypeInviscidOutputs
Note: not all methods return values for all outputs. Methods will return zeros in such cases.
Fields
vs
: surface velocities normalized by freestream velocity on each body, nominally a matrix, but becomes a vector of matrices in the multi-body case with dimensions [body][panel,angle]cp
: pressure coefficient for each panel of each body, becomes a vector of matrices in the multi-body case with dimensions [body][panel,angle]cl
: lift coefficient of each body, nominally a vector but becomes a matrix in the multi-body case with dimensions angle x bodycd
: Inviscid drag coefficient of each body (simply integral of pressure coefficient in x direction), but becomes a matrix in the multi-body case with dimensions angle x bodycm
: moment coefficient of each body, but becomes a matrix in the multi-body case with dimensions angle x body
See Tutorials for the various methods and additional output structure types.