@@ -14,7 +14,8 @@ using VortexStepMethod: calculate_AIC_matrices!, gamma_loop!, calculate_results,
1414 velocity_3D_bound_vortex!,
1515 velocity_3D_trailing_vortex!,
1616 velocity_3D_trailing_vortex_semiinfinite!,
17- Panel
17+ Panel,
18+ init!
1819using Test
1920using LinearAlgebra
2021
@@ -39,6 +40,13 @@ using LinearAlgebra
3940 INVISCID)
4041
4142 body_aero = BodyAerodynamics ([wing])
43+ init! (body_aero)
44+
45+ @testset " Re-initialization" begin
46+ result = @benchmark init! (body_aero; init_aero= false ) samples= 1 evals= 1
47+ @info " Re-initializing Allocations: $(result. allocs) \t Memory: $(result. memory) "
48+ @test result. allocs < 100
49+ end
4250
4351 vel_app = [cos (alpha), 0.0 , sin (alpha)] .* v_a
4452 set_va! (body_aero, vel_app)
@@ -66,7 +74,7 @@ using LinearAlgebra
6674 for model in models
6775 for frac in core_radius_fractions
6876 @testset " Model $model Core Radius Fraction $frac " begin
69- result = @benchmark calculate_AIC_matrices! ($ body_aero, $ model, $ frac, $ va_norm_array, $ va_unit_array) samples = 1 evals = 1
77+ result = @benchmark calculate_AIC_matrices! ($ body_aero, $ model, $ frac, $ va_norm_array, $ va_unit_array) samples= 1 evals= 1
7078 @test result. allocs ≤ 100
7179 @info " Model: $(model) \t Core radius fraction: $(frac) \t Allocations: $(result. allocs) \t Memory: $(result. memory) "
7280 end
@@ -129,7 +137,7 @@ using LinearAlgebra
129137 $ body_aero. panels,
130138 0.5 ;
131139 log = false
132- ) samples = 1 evals = 1
140+ ) samples= 1 evals= 1
133141 @test result. allocs ≤ 10
134142 @info " Model: $model \t Aero_model: $aero_model \t Allocations: $(result. allocs) Memory: $(result. memory) "
135143 end
@@ -180,103 +188,8 @@ using LinearAlgebra
180188 $ va_unit_array,
181189 $ body_aero. panels,
182190 false
183- ) samples = 1 evals = 1
184- @test_broken result. allocs ≤ 100
191+ ) samples= 1 evals= 1
192+ @test result. allocs ≤ 300
185193 end
186-
187-
188- # TODO : implement the rest of the benchmarks
189- # @testset "Angle of Attack Update" begin
190- # alpha_array = zeros(n_panels)
191- # result = @benchmark update_effective_angle_of_attack_if_VSM(
192- # $alpha_array,
193- # $body_aero,
194- # $gamma
195- # ) samples = 1 evals = 1
196- # @test result.allocs == 0
197- # end
198-
199- # @testset "Area Calculations" begin
200- # area = @MVector zeros(3)
201- # result = @benchmark calculate_projected_area(
202- # $area,
203- # $body_aero
204- # ) samples = 1 evals = 1
205- # @test result.allocs == 0
206- # end
207-
208- # @testset "Aerodynamic Coefficients" begin
209- # panel = body_aero.panels[1]
210- # alpha = 0.1
211-
212- # result = @benchmark calculate_cl($panel, $alpha) samples = 1 evals = 1
213- # @test result.allocs == 0
214-
215- # cd_cm = @MVector zeros(2)
216- # result = @benchmark calculate_cd_cm($cd_cm, $panel, $alpha) samples = 1 evals = 1
217- # @test result.allocs == 0
218- # end
219-
220- # @testset "Induced Velocity Calculations" begin
221- # v_ind = @MVector zeros(3)
222- # point = @MVector [0.25, 9.5, 0.0]
223- # work_vectors = ntuple(_ -> @MVector(zeros(3)), 10)
224-
225- # # Test single ring velocity calculation
226- # result = @benchmark calculate_velocity_induced_single_ring_semiinfinite!(
227- # $v_ind,
228- # $(work_vectors[1]),
229- # $panel.filaments,
230- # $point,
231- # true,
232- # 20.0,
233- # $(work_vectors[2]),
234- # 1.0,
235- # 1e-20,
236- # $work_vectors
237- # ) samples = 1 evals = 1
238- # @test result.allocs == 0
239-
240- # # Test 2D bound vortex
241- # result = @benchmark calculate_velocity_induced_bound_2D!(
242- # $v_ind,
243- # $panel,
244- # $point,
245- # $work_vectors
246- # ) samples = 1 evals = 1
247- # @test result.allocs == 0
248-
249- # # Test 3D velocity components
250- # result = @benchmark velocity_3D_bound_vortex!(
251- # $v_ind,
252- # $point,
253- # $panel,
254- # 1.0,
255- # 1e-20,
256- # $work_vectors
257- # ) samples = 1 evals = 1
258- # @test result.allocs == 0
259-
260- # result = @benchmark velocity_3D_trailing_vortex!(
261- # $v_ind,
262- # $point,
263- # $panel,
264- # 1.0,
265- # 20.0,
266- # $work_vectors
267- # ) samples = 1 evals = 1
268- # @test result.allocs == 0
269-
270- # result = @benchmark velocity_3D_trailing_vortex_semiinfinite!(
271- # $v_ind,
272- # $point,
273- # $panel,
274- # 1.0,
275- # 20.0,
276- # $(work_vectors[2]),
277- # $work_vectors
278- # ) samples = 1 evals = 1
279- # @test result.allocs == 0
280- # end
281194end
282195
0 commit comments