Skip to content

Commit 9a11903

Browse files
committed
generalize functions
1 parent ba1bf27 commit 9a11903

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/xfoilbasic.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Input x and y airfoil coordinates into XFOIL
44
Coordinates must start at the trailing edge and loop counterclockwise.
55
"""
6-
function setCoordinates(x::Array{Float64,1},y::Array{Float64,1})
6+
function setCoordinates(x::AbstractArray{<:Real,1},y::AbstractArray{<:Real,1})
77
if length(x) != length(y)
88
error("x and y arrays must match in length")
99
end
@@ -31,9 +31,9 @@ Run XFOIL's PANE Command (repanel airfoil)
3131
- `xpref1::Float64=1.0`: Bottom side refined area x/c limits
3232
- `xpref2::Float64=1.0`:
3333
"""
34-
function pane(;npan::Integer=140,cvpar::Float64=1.0,cterat::Float64=0.15,
35-
ctrrat::Float64=0.2,xsref1::Float64=1.0,xsref2::Float64=1.0,xpref1::Float64=1.0,
36-
xpref2::Float64=1.0)
34+
function pane(;npan::Integer=140,cvpar::Real=1.0,cterat::Real=0.15,
35+
ctrrat::Real=0.2,xsref1::Real=1.0,xsref2::Real=1.0,xpref1::Real=1.0,
36+
xpref2::Real=1.0)
3737
xfoilglobals.npan[1] = npan
3838
xfoilglobals.cvpar[1] = cvpar
3939
xfoilglobals.cterat[1] = cterat
@@ -51,7 +51,7 @@ end
5151
Compute the flow solution at specified angle of attack (in degrees).
5252
Returns cl,cd,cdp,cm,converged
5353
"""
54-
function solveAlpha(angle::Float64,re::Float64;mach::Float64=0.0,iter::Integer=50)
54+
function solveAlpha(angle::Real,re::Real;mach::Real=0.0,iter::Integer=50)
5555
cl = zeros(Float64,1)
5656
cd = zeros(Float64,1)
5757
cdp = zeros(Float64,1)

src/xfoilsweep.jl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
Performs angle of attack sweep using Xfoil. A number of options are available
44
to improve convergence and customize the run. Returns cl,cd,cdp,cm,converged
55
# Arguments
6-
- `x::Array{Float64,1}`: Airfoil coordinates start from trailing edge looping counterclockwise
7-
- `y::Array{Float64,1}`:
8-
- `aoa::Array{Float64,1}`: Array of angle of attacks in degrees
9-
- `re::Float64`: Reynolds number
10-
- `ma::Float64`: Mach number
6+
- `x::AbstractArray{<:Real,1}`: Airfoil coordinates start from trailing edge looping counterclockwise
7+
- `y::AbstractArray{<:Real,1}`:
8+
- `aoa::AbstractArray{<:Real,1}`: Array of angle of attacks in degrees
9+
- `re::Real`: Reynolds number
10+
- `ma::Real`: Mach number
1111
- `iter::Integer=50`: Maximum number of iterations
1212
- `npan::Integer=140`: Number of panels
1313
- `percussive_maintenance::Bool=true`: Try harder to achieve convergence
@@ -16,8 +16,9 @@ to improve convergence and customize the run. Returns cl,cd,cdp,cm,converged
1616
- `clmaxstop::Bool=false`: Stop if lift coefficient decreases twice consecutively going up
1717
- `clminstop::Bool=false`: Stop if lift coefficient increases twice consecutively going down
1818
"""
19-
function xfoilsweep(x::Array{Float64,1},y::Array{Float64,1},aoa::Array{Float64,1},
20-
re::Float64;mach::Float64=0.0,iter::Integer=50,
19+
function xfoilsweep(x::AbstractArray{<:Real,1},y::AbstractArray{<:Real,1},
20+
aoa::AbstractArray{<:Real,1},
21+
re::Real;mach::Real=0.0,iter::Integer=50,
2122
npan::Integer=140,percussive_maintenance::Bool=true,printdata::Bool=false,
2223
zeroinit::Bool=true,clmaxstop::Bool=false,clminstop::Bool=false)
2324

@@ -47,8 +48,8 @@ function xfoilsweep(x::Array{Float64,1},y::Array{Float64,1},aoa::Array{Float64,1
4748
return cl,cd,cdp,cm,conv
4849
end
4950

50-
function xfoilsweep(x::Array{Float64,1},y::Array{Float64,1},aoa::Array{Float64,1},
51-
re::Float64,mach::Float64,iter::Integer,
51+
function xfoilsweep(x::AbstractArray{<:Real,1},y::AbstractArray{<:Real,1},aoa::AbstractArray{<:Real,1},
52+
re::Real,mach::Real,iter::Integer,
5253
npan::Integer,percussive_maintenance::Bool,printdata::Bool,
5354
clmaxstop::Bool,clminstop::Bool)
5455

@@ -110,8 +111,8 @@ end
110111
Attempts to converge previously unconverged XFOIL solutions through modifying the
111112
solution initial conditions. Returns cl,cd,cdp,cm,converged
112113
"""
113-
function dopercussivemaintainance(x::Array{Float64,1},y::Array{Float64,1},
114-
aoa::Float64,re::Float64,mach::Float64,iter::Integer,npan::Integer)
114+
function dopercussivemaintainance(x::AbstractArray{<:Real,1},y::AbstractArray{<:Real,1},
115+
aoa::Real,re::Real,mach::Real,iter::Integer,npan::Integer)
115116
remod = re
116117
aoamod = aoa
117118
for j = 1:25

0 commit comments

Comments
 (0)