Skip to content

Commit dba02d9

Browse files
committed
Unify Wing and RamAirWing
1 parent f078c77 commit dba02d9

File tree

13 files changed

+309
-232
lines changed

13 files changed

+309
-232
lines changed

docs/src/types.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ AeroData
2424
```
2525

2626
## Wing Geometry, Panel and Aerodynamics
27-
A body is constructed of one or more abstract wings. An abstract wing can be a Wing or a RamAirWing.
28-
A Wing/ RamAirWing has one or more sections.
27+
A body is constructed of one or more abstract wings. All wings are of type Wing.
28+
A Wing has one or more sections and can be created from YAML files or OBJ geometry.
2929
```@docs
3030
Section
3131
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]))
35-
RamAirWing
36-
RamAirWing(obj_path, dat_path; alpha=0.0, crease_frac=0.75, wind_vel=10., mass=1.0,
37-
n_panels=54, n_sections=n_panels+1, spanwise_distribution=UNCHANGED,
35+
ObjWing
36+
ObjWing(obj_path, dat_path; alpha=0.0, crease_frac=0.75, wind_vel=10., mass=1.0,
37+
n_panels=54, n_sections=n_panels+1, spanwise_distribution=UNCHANGED,
3838
spanwise_direction=[0.0, 1.0, 0.0])
3939
BodyAerodynamics
4040
```

examples/bench.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ println("Rectangular wing, solve:")
5656
@time solve(vsm_solver, body_aero, nothing)
5757

5858
# Create wing geometry
59-
wing = RamAirWing(
60-
joinpath("data", "ram_air_kite", "ram_air_kite_body.obj"),
61-
joinpath("data", "ram_air_kite", "ram_air_kite_foil.dat");
59+
wing = ObjWing(
60+
joinpath("data", "ram_air_kite", "ram_air_kite_body.obj"),
61+
joinpath("data", "ram_air_kite", "ram_air_kite_foil.dat");
6262
prn=false
6363
)
6464
body_aero = BodyAerodynamics([wing])

examples/ram_air_kite.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ DEFORM = false
99
LINEARIZE = false
1010

1111
# Create wing geometry
12-
wing = RamAirWing(
13-
joinpath("data", "ram_air_kite", "ram_air_kite_body.obj"),
14-
joinpath("data", "ram_air_kite", "ram_air_kite_foil.dat");
12+
wing = ObjWing(
13+
joinpath("data", "ram_air_kite", "ram_air_kite_body.obj"),
14+
joinpath("data", "ram_air_kite", "ram_air_kite_foil.dat");
1515
prn=PRN
1616
)
1717
body_aero = BodyAerodynamics([wing];)
@@ -21,7 +21,7 @@ println("First init")
2121
if DEFORM
2222
# Linear interpolation of alpha from 10° at one tip to 0° at the other
2323
println("Deform")
24-
@time VortexStepMethod.smooth_deform!(wing, deg2rad.([10,20,10,0]), deg2rad.([-10,0,-10,0]))
24+
@time group_deform!(wing, deg2rad.([10,20,10,0]), deg2rad.([-10,0,-10,0]); smooth=true)
2525
println("Deform init")
2626
@time VortexStepMethod.reinit!(body_aero; init_aero=false)
2727
end

src/VortexStepMethod.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using Xfoil
2727

2828
# Export public interface
2929
export VSMSettings, WingSettings, SolverSettings
30-
export Wing, Section, RamAirWing, reinit!
30+
export Wing, Section, ObjWing, reinit!
3131
export BodyAerodynamics
3232
export Solver, solve, solve_base!, solve!, VSMSolution, linearize
3333
export calculate_results
@@ -272,7 +272,7 @@ end
272272
include("settings.jl")
273273
include("wing_geometry.jl")
274274
include("polars.jl")
275-
include("ram_geometry.jl")
275+
include("obj_geometry.jl")
276276
include("yaml_geometry.jl")
277277
include("filament.jl")
278278
include("panel.jl")

src/body_aerodynamics.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Main structure for calculating aerodynamic properties of bodies. Use the constru
55
66
# Fields
77
- panels::Vector{Panel}: Vector of [Panel](@ref) structs
8-
- wings::Union{Vector{Wing}, Vector{RamAirWing}}: A vector of wings; a body can have multiple wings
8+
- wings::Vector{Wing}: A vector of wings; a body can have multiple wings
99
- `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
@@ -23,7 +23,7 @@ Main structure for calculating aerodynamic properties of bodies. Use the constru
2323
"""
2424
@with_kw mutable struct BodyAerodynamics{P}
2525
panels::Vector{Panel}
26-
wings::Union{Vector{Wing}, Vector{RamAirWing}}
26+
wings::Vector{Wing}
2727
_va::MVec3 = zeros(MVec3)
2828
omega::MVec3 = zeros(MVec3)
2929
gamma_distribution::MVector{P, Float64} = zeros(P)
@@ -142,7 +142,7 @@ function reinit!(body_aero::BodyAerodynamics;
142142

143143
# Create panels
144144
for i in 1:wing.n_panels
145-
if wing isa RamAirWing
145+
if !isnothing(wing.delta_dist)
146146
delta = wing.delta_dist[i]
147147
else
148148
delta = 0.0

0 commit comments

Comments
 (0)