Sectional Data¶
Like AVL, OptVL can also plot data about each chordwise section.
This data is useful for visualizing the force distribution along the wing among other things.
In contrast to AVL's integrated plotter, we return the data and allow you to plot it anyway you wish.
In this demo we use matplotlib
as it by far the most common package for plotting in Python.
Plotting the data¶
To get the data, just call the ovl.get_strip_forces()
method.
The data is organized by surface and each surface has sectional geometric and force/moment data.
strip_data = ovl.get_strip_forces()
first_surf = list(strip_data.keys())[0]
print(strip_data[first_surf].keys())
dict_keys(['chord', 'width', 'X LE', 'Y LE', 'Z LE', 'twist', 'CL', 'CD', 'CDv', 'downwash', 'CX', 'CY', 'CZ', 'CM', 'CN', 'CR', 'CL strip', 'CD strip', 'CF strip', 'CM strip', 'CL perp', 'CM c/4', 'CM LE', 'spanloading', 'lift dist', 'drag dist'])
Some data is about the geometry of the chordwise sections such as chord and twist.
The twist of our baseline design is all zero, but we have some variation in the chord that you can see on the plot:
One of the most useful things to look at is how the lift is distributed over the wing at our analysis condition.
Just like AVL, you can plot the CL and the CL perpendicular to the wing of the aircraft.
The lift distribution is found by multiplying the CL at each section by the chord/cref.
You can also look at how each section contributes to the overall roll and yaw moment coefficients.
The roll distribution is the CR*chord^2/cref^2
and the yaw distribution is CN*chord^2/(cref*bref)
.
Example¶
The example script below can be used to generate these plots for the example aircraft.
from optvl import OVLSolver
import numpy as np
import matplotlib.pyplot as plt
ovl = OVLSolver(geo_file="aircraft.avl", debug=False)
ovl.set_constraint('alpha', 5.0)
ovl.set_constraint('beta', 10.0)
ovl.execute_run()
# keys-start
strip_data = ovl.get_strip_forces()
first_surf = list(strip_data.keys())[0]
print(strip_data[first_surf].keys())
# keys-end
for surf_key in strip_data:
span_distance = strip_data[surf_key]['Y LE']
plt.plot(span_distance, strip_data[surf_key]['chord'], color='blue')
plt.plot(span_distance, strip_data[surf_key]['twist'], color='red')
plt.legend(['chord', 'twist'])
plt.title('geometric spanwise data')
plt.xlabel('spanwise position')
plt.show()
for surf_key in strip_data:
span_distance = strip_data[surf_key]['Y LE']
plt.plot(span_distance, strip_data[surf_key]['lift dist'], color='blue')
plt.plot(span_distance, strip_data[surf_key]['CL'], color='red')
plt.plot(span_distance, strip_data[surf_key]['CL perp'], color='firebrick', linestyle='--')
plt.legend(['lift dist', 'CL', 'CL perp.'])
plt.title('lift spanwise data')
plt.xlabel('spanwise position')
plt.show()
strip_data = ovl.get_strip_forces()
for surf_key in strip_data:
span_distance = strip_data[surf_key]['Y LE']
plt.plot(span_distance, strip_data[surf_key]['CN'], color='C0')
plt.plot(span_distance, strip_data[surf_key]['CR'], color='C1')
plt.legend(['roll distribution', 'yaw distribution'])
plt.title('roll and yaw spanwise data')
plt.xlabel('spanwise position')
plt.show()