Skip to content

Commit a26ec1e

Browse files
committed
#186 passing all tests now!
1 parent bcb06ff commit a26ec1e

File tree

13 files changed

+196
-273
lines changed

13 files changed

+196
-273
lines changed

test/Aqua.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using Aqua
2+
@testset "Aqua.jl" begin
3+
Aqua.test_all(
4+
VortexStepMethod;
5+
stale_deps=(ignore=[:Xfoil, :Timers, :PyCall],),
6+
deps_compat=(ignore=[:PyCall],)
7+
)
8+
end

test/README.md

Lines changed: 56 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -2,103 +2,71 @@
22

33
This directory contains organized test data for the VortexStepMethod.jl test suite.
44

5-
## Structure
6-
7-
The test data is organized by source module being tested, following the structure of the `src/` directory:
5+
## Running Tests
86

7+
You can run tests in different ways:
8+
```bash
9+
# Run all tests
10+
julia --project=. test/runtests.jl
911
```
10-
test/data/
11-
├── body_aerodynamics/ # Tests for src/body_aerodynamics.jl
12-
│ ├── wings/
13-
│ │ └── test_wing.yaml
14-
│ ├── polars/
15-
│ │ └── simple_polar.csv
16-
│ └── complete_settings.yaml
17-
├── yaml_geometry/ # Tests for src/yaml_geometry.jl
18-
│ ├── wings/
19-
│ │ ├── simple_wing.yaml
20-
│ │ └── complex_wing.yaml
21-
│ └── polars/
22-
│ ├── standard_airfoil.csv
23-
│ └── alternate_airfoil.csv
24-
├── solver/ # Tests for src/solver.jl
25-
│ ├── wings/
26-
│ │ └── solver_test_wing.yaml
27-
│ ├── polars/
28-
│ │ └── solver_test_polar.csv
29-
│ └── solver_settings.yaml
30-
├── settings/ # Common settings files
31-
│ ├── basic_vsm.yaml
32-
│ └── basic_llt.yaml
33-
└── wing_geometry/ # Tests for src/wing_geometry.jl (future)
34-
```
35-
36-
## Usage
37-
38-
Use the helper functions in `test_data_utils.jl` to access test data:
39-
40-
### Basic Path Access
41-
```julia
42-
include("test_data_utils.jl")
43-
44-
# Get paths to test data files
45-
wing_file = test_data_path("yaml_geometry", "wings", "simple_wing.yaml")
46-
polar_file = test_data_path("yaml_geometry", "polars", "standard_airfoil.csv")
47-
settings_file = test_data_path("settings", "basic_vsm.yaml")
48-
```
49-
50-
### Module-Specific Convenience Functions
51-
```julia
52-
# Get standard wing file for a module
53-
wing_file = get_standard_wing_file("body_aerodynamics")
54-
55-
# Get complete settings file for a module
56-
settings_file = get_complete_settings_file("solver")
57-
58-
# Create temporary settings with custom parameters
59-
temp_settings = create_temp_wing_settings("yaml_geometry", "simple_wing.yaml";
60-
alpha=15.0, wind_speed=25.0)
12+
```bash
13+
# Run specific test files
14+
julia --project=. test/yaml_geometry/test_yaml_geometry.jl
15+
julia --project=. test/body_aerodynamics/test_body_aerodynamics.jl
16+
julia --project=. test/solver/test_solver.jl
17+
# etc.
6118
```
62-
63-
## Design Principles
64-
65-
1. **Module Isolation**: Each source module has its own test data directory
66-
2. **Consistent Structure**: All modules follow the same subdirectory pattern (wings/, polars/, etc.)
67-
3. **Reusable Components**: Common files (like basic settings) are shared in the `settings/` directory
68-
4. **Clear Naming**: File names clearly indicate their purpose and content
69-
5. **Self-Contained**: Each module's data is independent and can be used in isolation
70-
7119
## Adding New Test Data
7220

7321
When adding test data for a new source module:
7422

75-
1. Create a new directory under `test/data/` matching the source file name
76-
2. Add subdirectories as needed (`wings/`, `polars/`, etc.)
77-
3. Update `test_data_utils.jl` to include helper functions for the new module
23+
1. Create test files in the appropriate module directory under `test/`
24+
2. Add any required data files (YAML, CSV) in the same directory
25+
3. Use `test_data_path()` helper function to access files with proper paths
7826
4. Follow the existing naming conventions
7927

80-
## File Descriptions
81-
82-
### Wing Geometry Files (.yaml)
83-
- `simple_wing.yaml`: Basic 2-section wing for common tests
84-
- `complex_wing.yaml`: Multi-section wing with multiple airfoil types
85-
- `test_wing.yaml`: Simple wing for body aerodynamics tests
86-
- `solver_test_wing.yaml`: Wing optimized for solver testing
8728

88-
### Polar Data Files (.csv)
89-
- `standard_airfoil.csv`: Standard 6-point polar data
90-
- `alternate_airfoil.csv`: Alternative airfoil with different coefficients
91-
- `simple_polar.csv`: Minimal 3-point polar for basic tests
92-
- `solver_test_polar.csv`: Polar data for solver tests
29+
## Structure
9330

