|
| 1 | +# Run with: julia --project mwes/mwe_warntype.jl 2>&1 | less |
| 2 | +# Look for red/yellow "Any" or "Union" in output |
| 3 | + |
| 4 | +using VortexStepMethod |
| 5 | +using VortexStepMethod: calculate_AIC_matrices!, gamma_loop!, calculate_results, |
| 6 | + calculate_velocity_induced_single_ring_semiinfinite!, |
| 7 | + calculate_velocity_induced_bound_2D!, |
| 8 | + velocity_3D_bound_vortex!, |
| 9 | + velocity_3D_trailing_vortex!, |
| 10 | + velocity_3D_trailing_vortex_semiinfinite!, |
| 11 | + cross3!, calc_norm_array!, |
| 12 | + Panel, reinit!, solve_base! |
| 13 | +using LinearAlgebra |
| 14 | +using StaticArrays |
| 15 | +using InteractiveUtils |
| 16 | + |
| 17 | +# Setup |
| 18 | +n_panels = 20 |
| 19 | +span = 20.0 |
| 20 | +chord = 1.0 |
| 21 | +alpha = deg2rad(30.0) |
| 22 | + |
| 23 | +wing = Wing(n_panels, spanwise_distribution=LINEAR) |
| 24 | +add_section!(wing, [0.0, span/2, 0.0], [chord, span/2, 0.0], INVISCID) |
| 25 | +add_section!(wing, [0.0, -span/2, 0.0], [chord, -span/2, 0.0], INVISCID) |
| 26 | +refine!(wing) |
| 27 | +body_aero = BodyAerodynamics([wing]) |
| 28 | +vel_app = [cos(alpha), 0.0, sin(alpha)] .* 20.0 |
| 29 | +set_va!(body_aero, vel_app) |
| 30 | +solver = Solver(body_aero) |
| 31 | + |
| 32 | +va_norm_array = ones(n_panels) |
| 33 | +va_unit_array = ones(n_panels, 3) |
| 34 | + |
| 35 | +# Prepare args for individual functions |
| 36 | +panel = body_aero.panels[1] |
| 37 | +filaments = panel.filaments |
| 38 | +ep = panel.control_point |
| 39 | +velind = @MVector zeros(3) |
| 40 | +tempvel = @MVector zeros(3) |
| 41 | +va_unit = @MVector zeros(3) |
| 42 | +va_unit .= 1.0 / sqrt(3.0) |
| 43 | +work = body_aero.work_vectors |
| 44 | + |
| 45 | +sep = "=" ^ 80 |
| 46 | +printstyled("\n$sep\n cross3!\n$sep\n"; color=:cyan) |
| 47 | +a = MVector{3,Float64}(1.0, 2.0, 3.0) |
| 48 | +b = MVector{3,Float64}(4.0, 5.0, 6.0) |
| 49 | +r = MVector{3,Float64}(0.0, 0.0, 0.0) |
| 50 | +@code_warntype cross3!(r, a, b) |
| 51 | + |
| 52 | +printstyled("\n$sep\n velocity_3D_bound_vortex!\n$sep\n"; color=:cyan) |
| 53 | +@code_warntype velocity_3D_bound_vortex!( |
| 54 | + velind, filaments[1], ep, 1.0, 0.001, work) |
| 55 | + |
| 56 | +printstyled("\n$sep\n velocity_3D_trailing_vortex!\n$sep\n"; color=:cyan) |
| 57 | +@code_warntype velocity_3D_trailing_vortex!( |
| 58 | + tempvel, filaments[2], ep, 1.0, 20.0, work) |
| 59 | + |
| 60 | +printstyled("\n$sep\n velocity_3D_trailing_vortex_semiinfinite!\n$sep\n"; |
| 61 | + color=:cyan) |
| 62 | +@code_warntype velocity_3D_trailing_vortex_semiinfinite!( |
| 63 | + tempvel, filaments[4], va_unit, ep, 1.0, 20.0, work) |
| 64 | + |
| 65 | +printstyled("\n$sep\n calculate_velocity_induced_single_ring_semiinfinite!\n$sep\n"; |
| 66 | + color=:cyan) |
| 67 | +@code_warntype calculate_velocity_induced_single_ring_semiinfinite!( |
| 68 | + velind, tempvel, filaments, ep, false, 20.0, va_unit, 1.0, 0.001, work) |
| 69 | + |
| 70 | +printstyled("\n$sep\n calculate_velocity_induced_bound_2D!\n$sep\n"; color=:cyan) |
| 71 | +@code_warntype calculate_velocity_induced_bound_2D!( |
| 72 | + velind, panel, ep, work) |
| 73 | + |
| 74 | +printstyled("\n$sep\n calculate_AIC_matrices!\n$sep\n"; color=:cyan) |
| 75 | +@code_warntype calculate_AIC_matrices!( |
| 76 | + body_aero, VSM, 0.001, va_norm_array, va_unit_array) |
| 77 | + |
| 78 | +printstyled("\n$sep\n gamma_loop!\n$sep\n"; color=:cyan) |
| 79 | +@code_warntype gamma_loop!( |
| 80 | + solver, body_aero, body_aero.panels, 0.5; log=false) |
| 81 | + |
| 82 | +printstyled("\n$sep\n solve_base!\n$sep\n"; color=:cyan) |
| 83 | +@code_warntype solve_base!(solver, body_aero, nothing) |
| 84 | + |
| 85 | +printstyled("\n$sep\n calc_norm_array!\n$sep\n"; color=:cyan) |
| 86 | +@code_warntype calc_norm_array!(solver.br.va_norm_dist, solver.sol._va_dist) |
0 commit comments