Skip to content

Commit e24edc0

Browse files
authored
Use MVec3 in structs as much as possilbe (#59)
* Use MVec3 in SimitInfiniteFilament * one more MVec3 * make more use of MVec3 --------- Co-authored-by: Uwe Fechner <[email protected]>
1 parent 81b69fc commit e24edc0

File tree

6 files changed

+33
-33
lines changed

6 files changed

+33
-33
lines changed

src/body_aerodynamics.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Main structure for calculating aerodynamic properties of bodies.
66
# Fields
77
- panels::Vector{Panel}: Vector of Panel structs
88
- wings::Vector{AbstractWing}: a vector of wings; a body can have multiple wings
9-
- `_va`::Union{Nothing, Vector{Float64}, Tuple{Vector{Float64}, Float64}}: A vector of the apparent wind speed,
9+
- `_va`::Union{Nothing, Vector{Float64}, Tuple{MVec3, Float64}}: A vector of the apparent wind speed,
1010
or a tuple of the v_a vector and yaw rate (rad/s).
1111
- `gamma_distribution`::Union{Nothing, Vector{Float64}}: unclear, please defined
1212
- `alpha_uncorrected`::Union{Nothing, Vector{Float64}}: unclear, please define
@@ -16,7 +16,7 @@ Main structure for calculating aerodynamic properties of bodies.
1616
mutable struct BodyAerodynamics
1717
panels::Vector{Panel}
1818
wings::Vector{AbstractWing} # can be a vector of Wings, or of KiteWings
19-
_va::Union{Nothing, Vector{Float64}, Tuple{Vector{Float64}, Float64}}
19+
_va::Union{Nothing, Vector{Float64}, Tuple{MVec3, Float64}}
2020
gamma_distribution::Union{Nothing, Vector{Float64}}
2121
alpha_uncorrected::Union{Nothing, Vector{Float64}}
2222
alpha_corrected::Union{Nothing, Vector{Float64}}
@@ -105,20 +105,20 @@ end
105105
Structure to hold calculated panel properties.
106106
107107
# Fields
108-
- `aero_centers`::Vector{PosVector}
109-
- `control_points`::Vector{PosVector}
110-
- `bound_points_1`::Vector{PosVector}
111-
- `bound_points_2`::Vector{PosVector}
108+
- `aero_centers`::Vector{MVec3}
109+
- `control_points`::Vector{MVec3}
110+
- `bound_points_1`::Vector{MVec3}
111+
- `bound_points_2`::Vector{MVec3}
112112
- `x_airf`::Vector{Vector{Float64}}: unclear, please define
113113
- `y_airf`::Vector{Vector{Float64}}: unclear, please define
114114
- `z_airf`::Vector{Vector{Float64}}: unclear, please define
115115
116116
"""
117117
struct PanelProperties
118-
aero_centers::Vector{PosVector}
119-
control_points::Vector{PosVector}
120-
bound_points_1::Vector{PosVector}
121-
bound_points_2::Vector{PosVector}
118+
aero_centers::Vector{MVec3}
119+
control_points::Vector{MVec3}
120+
bound_points_1::Vector{MVec3}
121+
bound_points_2::Vector{MVec3}
122122
x_airf::Vector{Vector{Float64}}
123123
y_airf::Vector{Vector{Float64}}
124124
z_airf::Vector{Vector{Float64}}

src/filament.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ end
152152
Represents a semi-infinite vortex filament.
153153
"""
154154
struct SemiInfiniteFilament <: Filament
155-
x1::Vector{Float64} # Starting point
156-
direction::Vector{Float64} # Direction vector
157-
vel_mag::Float64 # Velocity magnitude
155+
x1::MVec3 # Starting point
156+
direction::MVec3 # Direction vector
157+
vel_mag::Float64 # Velocity magnitude
158158
filament_direction::Int64 # Direction indicator (-1 or 1)
159159
end
160160

src/kite_geometry.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Represents a curved wing that inherits from Wing with additional geometric prope
177177
- All fields from Wing:
178178
- `n_panels::Int`: Number of panels in aerodynamic mesh
179179
- `spanwise_panel_distribution::String`: Panel distribution type
180-
- `spanwise_direction::Vector{Float64}`: Wing span direction vector
180+
- `spanwise_direction::MVec3`: Wing span direction vector
181181
- `sections::Vector{Section}`: List of wing sections
182182
- Additional fields:
183183
- `center_of_mass::Vector{Float64}`: Center of mass coordinates
@@ -190,7 +190,7 @@ Same as Wing
190190
mutable struct KiteWing <: AbstractWing
191191
n_panels::Int64
192192
spanwise_panel_distribution::String
193-
spanwise_direction::Vector{Float64}
193+
spanwise_direction::MVec3
194194
sections::Vector{Section}
195195

196196
# Additional fields for KiteWing

src/panel.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Represents a panel in a vortex step method simulation.
1111
- `TE_point_2::Vector{MVec3}`: Second trailing edge point
1212
- `LE_point_2::Vector{MVec3}`: Second leading edge point
1313
- `chord::Float64`: Panel chord length
14-
- `va::Union{Nothing,Vector{Float64}}`: Panel velocity
14+
- `va::Union{Nothing, MVec3}`: Panel velocity
1515
- `corner_points::Matrix{Float64}`: Panel corner points
1616
- `aero_model::String`: Aerodynamic model type
1717
- `aerodynamic_center::Vector{Float64}`: Panel aerodynamic center
@@ -30,7 +30,7 @@ mutable struct Panel{P}
3030
TE_point_2::MVec3
3131
LE_point_2::MVec3
3232
chord::Float64
33-
va::Union{Nothing,Vector{Float64}}
33+
va::Union{Nothing, MVec3}
3434
corner_points::Matrix{Float64}
3535
aero_model::String
3636
cl_coefficients::Union{Nothing,Vector{Float64}}

src/solver.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ struct Solver
2424
is_only_f_and_gamma_output::Bool
2525

2626
function Solver(;
27-
aerodynamic_model_type::String="VSM",
28-
density::Float64=1.225,
29-
max_iterations::Int64=1500,
30-
allowed_error::Float64=1e-5,
31-
tol_reference_error::Float64=0.001,
32-
relaxation_factor::Float64=0.03,
33-
is_with_artificial_damping::Bool=false,
27+
aerodynamic_model_type::String = "VSM",
28+
density::Float64 = 1.225,
29+
max_iterations::Int64 = 1500,
30+
allowed_error::Float64 = 1e-5,
31+
tol_reference_error::Float64 = 0.001,
32+
relaxation_factor::Float64 = 0.03,
33+
is_with_artificial_damping::Bool = false,
3434
artificial_damping::NamedTuple{(:k2, :k4), Tuple{Float64, Float64}}=(k2=0.1, k4=0.0),
3535
type_initial_gamma_distribution::String="elliptic",
36-
core_radius_fraction::Float64=1e-20,
37-
mu::Float64=1.81e-5,
38-
is_only_f_and_gamma_output::Bool=false
36+
core_radius_fraction::Float64 = 1e-20,
37+
mu::Float64 = 1.81e-5, # TODO do not use magic constants
38+
is_only_f_and_gamma_output::Bool = false
3939
)
4040
new(
4141
aerodynamic_model_type,

src/wing_geometry.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
Represents a wing section with leading edge, trailing edge, and aerodynamic properties.
66
77
# Fields
8-
- `LE_point::Vector{Float64}`: Leading edge point coordinates
9-
- `TE_point::Vector{Float64}`: Trailing edge point coordinates
8+
- `LE_point::MVec3`: Leading edge point coordinates
9+
- `TE_point::MVec3`: Trailing edge point coordinates
1010
- `aero_input::Vector{Any}`: Aerodynamic input data for the section:
1111
- `("inviscid")`: Inviscid aerodynamics
1212
- `("polar_data", [alpha_column,CL_column,CD_column,CM_column])`: Polar data aerodynamics
1313
- `("lei_airfoil_breukels", [d_tube,camber])`: LEI airfoil with Breukels parameters
1414
"""
1515
struct Section{T}
16-
LE_point::Vector{Float64}
17-
TE_point::Vector{Float64}
16+
LE_point::MVec3
17+
TE_point::MVec3
1818
aero_input::T
1919

2020
function Section(
21-
LE_point::Vector{Float64},
22-
TE_point::Vector{Float64},
21+
LE_point::PosVector,
22+
TE_point::PosVector,
2323
aero_input::T
2424
) where T
2525
new{T}(LE_point, TE_point, aero_input)

0 commit comments

Comments
 (0)