1- using Makie
2- using GLMakie
1+ using ControlPlots
32using VortexStepMethod
43using LinearAlgebra
54
@@ -18,107 +17,105 @@ wing = RamAirWing(
1817body_aero = BodyAerodynamics ([wing];)
1918println (" First init" )
2019@time VortexStepMethod. reinit! (body_aero)
21- plot (body_aero. panels[1 ])
2220
21+ if DEFORM
22+ # Linear interpolation of alpha from 10° at one tip to 0° at the other
23+ println (" Deform" )
24+ @time VortexStepMethod. smooth_deform! (wing, deg2rad .([10 ,20 ,10 ,0 ]), deg2rad .([- 10 ,0 ,- 10 ,0 ]))
25+ println (" Deform init" )
26+ @time VortexStepMethod. reinit! (body_aero; init_aero= false )
27+ end
2328
24- # if DEFORM
25- # # Linear interpolation of alpha from 10° at one tip to 0° at the other
26- # println("Deform")
27- # @time VortexStepMethod.smooth_deform!(wing, deg2rad.([10,20,10,0]), deg2rad.([-10,0,-10,0]))
28- # println("Deform init")
29- # @time VortexStepMethod.reinit!(body_aero; init_aero=false)
30- # end
31-
32- # # Create solvers
33- # solver = Solver(body_aero;
34- # aerodynamic_model_type=VSM,
35- # is_with_artificial_damping=false,
36- # rtol=1e-5,
37- # solver_type=NONLIN
38- # )
29+ # Create solvers
30+ solver = Solver (body_aero;
31+ aerodynamic_model_type= VSM,
32+ is_with_artificial_damping= false ,
33+ rtol= 1e-5 ,
34+ solver_type= NONLIN
35+ )
3936
40- # # Setting velocity conditions
41- # v_a = 15.0
42- # aoa = 10.0
43- # side_slip = 0.0
44- # yaw_rate = 0.0
45- # aoa_rad = deg2rad(aoa)
46- # vel_app = [
47- # cos(aoa_rad) * cos(side_slip),
48- # sin(side_slip),
49- # sin(aoa_rad)
50- # ] * v_a
51- # set_va!(body_aero, vel_app)
37+ # Setting velocity conditions
38+ v_a = 15.0
39+ aoa = 10.0
40+ side_slip = 0.0
41+ yaw_rate = 0.0
42+ aoa_rad = deg2rad (aoa)
43+ vel_app = [
44+ cos (aoa_rad) * cos (side_slip),
45+ sin (side_slip),
46+ sin (aoa_rad)
47+ ] * v_a
48+ set_va! (body_aero, vel_app)
5249
53- # if LINEARIZE
54- # println("Linearize")
55- # jac, res = VortexStepMethod.linearize(
56- # solver,
57- # body_aero,
58- # [zeros(4); vel_app; zeros(3)];
59- # theta_idxs=1:4,
60- # va_idxs=5:7,
61- # omega_idxs=8:10,
62- # moment_frac=0.1)
63- # @time jac, res = VortexStepMethod.linearize(
64- # solver,
65- # body_aero,
66- # [zeros(4); vel_app; zeros(3)];
67- # theta_idxs=1:4,
68- # va_idxs=5:7,
69- # omega_idxs=8:10,
70- # moment_frac=0.1)
71- # end
50+ if LINEARIZE
51+ println (" Linearize" )
52+ jac, res = VortexStepMethod. linearize (
53+ solver,
54+ body_aero,
55+ [zeros (4 ); vel_app; zeros (3 )];
56+ theta_idxs= 1 : 4 ,
57+ va_idxs= 5 : 7 ,
58+ omega_idxs= 8 : 10 ,
59+ moment_frac= 0.1 )
60+ @time jac, res = VortexStepMethod. linearize (
61+ solver,
62+ body_aero,
63+ [zeros (4 ); vel_app; zeros (3 )];
64+ theta_idxs= 1 : 4 ,
65+ va_idxs= 5 : 7 ,
66+ omega_idxs= 8 : 10 ,
67+ moment_frac= 0.1 )
68+ end
7269
73- # # Plotting polar data
74- # PLOT && plot_polar_data(body_aero)
70+ # Plotting polar data
71+ PLOT && plot_polar_data (body_aero)
7572
76- # # Plotting geometry
77- # PLOT && plot_geometry(
78- # body_aero,
79- # "";
80- # data_type=".svg",
81- # save_path="",
82- # is_save=false,
83- # is_show=true,
84- # view_elevation=15,
85- # view_azimuth=-120,
86- # use_tex=USE_TEX
87- # )
73+ # Plotting geometry
74+ PLOT && plot_geometry (
75+ body_aero,
76+ " " ;
77+ data_type= " .svg" ,
78+ save_path= " " ,
79+ is_save= false ,
80+ is_show= true ,
81+ view_elevation= 15 ,
82+ view_azimuth= - 120 ,
83+ use_tex= USE_TEX
84+ )
8885
89- # # Solving and plotting distributions
90- # println("Solve")
91- # results = VortexStepMethod.solve(solver, body_aero; log=true)
92- # @time results = solve(solver, body_aero; log=true)
86+ # Solving and plotting distributions
87+ println (" Solve" )
88+ results = VortexStepMethod. solve (solver, body_aero; log= true )
89+ @time results = solve (solver, body_aero; log= true )
9390
94- # body_y_coordinates = [panel.aero_center[2] for panel in body_aero.panels]
91+ body_y_coordinates = [panel. aero_center[2 ] for panel in body_aero. panels]
9592
96- # PLOT && plot_distribution(
97- # [body_y_coordinates],
98- # [results],
99- # ["VSM"];
100- # title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_delta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))",
101- # data_type=".pdf",
102- # is_save=false,
103- # is_show=true,
104- # use_tex=USE_TEX
105- # )
93+ PLOT && plot_distribution (
94+ [body_y_coordinates],
95+ [results],
96+ [" VSM" ];
97+ title= " CAD_spanwise_distributions_alpha_$(round (aoa, digits= 1 )) _delta_$(round (side_slip, digits= 1 )) _yaw_$(round (yaw_rate, digits= 1 )) _v_a_$(round (v_a, digits= 1 )) " ,
98+ data_type= " .pdf" ,
99+ is_save= false ,
100+ is_show= true ,
101+ use_tex= USE_TEX
102+ )
106103
107- # PLOT && plot_polars(
108- # [solver],
109- # [body_aero],
110- # [
111- # "VSM from Ram Air Kite OBJ and DAT file",
112- # ];
113- # angle_range=range(0, 20, length=20),
114- # angle_type="angle_of_attack",
115- # angle_of_attack=0,
116- # side_slip=0,
117- # v_a=10,
118- # title="ram_kite_panels_$(wing.n_panels)_distribution_$(wing.spanwise_distribution)",
119- # data_type=".pdf",
120- # is_save=false,
121- # is_show=true,
122- # use_tex=USE_TEX
123- # )
124- # nothing
104+ PLOT && plot_polars (
105+ [solver],
106+ [body_aero],
107+ [
108+ " VSM from Ram Air Kite OBJ and DAT file" ,
109+ ];
110+ angle_range= range (0 , 20 , length= 20 ),
111+ angle_type= " angle_of_attack" ,
112+ angle_of_attack= 0 ,
113+ side_slip= 0 ,
114+ v_a= 10 ,
115+ title= " ram_kite_panels_$(wing. n_panels) _distribution_$(wing. spanwise_distribution) " ,
116+ data_type= " .pdf" ,
117+ is_save= false ,
118+ is_show= true ,
119+ use_tex= USE_TEX
120+ )
121+ nothing
0 commit comments