diff --git a/src/body_aerodynamics.jl b/src/body_aerodynamics.jl index 4eff3488..0182a4ff 100644 --- a/src/body_aerodynamics.jl +++ b/src/body_aerodynamics.jl @@ -6,7 +6,7 @@ Main structure for calculating aerodynamic properties of bodies. # Fields - panels::Vector{Panel}: Vector of Panel structs - wings::Vector{AbstractWing}: a vector of wings; a body can have multiple wings -- `_va`::Union{Nothing, Vector{Float64}, Tuple{Vector{Float64}, Float64}}: A vector of the apparent wind speed, +- `_va`::Union{Nothing, Vector{Float64}, Tuple{MVec3, Float64}}: A vector of the apparent wind speed, or a tuple of the v_a vector and yaw rate (rad/s). - `gamma_distribution`::Union{Nothing, Vector{Float64}}: unclear, please defined - `alpha_uncorrected`::Union{Nothing, Vector{Float64}}: unclear, please define @@ -16,7 +16,7 @@ Main structure for calculating aerodynamic properties of bodies. mutable struct BodyAerodynamics panels::Vector{Panel} wings::Vector{AbstractWing} # can be a vector of Wings, or of KiteWings - _va::Union{Nothing, Vector{Float64}, Tuple{Vector{Float64}, Float64}} + _va::Union{Nothing, Vector{Float64}, Tuple{MVec3, Float64}} gamma_distribution::Union{Nothing, Vector{Float64}} alpha_uncorrected::Union{Nothing, Vector{Float64}} alpha_corrected::Union{Nothing, Vector{Float64}} @@ -105,20 +105,20 @@ end Structure to hold calculated panel properties. # Fields -- `aero_centers`::Vector{PosVector} -- `control_points`::Vector{PosVector} -- `bound_points_1`::Vector{PosVector} -- `bound_points_2`::Vector{PosVector} +- `aero_centers`::Vector{MVec3} +- `control_points`::Vector{MVec3} +- `bound_points_1`::Vector{MVec3} +- `bound_points_2`::Vector{MVec3} - `x_airf`::Vector{Vector{Float64}}: unclear, please define - `y_airf`::Vector{Vector{Float64}}: unclear, please define - `z_airf`::Vector{Vector{Float64}}: unclear, please define """ struct PanelProperties - aero_centers::Vector{PosVector} - control_points::Vector{PosVector} - bound_points_1::Vector{PosVector} - bound_points_2::Vector{PosVector} + aero_centers::Vector{MVec3} + control_points::Vector{MVec3} + bound_points_1::Vector{MVec3} + bound_points_2::Vector{MVec3} x_airf::Vector{Vector{Float64}} y_airf::Vector{Vector{Float64}} z_airf::Vector{Vector{Float64}} diff --git a/src/filament.jl b/src/filament.jl index a7ffde58..41730627 100644 --- a/src/filament.jl +++ b/src/filament.jl @@ -152,9 +152,9 @@ end Represents a semi-infinite vortex filament. """ struct SemiInfiniteFilament <: Filament - x1::Vector{Float64} # Starting point - direction::Vector{Float64} # Direction vector - vel_mag::Float64 # Velocity magnitude + x1::MVec3 # Starting point + direction::MVec3 # Direction vector + vel_mag::Float64 # Velocity magnitude filament_direction::Int64 # Direction indicator (-1 or 1) end diff --git a/src/kite_geometry.jl b/src/kite_geometry.jl index 4e53097c..511a56bd 100644 --- a/src/kite_geometry.jl +++ b/src/kite_geometry.jl @@ -177,7 +177,7 @@ Represents a curved wing that inherits from Wing with additional geometric prope - All fields from Wing: - `n_panels::Int`: Number of panels in aerodynamic mesh - `spanwise_panel_distribution::String`: Panel distribution type - - `spanwise_direction::Vector{Float64}`: Wing span direction vector + - `spanwise_direction::MVec3`: Wing span direction vector - `sections::Vector{Section}`: List of wing sections - Additional fields: - `center_of_mass::Vector{Float64}`: Center of mass coordinates @@ -190,7 +190,7 @@ Same as Wing mutable struct KiteWing <: AbstractWing n_panels::Int64 spanwise_panel_distribution::String - spanwise_direction::Vector{Float64} + spanwise_direction::MVec3 sections::Vector{Section} # Additional fields for KiteWing diff --git a/src/panel.jl b/src/panel.jl index 29a38a23..78aee0c0 100644 --- a/src/panel.jl +++ b/src/panel.jl @@ -11,7 +11,7 @@ Represents a panel in a vortex step method simulation. - `TE_point_2::Vector{MVec3}`: Second trailing edge point - `LE_point_2::Vector{MVec3}`: Second leading edge point - `chord::Float64`: Panel chord length -- `va::Union{Nothing,Vector{Float64}}`: Panel velocity +- `va::Union{Nothing, MVec3}`: Panel velocity - `corner_points::Matrix{Float64}`: Panel corner points - `aero_model::String`: Aerodynamic model type - `aerodynamic_center::Vector{Float64}`: Panel aerodynamic center @@ -30,7 +30,7 @@ mutable struct Panel{P} TE_point_2::MVec3 LE_point_2::MVec3 chord::Float64 - va::Union{Nothing,Vector{Float64}} + va::Union{Nothing, MVec3} corner_points::Matrix{Float64} aero_model::String cl_coefficients::Union{Nothing,Vector{Float64}} diff --git a/src/solver.jl b/src/solver.jl index 39650e5b..9234c575 100644 --- a/src/solver.jl +++ b/src/solver.jl @@ -24,18 +24,18 @@ struct Solver is_only_f_and_gamma_output::Bool function Solver(; - aerodynamic_model_type::String="VSM", - density::Float64=1.225, - max_iterations::Int64=1500, - allowed_error::Float64=1e-5, - tol_reference_error::Float64=0.001, - relaxation_factor::Float64=0.03, - is_with_artificial_damping::Bool=false, + aerodynamic_model_type::String = "VSM", + density::Float64 = 1.225, + max_iterations::Int64 = 1500, + allowed_error::Float64 = 1e-5, + tol_reference_error::Float64 = 0.001, + relaxation_factor::Float64 = 0.03, + is_with_artificial_damping::Bool = false, artificial_damping::NamedTuple{(:k2, :k4), Tuple{Float64, Float64}}=(k2=0.1, k4=0.0), type_initial_gamma_distribution::String="elliptic", - core_radius_fraction::Float64=1e-20, - mu::Float64=1.81e-5, - is_only_f_and_gamma_output::Bool=false + core_radius_fraction::Float64 = 1e-20, + mu::Float64 = 1.81e-5, # TODO do not use magic constants + is_only_f_and_gamma_output::Bool = false ) new( aerodynamic_model_type, diff --git a/src/wing_geometry.jl b/src/wing_geometry.jl index df355ee7..4a71deff 100644 --- a/src/wing_geometry.jl +++ b/src/wing_geometry.jl @@ -5,21 +5,21 @@ Represents a wing section with leading edge, trailing edge, and aerodynamic properties. # Fields -- `LE_point::Vector{Float64}`: Leading edge point coordinates -- `TE_point::Vector{Float64}`: Trailing edge point coordinates +- `LE_point::MVec3`: Leading edge point coordinates +- `TE_point::MVec3`: Trailing edge point coordinates - `aero_input::Vector{Any}`: Aerodynamic input data for the section: - `("inviscid")`: Inviscid aerodynamics - `("polar_data", [alpha_column,CL_column,CD_column,CM_column])`: Polar data aerodynamics - `("lei_airfoil_breukels", [d_tube,camber])`: LEI airfoil with Breukels parameters """ struct Section{T} - LE_point::Vector{Float64} - TE_point::Vector{Float64} + LE_point::MVec3 + TE_point::MVec3 aero_input::T function Section( - LE_point::Vector{Float64}, - TE_point::Vector{Float64}, + LE_point::PosVector, + TE_point::PosVector, aero_input::T ) where T new{T}(LE_point, TE_point, aero_input)