Skip to content

Commit 1581170

Browse files
committed
Restore test
1 parent dba02d9 commit 1581170

File tree

1 file changed

+0
-191
lines changed

1 file changed

+0
-191
lines changed

test/solver/test_solver.jl

Lines changed: 0 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -29,195 +29,4 @@ using Test
2929
rm(settings_file; force=true)
3030
end
3131
end
32-
33-
@testset "Solver with n_groups=0" begin
34-
# Test that solver works correctly when n_groups=0 (no group functionality)
35-
settings_file = create_temp_wing_settings("solver", "solver_test_wing.yaml";
36-
alpha=5.0, beta=0.0, wind_speed=10.0, n_groups=0)
37-
38-
try
39-
settings = VSMSettings(settings_file)
40-
wing = Wing(settings)
41-
@test wing.n_groups == 0
42-
43-
body_aero = BodyAerodynamics([wing])
44-
solver = Solver(body_aero, settings)
45-
46-
# Verify solver has zero groups
47-
@test length(solver.sol.group_moment_dist) == 0
48-
@test length(solver.sol.group_moment_coeff_dist) == 0
49-
50-
# Test that solve! works without errors
51-
va = [10.0, 0.0, 0.0]
52-
set_va!(body_aero, va)
53-
sol = solve!(solver, body_aero)
54-
55-
@test sol isa VSMSolution
56-
@test sol.solver_status == FEASIBLE
57-
58-
# Verify that group moments are empty
59-
@test length(sol.group_moment_dist) == 0
60-
@test length(sol.group_moment_coeff_dist) == 0
61-
62-
# But force and moment should still be computed
63-
@test !all(sol.force .== 0.0)
64-
@test norm(sol.force) > 0
65-
66-
finally
67-
rm(settings_file; force=true)
68-
end
69-
end
70-
71-
@testset "Linearize with n_groups=0" begin
72-
# Test that linearize works correctly when n_groups=0
73-
settings_file = create_temp_wing_settings("solver", "solver_test_wing.yaml";
74-
alpha=5.0, beta=0.0, wind_speed=10.0, n_groups=0, n_panels=4)
75-
76-
try
77-
settings = VSMSettings(settings_file)
78-
wing = Wing(settings)
79-
@test wing.n_groups == 0
80-
81-
body_aero = BodyAerodynamics([wing])
82-
solver = Solver(body_aero, settings)
83-
84-
# Set velocity
85-
va = [10.0, 0.0, 0.0]
86-
set_va!(body_aero, va)
87-
88-
# Test linearize with only velocity (no theta or delta since n_groups=0)
89-
y = va # Only velocity in input vector
90-
jac, results = VortexStepMethod.linearize(
91-
solver,
92-
body_aero,
93-
y;
94-
theta_idxs=nothing,
95-
delta_idxs=nothing,
96-
va_idxs=1:3,
97-
omega_idxs=nothing
98-
)
99-
100-
# Results should only have 6 elements (force + moment, no group moments)
101-
@test length(results) == 6
102-
@test size(jac) == (6, 3) # 6 outputs, 3 inputs (vx, vy, vz)
103-
104-
# Verify forces are non-zero
105-
@test norm(results[1:3]) > 0
106-
107-
# Test that using theta_idxs with n_groups=0 throws an error
108-
@test_throws ArgumentError VortexStepMethod.linearize(
109-
solver,
110-
body_aero,
111-
[0.0, 10.0, 0.0, 0.0]; # Invalid: trying to use theta
112-
theta_idxs=1:1,
113-
va_idxs=2:4
114-
)
115-
116-
# Test that using delta_idxs with n_groups=0 throws an error
117-
@test_throws ArgumentError VortexStepMethod.linearize(
118-
solver,
119-
body_aero,
120-
[0.0, 10.0, 0.0, 0.0]; # Invalid: trying to use delta
121-
delta_idxs=1:1,
122-
va_idxs=2:4
123-
)
124-
125-
finally
126-
rm(settings_file; force=true)
127-
end
128-
end
129-
130-
@testset "Linearize theta_idxs validation" begin
131-
# Test that theta_idxs length must match n_groups
132-
settings_file = create_temp_wing_settings("solver", "solver_test_wing.yaml";
133-
alpha=5.0, beta=0.0, wind_speed=10.0, n_groups=2, n_panels=4)
134-
135-
try
136-
settings = VSMSettings(settings_file)
137-
wing = Wing(settings)
138-
@test wing.n_groups == 2
139-
140-
body_aero = BodyAerodynamics([wing])
141-
solver = Solver(body_aero, settings)
142-
143-
va = [10.0, 0.0, 0.0]
144-
set_va!(body_aero, va)
145-
146-
# Test with correct number of theta angles (2)
147-
y_correct = [0.0, 0.0, 10.0, 0.0, 0.0] # 2 theta + 3 va
148-
jac, results = VortexStepMethod.linearize(
149-
solver,
150-
body_aero,
151-
y_correct;
152-
theta_idxs=1:2,
153-
va_idxs=3:5
154-
)
155-
@test size(jac, 1) == 8 # 6 + 2 group moments
156-
157-
# Test with wrong number of theta angles (should throw error)
158-
y_wrong = [0.0, 0.0, 0.0, 0.0, 10.0, 0.0, 0.0] # 4 theta + 3 va
159-
@test_throws ArgumentError VortexStepMethod.linearize(
160-
solver,
161-
body_aero,
162-
y_wrong;
163-
theta_idxs=1:4, # Wrong: 4 angles but only 2 groups
164-
va_idxs=5:7
165-
)
166-
167-
# Test with wrong number of delta angles
168-
@test_throws ArgumentError VortexStepMethod.linearize(
169-
solver,
170-
body_aero,
171-
y_wrong;
172-
delta_idxs=1:4, # Wrong: 4 angles but only 2 groups
173-
va_idxs=5:7
174-
)
175-
176-
finally
177-
rm(settings_file; force=true)
178-
end
179-
end
180-
181-
@testset "Wing type cannot deform" begin
182-
# Test that regular Wing type (YAML-based) cannot use group_deform!
183-
settings_file = create_temp_wing_settings("solver", "solver_test_wing.yaml";
184-
alpha=5.0, beta=0.0, wind_speed=10.0, n_groups=2, n_panels=4)
185-
186-
try
187-
settings = VSMSettings(settings_file)
188-
wing = Wing(settings)
189-
@test wing isa Wing
190-
@test wing.n_groups == 2
191-
192-
body_aero = BodyAerodynamics([wing])
193-
solver = Solver(body_aero, settings)
194-
195-
va = [10.0, 0.0, 0.0]
196-
set_va!(body_aero, va)
197-
198-
# Test that trying to use theta angles with Wing throws an error
199-
y = [0.0, 0.0, 10.0, 0.0, 0.0] # 2 theta + 3 va
200-
@test_throws ArgumentError VortexStepMethod.linearize(
201-
solver,
202-
body_aero,
203-
y;
204-
theta_idxs=1:2,
205-
va_idxs=3:5
206-
)
207-
208-
# But linearize should work fine with only velocity (no deformation)
209-
y_velocity_only = [10.0, 0.0, 0.0]
210-
jac, results = VortexStepMethod.linearize(
211-
solver,
212-
body_aero,
213-
y_velocity_only;
214-
theta_idxs=nothing,
215-
va_idxs=1:3
216-
)
217-
@test size(jac, 1) == 8 # 6 + 2 group moments
218-
219-
finally
220-
rm(settings_file; force=true)
221-
end
222-
end
22332
end

0 commit comments

Comments
 (0)