Skip to content

Basic Usage Overview

OptVL offers a Python API mirroring AVL's text interface. The typical workflow involves loading a geometry file, adding constraints, and executing analysis runs. In addition to this, though, OptVL also offers unique optimization functionality.

Below is an example of a basic analysis run, to give you an idea of the workflow.

from optvl import OVLSolver

ovl = OVLSolver(geo_file="../geom_files/aircraft.avl", debug=True)

# look at the geometry to see that everything is right
ovl.plot_geom()

# set the angle of attack
ovl.set_variable("alpha", 1.23)
# modify the mach number
ovl.set_parameter("Mach", 0.3)

# set the deflection of the elevator to trim the pitching moment
ovl.set_constraint("Elevator", "Cm", 0.00)

ovl.set_control_deflection("Elevator", 10.0)


# This is the method that acutally runs the analysis
ovl.execute_run()

# print data about the run
force_data = ovl.get_total_forces()
print(
    f'CL:{force_data["CL"]:10.6f}   CD:{force_data["CD"]:10.6f}   Cm:{force_data["Cm"]:10.6f}'
)

# lets look at the cp countours
ovl.plot_cp()

The script will plot the geometry, set parameters, run an analysis, and then show a CP surface plot.

The geometry plot should look like this aircraft geometry plot and the CP surface plot should look like this aircraft cp You can rotate, zoom, and pan in the window to look at different parts for the aircraft. aircraft cp view 2

v1 to v2 changes

See this page for an overview of the API changes from V1 to v2

Limitations

  1. OptVL does not support multiple run cases
  1. No support for the DESIGN keyword for setting twist in the avl geometry file since we use a different system for modifying all aspects of the geometry.