Tutorials

FLOWFoil includes various panel method implementations that are available based on the method keyword argument. The analyze function is the way to run analyses with any method available in FLOWFoil, you just need to select the method you want and provide any additionally required inputs.

FLOWFoil.analyzeFunction
analyze(coordinates, flow_angles=0.0; method::Method=Xfoil())
analyze(x, y, flow_angles=0.0; method::Method=Xfoil())

Convenience function for setting up, solving, and post-processing airfoils and airfoil systems.

Arguments

  • coordinates::NTuple{Matrix{Float}} : Tuple of [x y] matrices of airfoil coordinates (may be a single matrix as well)
  • flow_angles::Vector{Float} : Vector of angles of attack in degrees (may be a single float as well)

OR

  • x::Vector{Float} : Vector of x-coordinates of airfoil geometry
  • y::Vector{Float} : Vector of y-coordinates of airfoil geometry
  • flow_angles::Vector{Float} : Vector of angles of attack in degrees (may be a single float as well)

Note that inputting separate vectors for airfoil coordinates is only available for analysis of single airfoils/bodies. Multi-airfoil/body systems require the use of a tuple of matrices for coordinate inputs.

Keyword Arguments

  • method::MethodType : desired method for solving

Returns

  • outputs::OutputType : outputs object (note that only inviscid methods are currently implemented)
source

Xfoil (inviscid) Method

An Xfoil-like method, actually based on Xfoil can be accessed using the Xfoil method type:

Note that we have also set Xfoil=Xfoil so you can also use the Xfoil method type with identical results. Currently, this method only includes the inviscid methods of Xfoil/Xfoil.

using FLOWFoil

x, y = AirfoilTools.naca4()

angles_of_attack = range(-5.0, 15.0; step=1)

# viscous solver not yet implemented
method = Xfoil(viscous=false)

outputs = analyze(x, y, angles_of_attack; method=method)
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;;])

Currently, the Xfoil method outputs are of type InviscidOutputs. This is also the default method used in the Quick Start.

FLOWFoil.XfoilType
Xfoil <: Method

Fields

  • viscous::Bool : Flag whether to run an inviscid (false) or viscous (true) analysis.

NOTE: viscous method not yet implemented.

source

Lewis' Method for Axisymmetric Bodies

An axisymmetric method based on the one described by Lewis can be accessed using the Lewis method type:

using FLOWFoil

# Since this is an axisymmetric method, we'll use r instead of y
x, r = AirfoilTools.naca4()

# give the duct some diameter so it doesn't have negative radial dimensions (see warning below)
r .+= 1.0

# indicate that the body is not a body of revolution (i.e. a duct)
method = Lewis(; body_of_revolution=false)

# note: we need to input an an angle of attack, even though it is unused in this method.
outputs = analyze(x, r, 0.0; method=method)
InviscidOutputs{Matrix{Float64}, Matrix{Float64}}([-0.7169024195697365; -0.7767614729891857; … ; 0.7525392894347069; 0.7169024195697365;;], [0.4860509208150574; 0.39664161407967047; … ; 0.4336846178571063; 0.4860509208150574;;], [0.0;;], [0.0;;], [0.0;;])

The comments here mention multiple bodies, for more information, see the multi-body example: Axisymmetric Mutli-element Systems on the next page.

The outputs for the Lewis method are also of type InviscidOutputs.

FLOWFoil.LewisType
Lewis <: Method

Fields

  • body_of_revolution::AbstractVector{Bool} : Flag(s) whether bodies are bodies of revolutions or not (false indicates an annular airfoil)

Note that if multiple bodies are used, the annular airfoil should come before the body of revolution.

source
Warning

No part of the geometry for an axisymmetric body can reside below z=0, otherwise an error will be thrown.

Martensen's Method for Axial Cascades

A periodic method for cascade analysis based on that developed by Martensen can be accessed using the Martensen method type:

using FLOWFoil

x, y = AirfoilTools.naca4()

angles_of_attack = range(-5.0, 15.0; step=1)

# The cascade method requires solidity (closeness) of sections and stagger (inflow angle - angle of attack)
method = Martensen(solidity=1.2, stagger=15.0)

outputs = analyze(x, y, angles_of_attack; method=method)
InviscidOutputs{Matrix{Float64}, Matrix{Float64}}([-0.7544599115670331 -0.7538202145476082 … -0.7035661149684265 -0.6986759587790516; -0.8179805047363827 -0.8172754670032392 … -0.7625875831073949 -0.7572748835260454; … ; 0.791451840049013 0.7907925155056825 … 0.7382816274393047 0.7331627666146286; 0.8179805047363827 0.8172754670032392 … 0.7625875831073949 0.7572748835260454], [0.43079024183826464 0.431755084139398 … 0.5049947218682349 0.511851904624173; 0.33090789387121256 0.33206081103463736 … 0.418460178090422 0.4265347507806143; … ; 0.3736039848830315 0.3746471974201948 … 0.45494023858557164 0.4624723576499835; 0.33090789387121256 0.33206081103463736 … 0.418460178090422 0.4265347507806143], [-0.0936580537854433; -0.06445079787747295; … ; 0.46516960393119644; 0.49552656511147086;;], [0.0; 0.0; … ; 0.0; 0.0;;], [0.0; 0.0; … ; 0.0; 0.0;;])

