1+ using LinearAlgebra
2+ using ControlPlots
3+ using VortexStepMethod
4+
5+ plot = true
6+
7+ # Step 1: Define wing parameters
8+ n_panels = 20 # Number of panels
9+ span = 20.0 # Wing span [m]
10+ chord = 1.0 # Chord length [m]
11+ v_a = 20.0 # Magnitude of inflow velocity [m/s]
12+ density = 1.225 # Air density [kg/m³]
13+ alpha_deg = 30.0 # Angle of attack [degrees]
14+ alpha = deg2rad (alpha_deg)
15+
16+ # Step 2: Create wing geometry with linear panel distribution
17+ wing = Wing (n_panels, spanwise_panel_distribution= :linear )
18+
19+ # Add wing sections - defining only tip sections with inviscid airfoil model
20+ add_section! (wing,
21+ [0.0 , span/ 2 , 0.0 ], # Left tip LE
22+ [chord, span/ 2 , 0.0 ], # Left tip TE
23+ :inviscid )
24+ add_section! (wing,
25+ [0.0 , - span/ 2 , 0.0 ], # Right tip LE
26+ [chord, - span/ 2 , 0.0 ], # Right tip TE
27+ :inviscid )
28+
29+ # Step 3: Initialize aerodynamics
30+ wa = BodyAerodynamics ([wing])
31+
32+ # Set inflow conditions
33+ vel_app = [cos (alpha), 0.0 , sin (alpha)] .* v_a
34+ set_va! (wa, (vel_app, 0.0 )) # Second parameter is yaw rate
35+
36+ # Step 4: Initialize solvers for both LLT and VSM methods
37+ llt_solver = Solver (aerodynamic_model_type= :LLT )
38+ vsm_solver = Solver (aerodynamic_model_type= :VSM )
39+
40+ # Step 5: Solve using both methods
41+ results_vsm = solve (vsm_solver, wa)
42+ @time results_vsm = solve (vsm_solver, wa)
43+ # time Python: 32.0 ms
44+ # time Julia: 0.7 ms
45+
46+ nothing
0 commit comments