Skip to content

Commit afb0836

Browse files
committed
Add back types
1 parent 7287f32 commit afb0836

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

docs/src/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ A body is constructed of one or more abstract wings. An abstract wing can be a W
2828
A Wing/ RamAirWing has one or more sections.
2929
```@docs
3030
Section
31-
Section(LE_point, TE_point, aero_model)
31+
Section(LE_point::PosVector, TE_point::PosVector, aero_model)
3232
Wing
3333
Wing(n_panels::Int; spanwise_distribution::PanelDistribution=LINEAR,
3434
spanwise_direction::PosVector=MVec3([0.0, 1.0, 0.0]))

src/body_aerodynamics.jl

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
"""
22
@with_kw mutable struct BodyAerodynamics{P}
33
4-
Main structure for calculating aerodynamic properties of bodies.
4+
Main structure for calculating aerodynamic properties of bodies. Use the constructor to initialize.
55
66
# Fields
77
- panels::Vector{Panel}: Vector of [Panel](@ref) structs
88
- wings::Union{Vector{Wing}, Vector{RamAirWing}}: A vector of wings; a body can have multiple wings
9-
- `_va`::MVec3 = zeros(MVec3): A vector of the apparent wind speed, see: [MVec3](@ref)
9+
- `va::MVec3` = zeros(MVec3): A vector of the apparent wind speed, see: [MVec3](@ref)
1010
- `omega`::MVec3 = zeros(MVec3): A vector of the turn rates around the kite body axes
1111
- `gamma_distribution`=zeros(Float64, P): A vector of the circulation
1212
of the velocity field; Length: Number of segments. [m²/s]
1313
- `alpha_uncorrected`=zeros(Float64, P): angles of attack per panel
1414
- `alpha_corrected`=zeros(Float64, P): corrected angles of attack per panel
1515
- `stall_angle_list`=zeros(Float64, P): stall angle per panel
16-
- `alpha_array` = zeros(Float64, P)
17-
- `v_a_array` = zeros(Float64, P)
16+
- `alpha_array::MVector{P, Float64}` = zeros(Float64, P)
17+
- `v_a_array::MVector{P, Float64}` = zeros(Float64, P)
1818
- `work_vectors`::NTuple{10, MVec3} = ntuple(_ -> zeros(MVec3), 10)
19-
- AIC::Array{Float64, 3} = zeros(3, P, P)
20-
- `projected_area`::Float64 = 1.0: The area projected onto the xy-plane of the kite body reference frame [m²]
19+
- `AIC::Array{Float64, 3}` = zeros(3, P, P)
20+
- `projected_area::Float64` = 1.0: The area projected onto the xy-plane of the kite body reference frame [m²]
21+
- `y::MVector{P, Float64}` = zeros(MVector{P, Float64})
22+
- `cache::Vector{PreallocationTools.LazyBufferCache{typeof(identity), typeof(identity)}}` = [LazyBufferCache() for _ in 1:5]
2123
"""
2224
@with_kw mutable struct BodyAerodynamics{P}
2325
panels::Vector{Panel}
@@ -43,6 +45,9 @@ end
4345
4446
Construct a [BodyAerodynamics](@ref) object for aerodynamic calculations.
4547
48+
This constructor handles initialization of panels, coordinate transformations, and
49+
aerodynamic properties, returning a fully initialized structure ready for simulation.
50+
4651
# Arguments
4752
- `wings::Vector{T}`: Vector of wings to analyze, where T is an AbstractWing type
4853
@@ -53,6 +58,12 @@ Construct a [BodyAerodynamics](@ref) object for aerodynamic calculations.
5358
5459
# Returns
5560
- [BodyAerodynamics](@ref) object initialized with panels and wings
61+
62+
# Example
63+
```julia
64+
wing = RamAirWing("body.obj", "foil.dat")
65+
body_aero = BodyAerodynamics([wing], va=[15.0, 0.0, 0.0], omega=zeros(3))
66+
```
5667
"""
5768
function BodyAerodynamics(
5869
wings::Vector{T};
@@ -304,7 +315,7 @@ end
304315
Update angle of attack at aerodynamic center for VSM method.
305316
306317
Returns:
307-
Vector{Float64}: Updated angles of attack
318+
nothing
308319
"""
309320
function update_effective_angle_of_attack!(alpha_corrected,
310321
body_aero::BodyAerodynamics,

src/wing_geometry.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ Represents a wing section with leading edge, trailing edge, and aerodynamic prop
1818
end
1919

2020
"""
21-
Section(LE_point, TE_point, aero_model)
21+
Section(LE_point::PosVector, TE_point::PosVector, aero_model)
2222
2323
Create a new wing section with the specified leading edge point, trailing edge point,
2424
and aerodynamic model.
2525
2626
# Arguments
27-
- `LE_point::MVec3`: Leading edge point coordinates
28-
- `TE_point::MVec3`: Trailing edge point coordinates
27+
- `LE_point::PosVector`: Leading edge point coordinates
28+
- `TE_point::PosVector`: Trailing edge point coordinates
2929
- `aero_model::AeroModel`: Aerodynamic model type (e.g., INVISCID, POLAR_VECTORS)
3030
3131
# Returns
@@ -36,11 +36,11 @@ function Section(LE_point, TE_point, aero_model)
3636
end
3737

3838
"""
39-
init!(section::Section, LE_point, TE_point, aero_model=nothing, aero_data=nothing)
39+
init!(section::Section, LE_point::PosVector, TE_point::PosVector, aero_model=nothing, aero_data=nothing)
4040
4141
Function to update a [Section](@ref) in place.
4242
"""
43-
function init!(section::Section, LE_point::AbstractVector, TE_point::AbstractVector, aero_model=nothing, aero_data=nothing)
43+
function init!(section::Section, LE_point, TE_point, aero_model=nothing, aero_data=nothing)
4444
section.LE_point .= LE_point
4545
section.TE_point .= TE_point
4646
(!isnothing(aero_model)) && (section.aero_model = aero_model)

test/bench.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ using LinearAlgebra
116116
z_airf_array[i, :] .= panel.z_airf
117117
end
118118

119-
alphas = collect(-20:30)
119+
alphas = collect(-20.0:30.0)
120120
cls = [2π * α for α in alphas]
121121
cds = [0.01 + 0.05 * α^2 for α in alphas]
122122
cms = [-0.1 * α for α in alphas]

0 commit comments

Comments
 (0)