Skip to content

Commit dabda8f

Browse files
committed
Improve naming
1 parent d029ca2 commit dabda8f

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
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

test/test_body_aerodynamics.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,18 @@ end
157157

158158
sol = solve!(solver_object, body_aero; reference_point=[0,1,0])
159159

160-
@test sol.aero_force.x -117.97225244011436
161-
@test sol.aero_force.y 0.0 atol=1e-10
162-
@test sol.aero_force.z 1481.996390329679
160+
@test sol.force.x -117.97225244011436
161+
@test sol.force.y 0.0 atol=1e-10
162+
@test sol.force.z 1481.996390329679
163163

164-
@test sol.aero_moments.x -1481.996390329678
165-
@test sol.aero_moments.y 0.0 atol=1e-10
166-
@test sol.aero_moments.z -117.97225244011435
164+
@test sol.moment.x -1481.996390329678
165+
@test sol.moment.y 0.0 atol=1e-10
166+
@test sol.moment.z -117.97225244011435
167167

168168
@test sol.force_coefficients[1] -0.039050322560956294 # CFx
169169
@test sol.force_coefficients[2] 0.0 # CFy
170170
@test sol.force_coefficients[3] 0.49055973654418716 # CFz
171-
@test sol.force_coefficients[3] / sol.force_coefficients[1] sol.aero_force[3] / sol.aero_force[1]
171+
@test sol.force_coefficients[3] / sol.force_coefficients[1] sol.force[3] / sol.force[1]
172172
@test sol.moment_distribution[1] -0.0006683746751654071 atol=1e-10
173173
@test sol.moment_coefficient_distribution[1] -2.212405554436003e-7 atol=1e-10
174174
@test sol.moment_distribution[1] / sol.moment_distribution[2] sol.moment_coefficient_distribution[1] / sol.moment_coefficient_distribution[2]

0 commit comments

Comments
 (0)