55Struct for storing the solution of the [solve!](@ref) function. Must contain all info needed by `KiteModels.jl`.
66
77# Attributes
8- - gamma_distribution::Union{Nothing, Vector{Float64}}: Vector containing the panel circulations
8+ - `panel_width_array`::Vector{Float64}: Width of the panels [m]
9+ - cl_array::Vector{Float64}: Lift coefficients of the panels [-]
10+ - cd_array::Vector{Float64}: Drag coefficients of the panels [-]
11+ - cm_array::Vector{Float64}: Pitching moment coefficients of the panels [-]
12+ - panel_lift::Vector{Float64}: Lift force of the panels [N]
13+ - panel_drag::Vector{Float64}: Drag force of the panels [N]
14+ - panel_moment::Vector{Float64}: Pitching moment around the spanwise vector of the panels [Nm]
15+ - `f_body_3D`::Matrix{Float64}: Matrix of the aerodynamic forces (x, y, z vectors) [N]
16+ - `m_body_3D`::Matrix{Float64}: Matrix of the aerodynamic moments [Nm]
17+ - `gamma_distribution`::Union{Nothing, Vector{Float64}}: Vector containing the panel circulations.
918- force::MVec3: Aerodynamic force vector in KB reference frame [N]
1019- moment::MVec3: Aerodynamic moments [Mx, My, Mz] around the reference point [Nm]
1120- force_coefficients::MVec3: Aerodynamic force coefficients [CFx, CFy, CFz] [-]
12- - moment_coefficients::MVec3: Aerodynamic moment coefficients [CMx, CMy, CMz] [-]
13- - moment_distribution::Vector{Float64}: Pitching moments around the spanwise vector of each panel. [Nm]
14- - moment_coeff_dist ::Vector{Float64}: Pitching moment coefficient around the spanwise vector of each panel. [-]
15- - solver_status::SolverStatus: enum, see [SolverStatus](@ref)
21+ - ` moment_coefficients` ::MVec3: Aerodynamic moment coefficients [CMx, CMy, CMz] [-]
22+ - ` moment_distribution` ::Vector{Float64}: Pitching moments around the spanwise vector of each panel. [Nm]
23+ - `moment_coefficient_distribution` ::Vector{Float64}: Pitching moment coefficient around the spanwise vector of each panel. [-]
24+ - ` solver_status` ::SolverStatus: enum, see [SolverStatus](@ref)
1625"""
1726@with_kw mutable struct VSMSolution{P}
1827 # ## private vectors of solve_base!
19- x_airf_array :: Matrix{Float64} = zeros (P, 3 )
20- y_airf_array :: Matrix{Float64} = zeros (P, 3 )
21- z_airf_array :: Matrix{Float64} = zeros (P, 3 )
22- va_array :: Matrix{Float64} = zeros (P, 3 )
23- chord_array :: MVector{P, Float64} = zeros (MVector{P, Float64} )
24- # ##
25- panel_width_array:: MVector{P, Float64} = zeros (MVector{P, Float64} )
26- cl_array:: MVector{P, Float64} = zeros (MVector{P, Float64} )
27- cd_array:: MVector{P, Float64} = zeros (MVector{P, Float64} )
28- cm_array:: MVector{P, Float64} = zeros (MVector{P, Float64} )
29- panel_lift:: Matrix {Float64} = zeros (P, 1 )
30- panel_drag:: Matrix {Float64} = zeros (P, 1 )
31- panel_moment:: Matrix {Float64} = zeros (P, 1 )
28+ _x_airf_array :: Matrix{Float64} = zeros (P, 3 )
29+ _y_airf_array :: Matrix{Float64} = zeros (P, 3 )
30+ _z_airf_array :: Matrix{Float64} = zeros (P, 3 )
31+ _va_array :: Matrix{Float64} = zeros (P, 3 )
32+ _chord_array :: Vector{ Float64} = zeros (P )
33+ # ## end of private vectors
34+ panel_width_array:: Vector{ Float64} = zeros (P )
35+ cl_array:: Vector{ Float64} = zeros (P )
36+ cd_array:: Vector{ Float64} = zeros (P )
37+ cm_array:: Vector{ Float64} = zeros (P )
38+ panel_lift:: Vector {Float64} = zeros (P)
39+ panel_drag:: Vector {Float64} = zeros (P)
40+ panel_moment:: Vector {Float64} = zeros (P)
3241 f_body_3D:: Matrix{Float64} = zeros (3 , P)
3342 m_body_3D:: Matrix{Float64} = zeros (3 , P)
3443 gamma_distribution:: Union{Nothing, Vector{Float64}} = nothing
@@ -196,9 +205,9 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
196205 panel_moment = solver. sol. panel_moment
197206
198207 # Compute using fused broadcasting (no intermediate allocations)
199- @. lift = cl_array * 0.5 * density * v_a_array^ 2 * solver. sol. chord_array
200- @. drag = cd_array * 0.5 * density * v_a_array^ 2 * solver. sol. chord_array
201- @. panel_moment = cm_array * 0.5 * density * v_a_array^ 2 * solver. sol. chord_array
208+ @. lift = cl_array * 0.5 * density * v_a_array^ 2 * solver. sol. _chord_array
209+ @. drag = cd_array * 0.5 * density * v_a_array^ 2 * solver. sol. _chord_array
210+ @. panel_moment = cm_array * 0.5 * density * v_a_array^ 2 * solver. sol. _chord_array
202211
203212 # Calculate alpha corrections based on model type
204213 if aerodynamic_model_type == VSM # 64 bytes
@@ -207,9 +216,9 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
207216 body_aero,
208217 gamma_new,
209218 solver. core_radius_fraction,
210- solver. sol. z_airf_array ,
211- solver. sol. x_airf_array ,
212- solver. sol. va_array ,
219+ solver. sol. _z_airf_array ,
220+ solver. sol. _x_airf_array ,
221+ solver. sol. _va_array ,
213222 solver. br. va_norm_array,
214223 solver. br. va_unit_array
215224 )
@@ -334,11 +343,11 @@ function solve(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=n
334343 solver. mu,
335344 solver. lr. alpha_array,
336345 solver. lr. v_a_array,
337- solver. sol. chord_array ,
338- solver. sol. x_airf_array ,
339- solver. sol. y_airf_array ,
340- solver. sol. z_airf_array ,
341- solver. sol. va_array ,
346+ solver. sol. _chord_array ,
347+ solver. sol. _x_airf_array ,
348+ solver. sol. _y_airf_array ,
349+ solver. sol. _z_airf_array ,
350+ solver. sol. _va_array ,
342351 solver. br. va_norm_array,
343352 solver. br. va_unit_array,
344353 body_aero. panels,
@@ -365,31 +374,31 @@ function solve_base!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribu
365374 relaxation_factor = solver. relaxation_factor
366375
367376 # Clear arrays
368- solver. sol. x_airf_array .= 0
369- solver. sol. y_airf_array .= 0
370- solver. sol. z_airf_array .= 0
371- solver. sol. va_array .= 0
372- solver. sol. chord_array .= 0
377+ solver. sol. _x_airf_array .= 0
378+ solver. sol. _y_airf_array .= 0
379+ solver. sol. _z_airf_array .= 0
380+ solver. sol. _va_array .= 0
381+ solver. sol. _chord_array .= 0
373382
374383 # Fill arrays from panels
375384 for (i, panel) in enumerate (panels)
376- solver. sol. x_airf_array [i, :] .= panel. x_airf
377- solver. sol. y_airf_array [i, :] .= panel. y_airf
378- solver. sol. z_airf_array [i, :] .= panel. z_airf
379- solver. sol. va_array [i, :] .= panel. va
380- solver. sol. chord_array [i] = panel. chord
385+ solver. sol. _x_airf_array [i, :] .= panel. x_airf
386+ solver. sol. _y_airf_array [i, :] .= panel. y_airf
387+ solver. sol. _z_airf_array [i, :] .= panel. z_airf
388+ solver. sol. _va_array [i, :] .= panel. va
389+ solver. sol. _chord_array [i] = panel. chord
381390 end
382391
383392 # Calculate unit vectors
384- calc_norm_array! (solver. br. va_norm_array, solver. sol. va_array )
385- solver. br. va_unit_array .= solver. sol. va_array ./ solver. br. va_norm_array
393+ calc_norm_array! (solver. br. va_norm_array, solver. sol. _va_array )
394+ solver. br. va_unit_array .= solver. sol. _va_array ./ solver. br. va_norm_array
386395
387396 # Calculate AIC matrices
388397 calculate_AIC_matrices! (body_aero, solver. aerodynamic_model_type, solver. core_radius_fraction, solver. br. va_norm_array,
389398 solver. br. va_unit_array)
390399
391400 # Initialize gamma distribution
392- gamma_initial = solver. cache_base[1 ][solver. sol. chord_array ]
401+ gamma_initial = solver. cache_base[1 ][solver. sol. _chord_array ]
393402 if isnothing (gamma_distribution)
394403 if solver. type_initial_gamma_distribution == ELLIPTIC
395404 calculate_circulation_distribution_elliptical_wing (gamma_initial, body_aero)
@@ -430,11 +439,11 @@ function gamma_loop!(
430439 relaxation_factor:: Float64 ;
431440 log:: Bool = true
432441)
433- va_array = solver. sol. va_array
434- chord_array = solver. sol. chord_array
435- x_airf_array = solver. sol. x_airf_array
436- y_airf_array = solver. sol. y_airf_array
437- z_airf_array = solver. sol. z_airf_array
442+ va_array = solver. sol. _va_array
443+ chord_array = solver. sol. _chord_array
444+ x_airf_array = solver. sol. _x_airf_array
445+ y_airf_array = solver. sol. _y_airf_array
446+ z_airf_array = solver. sol. _z_airf_array
438447 solver. lr. converged = false
439448 n_panels = length (body_aero. panels)
440449 solver. lr. alpha_array .= body_aero. alpha_array
0 commit comments