-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyramid_model.jl
More file actions
74 lines (63 loc) · 2.01 KB
/
pyramid_model.jl
File metadata and controls
74 lines (63 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using LinearAlgebra
using VortexStepMethod
# Load VSM vsm_settings from YAML configuration file
vsm_settings = VSMSettings("pyramid_model/vsm_settings.yaml")
# Create wing, body_aero, and solver objects using vsm_settings
wing = Wing(vsm_settings)
refine!(wing)
body_aero = BodyAerodynamics([wing])
solver = Solver(body_aero, vsm_settings)
# Set flight conditions from settings
set_va!(body_aero, vsm_settings)
# Extract values for plotting (optional - for reference)
wind_speed = vsm_settings.condition.wind_speed
angle_of_attack_deg = vsm_settings.condition.alpha
sideslip_deg = vsm_settings.condition.beta
yaw_rate = vsm_settings.condition.yaw_rate
# Run the solver
results = VortexStepMethod.solve(solver, body_aero; log=true)
# Using plotting modules, to create more comprehensive plots
PLOT = true
SAVE_ALL = false
USE_TEX = false
OUTPUT_DIR = joinpath(dirname(@__DIR__), "output")
# Plotting polars
PLOT && plot_polars(
[solver],
[body_aero],
["VSM Pyramid Model"],
angle_range=range(-5, 25, length=30),
angle_type="angle_of_attack",
angle_of_attack=angle_of_attack_deg,
side_slip=sideslip_deg,
v_a=wind_speed,
title="$(wing.n_panels)_panels_$(wing.spanwise_distribution)_pyramid_model",
save_path=OUTPUT_DIR,
is_save=false || SAVE_ALL,
is_show=true,
use_tex=USE_TEX
)
# Plotting geometry
PLOT && plot_geometry(
body_aero,
"Pyramid model geometry";
save_path=OUTPUT_DIR,
is_save=false || SAVE_ALL,
is_show=true,
view_elevation=15,
view_azimuth=-120,
use_tex=USE_TEX
)
# Plotting spanwise distributions
body_y_coordinates = [panel.aero_center[2] for panel in body_aero.panels]
PLOT && plot_distribution(
[body_y_coordinates],
[results],
["VSM"];
title="pyramid_spanwise_distributions_alpha_$(round(angle_of_attack_deg, digits=1))_delta_$(round(sideslip_deg, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(wind_speed, digits=1))",
save_path=OUTPUT_DIR,
is_save=false || SAVE_ALL,
is_show=true,
use_tex=USE_TEX
)
nothing