Skip to content

Commit a173557

Browse files
committed
Use a lot more mvec
1 parent 0630f78 commit a173557

File tree

6 files changed

+31
-40
lines changed

6 files changed

+31
-40
lines changed

src/body_aerodynamics.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ Main structure for calculating aerodynamic properties of bodies.
2424
wings::Union{Vector{Wing}, Vector{RamAirWing}}
2525
_va::MVec3 = zeros(MVec3)
2626
omega::MVec3 = zeros(MVec3)
27-
gamma_distribution::Vector{Float64} = zeros(Float64, P)
28-
alpha_uncorrected::Vector{Float64} = zeros(Float64, P)
29-
alpha_corrected::Vector{Float64} = zeros(Float64, P)
30-
stall_angle_list::Vector{Float64} = zeros(Float64, P)
31-
alpha_array::Vector{Float64} = zeros(Float64, P)
32-
v_a_array::Vector{Float64} = zeros(Float64, P)
27+
gamma_distribution::MVector{P, Float64} = zeros(MVector{P, Float64})
28+
alpha_uncorrected::MVector{P, Float64} = zeros(MVector{P, Float64})
29+
alpha_corrected::MVector{P, Float64} = zeros(MVector{P, Float64})
30+
stall_angle_list::MVector{P, Float64} = zeros(MVector{P, Float64})
31+
alpha_array::MVector{P, Float64} = zeros(MVector{P, Float64})
32+
v_a_array::MVector{P, Float64} = zeros(MVector{P, Float64})
3333
work_vectors::NTuple{10,MVec3} = ntuple(_ -> zeros(MVec3), 10)
3434
AIC::Array{Float64, 3} = zeros(3, P, P)
3535
projected_area::Float64 = one(Float64)
36-
y::Vector{Float64} = zeros(Float64, P)
36+
y::MVector{P, Float64} = zeros(MVector{P, Float64})
3737
end
3838

3939
"""

src/kite_geometry.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ Represents a curved wing that inherits from Wing with additional geometric prope
375375
- refined_sections::Vector{Section}
376376
- `remove_nan::Bool`: Wether to remove the NaNs from interpolations or not
377377
- Additional fields:
378-
- `circle_center_z::Vector{Float64}`: Center of circle coordinates
378+
- `circle_center_z`: Center of circle coordinates
379379
- gamma_tip::Float64: Angle between the body frame z axis and the vector going from the kite circular shape center to the wing tip.
380380
- `inertia_tensor`::Matrix{Float64}: see: [`calculate_inertia_tensor`](@ref)
381381
- radius::Float64: Radius of curvature
@@ -398,13 +398,13 @@ mutable struct RamAirWing <: AbstractWing
398398
mass::Float64
399399
gamma_tip::Float64
400400
inertia_tensor::Matrix{Float64}
401-
center_of_mass::Vector{Float64}
401+
center_of_mass
402402
radius::Float64
403403
le_interp::NTuple{3, Extrapolation}
404404
te_interp::NTuple{3, Extrapolation}
405405
area_interp::Extrapolation
406-
theta_dist::Vector{Float64}
407-
delta_dist::Vector{Float64}
406+
theta_dist
407+
delta_dist
408408
end
409409

410410
"""

src/panel.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,11 @@ function compute_lei_coeffs(section_1::Section, section_2::Section)
301301
end
302302

303303
"""
304-
calculate_relative_alpha_and_velocity(panel::Panel, induced_velocity::Vector{Float64})
304+
calculate_relative_alpha_and_velocity(panel::Panel, induced_velocity)
305305
306306
Calculate relative angle of attack and relative velocity of the panel.
307307
"""
308-
function calculate_relative_alpha_and_velocity(panel::Panel, induced_velocity::Vector{Float64})
308+
function calculate_relative_alpha_and_velocity(panel::Panel, induced_velocity)
309309
relative_velocity = panel.va + induced_velocity
310310
v_normal = dot(panel.z_airf, relative_velocity)
311311
v_tangential = dot(panel.x_airf, relative_velocity)

src/solver.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Struct for storing the solution of the [solve!](@ref) function. Must contain all
2020
y_airf_array::Matrix{Float64} = zeros(P, 3)
2121
z_airf_array::Matrix{Float64} = zeros(P, 3)
2222
va_array::Matrix{Float64} = zeros(P, 3)
23-
chord_array::Vector{Float64} = zeros(P)
23+
chord_array::MVector{P, Float64} = zeros(MVector{P, Float64})
2424
###
25-
panel_width_array::Vector{Float64} = zeros(P)
26-
cl_array::Vector{Float64} = zeros(P)
27-
cd_array::Vector{Float64} = zeros(P)
28-
cm_array::Vector{Float64} = zeros(P)
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})
2929
panel_lift::Matrix{Float64} = zeros(P,1)
3030
panel_drag::Matrix{Float64} = zeros(P,1)
3131
panel_moment::Matrix{Float64} = zeros(P,1)
@@ -36,8 +36,8 @@ Struct for storing the solution of the [solve!](@ref) function. Must contain all
3636
moment::MVec3 = zeros(MVec3)
3737
force_coefficients::MVec3 = zeros(MVec3)
3838
moment_coefficients::MVec3 = zeros(MVec3)
39-
moment_distribution::Vector{Float64} = zeros(P)
40-
moment_coeff_dist::Vector{Float64} = zeros(P)
39+
moment_distribution::MVector{P, Float64} = zeros(MVector{P, Float64})
40+
moment_coeff_dist::MVector{P, Float64} = zeros(MVector{P, Float64})
4141
solver_status::SolverStatus = FAILURE
4242
end
4343

