Skip to content

Commit 504947e

Browse files
committed
document frame and rename global to body
1 parent 9569c8c commit 504947e

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

src/body_aerodynamics.jl

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ end
406406
va_unit_array::Matrix{Float64}, panels::Vector{Panel},
407407
is_only_f_and_gamma_output::Bool)
408408
409-
Calculate final aerodynamic results.
409+
Calculate final aerodynamic results. Reference point is in the kite body (KB) frame.
410410
411411
Returns:
412412
Dict: Results including forces, coefficients and distributions
@@ -478,8 +478,8 @@ function calculate_results(
478478
cl_prescribed_va = Float64[]
479479
cd_prescribed_va = Float64[]
480480
cs_prescribed_va = Float64[]
481-
f_global_3D = zeros(3, n_panels)
482-
m_global_3D = zeros(3, n_panels)
481+
f_body_3D = zeros(3, n_panels)
482+
m_body_3D = zeros(3, n_panels)
483483
area_all_panels = 0.0
484484

485485
# Initialize force sums
@@ -533,8 +533,8 @@ function calculate_results(
533533
side_prescribed_va = dot(lift_induced_va, spanwise_direction) +
534534
dot(drag_induced_va, spanwise_direction)
535535

536-
# Global forces
537-
f_global_3D[:,i] .= [
536+
# Body frame forces
537+
f_body_3D[:,i] .= [
538538
dot(ftotal_induced_va, [1.0, 0.0, 0.0]),
539539
dot(ftotal_induced_va, [0.0, 1.0, 0.0]),
540540
dot(ftotal_induced_va, [0.0, 0.0, 1.0])
@@ -551,30 +551,30 @@ function calculate_results(
551551
push!(cs_prescribed_va, side_prescribed_va / (q_inf * panel.chord))
552552

553553
### Moment ###
554-
# (1) Panel aerodynamic center in global frame:
555-
panel_ac_global = panel.aero_center # 3D [x, y, z]
554+
# (1) Panel aerodynamic center in body frame:
555+
panel_ac_body = panel.aero_center # 3D [x, y, z]
556556

557-
# (2) Convert local (2D) pitching moment to a 3D vector in global coords.
557+
# (2) Convert local (2D) pitching moment to a 3D vector in body coords.
558558
# Use the axis around which the moment is defined,
559559
# which is the z-axis pointing "spanwise"
560-
moment_axis_global = panel.z_airf
560+
moment_axis_body = panel.z_airf
561561

562562
# Scale by panel width if your 'moment[i]' is 2D moment-per-unit-span:
563-
M_local_3D = moment[i] * moment_axis_global * panel.width
563+
M_local_3D = moment[i] * moment_axis_body * panel.width
564564

565565
# Vector from panel AC to the chosen reference point:
566-
r_vector = panel_ac_global - reference_point # e.g. CG, wing root, etc.
566+
r_vector = panel_ac_body - reference_point # e.g. CG, wing root, etc.
567567

568568
# Cross product to shift the force from panel AC to ref. point:
569-
M_shift = cross(r_vector, f_global_3D[:,i])
569+
M_shift = cross(r_vector, f_body_3D[:,i])
570570

571571
# Total panel moment about the reference point:
572-
m_global_3D[:,i] = M_local_3D + M_shift
572+
m_body_3D[:,i] = M_local_3D + M_shift
573573
end
574574

575575
if is_only_f_and_gamma_output
576576
return Dict{String,Any}(
577-
"F_distribution" => f_global_3D,
577+
"F_distribution" => f_body_3D,
578578
"gamma_distribution" => gamma_new
579579
)
580580
end
@@ -596,28 +596,28 @@ function calculate_results(
596596

597597
# Create results dictionary
598598
results = Dict{String,Any}(
599-
"Fx" => sum(f_global_3D[1,:]),
600-
"Fy" => sum(f_global_3D[2,:]),
601-
"Fz" => sum(f_global_3D[3,:]),
602-
"Mx" => sum(m_global_3D[1,:]),
603-
"My" => sum(m_global_3D[2,:]),
604-
"Mz" => sum(m_global_3D[3,:]),
599+
"Fx" => sum(f_body_3D[1,:]),
600+
"Fy" => sum(f_body_3D[2,:]),
601+
"Fz" => sum(f_body_3D[3,:]),
602+
"Mx" => sum(m_body_3D[1,:]),
603+
"My" => sum(m_body_3D[2,:]),
604+
"Mz" => sum(m_body_3D[3,:]),
605605
"lift" => lift_wing_3D_sum,
606606
"drag" => drag_wing_3D_sum,
607607
"side" => side_wing_3D_sum,
608608
"cl" => lift_wing_3D_sum / (q_inf * projected_area),
609609
"cd" => drag_wing_3D_sum / (q_inf * projected_area),
610610
"cs" => side_wing_3D_sum / (q_inf * projected_area),
611-
"cmx" => sum(m_global_3D[1,:]) / (q_inf * projected_area * max_chord),
612-
"cmy" => sum(m_global_3D[2,:]) / (q_inf * projected_area * max_chord),
613-
"cmz" => sum(m_global_3D[3,:]) / (q_inf * projected_area * max_chord),
611+
"cmx" => sum(m_body_3D[1,:]) / (q_inf * projected_area * max_chord),
612+
"cmy" => sum(m_body_3D[2,:]) / (q_inf * projected_area * max_chord),
613+
"cmz" => sum(m_body_3D[3,:]) / (q_inf * projected_area * max_chord),
614614
"cl_distribution" => cl_prescribed_va,
615615
"cd_distribution" => cd_prescribed_va,
616616
"cs_distribution" => cs_prescribed_va,
617-
"F_distribution" => f_global_3D,
618-
"cfx" => (sum(f_global_3D[1,:]) / (q_inf * projected_area)),
619-
"cfy" => (sum(f_global_3D[2,:]) / (q_inf * projected_area)),
620-
"cfz" => (sum(f_global_3D[3,:]) / (q_inf * projected_area)),
617+
"F_distribution" => f_body_3D,
618+
"cfx" => (sum(f_body_3D[1,:]) / (q_inf * projected_area)),
619+
"cfy" => (sum(f_body_3D[2,:]) / (q_inf * projected_area)),
620+
"cfz" => (sum(f_body_3D[3,:]) / (q_inf * projected_area)),
621621
"alpha_at_ac" => alpha_corrected,
622622
"alpha_uncorrected" => alpha_array,
623623
"alpha_geometric" => alpha_geometric,

src/solver.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ end
5757
"""
5858
solve(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=nothing; log=false)
5959
60-
Main solving routine for the aerodynamic model.
60+
Main solving routine for the aerodynamic model. Reference point is in the kite body (KB) frame.
6161
"""
6262
function solve(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=nothing; log=false, reference_point=zeros(MVec3))
6363
isnothing(body_aero.panels[1].va) && throw(ArgumentError("Inflow conditions are not set, use set_va!(body_aero, va)"))

0 commit comments

Comments
 (0)