OpenVSP Utilities Module

OpenVSP utility helpers for AeroDemonstrator.

This module provides helper functions to set up and run OpenVSP models and VSPAero analyses from Python.

Requires the openvsp package to be installed. See https://openvsp.org/pyapi_docs/latest/ for the full OpenVSP Python API.

Notes

OpenVSP is an open-source parametric aircraft geometry tool developed by NASA. The Python API (openvsp package) allows programmatic geometry creation and aerodynamic analysis through VSPAero.

Installation

Install the OpenVSP Python API with:

pip install openvsp

or download prebuilt wheels from https://openvsp.org.

aerodemo.openvsp_utils.check_openvsp()[source]

Check whether the OpenVSP Python API is available.

Returns:

True if openvsp can be imported, False otherwise.

Return type:

bool

aerodemo.openvsp_utils.init_vsp(title='AeroDemonstrator')[source]

Initialize a fresh OpenVSP model.

Parameters:

title (str, optional) – Title for the VSP model. Default is 'AeroDemonstrator'.

Raises:

ImportError – If the openvsp package is not installed.

Return type:

None

aerodemo.openvsp_utils.add_wing(span=10.0, root_chord=2.0, tip_chord=1.0, sweep_deg=0.0, dihedral_deg=0.0, x_offset=0.0, z_offset=0.0, name='Wing')[source]

Add a trapezoidal wing to the current VSP model.

Parameters:
  • span (float) – Full wing span [m]. Default 10.0.

  • root_chord (float) – Root chord [m]. Default 2.0.

  • tip_chord (float) – Tip chord [m]. Default 1.0.

  • sweep_deg (float) – Quarter-chord sweep angle [degrees]. Default 0.0.

  • dihedral_deg (float) – Dihedral angle [degrees]. Default 0.0.

  • x_offset (float) – X-position of wing origin [m]. Default 0.0.

  • z_offset (float) – Z-position of wing [m]. Default 0.0.

  • name (str) – Geometry name in VSP. Default 'Wing'.

Returns:

VSP geometry ID string, or None if OpenVSP is unavailable.

Return type:

str or None

aerodemo.openvsp_utils.add_fuselage(length=10.0, max_diameter=1.5, name='Fuselage')[source]

Add a simple fuselage to the current VSP model.

Parameters:
  • length (float) – Fuselage length [m]. Default 10.0.

  • max_diameter (float) – Maximum diameter [m]. Default 1.5.

  • name (str) – Geometry name. Default 'Fuselage'.

Returns:

VSP geometry ID, or None if OpenVSP is unavailable.

Return type:

str or None

aerodemo.openvsp_utils.add_horizontal_tail(span=4.0, root_chord=1.2, tip_chord=0.7, x_offset=8.5, z_offset=0.2, name='HTail')[source]

Add a horizontal tail surface.

Parameters:
  • span (float) – Full horizontal tail span [m]. Default 4.0.

  • root_chord (float) – Root chord [m]. Default 1.2.

  • tip_chord (float) – Tip chord [m]. Default 0.7.

  • x_offset (float) – X-position [m]. Default 8.5.

  • z_offset (float) – Z-position [m]. Default 0.2.

  • name (str) – Geometry name. Default 'HTail'.

Returns:

VSP geometry ID, or None if OpenVSP is unavailable.

Return type:

str or None

aerodemo.openvsp_utils.add_vertical_tail(height=2.5, root_chord=1.5, tip_chord=0.8, x_offset=8.0, z_offset=0.0, name='VTail')[source]

Add a vertical tail surface.

Parameters:
  • height (float) – Vertical tail height [m]. Default 2.5.

  • root_chord (float) – Root chord [m]. Default 1.5.

  • tip_chord (float) – Tip chord [m]. Default 0.8.

  • x_offset (float) – X-position [m]. Default 8.0.

  • z_offset (float) – Z-position [m]. Default 0.0.

  • name (str) – Geometry name. Default 'VTail'.

Returns:

VSP geometry ID, or None if OpenVSP is unavailable.

Return type:

str or None

aerodemo.openvsp_utils.run_vspaero(alpha_start=0.0, alpha_end=10.0, alpha_npts=5, mach=0.1, ref_area=1.0, ref_span=1.0, ref_chord=1.0, analysis_type='VLM')[source]

Run a VSPAero analysis sweep on the current model.

Parameters:
  • alpha_start (float) – Start angle of attack [degrees]. Default 0.0.

  • alpha_end (float) – End angle of attack [degrees]. Default 10.0.

  • alpha_npts (int) – Number of alpha points. Default 5.

  • mach (float) – Mach number. Default 0.1 (incompressible).

  • ref_area (float) – Reference area [m^2]. Default 1.0.

  • ref_span (float) – Reference span [m]. Default 1.0.

  • ref_chord (float) – Reference chord [m]. Default 1.0.

  • analysis_type (str) – 'VLM' for Vortex Lattice Method or 'Panel' for panel method. Default 'VLM'.

Returns:

Dictionary with VSPAero result arrays, or None if OpenVSP is unavailable.

Return type:

dict or None

Notes

The returned dictionary contains:

{
    "Alpha": array of alpha values,
    "CL":    array of lift coefficients,
    "CDi":   array of induced drag coefficients,
    "CY":    array of side force coefficients,
    "Cl":    array of rolling moment coefficients,
    "Cm":    array of pitching moment coefficients,
    "Cn":    array of yawing moment coefficients,
}
aerodemo.openvsp_utils.save_vsp3_file(filepath)[source]

Save the current VSP model to a .vsp3 file.

Parameters:

filepath (str) – Output file path (should end in .vsp3).

Raises:

ImportError – If the openvsp package is not installed.

Return type:

None

aerodemo.openvsp_utils.load_vsp3_file(filepath)[source]

Load a VSP model from a .vsp3 file.

Parameters:

filepath (str) – Input .vsp3 file path.

Raises:
Return type:

None