Skip to content

Commit 917751b

Browse files
committed
pre-calculate projected area and add as field to body
1 parent 7fc9120 commit 917751b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/body_aerodynamics.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Main structure for calculating aerodynamic properties of bodies.
1717
- v_a_array::Vector{Float64} = zeros(Float64, P)
1818
- work_vectors::NTuple{10,MVec3} = ntuple(_ -> zeros(MVec3), 10)
1919
- AIC::Array{Float64, 3} = zeros(3, P, P)
20+
- projected_area::Float64 = 1.0: The area projected onto the xy-plane of the kite body reference frame [m²]
2021
"""
2122
@with_kw mutable struct BodyAerodynamics{P}
2223
panels::Vector{Panel}
@@ -31,6 +32,7 @@ Main structure for calculating aerodynamic properties of bodies.
3132
v_a_array::Vector{Float64} = zeros(Float64, P)
3233
work_vectors::NTuple{10,MVec3} = ntuple(_ -> zeros(MVec3), 10)
3334
AIC::Array{Float64, 3} = zeros(3, P, P)
35+
projected_area::Float64 = one(Float64)
3436
end
3537

3638
"""
@@ -132,10 +134,9 @@ function init!(body_aero::BodyAerodynamics;
132134
idx += 1
133135
end
134136
end
135-
136-
@assert all([panel.filaments[1].initialized for panel in body_aero.panels])
137137

138138
# Initialize rest of the struct
139+
body_aero.projected_area = sum(wing -> calculate_projected_area(wing), body_aero.wings)
139140
body_aero.stall_angle_list .= calculate_stall_angle_list(body_aero.panels)
140141
body_aero.alpha_array .= 0.0
141142
body_aero.v_a_array .= 0.0
@@ -635,7 +636,7 @@ function calculate_results(
635636
end
636637

637638
# Calculate wing geometry properties
638-
projected_area = sum(wing -> calculate_projected_area(wing), body_aero.wings)
639+
projected_area = body_aero.projected_area
639640
wing_span = body_aero.wings[1].span
640641
aspect_ratio_projected = wing_span^2 / projected_area
641642

src/solver.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
171171
q_inf = 0.5 * density * va_mag^2
172172

173173
# Calculate wing geometry properties
174-
projected_area = sum(wing -> calculate_projected_area(wing), body_aero.wings)
174+
projected_area = body_aero.projected_area
175175

176176
for (i, panel) in enumerate(panels) # 30625 bytes
177177

0 commit comments

Comments
 (0)