Skip to content

Commit 1273082

Browse files
committed
Merge branch 'main' into feat/moment
2 parents 9b7e652 + d2b832a commit 1273082

File tree

11 files changed

+54
-47
lines changed

11 files changed

+54
-47
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ authors = ["1-Bart-1 <[email protected]>"]
44
version = "0.1.2"
55

66
[deps]
7-
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
87
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
98
ControlPlots = "23c2ee80-7a9e-4350-b264-8e670f12517c"
109
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
@@ -40,6 +39,7 @@ Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
4039
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4140
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4241
Xfoil = "19641d66-a62d-11e8-2441-8f57a969a9c4"
42+
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
4343

4444
[targets]
45-
test = ["Test", "DataFrames", "CSV", "Distributed", "Documenter", "Xfoil"]
45+
test = ["Test", "DataFrames", "CSV", "Distributed", "Documenter", "Xfoil", "BenchmarkTools"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ wing = Wing(n_panels, spanwise_panel_distribution="linear")
102102
add_section!(wing,
103103
[0.0, span/2, 0.0], # Left tip LE
104104
[chord, span/2, 0.0], # Left tip TE
105-
"inviscid")
105+
:inviscid)
106106
add_section!(wing,
107107
[0.0, -span/2, 0.0], # Right tip LE
108108
[chord, -span/2, 0.0], # Right tip TE
109-
"inviscid")
109+
:inviscid)
110110

111111
# Step 3: Initialize aerodynamics
112112
wa = BodyAerodynamics([wing])

