@@ -337,7 +337,7 @@ mutable struct RamAirWing <: AbstractWing
337337 le_interp:: NTuple{3, Extrapolation}
338338 te_interp:: NTuple{3, Extrapolation}
339339 area_interp:: Extrapolation
340- alpha_dist :: Vector{Float64}
340+ theta_dist :: Vector{Float64}
341341 delta_dist:: Vector{Float64}
342342end
343343
@@ -426,45 +426,33 @@ function RamAirWing(obj_path, dat_path; alpha=0.0, crease_frac=0.75, wind_vel=10
426426end
427427
428428"""
429- deform!(wing::RamAirWing, alphas ::AbstractVector, deltas ::AbstractVector; width)
429+ deform!(wing::RamAirWing, theta_dist ::AbstractVector, delta_dist ::AbstractVector; width)
430430
431- Deform wing by applying left and right alpha and delta.
431+ Deform wing by applying theta and delta distributions .
432432
433433# Arguments
434434- `wing`: RamAirWing to deform
435- - `alphas`: [left, right] the angle between of the kite and the body x-axis in radians
436- - `deltas`: [left, right] the deformation of the trailing edges
437- - `width`: Transition width in meters to smoothe out the transition from left to right deformation
435+ - `theta_dist`: the angle distribution between of the kite and the body x-axis in radians of each panel
436+ - `delta_dist`: the deformation of the trailing edges of each panel
438437
439438# Effects
440439Updates wing.sections with deformed geometry
441440"""
442- function deform! (wing:: RamAirWing , alphas:: AbstractVector , deltas:: AbstractVector ; width)
441+ function deform! (wing:: RamAirWing , theta_dist:: AbstractVector , delta_dist:: AbstractVector )
442+ ! (length (theta_dist) == wing. n_panels) && throw (ArgumentError (" theta_dist and panels are of different lengths" ))
443+ ! (length (delta_dist) == wing. n_panels) && throw (ArgumentError (" delta_dist and panels are of different lengths" ))
444+ wing. theta_dist .= theta_dist
445+ wing. delta_dist .= delta_dist
446+
443447 local_y = zeros (MVec3)
444448 chord = zeros (MVec3)
445449
446- for (i, gamma) in enumerate (range (- wing. gamma_tip, wing. gamma_tip, wing. n_panels))
447- normalized_gamma = (gamma * wing. radius / width + 0.5 ) # Maps [-0.5, 0.5] to [0, 1]
448- wing. alpha_dist[i] = if normalized_gamma <= 0.0
449- alphas[1 ]
450- elseif normalized_gamma >= 1.0
451- alphas[2 ]
452- else
453- alphas[1 ] * (1.0 - normalized_gamma) + alphas[2 ] * normalized_gamma
454- end
455- wing. delta_dist[i] = if normalized_gamma <= 0.0
456- deltas[1 ]
457- elseif normalized_gamma >= 1.0
458- deltas[2 ]
459- else
460- deltas[1 ] * (1.0 - normalized_gamma) + deltas[2 ] * normalized_gamma
461- end
462-
450+ for i in 1 : wing. n_panels
463451 section1 = wing. non_deformed_sections[i]
464452 section2 = wing. non_deformed_sections[i+ 1 ]
465453 local_y .= normalize (section1. LE_point - section2. LE_point)
466454 chord .= section1. TE_point .- section1. LE_point
467- wing. sections[i]. TE_point .= section1. LE_point .+ rotate_v_around_k (chord, local_y, wing. alpha_dist [i])
455+ wing. sections[i]. TE_point .= section1. LE_point .+ rotate_v_around_k (chord, local_y, wing. theta_dist [i])
468456 end
469457 return nothing
470458end
0 commit comments