@@ -22,6 +22,8 @@ Struct for storing the solution of the [solve!](@ref) function. Must contain all
2222 lift:: Matrix{Float64} = zeros (P,1 )
2323 drag:: Matrix{Float64} = zeros (P,1 )
2424 moment:: Matrix{Float64} = zeros (P,1 )
25+ f_body_3D:: Matrix{Float64} = zeros (3 , P)
26+ m_body_3D:: Matrix{Float64} = zeros (3 , P)
2527 gamma_distribution:: Union{Nothing, Vector{Float64}} = nothing
2628 aero_force:: MVec3 = zeros (MVec3)
2729 aero_moments:: MVec3 = zeros (MVec3)
@@ -170,8 +172,6 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
170172 end
171173
172174 # Initialize result arrays
173- f_body_3D = zeros (3 , n_panels)
174- m_body_3D = zeros (3 , n_panels)
175175 area_all_panels = 0.0
176176
177177 # Get wing properties
@@ -207,7 +207,7 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
207207 ftotal_induced_va = lift_induced_va + drag_induced_va
208208
209209 # Body frame forces
210- f_body_3D[:,i] .= ftotal_induced_va .* panel. width
210+ solver . sol . f_body_3D[:,i] .= ftotal_induced_va .* panel. width
211211
212212 # Calculate the moments
213213 # (1) Panel aerodynamic center in body frame:
@@ -220,9 +220,9 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
220220 # Vector from panel AC to the chosen reference point:
221221 r_vector = panel_ac_body - reference_point # e.g. CG, wing root, etc.
222222 # Cross product to shift the force from panel AC to ref. point:
223- M_shift = r_vector × MVec3 (f_body_3D[:,i])
223+ M_shift = r_vector × MVec3 (solver . sol . f_body_3D[:,i])
224224 # Total panel moment about the reference point:
225- m_body_3D[:,i] .= M_local_3D + M_shift
225+ solver . sol . m_body_3D[:,i] .= M_local_3D + M_shift
226226
227227 # Calculate the moment distribution (moment on each panel)
228228 arm = (moment_frac - 0.25 ) * panel. chord
@@ -232,14 +232,14 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
232232
233233 # update the result struct
234234 solver. sol. aero_force .= [
235- sum (f_body_3D[1 ,:]),
236- sum (f_body_3D[2 ,:]),
237- sum (f_body_3D[3 ,:])
235+ sum (solver . sol . f_body_3D[1 ,:]),
236+ sum (solver . sol . f_body_3D[2 ,:]),
237+ sum (solver . sol . f_body_3D[3 ,:])
238238 ]
239239 solver. sol. aero_moments .= [
240- sum (m_body_3D[1 ,:]),
241- sum (m_body_3D[2 ,:]),
242- sum (m_body_3D[3 ,:])
240+ sum (solver . sol . m_body_3D[1 ,:]),
241+ sum (solver . sol . m_body_3D[2 ,:]),
242+ sum (solver . sol . m_body_3D[3 ,:])
243243 ]
244244 solver. sol. force_coefficients .= solver. sol. aero_force ./ (q_inf * projected_area)
245245 solver. sol. moment_coefficients .= solver. sol. aero_moments ./ (q_inf * projected_area)
0 commit comments