Skip to content

Commit

Permalink
Expose rotor airfoil constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
EdoAlvarezR committed May 1, 2021
1 parent ee0cfeb commit 722facb
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions src/FLOWUnsteady_rotor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function generate_rotor(Rtip::Real, Rhub::Real, B::Int,
pitchdist::Array{Float64,2},
sweepdist::Array{Float64,2},
heightdist::Array{Float64,2},
airfoil_files::Array{Tuple{Float64,String,String},1};
airfoil_contours::Array{Tuple{Float64,Array{Float64, 2},String},1};
# INPUT OPTIONS
data_path=def_data_path,
read_polar=vlm.ap.read_polar,
Expand All @@ -42,7 +42,6 @@ function generate_rotor(Rtip::Real, Rhub::Real, B::Int,
ReD=5*10^5, altReD=nothing, Matip=0.0,
ncrit=9,
xfoil=false,
rotor_file="apc10x7.jl",
spline_k=5, spline_s=0.001, splines_s=nothing, spline_bc="extrapolate",
turbine_flag=false,
rfl_n_lower=15, rfl_n_upper=15,
Expand All @@ -53,19 +52,6 @@ function generate_rotor(Rtip::Real, Rhub::Real, B::Int,
if verbose; println("\t"^v_lvl*"Generating geometry..."); end;
n_bem = n

# Read airfoil contours
# Airfoils along the blade as
# airfoil_contours=[ (pos1, contour1, polar1), (pos2, contour2, pol2), ...]
# with contour=(x,y) and pos the position from root to tip between 0 and 1.
# pos1 must equal 0 (root airfoil) and the last must be 1 (tip airfoil)
airfoil_contours = []
airfoil_path = joinpath(data_path, "airfoils")
for (r, rfl_file, clcurve_file) in airfoil_files
x,y = gt.readcontour(rfl_file; delim=",", path=airfoil_path, header_len=1)
rfl = hcat(x,y)

push!(airfoil_contours, (r, rfl, clcurve_file))
end

# Splines
_spl_chord = Dierckx.Spline1D(chorddist[:, 1]*Rtip, chorddist[:, 2]*Rtip;
Expand Down Expand Up @@ -185,6 +171,34 @@ function generate_rotor(Rtip::Real, Rhub::Real, B::Int,
return propeller
end

function generate_rotor(Rtip::Real, Rhub::Real, B::Int,
chorddist::Array{Float64,2},
pitchdist::Array{Float64,2},
sweepdist::Array{Float64,2},
heightdist::Array{Float64,2},
airfoil_files::Array{Tuple{Float64,String,String},1};
# INPUT OPTIONS
data_path=def_data_path, optargs...)

# Read airfoil contours
# Airfoils along the blade as
# airfoil_contours=[ (pos1, contour1, polar1), (pos2, contour2, pol2), ...]
# with contour=(x,y) and pos the position from root to tip between 0 and 1.
# pos1 must equal 0 (root airfoil) and the last must be 1 (tip airfoil)
airfoil_contours = []
airfoil_path = joinpath(data_path, "airfoils")
for (r, rfl_file, clcurve_file) in airfoil_files
x,y = gt.readcontour(rfl_file; delim=",", path=airfoil_path, header_len=1)
rfl = hcat(x,y)

push!(airfoil_contours, (r, rfl, clcurve_file))
end

return generate_rotor(Rtip, Rhub, B,
chorddist, pitchdist, sweepdist, heightdist,
airfoil_contours; data_path=def_data_path, optargs...)
end

function generate_rotor(Rtip::Real, Rhub::Real, B::Int, blade_file::String;
data_path=def_data_path, optargs...)

Expand Down

0 comments on commit 722facb

Please sign in to comment.