Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
profiler.dump_stats(filename)
# profiler.print_stats()
return wrapper
class AeroProblem:
def __init__(self,
airplane, # Object of Airplane class
op_point, # Object of OperatingPoint class
):
self.airplane = airplane
self.op_point = op_point
class vlm1(AeroProblem):
# NOTE: USE VLM2 INSTEAD OF THIS; VLM1 HAS BEEN COMPLETELY SUPERSEDED IN PERFORMANCE AND FUNCTIONALITY BY VLM2.
# Traditional vortex-lattice-method approach with quadrilateral paneling, horseshoe vortices from each one, etc.
# Implemented exactly as The Good Book says (Drela, "Flight Vehicle Aerodynamics", p. 130-135)
@profile
def run(self, verbose=True):
self.verbose = verbose
if self.verbose: print("Running VLM1 calculation...")
# Deprecation warning (use VLM2 instead)
if self.verbose: print("WARNING! VLM1 has been wholly eclipsed in performance and functionality by VLM2. The VLM1 source code has been left intact for validation purposes and backwards-compatibility, but it will not be supported going forward.")
self.make_panels()
self.setup_geometry()
self.setup_operating_point()
ax.text(
panel.colocation_point[0],
panel.colocation_point[1],
panel.colocation_point[2],
str(panel_num),
)
x, y, z, s = self.airplane.get_bounding_cube()
ax.set_xlim3d((x - s, x + s))
ax.set_ylim3d((y - s, y + s))
ax.set_zlim3d((z - s, z + s))
plt.tight_layout()
plt.show()
class vlm2(AeroProblem):
# Vortex-Lattice Method aerodynamics code written from the ground up with lessons learned from writing VLM1.
# Should eventually eclipse VLM1 in performance and render it obsolete.
#
# Notable improvements over VLM1:
# # Specifically written to be reverse-mode-AD-compatible at every step
# # Supports control surfaces
# # Supports bodies in quasi-steady rotation (nonzero p, q, and r)
# # Supports calculation of stability derivatives
# # Vortex lattice follows the mean camber line for higher accuracy (though control deflections are done by rotating normals)
# # TODO: Takes advantage of the connectivity of the vortex lattice to speed up calculate_Vij() by almost exactly 2x
# # TODO: calculate_Vij() is parallelized, one core per wing
#
# Usage:
# # Set up a problem using the syntax in the AeroProblem constructor (e.g. "vlm2(airplane = a, op_point = op)" for some Airplane a and OperatingPoint op)
# # Call vlm2.run() to run the problem.
# # Access results in the command line, or through properties of the vlm2 class.