The InviscidOutputs type is also used for the Martensen method.

FLOWFoil.MartensenType
Martensen <: Method

Fields

  • cascade::Bool=true : flag to apply cascade treatment or not
  • solidity::Float=0.0 : Ratio between airfoil chord length and pitch. Airfoil pitch is simply the distance between chordlines in the cascade.
  • stagger::Float=0.0 : Angle (in degrees) from axis of rotation to airfoil chordline. Note that stagger is equivalent to the inflow angle minus the angle of attack.
  • transition_value::Float=Inf : pitch to chord ratio at which we stop applying cascade effects (Lewis uses 30 in his implementation)
  • curvature_correction::Bool=false : flag to apply curvature correction from Lewis
source
Note

If the cascade option is set to false, this method becomes a standard planar airfoil method, but uses constant vortices, so the Xfoil method is the superior method in that case.

NeuralFoil Method

NeuralFoil is a multi-layer perceptron model of Xfoil. We provide the Neuralfoil Method through the NeuralFoil method type and is accessed through the NeuralFoil.jl package:

using FLOWFoil

x, y = AirfoilTools.naca4()

angles_of_attack = range(-5.0, 15.0; step=1)

reynolds = 2e6
mach = 0.0

method = NeuralFoil(reynolds, mach; model_size="xlarge", n_crit=9.0, xtr_upper=1.0, xtr_lower=1.0)

