Skip to content

Commit

Permalink
update parameterization
Browse files Browse the repository at this point in the history
  • Loading branch information
juddmehr committed Sep 8, 2023
1 parent 6d6e383 commit 8d67153
Showing 1 changed file with 9 additions and 139 deletions.
148 changes: 9 additions & 139 deletions duct_param_temp/bspline_param.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function duct_geom(
cbspline;
nosecone_stop=0.35,
tailcone_start=0.65,
nacell_var=1.1,
nacell_var=1.0,
N=60,
)
le_cpr = sqrt(inlet_area / pi)
Expand Down Expand Up @@ -151,7 +151,7 @@ function duct_geom(
# control points
nacelle_cps = [
[0.0, le_cpr],
[0.0, le_cpr + 1.25 * nacell_var],
[0.0, le_cpr + nacell_var],
[chord / 2.0, le_cpr + nacell_var],
[chord, ductter],
]
Expand Down Expand Up @@ -259,9 +259,13 @@ RPM = 4000 #change
Vinf = calculate_vstar(Rtip * 0.0254, RPM, 0.5)

exit_area, debug = size_exit(Rtip * 0.0254, RPM, Jop, ctop, Vinf; rho=1.225)
facearea = pi * Rtip^2
capturearea = debug.Vface * facearea / Vinf
captureradius = sqrt(capturearea / pi)
exit_area /= 0.0254^2 # convert from m^2 to in^2

inlet_area = pi * 5.875^2
# inlet_area = pi * 5.875^2
inlet_area = pi * captureradius^2

cx, cr, nx, nr, cpi, cpo, cpn = duct_geom(
inlet_area,
Expand All @@ -271,7 +275,7 @@ cx, cr, nx, nr, cpi, cpo, cpn = duct_geom(
cbspline;
nosecone_stop=nosecone_stop,
tailcone_start=tailcone_start,
nacell_var=1.25,
nacell_var=0.75,
)

ductx = [reverse(nx); cx[2:end]] ./ chord
Expand Down Expand Up @@ -342,140 +346,6 @@ plot!(
)
savefig("ducttest.pdf")

#=
TODOs for exit area sizing
go get APC 10x7 data and get all the inputs for the area calcuation
get area.
=#

# script for duct geometry generation and plotting
# area will determine TE control point locations
# probably use quadratic from flat to TE
# probably use quadratic from flat to LE
# probably use cubic on top
# probably keep it a bit thin if possible
#
# after you get the geometry, run it through xfoil as a check on separation.
# probably want to run it at a slight negative angle of attack to simulate the affects of the rotor
#
#
#
#
#
# TODO: write parameters file

#function generate_duct_section(
# Rin,
# Rd,
# Rout,
# Lin,
# Ltot,
# r_le,
# wedge_angle,
# te_camber_angle,
# max_thick;
# N=161,
# disk_ratio=0.125,
#)
# boattailangle = pi * wedge_angle / 360 #boattail angle is half of wedge angle

# te_camber_angle *= pi / 180

# #--Initialize knot vector
# knots_inner = [
# 0.0,
# 0.0,
# 0.0,
# Lin * (1.0 - disk_ratio) / Ltot,
# Lin * (1.0 - disk_ratio) / Ltot,
# Lin * (1.0 + disk_ratio) / Ltot,
# Lin * (1.0 + disk_ratio) / Ltot,
# 1.0,
# 1.0,
# 1.0,
# ]

# knots_outer = [0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0]

# #calculate unweighted controlpoints
# Pouter = [
# [0.0, Rin], [0.0, Rin + (Rin - Rd)], [Lin, Rd + 2.0 * max_thick], [Ltot, Rout]
# ]

# Pinner = [
# [0.0, Rin], #sqrt(2.0 * leradius) / 3.0],
# [0.0, Rd],
# [Lin * (1.0 - disk_ratio), Rd],
# [Lin * (1.0 - disk_ratio), Rd],
# [Lin * (1.0 + disk_ratio), Rd],
# # [Lin * 1.1, Rd],
# [(Ltot + Lin) / 2.0, Rd],
# [Ltot, Rout],
# ]

# inner_spline = Splines.NURBS(2, knots_inner, ones(length(Pinner)), Pinner)
# outer_spline = Splines.NURBS(3, knots_outer, ones(length(Pouter)), Pouter)

# u = range(0.0, 1.0; length=N + 1)
# n = length(inner_spline.ctrlpts) - 1
# Cw_inner = [[0.0; 0.0] for i in 1:length(u)]
# Cw_outer = [[0.0; 0.0] for i in 1:length(u)]

# #loop through parametric points to get curve points
# for i in 1:length(u)
# Cw_inner[i] = Splines.curvepoint(inner_spline, u[i])
# Cw_outer[i] = Splines.curvepoint(outer_spline, u[i])
# end

# return Pinner, Pouter, Cw_inner, Cw_outer
#end

#Rin = 2.75
#Rd = 2.5
#Rout = 2.35
#Ltot = Rd * 2.0
#Lin = 0.4 * Ltot
#r_le = 0.25
#wedge_angle = 20.0
#te_camber_angle = 5.0
#max_thick = 0.5
#N = 161
#disk_ratio = 0.125

#pin, pout, xrin, xrout = generate_duct_section(
# Rin,
# Rd,
# Rout,
# Lin,
# Ltot,
# r_le,
# wedge_angle,
# te_camber_angle,
# max_thick;
# N=N,
# disk_ratio=disk_ratio,
#)

#plot(; aspectratio=:equal)
#plot!(getindex.(pin, 1), getindex.(pin, 2); seriestype=:scatter)
#plot!(getindex.(pout, 1), getindex.(pout, 2); seriestype=:scatter)
#plot!(getindex.(xrout, 1), getindex.(xrout, 2))
#plot!(getindex.(xrin, 1), getindex.(xrin, 2))

#using FLOWMath
#using FLOWFoil
#t = Ltot .* FLOWFoil.cosine_spacing(161)
#osp = akima(getindex.(xrout, 1), getindex.(xrout, 2), t)
#isp = akima(getindex.(xrin, 1), getindex.(xrin, 2), t)

#xx = [reverse(t); t[2:end]]
#rr = [reverse(isp); osp[2:end]]
#if rr[1] != rr[end]
# rr[1] = rr[end]
#end

#f = open("jenky.dat", "w")
#for i in 1:length(xx)
# write(f, "$(xx[i]), $(rr[i])\n")
#end
#close(f)

0 comments on commit 8d67153

Please sign in to comment.