Skip to content

Commit da9d9da

Browse files
authored
Merge branch 'main' into refac
2 parents 5d559fb + dabda8f commit da9d9da

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/solver.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Struct for storing the solution of the [solve!](@ref) function. Must contain all
66
77
# Attributes
88
- gamma_distribution::Union{Nothing, Vector{Float64}}: Vector containing the panel circulations
9-
- aero_force::MVec3: Aerodynamic force vector in KB reference frame [N]
10-
- aero_moments::MVec3: Aerodynamic moments [Mx, My, Mz] around the reference point [Nm]
9+
- force::MVec3: Aerodynamic force vector in KB reference frame [N]
10+
- moment::MVec3: Aerodynamic moments [Mx, My, Mz] around the reference point [Nm]
1111
- force_coefficients::MVec3: Aerodynamic force coefficients [CFx, CFy, CFz] [-]
1212
- moment_coefficients::MVec3: Aerodynamic moment coefficients [CMx, CMy, CMz] [-]
1313
- moment_distribution::Vector{Float64}: Pitching moments around the spanwise vector of each panel. [Nm]
@@ -26,14 +26,14 @@ Struct for storing the solution of the [solve!](@ref) function. Must contain all
2626
cl_array::Vector{Float64} = zeros(P)
2727
cd_array::Vector{Float64} = zeros(P)
2828
cm_array::Vector{Float64} = zeros(P)
29-
lift::Matrix{Float64} = zeros(P,1)
30-
drag::Matrix{Float64} = zeros(P,1)
31-
moment::Matrix{Float64} = zeros(P,1)
29+
panel_lift::Matrix{Float64} = zeros(P,1)
30+
panel_drag::Matrix{Float64} = zeros(P,1)
31+
panel_moment::Matrix{Float64} = zeros(P,1)
3232
f_body_3D::Matrix{Float64} = zeros(3, P)
3333
m_body_3D::Matrix{Float64} = zeros(3, P)
3434
gamma_distribution::Union{Nothing, Vector{Float64}} = nothing
35-
aero_force::MVec3 = zeros(MVec3)
36-
aero_moments::MVec3 = zeros(MVec3)
35+
force::MVec3 = zeros(MVec3)
36+
moment::MVec3 = zeros(MVec3)
3737
force_coefficients::MVec3 = zeros(MVec3)
3838
moment_coefficients::MVec3 = zeros(MVec3)
3939
moment_distribution::Vector{Float64} = zeros(P)
@@ -185,14 +185,14 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
185185
end
186186

187187
# create an alias for the three vertical output vectors
188-
lift = solver.sol.lift
189-
drag = solver.sol.drag
190-
moment = solver.sol.moment
188+
lift = solver.sol.panel_lift
189+
drag = solver.sol.panel_drag
190+
panel_moment = solver.sol.panel_moment
191191

192192
# Compute using fused broadcasting (no intermediate allocations)
193193
@. lift = cl_array * 0.5 * density * v_a_array^2 * solver.sol.chord_array
194194
@. drag = cd_array * 0.5 * density * v_a_array^2 * solver.sol.chord_array
195-
@. moment = cm_array * 0.5 * density * v_a_array^2 * solver.sol.chord_array
195+
@. panel_moment = cm_array * 0.5 * density * v_a_array^2 * solver.sol.chord_array
196196

197197
# Calculate alpha corrections based on model type
198198
if aerodynamic_model_type == VSM # 64 bytes
@@ -256,7 +256,7 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
256256
# Use the axis around which the moment is defined,
257257
# which is the y-axis pointing "spanwise"
258258
moment_axis_body = panel.y_airf
259-
M_local_3D = moment[i] * moment_axis_body * panel.width
259+
M_local_3D = panel_moment[i] * moment_axis_body * panel.width
260260
# Vector from panel AC to the chosen reference point:
261261
r_vector = panel_ac_body - reference_point # e.g. CG, wing root, etc.
262262
# Cross product to shift the force from panel AC to ref. point:
@@ -266,23 +266,23 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
266266

267267
# Calculate the moment distribution (moment on each panel)
268268
arm = (moment_frac - 0.25) * panel.chord
269-
moment_distribution[i] = ((ftotal_induced_va panel.z_airf) * arm + moment[i]) * panel.width
269+
moment_distribution[i] = ((ftotal_induced_va panel.z_airf) * arm + panel_moment[i]) * panel.width
270270
moment_coefficient_distribution[i] = moment_distribution[i] / (q_inf * projected_area)
271271
end
272272

273273
# update the result struct
274-
solver.sol.aero_force .= MVec3(
274+
solver.sol.force .= MVec3(
275275
sum(solver.sol.f_body_3D[1,:]),
276276
sum(solver.sol.f_body_3D[2,:]),
277277
sum(solver.sol.f_body_3D[3,:])
278278
)
279-
solver.sol.aero_moments .= MVec3(
279+
solver.sol.moment .= MVec3(
280280
sum(solver.sol.m_body_3D[1,:]),
281281
sum(solver.sol.m_body_3D[2,:]),
282282
sum(solver.sol.m_body_3D[3,:])
283283
)
284-
solver.sol.force_coefficients .= solver.sol.aero_force ./ (q_inf * projected_area)
285-
solver.sol.moment_coefficients .= solver.sol.aero_moments ./ (q_inf * projected_area)
284+
solver.sol.force_coefficients .= solver.sol.force ./ (q_inf * projected_area)
285+
solver.sol.moment_coefficients .= solver.sol.moment ./ (q_inf * projected_area)
286286
if converged
287287
# TODO: Check if the result if feasible if converged
288288
solver.sol.solver_status = FEASIBLE

0 commit comments

Comments
 (0)