94-
### Settings Files (.yaml)
95-
- `basic_vsm.yaml`: Basic VSM solver settings
96-
- `basic_llt.yaml`: Basic LLT solver settings
97-
- `complete_settings.yaml`: Full wing + solver configuration
98-
- `solver_settings.yaml`: Solver-specific configuration
31+
The test data is organized by source module being tested, following the structure of the `src/` directory:
9932

100-
This organization makes it easy to:
101-
- Find test data relevant to specific source modules
102-
- Avoid conflicts between different test requirements
103-
- Maintain and update test data independently
104-
- Add new test cases without affecting existing ones
33+
```
34+
test/
35+
├── body_aerodynamics/ # Tests for src/body_aerodynamics.jl
36+
│ ├── test_body_aerodynamics.jl
37+
│ ├── test_results.jl
38+
│ └── test_wing.yaml # Wing geometry for body aero tests
39+
├── yaml_geometry/ # Tests for src/yaml_geometry.jl
40+
│ ├── test_yaml_geometry.jl
41+
│ ├── simple_wing.yaml # Basic 2-section wing
42+
│ ├── complex_wing.yaml # Multi-section wing
43+
│ ├── standard_airfoil.csv # Standard polar data
44+
│ └── alternate_airfoil.csv # Alternative airfoil data
45+
├── solver/ # Tests for src/solver.jl
46+
│ ├── test_solver.jl
47+
│ ├── solver_settings.yaml # Settings for solver tests
48+
│ ├── solver_test_polar.csv # Polar data for solver tests
49+
│ └── solver_test_wing.yaml # Wing for solver tests
50+
├── settings/ # Tests for src/settings.jl
51+
│ └── test_settings.jl
52+
├── filament/ # Tests for src/filament.jl
53+
│ ├── test_bound_filament.jl
54+
│ └── test_semi_infinite_filament.jl
55+
├── panel/ # Tests for src/panel.jl
56+
│ └── test_panel.jl
57+
├── plotting/ # Tests for src/plotting.jl
58+
│ └── test_plotting.jl
59+
├── polars/ # Tests for src/polars.jl
60+
│ └── test_polars.jl
61+
├── ram_geometry/ # Tests for src/ram_geometry.jl
62+
│ └── test_kite_geometry.jl
63+
├── wake/ # Tests for src/wake.jl
64+
│ └── test_wake.jl
65+
├── wing_geometry/ # Tests for src/wing_geometry.jl
66+
│ └── test_wing_geometry.jl
67+
├── VortexStepMethod/ # Tests for main module
68+
│ └── test_VortexStepMethod.jl
69+
├── test_data_utils.jl # Shared utilities for test data access
70+
├── runtests.jl # Main test runner
71+
└── README.md # This file
72+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
##TODO: populate

test/filament/test_semi_infinite_filament.jl

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,6 @@ end
4141
gamma = 1.0
4242
core_radius_fraction = 0.01
4343
work_vectors = ntuple(_ -> Vector{Float64}(undef, 3), 10)
44-
45-
# @testset "Allocation Tests" begin
46-
# filament = create_test_filament2()
47-
# control_point = [0.5, 0.5, 2.0]
48-
# induced_velocity = zeros(3)
49-
#
50-
# b = @benchmarkable velocity_3D_trailing_vortex_semiinfinite!(
51-
# $induced_velocity,
52-
# $filament,
53-
# $filament.direction,
54-
# $control_point,
55-
# $gamma,
56-
# $filament.vel_mag,
57-
# $work_vectors
58-
# )
59-
# result = run(b)
60-
# @test result.allocs == 0
61-
# @test result.memory == 0
62-
# end
63-
6444
@testset "Calculate Induced Velocity" begin
6545
filament = create_test_filament2()
6646
control_point = [0.5, 0.5, 2.0]

test/panel/test_panel.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using VortexStepMethod: Panel, Section, calculate_relative_alpha_and_relative_velocity, calculate_cl, calculate_cd_cm, reinit!
1+
using VortexStepMethod: Panel, Section, calculate_relative_alpha_and_relative_velocity, calculate_cl, calculate_cd_cm, reinit!, INVISCID, POLAR_VECTORS, MVec3
22
using Interpolations: linear_interpolation, Line
33
using LinearAlgebra
44
using Test
5-
# using BenchmarkTools
65

76
function create_panel(section1::Section, section2::Section)
87
# Calculate panel geometry

test/plotting/test_plotting.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ using VortexStepMethod
22
using ControlPlots
33
using Test
44

5+
include("../test_data_utils.jl")
6+
57
if !@isdefined ram_wing
68
body_path = joinpath(tempdir(), "ram_air_kite_body.obj")
79
foil_path = joinpath(tempdir(), "ram_air_kite_foil.dat")
8-
cp("data/ram_air_kite/ram_air_kite_body.obj", body_path; force=true)
9-
cp("data/ram_air_kite/ram_air_kite_foil.dat", foil_path; force=true)
10+
cp("../data/ram_air_kite/ram_air_kite_body.obj", body_path; force=true)
11+
cp("../data/ram_air_kite/ram_air_kite_foil.dat", foil_path; force=true)
1012
ram_wing = RamAirWing(body_path, foil_path; alpha_range=deg2rad.(-1:1), delta_range=deg2rad.(-1:1))
1113
end
1214

test/polars/test_polars.jl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
using Aqua
2-
@testset "Aqua.jl" begin
3-
Aqua.test_all(
4-
VortexStepMethod;
5-
stale_deps=(ignore=[:Xfoil, :Timers, :PyCall],),
6-
deps_compat=(ignore=[:PyCall],)
7-
)
8-
end
1+
##TODO: populate

test/runtests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ println("Running tests...")
3333
include("ram_geometry/test_kite_geometry.jl")
3434
include("settings/test_settings.jl")
3535
include("solver/test_solver.jl")
36-
include("solver/test_solver_results.jl")
37-
include("wing_geometry/test_wing_settings.jl")
38-
include("VortexStepMethod/test_vortex_step_method.jl")
36+
include("VortexStepMethod/test_VortexStepMethod.jl")
3937
include("wake/test_wake.jl")
4038
include("wing_geometry/test_wing_geometry.jl")
4139
include("yaml_geometry/test_yaml_geometry.jl")
40+
include("Aqua.jl")
41+
4242
end

test/settings/test_settings.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ end
66
using VortexStepMethod
77
using Test
88

9+
include("../test_data_utils.jl")
10+
911
@testset "Test settings.jl" begin
10-
# Change to project root directory for the test
12+
# Use the absolute path to test data to avoid path concatenation issues
1113
project_root = dirname(dirname(@__DIR__))
12-
cd(project_root) do
13-
vss = VSMSettings("data/ram_air_kite/vsm_settings_dual.yaml")
14-
@test vss isa VSMSettings
15-
@test vss.solver_settings isa SolverSettings
16-
@test vss.wings isa Vector{WingSettings}
17-
@test length(vss.wings) == 2
18-
io = IOBuffer(repr(vss))
19-
@test countlines(io) == 40 # Updated to match new output format
20-
end
14+
settings_file = joinpath(project_root, "data", "ram_air_kite", "vsm_settings_dual.yaml")
15+
vss = VSMSettings(settings_file)
16+
@test vss isa VSMSettings
17+
@test vss.solver_settings isa SolverSettings
18+
@test vss.wings isa Vector{WingSettings}
19+
@test length(vss.wings) == 2
20+
io = IOBuffer(repr(vss))
21+
@test countlines(io) == 40 # Updated to match new output format
2122
end
2223
nothing

test/wake/test_wake.jl

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using Test
2+
using LinearAlgebra
3+
using VortexStepMethod
4+
5+
# Test the actual frozen_wake! function using real objects
6+
@testset "frozen_wake! Tests" begin
7+
@testset "frozen_wake! basic functionality" begin
8+
# Use existing test data that we know works
9+
data_dir = joinpath(dirname(dirname(@__DIR__)), "data", "ram_air_kite")
10+
body_path = joinpath(tempdir(), "ram_air_kite_body.obj")
11+
foil_path = joinpath(tempdir(), "ram_air_kite_foil.dat")
12+
13+
body_src = joinpath(data_dir, "ram_air_kite_body.obj")
14+
foil_src = joinpath(data_dir, "ram_air_kite_foil.dat")
15+
16+
# Check if source files exist before copying
17+
if isfile(body_src) && isfile(foil_src)
18+
cp(body_src, body_path; force=true)
19+
cp(foil_src, foil_path; force=true)
20+
21+
try
22+
# Create wing and body aerodynamics with known good geometry
23+
wing = RamAirWing(body_path, foil_path; n_panels=56) # Use default panels
24+
body_aero = BodyAerodynamics([wing])
25+
26+
# Test that frozen_wake! doesn't throw errors
27+
n_panels = length(body_aero.panels)
28+
va_distribution = ones(n_panels, 3) # Create velocity distribution for all panels
29+
va_distribution[:, 1] .= 15.0 # X velocity = 15.0 m/s
30+
va_distribution[:, 2] .= 0.0 # Y velocity = 0.0
31+
va_distribution[:, 3] .= 0.0 # Z velocity = 0.0
32+
33+
# This should not throw an error
34+
@test_nowarn VortexStepMethod.frozen_wake!(body_aero, va_distribution)
35+
36+
# Test that the function accepts the right number of velocity vectors
37+
@test size(va_distribution, 1) == length(body_aero.panels)
38+
@test size(va_distribution, 2) == 3 # 3D velocity vectors
39+
40+
finally
41+
# Clean up
42+
rm(body_path; force=true)
43+
rm(foil_path; force=true)
44+
end
45+
else
46+
@test_skip "Ram air kite test data files not found, skipping frozen_wake! test"
47+
end
48+
end
49+
end

0 commit comments

Comments
 (0)