@@ -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
@@ -1083,44 +1087,32 @@ end
10831087
10841088
10851089"""
1086- 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)
10871092
1088- 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)`.
10891095
10901096# Arguments
10911097- body_aero::BodyAerodynamics: The [`BodyAerodynamics`](@ref) struct to modify
10921098- `va_vec::VelVector`: Velocity vector of the apparent wind speed [m/s]
10931099- `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]
10941101
10951102`omega` is also projected onto each panel's spanwise axis into
10961103`pitch_rate_dist`, which the solver reads when `flow_curvature` is enabled.
10971104"""
10981105function set_va! (body_aero:: BodyAerodynamics{P, W, T} , va_vec:: AbstractVector ,
1099- omega= zeros (MVector{3 , T})) where {P, W, T}
1100- n_panels = length (body_aero. panels)
1101- 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}
11021108 body_aero. omega .= omega
1109+ body_aero. reference_point .= reference_point
11031110 set_pitch_rate_dist! (body_aero, omega)
11041111
1105- if all (iszero, omega)
1106- va_vec_dist .= reshape (va_vec, 1 , 3 )
1107- else
1108- idx = 1
1109- for wing in body_aero. wings
1110- panel_end = idx + wing. n_panels - 1
1111-
1112- # Calculate velocities for each panel in this wing slice
1113- for j in idx: panel_end
1114- omega_va_vec = - omega × body_aero. panels[j]. control_point
1115- va_vec_dist[j, :] .= omega_va_vec .+ va_vec
1116- end
1117- idx = panel_end + 1
1118- end
1119- end
1120-
1121- # Update panel velocities
1112+ va_vec_dist = zeros (T, P, 3 )
11221113 for (i, panel) in enumerate (body_aero. panels)
1123- 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
11241116 end
11251117
11261118 # Update wake elements
@@ -1175,6 +1167,8 @@ constructs the velocity vector in the body reference frame based on:
11751167- Wind speed from settings.condition.wind_speed
11761168- Angle of attack from settings.condition.alpha (converted from degrees)
11771169- Sideslip angle from settings.condition.beta (converted from degrees)
1170+ - Yaw rate from settings.condition.yaw_rate (converted from °/s), applied as `omega`
1171+ about Z_b and turning the body about `body_aero.reference_point`
11781172
11791173The velocity vector is constructed as:
11801174- X_b (forward): wind_speed * cos(α) * cos(β)
@@ -1202,6 +1196,7 @@ function set_va!(body_aero::BodyAerodynamics, settings::VSMSettings)
12021196 sin (β), # Y_b (right)
12031197 sin (α)* cos (β) # Z_b (down)
12041198 ]
1205-
1206- set_va! (body_aero, va_vec)
1199+ omega = [0.0 , 0.0 , deg2rad (settings. condition. yaw_rate)]
1200+
1201+ set_va! (body_aero, va_vec, omega)
12071202end
0 commit comments