Skip to content

Commit b3ef2b0

Browse files
committed
Fixed deform
1 parent 80fc357 commit b3ef2b0

File tree

3 files changed

+65
-29
lines changed

3 files changed

+65
-29
lines changed

src/wing_geometry.jl

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -456,14 +456,37 @@ function deform!(wing::Wing)
456456
chord = zeros(MVec3)
457457
normal = zeros(MVec3)
458458

459-
for i in 1:wing.n_panels
460-
section1 = wing.non_deformed_sections[i]
461-
section2 = wing.non_deformed_sections[i+1]
462-
local_y .= normalize(section1.LE_point - section2.LE_point)
463-
chord .= section1.TE_point .- section1.LE_point
459+
# Process all sections (n_panels + 1)
460+
# Each section gets angle(s) from adjacent panel(s)
461+
for i in 1:(wing.n_panels + 1)
462+
section = wing.non_deformed_sections[i]
463+
464+
# Determine the angle for this section
465+
if i == 1
466+
# First section: use angle from first panel
467+
theta = wing.theta_dist[1]
468+
elseif i == wing.n_panels + 1
469+
# Last section: use angle from last panel
470+
theta = wing.theta_dist[wing.n_panels]
471+
else
472+
# Middle sections: average of adjacent panels
473+
theta = 0.5 * (wing.theta_dist[i-1] + wing.theta_dist[i])
474+
end
475+
476+
# Compute local coordinate system
477+
if i < wing.n_panels + 1
478+
section2 = wing.non_deformed_sections[i+1]
479+
local_y .= normalize(section.LE_point - section2.LE_point)
480+
else
481+
# For last section, use same local_y as previous
482+
section_prev = wing.non_deformed_sections[i-1]
483+
local_y .= normalize(section_prev.LE_point - section.LE_point)
484+
end
485+
486+
chord .= section.TE_point .- section.LE_point
464487
normal .= chord × local_y
465-
@. wing.refined_sections[i].TE_point = section1.LE_point +
466-
cos(wing.theta_dist[i]) * chord - sin(wing.theta_dist[i]) * normal
488+
@. wing.refined_sections[i].TE_point = section.LE_point +
489+
cos(theta) * chord - sin(theta) * normal
467490
end
468491
return nothing
469492
end

test/ram_geometry/test_kite_geometry.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,6 @@ using Serialization
232232
original_te_points = [copy(wing.refined_sections[i].TE_point)
233233
for i in 1:n_sections]
234234

235-
@show wing.refined_sections[1].LE_point
236-
@show wing.refined_sections[1].TE_point
237-
@show wing.refined_sections[end].LE_point
238-
@show wing.refined_sections[end].TE_point
239-
240235
# Apply group_deform! with non-zero angles (2 groups, each controlling 2 panels)
241236
theta_angles = [deg2rad(15.0), deg2rad(20.0)]
242237
delta_angles = [deg2rad(5.0), deg2rad(10.0)]

test/runtests.jl

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@ 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+
# Support selective test execution via ]test test_args=["pattern"]
8+
const test_patterns = isempty(ARGS) ? String[] : ARGS
9+
710
println("Running tests...")
11+
if !isempty(test_patterns)
12+
println("Filtering tests matching: ", test_patterns)
13+
end
14+
15+
# Helper to check if a test file matches any pattern
16+
function should_run_test(test_path::String)
17+
isempty(test_patterns) && return true
18+
for pattern in test_patterns
19+
# Match directory (e.g., "solver") or specific file (e.g., "test_group_coefficients")
20+
if occursin(pattern, test_path)
21+
return true
22+
end
23+
end
24+
return false
25+
end
826

927
# keep your env check as-is...
1028
const build_is_production_build_env_name = "BUILD_IS_PRODUCTION_BUILD"
@@ -14,25 +32,25 @@ const build_is_production_build = let v = get(ENV, build_is_production_build_env
1432
end::Bool
1533

1634
@testset verbose = true "Testing VortexStepMethod..." begin
17-
if build_is_production_build
35+
if build_is_production_build && should_run_test("bench")
1836
include("bench.jl")
1937
end
20-
include("body_aerodynamics/test_body_aerodynamics.jl")
21-
include("body_aerodynamics/test_results.jl")
22-
include("filament/test_bound_filament.jl")
23-
include("filament/test_semi_infinite_filament.jl")
24-
include("panel/test_panel.jl")
25-
include("plotting/test_plotting.jl")
26-
include("polars/test_polars.jl")
27-
include("ram_geometry/test_kite_geometry.jl")
28-
include("settings/test_settings.jl")
29-
include("solver/test_solver.jl")
30-
include("solver/test_group_coefficients.jl")
31-
include("VortexStepMethod/test_VortexStepMethod.jl")
32-
include("wake/test_wake.jl")
33-
include("wing_geometry/test_wing_geometry.jl")
34-
include("yaml_geometry/test_yaml_geometry.jl")
35-
include("Aqua.jl")
38+
should_run_test("body_aerodynamics/test_body_aerodynamics.jl") && include("body_aerodynamics/test_body_aerodynamics.jl")
39+
should_run_test("body_aerodynamics/test_results.jl") && include("body_aerodynamics/test_results.jl")
40+
should_run_test("filament/test_bound_filament.jl") && include("filament/test_bound_filament.jl")
41+
should_run_test("filament/test_semi_infinite_filament.jl") && include("filament/test_semi_infinite_filament.jl")
42+
should_run_test("panel/test_panel.jl") && include("panel/test_panel.jl")
43+
should_run_test("plotting/test_plotting.jl") && include("plotting/test_plotting.jl")
44+
should_run_test("polars/test_polars.jl") && include("polars/test_polars.jl")
45+
should_run_test("ram_geometry/test_kite_geometry.jl") && include("ram_geometry/test_kite_geometry.jl")
46+
should_run_test("settings/test_settings.jl") && include("settings/test_settings.jl")
47+
should_run_test("solver/test_solver.jl") && include("solver/test_solver.jl")
48+
should_run_test("solver/test_group_coefficients.jl") && include("solver/test_group_coefficients.jl")
49+
should_run_test("VortexStepMethod/test_VortexStepMethod.jl") && include("VortexStepMethod/test_VortexStepMethod.jl")
50+
should_run_test("wake/test_wake.jl") && include("wake/test_wake.jl")
51+
should_run_test("wing_geometry/test_wing_geometry.jl") && include("wing_geometry/test_wing_geometry.jl")
52+
should_run_test("yaml_geometry/test_yaml_geometry.jl") && include("yaml_geometry/test_yaml_geometry.jl")
53+
should_run_test("Aqua.jl") && include("Aqua.jl")
3654
end
3755

3856
nothing

0 commit comments

Comments
 (0)