Skip to content

Commit b212b0b

Browse files
committed
Fix warnings
1 parent 611d177 commit b212b0b

6 files changed

Lines changed: 26 additions & 25 deletions

File tree

src/body_aerodynamics.jl

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ Main structure for calculating aerodynamic properties of bodies. Use the constru
2222
- `y::MVector{P, Float64}` = MVector{P,Float64}(zeros(P))
2323
- `cache::Vector{PreallocationTools.LazyBufferCache{typeof(identity), typeof(identity)}}` = [LazyBufferCache() for _ in 1:15]
2424
"""
25-
@with_kw mutable struct BodyAerodynamics{P}
25+
@with_kw mutable struct BodyAerodynamics{P,W<:AbstractWing}
2626
panels::Vector{Panel}
27-
wings::Vector{Wing}
27+
wings::Vector{W}
2828
_va::MVec3 = zeros(MVec3)
2929
has_distributed_va::Bool = false
3030
omega::MVec3 = zeros(MVec3)
@@ -110,7 +110,7 @@ function BodyAerodynamics(
110110
end
111111
end
112112

113-
body_aero = BodyAerodynamics{length(panels)}(; panels, wings)
113+
body_aero = BodyAerodynamics{length(panels),T}(; panels, wings)
114114
reinit!(body_aero; va, omega)
115115
return body_aero
116116
end
@@ -694,11 +694,11 @@ end
694694

695695
"""
696696
calculate_results(body_aero::BodyAerodynamics, gamma_new,
697-
density, aerodynamic_model_type::Model,
697+
density,
698698
core_radius_fraction, mu,
699699
alpha_dist, v_a_dist,
700700
chord_array, x_airf_array,
701-
y_airf_array, z_airf_array,
701+
z_airf_array,
702702
va_array, va_norm_array,
703703
va_unit_array, panels::Vector{Panel},
704704
is_only_f_and_gamma_output::Bool)
@@ -713,14 +713,12 @@ function calculate_results(
713713
gamma_new,
714714
reference_point,
715715
density,
716-
aerodynamic_model_type::Model,
717716
core_radius_fraction,
718717
mu,
719718
alpha_dist,
720719
v_a_dist,
721720
chord_array,
722721
x_airf_array,
723-
y_airf_array,
724722
z_airf_array,
725723
va_array,
726724
va_norm_array,
@@ -1041,23 +1039,22 @@ Set velocity array and update wake filaments.
10411039
- `omega::VelVector`: Turn rate vector around x y and z axis [rad/s]
10421040
"""
10431041
function set_va!(body_aero::BodyAerodynamics, va::AbstractVector, omega=zeros(MVec3))
1044-
# Calculate va_distribution based on input type
1045-
va_distribution = if all(omega .== 0.0)
1046-
repeat(reshape(va, 1, 3), length(body_aero.panels))
1047-
elseif !all(omega .== 0.0)
1048-
va_dist = zeros(length(body_aero.panels), 3)
1049-
1042+
n_panels = length(body_aero.panels)
1043+
va_distribution = zeros(n_panels, 3)
1044+
1045+
if all(iszero, omega)
1046+
va_distribution .= repeat(reshape(va, 1, 3), n_panels)
1047+
else
10501048
for wing in body_aero.wings
10511049
# Get spanwise positions
10521050
spanwise_positions = [panel.control_point for panel in body_aero.panels]
10531051

10541052
# Calculate velocities for each panel
10551053
for i in 1:wing.n_panels
10561054
omega_va = -omega × spanwise_positions[i]
1057-
va_dist[i, :] .= omega_va .+ va
1055+
va_distribution[i, :] .= omega_va .+ va
10581056
end
10591057
end
1060-
va_dist
10611058
end
10621059

10631060
# Update panel velocities
@@ -1072,7 +1069,7 @@ function set_va!(body_aero::BodyAerodynamics, va::AbstractVector, omega=zeros(MV
10721069
return nothing
10731070
end
10741071

1075-
function set_va!(body_aero::BodyAerodynamics, va_distribution::AbstractMatrix, omega=zeros(MVec3))
1072+
function set_va!(body_aero::BodyAerodynamics, va_distribution::AbstractMatrix)
10761073
size(va_distribution, 1) != length(body_aero.panels) &&
10771074
throw(ArgumentError("Number of rows in va distribution should be equal to number of panels."))
10781075

src/solver.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,14 +551,12 @@ function solve(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=n
551551
solver.lr.gamma_new,
552552
reference_point_checked,
553553
solver.density,
554-
solver.aerodynamic_model_type,
555554
solver.core_radius_fraction,
556555
solver.mu,
557556
solver.lr.alpha_dist,
558557
solver.lr.v_a_dist,
559558
solver.sol._chord_dist,
560559
solver.sol._x_airf_dist,
561-
solver.sol._y_airf_dist,
562560
solver.sol._z_airf_dist,
563561
solver.sol._va_dist,
564562
solver.br.va_norm_dist,

test/body_aerodynamics/test_body_aerodynamics.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ using Test
55
using Logging
66

77
include("../utils.jl")
8+
if !@isdefined(create_temp_wing_settings)
9+
include("../test_data_utils.jl")
10+
end
811

912
@testset "Induction Matrix Creation" begin
1013
# Setup

test/runtests.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ using Test, VortexStepMethod
44
cd(@__DIR__) # ensure we're in test/ no matter how tests are launched
55
include("test_data_utils.jl")
66

7-
# ControlPlots must run in a separate single-threaded process
8-
const _plot_controlplots = "plot-controlplots" in ARGS
9-
107
# Filter special args from pattern matching
118
const test_patterns = filter(a -> a != "plot-controlplots", ARGS)
129

1310
println("Running tests...")
14-
if _plot_controlplots
11+
if "plot-controlplots" in ARGS
1512
println("Running plotting tests with ControlPlots backend")
1613
elseif !isempty(test_patterns)
1714
println("Filtering tests matching: ", test_patterns)
@@ -36,8 +33,8 @@ const build_is_production_build = let v = get(ENV, build_is_production_build_env
3633
v == "true"
3734
end::Bool
3835

39-
@testset verbose = true "Testing VortexStepMethod..." begin
40-
if _plot_controlplots
36+
function include_selected_tests()
37+
if "plot-controlplots" in ARGS
4138
include("plotting/test_plotting.jl")
4239
else
4340
if build_is_production_build && should_run_test("bench")
@@ -63,4 +60,8 @@ end::Bool
6360
end
6461
end
6562

63+
@testset verbose = true "Testing VortexStepMethod..." begin
64+
include_selected_tests()
65+
end
66+
6667
nothing

test/solver/test_solver.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using VortexStepMethod
22
using LinearAlgebra
33
using Test
4+
include("../test_data_utils.jl")
45

56
@testset "Solver Constructor Tests" begin
67
@testset "Solver Constructor with VSMSettings" begin

test/test_data_utils.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ polar_file = test_data_path("yaml_geometry", "polars", "standard_airfoil.csv")
4242
body_aero_wing = test_data_path("body_aerodynamics", "wings", "test_wing.yaml")
4343
```
4444
"""
45-
test_data_path(module_name, relative_path...) = joinpath(@__DIR__, module_name, relative_path...)
45+
test_data_path(module_name, relative_path...) =
46+
joinpath(@__DIR__, string(module_name), map(string, relative_path)...)
4647

4748
"""
4849
create_temp_wing_settings(module_name, wing_file; kwargs...)

0 commit comments

Comments
 (0)