@@ -8,6 +8,7 @@ Main structure for calculating aerodynamic properties of bodies. Use the constru
88- wings::Vector{W}: A vector of wings of type `W <: AbstractWing`; a body can have multiple wings
99- `va::MVec3` = zeros(MVec3): A vector of the apparent wind speed, see: [`MVec3`](@ref)
1010- `omega`::MVec3 = zeros(MVec3): A vector of the turn rates around the kite body axes
11+ - `reference_point`::MVec3 = zeros(MVec3): The point `omega` turns the body about [m]
1112- `gamma_distribution`=zeros(Float64, P): A vector of the circulation
1213 of the velocity field; Length: Number of segments. [m²/s]
1314- `alpha_uncorrected`=zeros(Float64, P): angles of attack per panel
@@ -35,6 +36,7 @@ Main structure for calculating aerodynamic properties of bodies. Use the constru
3536 _va:: MVector{3, T} = zeros (MVector{3 , T})
3637 has_distributed_va:: Bool = false
3738 omega:: MVector{3, T} = zeros (MVector{3 , T})
39+ reference_point:: MVector{3, T} = zeros (MVector{3 , T})
3840 gamma_distribution:: MVector{P, T} = zeros (MVector{P, T})
3941 alpha_uncorrected:: MVector{P, T} = zeros (MVector{P, T})
4042 alpha_corrected:: MVector{P, T} = zeros (MVector{P, T})
@@ -155,6 +157,8 @@ function Base.setproperty!(obj::BodyAerodynamics, sym::Symbol, val)
155157 set_va! (obj, val)
156158 elseif sym === :omega
157159 set_va! (obj, obj. _va, val)
160+ elseif sym === :reference_point
161+ set_va! (obj, obj. _va, obj. omega; reference_point= val)
158162 else
159163 setfield! (obj, sym, val)
160164 end
@@ -252,6 +256,37 @@ function calculate_stall_angle_list!(stall_angles::AbstractVector,
252256 return nothing
253257end
254258
259+ """
260+ unrefined_section_range(body_aero::BodyAerodynamics, wing_idx)
261+
262+ Indices of the unrefined sections of wing `wing_idx` in a distribution that runs over the
263+ unrefined sections of all wings in order, such as `moment_unrefined_dist`.
264+ """
265+ function unrefined_section_range (body_aero:: BodyAerodynamics , wing_idx)
266+ offset = 0
267+ for i in 1 : wing_idx- 1
268+ offset += body_aero. wings[i]. n_unrefined_sections
269+ end
270+ return offset .+ (1 : body_aero. wings[wing_idx]. n_unrefined_sections)
271+ end
272+
273+ """
274+ unrefined_deform!(body_aero::BodyAerodynamics, theta_angles, delta_angles)
275+
276+ Deform each wing of `body_aero` by its entries of `theta_angles` and `delta_angles` [rad],
277+ which run over the unrefined sections of all wings in order; `nothing` leaves that angle
278+ unchanged. Call [`reinit!`](@ref) afterwards to update the panels.
279+ """
280+ function unrefined_deform! (body_aero:: BodyAerodynamics , theta_angles, delta_angles)
281+ for (wing_idx, wing) in enumerate (body_aero. wings)
282+ section_range = unrefined_section_range (body_aero, wing_idx)
283+ unrefined_deform! (wing,
284+ isnothing (theta_angles) ? nothing : view (theta_angles, section_range),
285+ isnothing (delta_angles) ? nothing : view (delta_angles, section_range))
286+ end
287+ return nothing
288+ end
289+
255290"""
256291 reinit!(body_aero::BodyAerodynamics; init_aero, va, omega, refine_mesh, recompute_mapping, sort_sections)
257292
@@ -1052,44 +1087,32 @@ end
10521087
10531088
10541089"""
1055- set_va!(body_aero::BodyAerodynamics, va_vec::VelVector, omega=zeros(MVec3))
1090+ set_va!(body_aero::BodyAerodynamics, va_vec::VelVector, omega=zeros(MVec3);
1091+ reference_point=body_aero.reference_point)
10561092
1057- Set velocity array and update wake filaments.
1093+ Set a uniform apparent wind and a body turn rate, and update the wake filaments. Each
1094+ panel sees `va_vec - omega × (control_point - reference_point)`.
10581095
10591096# Arguments
10601097- body_aero::BodyAerodynamics: The [`BodyAerodynamics`](@ref) struct to modify
10611098- `va_vec::VelVector`: Velocity vector of the apparent wind speed [m/s]
10621099- `omega::VelVector`: Turn rate vector around x y and z axis [rad/s]
1100+ - `reference_point`: Point the body turns about, stored on `body_aero` [m]
10631101
10641102`omega` is also projected onto each panel's spanwise axis into
10651103`pitch_rate_dist`, which the solver reads when `flow_curvature` is enabled.
10661104"""
10671105function set_va! (body_aero:: BodyAerodynamics{P, W, T} , va_vec:: AbstractVector ,
1068- omega= zeros (MVector{3 , T})) where {P, W, T}
1069- n_panels = length (body_aero. panels)
1070- va_vec_dist = zeros (T, n_panels, 3 )
1106+ omega= zeros (MVector{3 , T});
1107+ reference_point= body_aero. reference_point) where {P, W, T}
10711108 body_aero. omega .= omega
1109+ body_aero. reference_point .= reference_point
10721110 set_pitch_rate_dist! (body_aero, omega)
10731111
1074- if all (iszero, omega)
1075- va_vec_dist .= reshape (va_vec, 1 , 3 )
1076- else
1077- idx = 1
1078- for wing in body_aero. wings
1079- panel_end = idx + wing. n_panels - 1
1080-
1081- # Calculate velocities for each panel in this wing slice
1082- for j in idx: panel_end
1083- omega_va_vec = - omega × body_aero. panels[j]. control_point
1084- va_vec_dist[j, :] .= omega_va_vec .+ va_vec
1085- end
1086- idx = panel_end + 1
1087- end
1088- end
1089-
1090- # Update panel velocities
1112+ va_vec_dist = zeros (T, P, 3 )
10911113 for (i, panel) in enumerate (body_aero. panels)
1092- panel. va .= va_vec_dist[i,:]
1114+ panel. va .= va_vec .- omega × (panel. control_point .- body_aero. reference_point)
1115+ va_vec_dist[i, :] .= panel. va
10931116 end
10941117
10951118 # Update wake elements
@@ -1147,7 +1170,8 @@ apparent_wind(alpha, beta, wind_speed) =
11471170 set_va!(body_aero::BodyAerodynamics, settings::VSMSettings)
11481171
11491172Set the uniform inflow of `body_aero` to the [`apparent_wind`](@ref) at the `alpha` and
1150- `beta` [°] and `wind_speed` [m/s] of `settings.condition`.
1173+ `beta` [°] and `wind_speed` [m/s] of `settings.condition`, turning the body about
1174+ `body_aero.reference_point` at its `yaw_rate` [°/s] about Z_b.
11511175
11521176# Example
11531177```julia
@@ -1160,5 +1184,5 @@ function set_va!(body_aero::BodyAerodynamics, settings::VSMSettings)
11601184 condition = settings. condition
11611185 va_vec = apparent_wind (deg2rad (condition. alpha), deg2rad (condition. beta),
11621186 condition. wind_speed)
1163- set_va! (body_aero, va_vec)
1187+ set_va! (body_aero, va_vec, [ 0.0 , 0.0 , deg2rad (condition . yaw_rate)] )
11641188end
0 commit comments