Skip to content

Commit

Permalink
generalize functions
Browse files Browse the repository at this point in the history
  • Loading branch information
taylormcd committed May 17, 2018
1 parent ba1bf27 commit 9a11903
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/xfoilbasic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Input x and y airfoil coordinates into XFOIL
Coordinates must start at the trailing edge and loop counterclockwise.
"""
function setCoordinates(x::Array{Float64,1},y::Array{Float64,1})
function setCoordinates(x::AbstractArray{<:Real,1},y::AbstractArray{<:Real,1})
if length(x) != length(y)
error("x and y arrays must match in length")
end
Expand Down Expand Up @@ -31,9 +31,9 @@ Run XFOIL's PANE Command (repanel airfoil)
- `xpref1::Float64=1.0`: Bottom side refined area x/c limits
- `xpref2::Float64=1.0`:
"""
function pane(;npan::Integer=140,cvpar::Float64=1.0,cterat::Float64=0.15,
ctrrat::Float64=0.2,xsref1::Float64=1.0,xsref2::Float64=1.0,xpref1::Float64=1.0,
xpref2::Float64=1.0)
function pane(;npan::Integer=140,cvpar::Real=1.0,cterat::Real=0.15,
ctrrat::Real=0.2,xsref1::Real=1.0,xsref2::Real=1.0,xpref1::Real=1.0,
xpref2::Real=1.0)
xfoilglobals.npan[1] = npan
xfoilglobals.cvpar[1] = cvpar
xfoilglobals.cterat[1] = cterat
Expand All @@ -51,7 +51,7 @@ end
Compute the flow solution at specified angle of attack (in degrees).
Returns cl,cd,cdp,cm,converged
"""
function solveAlpha(angle::Float64,re::Float64;mach::Float64=0.0,iter::Integer=50)
function solveAlpha(angle::Real,re::Real;mach::Real=0.0,iter::Integer=50)
cl = zeros(Float64,1)
cd = zeros(Float64,1)
cdp = zeros(Float64,1)
Expand Down
23 changes: 12 additions & 11 deletions src/xfoilsweep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
Performs angle of attack sweep using Xfoil. A number of options are available
to improve convergence and customize the run. Returns cl,cd,cdp,cm,converged
# Arguments
- `x::Array{Float64,1}`: Airfoil coordinates start from trailing edge looping counterclockwise
- `y::Array{Float64,1}`:
- `aoa::Array{Float64,1}`: Array of angle of attacks in degrees
- `re::Float64`: Reynolds number
- `ma::Float64`: Mach number
- `x::AbstractArray{<:Real,1}`: Airfoil coordinates start from trailing edge looping counterclockwise
- `y::AbstractArray{<:Real,1}`:
- `aoa::AbstractArray{<:Real,1}`: Array of angle of attacks in degrees
- `re::Real`: Reynolds number
- `ma::Real`: Mach number
- `iter::Integer=50`: Maximum number of iterations
- `npan::Integer=140`: Number of panels
- `percussive_maintenance::Bool=true`: Try harder to achieve convergence
Expand All @@ -16,8 +16,9 @@ to improve convergence and customize the run. Returns cl,cd,cdp,cm,converged
- `clmaxstop::Bool=false`: Stop if lift coefficient decreases twice consecutively going up
- `clminstop::Bool=false`: Stop if lift coefficient increases twice consecutively going down
"""
function xfoilsweep(x::Array{Float64,1},y::Array{Float64,1},aoa::Array{Float64,1},
re::Float64;mach::Float64=0.0,iter::Integer=50,
function xfoilsweep(x::AbstractArray{<:Real,1},y::AbstractArray{<:Real,1},
aoa::AbstractArray{<:Real,1},
re::Real;mach::Real=0.0,iter::Integer=50,
npan::Integer=140,percussive_maintenance::Bool=true,printdata::Bool=false,
zeroinit::Bool=true,clmaxstop::Bool=false,clminstop::Bool=false)

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

function xfoilsweep(x::Array{Float64,1},y::Array{Float64,1},aoa::Array{Float64,1},
re::Float64,mach::Float64,iter::Integer,
function xfoilsweep(x::AbstractArray{<:Real,1},y::AbstractArray{<:Real,1},aoa::AbstractArray{<:Real,1},
re::Real,mach::Real,iter::Integer,
npan::Integer,percussive_maintenance::Bool,printdata::Bool,
clmaxstop::Bool,clminstop::Bool)

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

0 comments on commit 9a11903

Please sign in to comment.