@@ -58,7 +58,7 @@ function LoopResult(P)
5858
end
5959

6060
@with_kw struct BaseResult{P}
61-
va_norm_array::Vector{Float64} = zeros(P)
61+
va_norm_array::MVector{P, Float64} = zeros(MVector{P, Float64})
6262
va_unit_array::Matrix{Float64} = zeros(P, 3)
6363
end
6464

@@ -556,7 +556,7 @@ function gamma_loop!(
556556
end
557557

558558
"""
559-
smooth_circulation(circulation::Vector{Float64},
559+
smooth_circulation(circulation,
560560
smoothness_factor::Float64,
561561
damping_factor::Float64)
562562
@@ -566,7 +566,7 @@ Returns:
566566
- Tuple of smoothed circulation and boolean indicating if smoothing was applied
567567
"""
568568
function smooth_circulation(
569-
circulation::Vector{Float64},
569+
circulation,
570570
smoothness_factor::Float64,
571571
damping_factor::Float64
572572
)

src/wing_geometry.jl

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,13 @@ Represents a wing section with leading edge, trailing edge, and aerodynamic prop
1616
aero_model::AeroModel = INVISCID
1717
aero_data::AeroData = nothing
1818
end
19-
"""
20-
Section(LE_point::Vector{Float64}, TE_point::Vector{Float64},
21-
aero_model=INVISCID, aero_data=nothing)
22-
23-
Constructor for [Section](@ref) that allows to pass Vectors of Float64 as point coordinates.
24-
"""
25-
function Section(LE_point::Vector{Float64}, TE_point::Vector{Float64}, aero_model=INVISCID, aero_data=nothing)
26-
Section(MVec3(LE_point), MVec3(TE_point), aero_model, aero_data)
27-
end
2819

2920
"""
3021
init!(section::Section, LE_point, TE_point, aero_model=nothing, aero_data=nothing)
3122
3223
Function to update a [Section](@ref) in place.
3324
"""
34-
function init!(section::Section, LE_point, TE_point, aero_model=nothing, aero_data=nothing)
25+
function init!(section::Section, LE_point::AbstractVector, TE_point::AbstractVector, aero_model=nothing, aero_data=nothing)
3526
section.LE_point .= LE_point
3627
section.TE_point .= TE_point
3728
(!isnothing(aero_model)) && (section.aero_model = aero_model)
@@ -281,8 +272,8 @@ Add a new section to the wing.
281272
- `aero_model`::AeroModel: [AeroModel](@ref)
282273
- `aero_data`::AeroData: See [AeroData](@ref)
283274
"""
284-
function add_section!(wing::Wing, LE_point::Vector{Float64},
285-
TE_point::Vector{Float64}, aero_model::AeroModel, aero_data::AeroData=nothing)
275+
function add_section!(wing::Wing, LE_point,
276+
TE_point, aero_model::AeroModel, aero_data::AeroData=nothing)
286277
if aero_model == POLAR_VECTORS && wing.remove_nan
287278
aero_data = remove_vector_nans(aero_data)
288279
elseif aero_model == POLAR_MATRICES && wing.remove_nan
@@ -771,15 +762,15 @@ end
771762
end
772763

773764
"""
774-
calculate_projected_area(wing::AbstractWing, z_plane_vector::Vector{Float64}=[0.0, 0.0, 1.0])
765+
calculate_projected_area(wing::AbstractWing, z_plane_vector=[0.0, 0.0, 1.0])
775766
776767
Calculate projected wing area onto plane defined by normal vector.
777768
778769
Returns:
779770
Float64: Projected area
780771
"""
781772
function calculate_projected_area(wing::AbstractWing,
782-
z_plane_vector::Vector{Float64}=[0.0, 0.0, 1.0])
773+
z_plane_vector=[0.0, 0.0, 1.0])
783774
# Normalize plane normal vector
784775
z_plane_vector = z_plane_vector ./ norm(z_plane_vector)
785776

test/utils.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ end
1818
Generate 3D coordinates of a rectangular wing with twist and dihedral.
1919
2020
# Arguments
21-
- `chord::Vector{Float64}`: Chord lengths of wing panels
21+
- `chord`: Chord lengths of wing panels
2222
- `span::Float64`: Total wing span
23-
- `theta::Vector{Float64}`: Twist angles in radians
24-
- `beta::Vector{Float64}`: Dihedral angles in radians
23+
- `theta`: Twist angles in radians
24+
- `beta`: Dihedral angles in radians
2525
- `N::Int`: Number of spanwise panels
2626
- `dist::String`: Distribution type ("cos" or "lin")
2727

0 commit comments

Comments
 (0)