outputs = analyze([x y], angles_of_attack; method=method)
NeuralFoil.NeuralOutputs{Matrix{Float64}, Vector{Float64}}([0.9658690711181539, 0.9652067418272083, 0.9617760613615883, 0.9584140767926261, 0.9567722239783185, 0.9590533634437008, 0.9636621596081686, 0.9608110453659163, 0.9531057367694116, 0.9531960172267079  …  0.9545028623785627, 0.9604992091254608, 0.9660191804500238, 0.968533079630373, 0.9694143916152298, 0.9701851070191952, 0.9712104746033376, 0.9723750731359512, 0.973319631587101, 0.9736220088414475], [-0.29333110192838996, -0.1887601976762991, -0.08379098600652868, 0.021957243792698977, 0.1266285349182399, 0.23094070641438852, 0.33140184809834, 0.4307580154967984, 0.5437956319188874, 0.6751252484567886  …  0.9173976116144946, 1.011270365863309, 1.0950413623630861, 1.174629323172015, 1.2521587648796082, 1.326601319183426, 1.3945008853536551, 1.4541725821366873, 1.5065671810505206, 1.5501162499121672], [0.007068834786627551, 0.006662257257342125, 0.0063070869005499115, 0.006020143008742286, 0.005759704716589132, 0.005528653704595198, 0.005202412246418287, 0.005079913078107053, 0.005379608198706975, 0.006040227265139347  …  0.008350181908413691, 0.00953930402455891, 0.010565955134481123, 0.011651665103825525, 0.012898448909796165, 0.014304170474114574, 0.01592484879058611, 0.01791722157858429, 0.020543058013902764, 0.024203354972132007], [-0.05877988664812076, -0.05715910207254121, -0.0554365147859634, -0.05389397837115921, -0.0522428900976308, -0.050455681711250436, -0.04778032335510061, -0.044512135822076714, -0.044337419489327304, -0.04843435158712335  …  -0.053735832542342175, -0.05063662615725094, -0.04544225866663261, -0.039560084277762385, -0.033444781668970344, -0.02699906496278367, -0.019876150083422937, -0.012267191079643936, -0.0051489131249701, 0.0008555939939929979], [0.8579368989691069, 0.8082819228401222, 0.7445617540900146, 0.6858716956879483, 0.6309780193166262, 0.5710280976118897, 0.5126745137524349, 0.45976657530584436, 0.4030528616118133, 0.3351543081228707  …  0.14434130816742885, 0.08381936421372926, 0.05682724249545551, 0.04183470296131331, 0.031219459768666413, 0.023719879840444158, 0.018248534268198835, 0.01396661563227336, 0.010942662992816876, 0.009930665285547813], [0.06397680009584888, 0.08783556137066412, 0.13654757154012792, 0.2096178770675631, 0.3191333199112863, 0.4676202141193211, 0.6846099919619206, 0.8346690944653485, 0.9698391718017737, 1.0  …  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [0.38190293972973044 1.0716654952587967 … 1.1294530761767145 1.4694884054505195; 0.7535322342078451 1.0660558714309338 … 1.0999377369355772 1.4346003195370205; … ; 1.0803529149734672 1.1250817679531409 … 1.5449161671017386 0.9915951664733094; 1.0764531978426835 1.1288842260882488 … 1.506032720927499 0.9930711212623622], [4.236679152089573e-5 0.00036692204498517037 … 0.005009624754694589 0.0018718386038852211; 7.161556367213297e-5 0.00037924221520080435 … 0.005560120399628629 0.0020788494281959967; … ; 0.0003389671835808455 0.00018314542681464798 … 0.0015043482211069127 0.00945611359490933; 0.0003531629316031587 0.0001987000555028426 … 0.0016819659733355965 0.009539056153836442], [2.253867843580234 2.839417728973645 … 1.764159588035258 1.5148542296511496; 2.3362057787559576 2.911440729798473 … 1.8375668248024166 1.5318950366196884; … ; 2.744545708299601 2.4828555793901446 … 1.495659265941764 5.392626502767228; 2.783837221269751 2.519748537867168 … 1.5028092233294634 5.970227552393948], [-1.7157972678941742 -1.0465641008256492 … -0.8814823264955048 -0.744195908603619; -1.578190343825853 -1.0365606296921293 … -0.8919081582897372 -0.7620100012196319; … ; -1.0666847348208934 -1.1973312421220321 … -0.7040454327198974 -0.9787305694739551; -1.0565743984445903 -1.1801004167457079 … -0.7249389501059953 -0.9972766263179291], [5.6901236248619134e-5 0.002047017273167992 … 0.0002962614319723432 0.00020742231243225733; 9.445621645942277e-5 0.0021640618519680205 … 0.00030018564900578847 0.00021645269515749676; … ; 0.0018238425895316086 0.000660036481548941 … 0.00018642937810296287 0.000299323574744511; 0.001933714494993704 0.0007462947419752854 … 0.0001973946113487537 0.00029696377375841354], [2.7431906296454707 1.44506577694394 … 2.391540861876067 2.343627612210537; 3.4385826471224656 1.4463084300825255 … 2.3754635718459944 2.351763862174063; … ; 1.4450025228201195 1.449533899818537 … 2.339966741735422 2.0609869639489458; 1.445492399264679 1.448417670371811 … 2.3411788964222935 2.061729050290895])
FLOWFoil.NeuralFoilType
NeuralFoil <: Method

In general usage, this struct is generated by calling the NeuralFoil constructor.

Fields:

  • Re::Float
  • Ma::Float
  • n_crit::Float
  • xtr_upper::Float
  • xtr_lower::Float
  • net_cache::NeuralFoil.NetParameters
source
FLOWFoil.NeuralFoilMethod
NeuralFoil(
    reynolds=1e6, mach=0.0; model_size="xlarge", n_crit=9.0, xtr_upper=1.0, xtr_lower=1.0
)

Constructor for NeuralFoil type.

Default Arguments

  • reynolds::Float=1e6 : Reynolds number
  • mach::Float=0.0 : Mach number

Keyword Arguments

  • model_size::String="xlarge" : model size from NeuralFoil choose from:
    • "xxsmall"
    • "xsmall"
    • "small"
    • "medium"
    • "large"
    • "xlarge"
    • "xxlarge"
    • "xxxlarge"
  • n_crit::Float=9.0 : n_crit for Xfoil
  • xtr_upperFloat=1.0 : Xtr_Upper for Xfoil
  • xtr_lowerFloat=1.0 : Xtr_Lower for Xfoil

Returns

  • method::NeuralFoil : NeuralFoil method object

NeuralFoil Method Fields:

  • Re::Vector{Float} : Reynolds Number(s)
  • Ma::Float=0.0 : Mach Number
  • `n_crit::Float=9.0' : n for e^n transition model
  • `xtr_upper::Float=1.0' : location for forced trip to turbulent, upper side
  • `xtr_lower::Float=1.0' : location for forced trip to turbulent, lower side
  • net_cache::NeuralFoil.NetParameters : NeuralFoil network parameters based on model size
source

Note that the NeuralFoil method does not allow multi-body analysis like the other methods do as it is based specifically on Xfoil. We also return a separate output type for the NeuralFoil method from the NeuralFoil.jl namespace.

LegacyXfoil Method

We also have the LegacyXfoil method that is based on Xfoil and can be accessed with the LegacyXfoil method type:

using FLOWFoil

x, y = AirfoilTools.naca4()

angles_of_attack = range(-5.0, 15.0; step=1)

reynolds = 2e6

method = LegacyXfoil(reynolds; npan=140)

outputs = analyze([x y], angles_of_attack; method=method)
LegacyXFOutputs{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Bool}}([-0.2836228537377497, -0.18092650655863265, -0.078259411374531, 0.024257636715053977, 0.12654460453573607, 0.227542154201225, 0.3271543494915982, 0.42364199076497777, 0.5360570719075262, 0.6727479385043966  …  0.9355009930986437, 1.0176760939833431, 1.0944204811433635, 1.1722158441948214, 1.2502246316503087, 1.3181474318187905, 1.3785330861499643, 1.4384184772148023, 1.4908454575978625, 1.5353971081632525], [0.007067611342326388, 0.006610662558733619, 0.006258395057044495, 0.005953670491741795, 0.005738014828171401, 0.0054250691323250175, 0.005177391128439505, 0.005044499187737041, 0.0052302906711971684, 0.005982311162850236  …  0.008442757526533283, 0.009579627225083848, 0.010685185744678319, 0.011827915654134468, 0.013004911985719887, 0.01435016170430288, 0.015979712825190794, 0.017987625638182875, 0.02069361693115564, 0.024329392402545412], [0.0007997079623480638, 0.0005085420145730919, 0.00029691214329385007, 0.00015290690817651496, 7.819551350536364e-5, 4.8773703739780455e-5, 8.717799967342734e-5, 0.00017050120202277588, 0.00034346155880394884, 0.0005789047386906395  …  0.0015275119958792574, 0.0020522342948780365, 0.0025622871573297203, 0.00308229718340812, 0.003605546647801968, 0.004145365823202613, 0.004801710869337781, 0.005718865027528617, 0.007097802670681995, 0.009091734966822158], [-0.06098178547528287, -0.05870054212586034, -0.056410656444290865, -0.054145798060273635, -0.051880485236678826, -0.04944294790178676, -0.04663038280514772, -0.04291443237884535, -0.04255372468140533, -0.04810173788205186  …  -0.05795531618806585, -0.05228540170248866, -0.04543935933136167, -0.0390112040059809, -0.032933905708970125, -0.025210928964475292, -0.01685854506528701, -0.009721486294460242, -0.0029512421367404954, 0.0029247957629873994], Bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1  …  1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
FLOWFoil.LegacyXfoilType
LegacyXfoil <: Method

In general usage, this struct is generated by calling the LegacyXfoil constructor.

Fields

  • reynolds: Reynolds number
  • mach: Mach number
  • xtrip: forced transition x/c locations on top/bottom sides
  • reinit: reinitialize the solution? (rather than use the previous solution)
  • iter: Maximum iterations for viscous analyses
  • npan: Number of panels
  • percussive_maintenance: Call do_percussive_maintenance upon convergence failure?
  • printdata: Print data obtained from XFOIL during the solution?
  • zeroinit: Start angle of attack sweeps from zero? If true, results will be sorted by ascending angle of attack.
  • clmaxstop: Stop if lift coefficient decreases twice consecutively going up?
  • clminstop: Stop if lift coefficient increases twice consecutively going down?
source
FLOWFoil.LegacyXfoilMethod
LegacyXfoil(
    reynolds,
    mach=0.0;
    xtrip=(1.0, 1.0),
    reinit=false,
    iter=50,
    npan=140,
    percussive_maintenance=!reinit,
    printdata=false,
    zeroinit=true,
    clmaxstop=false,
    clminstop=false,
)

Constructor for LegacyXfoil type.

Arguments

  • reynolds::Float=1e6 : Reynolds number

Default Arguments

  • mach::Float=0.0 : Mach number

Keyword Arguments

  • xtrip::Tuple{Float, Float}=(1.0,1.0): forced transition x/c locations on top/bottom sides
  • reinit::Bool=false: reinitialize the solution? (rather than use the previous solution)
  • iter::Int=50: Maximum iterations for viscous analyses
  • npan::Int=140: Number of panels
  • percussive_maintenance::Bool=!reinit: Call do_percussive_maintenance upon convergence failure?
  • printdata::Bool=false: Print data obtained from XFOIL during the solution?
  • zeroinit::Bool=true: Start angle of attack sweeps from zero? If true, results will be sorted by ascending angle of attack.
  • clmaxstop::Bool=false: Stop if lift coefficient decreases twice consecutively going up?
  • clminstop::Bool=false: Stop if lift coefficient increases twice consecutively going down?

Returns

  • method::LegacyXfoil : LegacyXfoil method object
source

Note that we return a separate output type for the LegacyXFoil method:

FLOWFoil.LegacyXFOutputsType
LegacyXFOutputs

Fields

  • cl::Vector{Float}
  • cd::Vector{Float}
  • cdp::Vector{Float}
  • cm::Vector{Float}
  • converged::Vector{Bool}
source