docs/src/functions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
```@meta
22
CurrentModule = VortexStepMethod
33
```
4+
## Functions for creating the geometry
5+
```@docs
6+
add_section!
7+
```
8+
49
## Main Plotting Functions
510
```@docs
611
plot_geometry

examples/bench.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ vsm_solver = Solver(aerodynamic_model_type=:VSM)
4040
# Step 5: Solve using both methods
4141
results_vsm = solve(vsm_solver, wa)
4242
@time results_vsm = solve(vsm_solver, wa)
43-
# time Python: 32.0 ms
44-
# time Julia: 0.6 ms
43+
# time Python: 32.0 ms Ryzen 7950x
44+
# time Julia: 0.6 ms Ryzen 7950x
45+
# 0.8 ms laptop, performance mode, battery
4546

4647
nothing

examples/ram_air_kite.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ using VortexStepMethod
22
using LinearAlgebra
33
using Pkg
44

5-
if ! ("CSV" keys(Pkg.project().dependencies))
6-
using TestEnv; TestEnv.activate()
5+
if !("CSV" keys(Pkg.project().dependencies))
6+
using TestEnv
7+
TestEnv.activate()
78
end
89
using CSV
910
using DataFrames
@@ -50,7 +51,7 @@ plot && plot_geometry(
5051
)
5152

5253
# Solving and plotting distributions
53-
@time results = solve(VSM, body_aero)
54+
results = solve(VSM, body_aero)
5455
@time results = solve(VSM, body_aero)
5556

5657
CAD_y_coordinates = [panel.aero_center[2] for panel in body_aero.panels]

examples/rectangular_wing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plot = true
88
n_panels = 20 # Number of panels
99
span = 20.0 # Wing span [m]
1010
chord = 1.0 # Chord length [m]
11-
v_a = 20.0 # Magnitude of inflow velocity [m/s]
11+
v_a = 20.0 # Magnitude of inflow velocity [m/s]
1212
density = 1.225 # Air density [kg/m³]
1313
alpha_deg = 30.0 # Angle of attack [degrees]
1414
alpha = deg2rad(alpha_deg)

src/body_aerodynamics.jl

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,18 @@ Structure to hold calculated panel properties.
112112
- `control_points`::Vector{MVec3}
113113
- `bound_points_1`::Vector{MVec3}
114114
- `bound_points_2`::Vector{MVec3}
115-
- `x_airf`::Vector{Vector{Float64}}: unclear, please define
116-
- `y_airf`::Vector{Vector{Float64}}: unclear, please define
117-
- `z_airf`::Vector{Vector{Float64}}: unclear, please define
118-
115+
- `x_airf`::Vector{MVec3}: Vector of unit vectors perpendicular to chord line
116+
- `y_airf`::Vector{MVec3}: Vector of unit vectors parallel to chord line
117+
- `z_airf`::Vector{MVec3}: Vector of unit vectors in spanwise direction
119118
"""
120119
struct PanelProperties
121120
aero_centers::Vector{MVec3}
122121
control_points::Vector{MVec3}
123122
bound_points_1::Vector{MVec3}
124123
bound_points_2::Vector{MVec3}
125-
x_airf::Vector{Vector{Float64}}
126-
y_airf::Vector{Vector{Float64}}
127-
z_airf::Vector{Vector{Float64}}
124+
x_airf::Vector{MVec3}
125+
y_airf::Vector{MVec3}
126+
z_airf::Vector{MVec3}
128127
end
129128

130129
"""
@@ -139,23 +138,23 @@ Returns:
139138
function calculate_panel_properties(section_list::Vector{Section}, n_panels::Int,
140139
aero_center_loc::Float64, control_point_loc::Float64)
141140
# Initialize arrays
142-
aero_centers = Vector{Float64}[]
143-
control_points = Vector{Float64}[]
144-
bound_points_1 = Vector{Float64}[]
145-
bound_points_2 = Vector{Float64}[]
146-
x_airf = Vector{Float64}[]
147-
y_airf = Vector{Float64}[]
148-
z_airf = Vector{Float64}[]
141+
aero_centers = MVec3[]
142+
control_points = MVec3[]
143+
bound_points_1 = MVec3[]
144+
bound_points_2 = MVec3[]
145+
x_airf = MVec3[]
146+
y_airf = MVec3[]
147+
z_airf = MVec3[]
149148

150149
# Define coordinates matrix
151150
coords = zeros(2 * (n_panels + 1), 3)
152151
@debug "Shape of coordinates: $(size(coords))"
153152

154153
for i in 1:n_panels
155-
coords[2i-1, :] = section_list[i].LE_point
156-
coords[2i, :] = section_list[i].TE_point
157-
coords[2i+1, :] = section_list[i+1].LE_point
158-
coords[2i+2, :] = section_list[i+1].TE_point
154+
coords[2i-1, :] .= section_list[i].LE_point
155+
coords[2i, :] .= section_list[i].TE_point
156+
coords[2i+1, :] .= section_list[i+1].LE_point
157+
coords[2i+2, :] .= section_list[i+1].TE_point
159158
end
160159

161160
@debug "Coordinates: $coords"

src/kite_geometry.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ mutable struct KiteWing <: AbstractWing
204204
te_interp::Extrapolation
205205
area_interp::Extrapolation
206206

207-
function KiteWing(obj_path, dat_path; alpha=0.0, n_sections=20, crease_frac=0.75, wind_vel=10., mass=1.0, n_panels=54, spanwise_panel_distribution=:linear, spanwise_direction=[0.0, 1.0, 0.0])
207+
function KiteWing(obj_path, dat_path; alpha=0.0, n_sections=20, crease_frac=0.75, wind_vel=10., mass=1.0,
208+
n_panels=54, spanwise_panel_distribution=:linear, spanwise_direction=[0.0, 1.0, 0.0])
209+
208210
!isapprox(spanwise_direction, [0.0, 1.0, 0.0]) && @error "Spanwise direction has to be [0.0, 1.0, 0.0]"
209211

210212
# Load or create polars

src/panel.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,17 +414,16 @@ Calculate the velocity induced by a vortex ring at a control point.
414414
end
415415

416416
"""
417-
calculate_velocity_induced_bound_2D!(panel::Panel, evaluation_point::Vector{Float64})
417+
calculate_velocity_induced_bound_2D!(U2D, panel::Panel, evaluation_point, work_vectors)
418418
419419
Calculate velocity induced by bound vortex filaments at the control point.
420420
Only needed for VSM, as LLT bound and filament align, thus no induced velocity.
421421
422422
# Arguments
423+
- U_2D: resulting 2D velocity vector
423424
- `panel::Panel`: Panel object
424-
- `evaluation_point::Vector{Float64}`: Point where induced velocity is evaluated
425-
426-
# Returns
427-
- `Vector{Float64}`: Induced velocity at the control point
425+
- `evaluation_point`: Point where induced velocity is evaluated
426+
- work_vectors: unclear
428427
"""
429428
function calculate_velocity_induced_bound_2D!(
430429
U_2D,

src/wing_geometry.jl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11

22
"""
3-
Section
3+
Section{T}
44
55
Represents a wing section with leading edge, trailing edge, and aerodynamic properties.
66
77
# Fields
88
- `LE_point::MVec3`: Leading edge point coordinates
99
- `TE_point::MVec3`: Trailing edge point coordinates
10-
- `aero_input::Vector{Any}`: Aerodynamic input data for the section:
11-
- `("inviscid")`: Inviscid aerodynamics
12-
- `("polar_data", [alpha_column,CL_column,CD_column,CM_column])`: Polar data aerodynamics
13-
- `("lei_airfoil_breukels", [d_tube,camber])`: LEI airfoil with Breukels parameters
10+
- `aero_input`::T: Aerodynamic input, one of three possible types
1411
"""
1512
struct Section{T}
1613
LE_point::MVec3
@@ -61,10 +58,17 @@ mutable struct Wing <: AbstractWing
6158
end
6259

6360
"""
64-
add_section!(wing::Wing, LE_point::PosVector,
65-
TE_point::PosVector, aero_input::Vector{Any})
61+
add_section!(wing::Wing, LE_point::PosVector, TE_point::PosVector, aero_input)
6662
6763
Add a new section to the wing.
64+
65+
# Arguments:
66+
- LE_point::PosVector: position of the point on the side of the leading edge
67+
- TE_point::PosVector: position of the point on the side of the leading edge
68+
- aero_input: Can be:
69+
- :inviscid
70+
- :`lei_airfoil_breukels`
71+
- (:interpolations, (`cl_interp`, `cd_interp`, `cm_interp`))
6872
"""
6973
function add_section!(wing::Wing, LE_point::Vector{Float64},
7074
TE_point::Vector{Float64}, aero_input)
@@ -182,7 +186,7 @@ function interpolate_to_common_alpha(alpha_common,
182186
end
183187

184188
"""
185-
calculate_new_aero_input(aero_input::Vector{Any},
189+
calculate_new_aero_input(aero_input,
186190
section_index::Int,
187191
left_weight::Float64,
188192
right_weight::Float64)
@@ -272,7 +276,7 @@ end
272276
n_sections::Int,
273277
LE::Matrix{Float64},
274278
TE::Matrix{Float64},
275-
aero_input::Vector{Any})
279+
aero_input)
276280
277281
Refine wing mesh using linear or cosine spacing.
278282

0 commit comments

Comments
 (0)