aerosandbox.aerodynamics#

Subpackages#

Package Contents#

Classes#

AirfoilInviscid

An implicit analysis for inviscid analysis of an airfoil (or family of airfoils).

XFoil

An interface to XFoil, a 2D airfoil analysis tool developed by Mark Drela at MIT.

MSES

An interface to MSES, MSET, and MPLOT, a 2D airfoil analysis system developed by Mark Drela at MIT.

VortexLatticeMethod

An explicit (linear) vortex-lattice-method aerodynamics analysis.

LiftingLine

An implicit aerodynamics analysis based on lifting line theory, with modifications for nonzero sweep

NonlinearLiftingLine

An implicit aerodynamics analysis based on lifting line theory, with modifications for nonzero sweep

AeroBuildup

A workbook-style aerodynamics buildup.

AVL

An interface to AVL, a 3D vortex lattice aerodynamics code developed by Mark Drela at MIT.

class aerosandbox.aerodynamics.AirfoilInviscid(airfoil, op_point, ground_effect=False)[source]#

Bases: aerosandbox.common.ImplicitAnalysis

An implicit analysis for inviscid analysis of an airfoil (or family of airfoils).

Key outputs:

  • AirfoilInviscid.Cl

Parameters:
__repr__()[source]#

Return repr(self).

_setup_unknowns()[source]#
calculate_velocity(x_field, y_field)[source]#
Return type:

[aerosandbox.numpy.ndarray, aerosandbox.numpy.ndarray]

_enforce_governing_equations()[source]#
_calculate_forces()[source]#
draw_streamlines(res=200, show=True)[source]#
draw_cp(show=True)[source]#
class aerosandbox.aerodynamics.XFoil(airfoil, Re=0.0, mach=0.0, n_crit=9.0, xtr_upper=1.0, xtr_lower=1.0, hinge_point_x=0.75, full_potential=False, max_iter=100, xfoil_command='xfoil', xfoil_repanel=True, xfoil_repanel_n_points=279, include_bl_data=False, verbose=False, timeout=30, working_directory=None)[source]#

Bases: aerosandbox.common.ExplicitAnalysis

An interface to XFoil, a 2D airfoil analysis tool developed by Mark Drela at MIT.

Requires XFoil to be on your computer; XFoil is available here: https://web.mit.edu/drela/Public/web/xfoil/

It is recommended (but not required) that you add XFoil to your system PATH environment variable such that it can be called with the command xfoil. If this is not the case, you need to specify the path to your XFoil executable using the xfoil_command argument of the constructor.

Usage example:

>>> xf = XFoil(
>>>     airfoil=Airfoil("naca2412").repanel(n_points_per_side=100),
>>>     Re=1e6,
>>> )
>>>
>>> result_at_single_alpha = xf.alpha(5)
>>> result_at_several_CLs = xf.cl([0.5, 0.7, 0.8, 0.9])
>>> result_at_multiple_alphas = xf.alpha([3, 5, 60]) # Note: if a result does not converge (such as the 60 degree case here), it will not be included in the results.
Parameters:
  • airfoil (aerosandbox.geometry.Airfoil) –

  • Re (float) –

  • mach (float) –

  • n_crit (float) –

  • xtr_upper (float) –

  • xtr_lower (float) –

  • hinge_point_x (float) –

  • full_potential (bool) –

  • max_iter (int) –

  • xfoil_command (str) –

  • xfoil_repanel (bool) –

  • xfoil_repanel_n_points (int) –

  • include_bl_data (bool) –

  • verbose (bool) –

  • timeout (Union[float, int, None]) –

  • working_directory (Union[pathlib.Path, str]) –

__repr__()[source]#

Return repr(self).

_default_keystrokes(airfoil_filename, output_filename)[source]#

Returns a list of XFoil keystrokes that are common to all XFoil runs.

Returns:

A list of strings, each of which is a single XFoil keystroke to be followed by <enter>.

Parameters:
  • airfoil_filename (str) –

  • output_filename (str) –

Return type:

List[str]

_run_xfoil(run_command, read_bl_data_from=None)[source]#

Private function to run XFoil.

Args: run_command: A string with any XFoil keystroke inputs that you’d like. By default, you start off within the OPER menu. All of the inputs indicated in the constructor have been set already, but you can override them here (for this run only) if you want.

Returns: A dictionary containing all converged solutions obtained with your inputs.

Parameters:
  • run_command (str) –

  • read_bl_data_from (str) –

Return type:

Dict[str, aerosandbox.numpy.ndarray]

open_interactive()[source]#

Opens a new terminal window and runs XFoil interactively. This is useful for detailed analysis or debugging.

Returns: None

Return type:

None

alpha(alpha, start_at=0)[source]#

Execute XFoil at a given angle of attack, or at a sequence of angles of attack.

Parameters:
  • alpha (Union[float, aerosandbox.numpy.ndarray]) – The angle of attack [degrees]. Can be either a float or an iterable of floats, such as an array.

  • start_at (Union[float, None]) – Chooses whether to split a large sweep into two runs that diverge away from some central value,

  • example (to improve convergence. As an) –

  • alpha=20 (if you wanted to sweep from alpha=-20 to) –

  • want (you might) –

  • together (to instead do two sweeps and stitch them) –

    0 to 20, and 0 to -20. start_at can be either:

    • None, in which case the alpha inputs are run as a single sequence in the order given.

    • A float that corresponds to an angle of attack (in degrees), in which case the alpha inputs are

    split into two sequences that diverge from the start_at value. Successful runs are then sorted by alpha before returning.

Return type:

Dict[str, aerosandbox.numpy.ndarray]

Returns: A dictionary with the XFoil results. Dictionary values are arrays; they may not be the same shape as your input array if some points did not converge.

cl(cl, start_at=0)[source]#

Execute XFoil at a given lift coefficient, or at a sequence of lift coefficients.

Parameters:
  • cl (Union[float, aerosandbox.numpy.ndarray]) – The lift coefficient [-]. Can be either a float or an iterable of floats, such as an array.

  • start_at (Union[float, None]) – Chooses whether to split a large sweep into two runs that diverge away from some central value,

  • example (to improve convergence. As an) –

  • cl=1.5 (if you wanted to sweep from cl=-1.5 to) –

  • to (you might want) –

  • together (instead do two sweeps and stitch them) –

    0 to 1.5, and 0 to -1.5. start_at can be either:

    • None, in which case the cl inputs are run as a single sequence in the order given.

    • A float that corresponds to an lift coefficient, in which case the cl inputs are

    split into two sequences that diverge from the start_at value. Successful runs are then sorted by alpha before returning.

Return type:

Dict[str, aerosandbox.numpy.ndarray]

Returns: A dictionary with the XFoil results. Dictionary values are arrays; they may not be the same shape as your input array if some points did not converge.

class aerosandbox.aerodynamics.MSES(airfoil, n_crit=9.0, xtr_upper=1.0, xtr_lower=1.0, max_iter=100, mset_command='mset', mses_command='mses', mplot_command='mplot', use_xvfb=None, xvfb_command='xvfb-run -a', verbosity=1, timeout_mset=10, timeout_mses=60, timeout_mplot=10, working_directory=None, behavior_after_unconverged_run='reinitialize', mset_alpha=0, mset_n=141, mset_e=0.4, mset_io=37, mset_x=0.85, mses_mcrit=0.99, mses_mucon=-1.0)[source]#

Bases: aerosandbox.common.ExplicitAnalysis

An interface to MSES, MSET, and MPLOT, a 2D airfoil analysis system developed by Mark Drela at MIT.

Requires compiled binaries for all the programs to be on your computer; MSES is available here: https://web.mit.edu/drela/Public/web/mses/ Academics can get a copy by emailing the MIT Tech. Licensing Office; MIT affiliates can find a copy on Athena.

It is recommended (but not required) that you add MSES, MSET, and MPLOT to your system PATH environment variable such that they can be called with the commands mses, mset, and mplot. If this is not the case, you need to specify the path to these executables using the command arguments of the constructor.

Note that MSES, MSET, and MPLOT by default open up X11 windows on your computer. If you prefer that this doesn’t happen (for extra speed), or if you cannot have this happen (e.g., you are computing in an environment without proper X11 support, like Windows Subsystem for Linux), you should use XVFB. https://en.wikipedia.org/wiki/Xvfb

XVFB is a virtual “display” server that can receive X11 output and safely dump it. (If you don’t use XVFB and you don’t have proper X11 support on your computer, this AeroSandbox MSES module will simply error out during the MSET call - probably not what you want.)

To install XVFB on a Linux machine, use:

`bash sudo apt-get install xvfb `

Then, when instantiating this MSES instance in AeroSandbox, pass the use_xvfb flag to be True. Default behavior here is that this class will look for the XVFB executable, xvfb-run, on your machine. If it finds it, it will run with XVFB enabled. If it does not, it will run without XVFB.


Usage example:

>>> ms = MSES(
>>>     airfoil=Airfoil("naca2412").repanel(n_points_per_side=100),
>>>     Re=1e6,
>>>     mach=0.2,
>>> )
>>>
>>> result_at_single_alpha = ms.alpha(5)
>>> #result_at_several_CLs = ms.cl([0.5, 0.7, 0.8, 0.9])
>>> result_at_multiple_alphas = ms.alpha([3, 5, 60]) # Note: if a result does not converge (such as the 60 degree case here), it will not be included in the results.
Parameters:
  • airfoil (aerosandbox.geometry.Airfoil) –

  • n_crit (float) –

  • xtr_upper (float) –

  • xtr_lower (float) –

  • max_iter (int) –

  • mset_command (str) –

  • mses_command (str) –

  • mplot_command (str) –

  • use_xvfb (bool) –

  • xvfb_command (str) –

  • verbosity (int) –

  • timeout_mset (Union[float, int, None]) –

  • timeout_mses (Union[float, int, None]) –

  • timeout_mplot (Union[float, int, None]) –

  • working_directory (str) –

  • behavior_after_unconverged_run (str) –

  • mset_alpha (float) –

  • mset_n (int) –

  • mset_e (float) –

  • mset_io (int) –

  • mset_x (float) –

  • mses_mcrit (float) –

  • mses_mucon (float) –

run(alpha=0.0, Re=0.0, mach=0.01)[source]#
Parameters:
  • alpha (Union[float, aerosandbox.numpy.ndarray, List]) –

  • Re (Union[float, aerosandbox.numpy.ndarray, List]) –

  • mach (Union[float, aerosandbox.numpy.ndarray, List]) –

class aerosandbox.aerodynamics.VortexLatticeMethod(airplane, op_point, xyz_ref=None, run_symmetric_if_possible=False, verbose=False, spanwise_resolution=10, spanwise_spacing_function=np.cosspace, chordwise_resolution=10, chordwise_spacing_function=np.cosspace, vortex_core_radius=1e-08, align_trailing_vortices_with_wind=False)[source]#

Bases: aerosandbox.ExplicitAnalysis

An explicit (linear) vortex-lattice-method aerodynamics analysis.

Usage example:
>>> analysis = asb.VortexLatticeMethod(
>>>     airplane=my_airplane,
>>>     op_point=asb.OperatingPoint(
>>>         velocity=100, # m/s
>>>         alpha=5, # deg
>>>         beta=4, # deg
>>>         p=0.01, # rad/sec
>>>         q=0.02, # rad/sec
>>>         r=0.03, # rad/sec
>>>     )
>>> )
>>> aero_data = analysis.run()
>>> analysis.draw()
Parameters:
  • airplane (aerosandbox.geometry.Airplane) –

  • op_point (aerosandbox.performance.OperatingPoint) –

  • xyz_ref (List[float]) –

  • run_symmetric_if_possible (bool) –

  • verbose (bool) –

  • spanwise_resolution (int) –

  • spanwise_spacing_function (Callable[[float, float, float], aerosandbox.geometry.np.ndarray]) –

  • chordwise_resolution (int) –

  • chordwise_spacing_function (Callable[[float, float, float], aerosandbox.geometry.np.ndarray]) –

  • vortex_core_radius (float) –

  • align_trailing_vortices_with_wind (bool) –

__repr__()[source]#

Return repr(self).

run()[source]#

Computes the aerodynamic forces.

Returns a dictionary with keys:

  • ‘F_g’ : an [x, y, z] list of forces in geometry axes [N]

  • ‘F_b’ : an [x, y, z] list of forces in body axes [N]

  • ‘F_w’ : an [x, y, z] list of forces in wind axes [N]

  • ‘M_g’ : an [x, y, z] list of moments about geometry axes [Nm]

  • ‘M_b’ : an [x, y, z] list of moments about body axes [Nm]

  • ‘M_w’ : an [x, y, z] list of moments about wind axes [Nm]

  • ‘L’ : the lift force [N]. Definitionally, this is in wind axes.

  • ‘Y’ : the side force [N]. This is in wind axes.

  • ‘D’ : the drag force [N]. Definitionally, this is in wind axes.

  • ‘l_b’, the rolling moment, in body axes [Nm]. Positive is roll-right.

  • ‘m_b’, the pitching moment, in body axes [Nm]. Positive is pitch-up.

  • ‘n_b’, the yawing moment, in body axes [Nm]. Positive is nose-right.

  • ‘CL’, the lift coefficient [-]. Definitionally, this is in wind axes.

  • ‘CY’, the sideforce coefficient [-]. This is in wind axes.

  • ‘CD’, the drag coefficient [-]. Definitionally, this is in wind axes.

  • ‘Cl’, the rolling coefficient [-], in body axes

  • ‘Cm’, the pitching coefficient [-], in body axes

  • ‘Cn’, the yawing coefficient [-], in body axes

Nondimensional values are nondimensionalized using reference values in the VortexLatticeMethod.airplane object.

Return type:

Dict[str, Any]

run_with_stability_derivatives(alpha=True, beta=True, p=True, q=True, r=True)[source]#

Computes the aerodynamic forces and moments on the airplane, and the stability derivatives.

Arguments essentially determine which stability derivatives are computed. If a stability derivative is not needed, leaving it False will speed up the computation.

Parameters:
  • alpha (-) – If True, compute the stability derivatives with respect to the angle of attack (alpha).

  • beta (-) – If True, compute the stability derivatives with respect to the sideslip angle (beta).

  • p (-) – If True, compute the stability derivatives with respect to the body-axis roll rate (p).

  • q (-) – If True, compute the stability derivatives with respect to the body-axis pitch rate (q).

  • r (-) – If True, compute the stability derivatives with respect to the body-axis yaw rate (r).

Returns: a dictionary with keys:

  • ‘F_g’ : an [x, y, z] list of forces in geometry axes [N]

  • ‘F_b’ : an [x, y, z] list of forces in body axes [N]

  • ‘F_w’ : an [x, y, z] list of forces in wind axes [N]

  • ‘M_g’ : an [x, y, z] list of moments about geometry axes [Nm]

  • ‘M_b’ : an [x, y, z] list of moments about body axes [Nm]

  • ‘M_w’ : an [x, y, z] list of moments about wind axes [Nm]

  • ‘L’ : the lift force [N]. Definitionally, this is in wind axes.

  • ‘Y’ : the side force [N]. This is in wind axes.

  • ‘D’ : the drag force [N]. Definitionally, this is in wind axes.

  • ‘l_b’, the rolling moment, in body axes [Nm]. Positive is roll-right.

  • ‘m_b’, the pitching moment, in body axes [Nm]. Positive is pitch-up.

  • ‘n_b’, the yawing moment, in body axes [Nm]. Positive is nose-right.

  • ‘CL’, the lift coefficient [-]. Definitionally, this is in wind axes.

  • ‘CY’, the sideforce coefficient [-]. This is in wind axes.

  • ‘CD’, the drag coefficient [-]. Definitionally, this is in wind axes.

  • ‘Cl’, the rolling coefficient [-], in body axes

  • ‘Cm’, the pitching coefficient [-], in body axes

  • ‘Cn’, the yawing coefficient [-], in body axes

Along with additional keys, depending on the value of the alpha, beta, p, q, and r arguments. For example, if alpha=True, then the following additional keys will be present:

  • ‘CLa’, the lift coefficient derivative with respect to alpha [1/rad]

  • ‘CDa’, the drag coefficient derivative with respect to alpha [1/rad]

  • ‘CYa’, the sideforce coefficient derivative with respect to alpha [1/rad]

  • ‘Cla’, the rolling moment coefficient derivative with respect to alpha [1/rad]

  • ‘Cma’, the pitching moment coefficient derivative with respect to alpha [1/rad]

  • ‘Cna’, the yawing moment coefficient derivative with respect to alpha [1/rad]

  • ‘x_np’, the neutral point location in the x direction [m]

Nondimensional values are nondimensionalized using reference values in the VortexLatticeMethod.airplane object.

Data types:
  • The “L”, “Y”, “D”, “l_b”, “m_b”, “n_b”, “CL”, “CY”, “CD”, “Cl”, “Cm”, and “Cn” keys are:

    • floats if the OperatingPoint object is not vectorized (i.e., if all attributes of OperatingPoint

    are floats, not arrays).

    • arrays if the OperatingPoint object is vectorized (i.e., if any attribute of OperatingPoint is an

    array).

  • The “F_g”, “F_b”, “F_w”, “M_g”, “M_b”, and “M_w” keys are always lists, which will contain either

floats or arrays, again depending on whether the OperatingPoint object is vectorized or not.

get_induced_velocity_at_points(points)[source]#

Computes the induced velocity at a set of points in the flowfield.

Parameters:

points (aerosandbox.geometry.np.ndarray) – A Nx3 array of points that you would like to know the induced velocities at. Given in geometry axes.

Return type:

aerosandbox.geometry.np.ndarray

Returns: A Nx3 of the induced velocity at those points. Given in geometry axes.

get_velocity_at_points(points)[source]#

Computes the velocity at a set of points in the flowfield.

Parameters:

points (aerosandbox.geometry.np.ndarray) – A Nx3 array of points that you would like to know the velocities at. Given in geometry axes.

Return type:

aerosandbox.geometry.np.ndarray

Returns: A Nx3 of the velocity at those points. Given in geometry axes.

calculate_streamlines(seed_points=None, n_steps=300, length=None)[source]#

Computes streamlines, starting at specific seed points.

After running this function, a new instance variable VortexLatticeFilaments.streamlines is computed

Uses simple forward-Euler integration with a fixed spatial stepsize (i.e., velocity vectors are normalized before ODE integration). After investigation, it’s not worth doing fancier ODE integration methods (adaptive schemes, RK substepping, etc.), due to the near-singular conditions near vortex filaments.

Parameters:
  • seed_points (aerosandbox.geometry.np.ndarray) – A Nx3 ndarray that contains a list of points where streamlines are started. Will be

  • specified. (not) –

  • n_steps (int) – The number of individual streamline steps to trace. Minimum of 2.

  • length (float) – The approximate total length of the streamlines desired, in meters. Will be auto-calculated if

  • specified.

Returns:

a 3D array with dimensions: (n_seed_points) x (3) x (n_steps). Consists of streamlines data.

Result is also saved as an instance variable, VortexLatticeMethod.streamlines.

Return type:

streamlines

draw(c=None, cmap=None, colorbar_label=None, show=True, show_kwargs=None, draw_streamlines=True, recalculate_streamlines=False, backend='pyvista')[source]#

Draws the solution. Note: Must be called on a SOLVED AeroProblem object. To solve an AeroProblem, use opti.solve(). To substitute a solved solution, use ap = sol(ap). :return:

Parameters:
  • c (aerosandbox.geometry.np.ndarray) –

  • cmap (str) –

  • colorbar_label (str) –

  • show (bool) –

  • show_kwargs (Dict) –

  • backend (str) –

class aerosandbox.aerodynamics.LiftingLine(airplane, op_point, xyz_ref=None, model_size='medium', run_symmetric_if_possible=False, verbose=False, spanwise_resolution=4, spanwise_spacing_function=np.cosspace, vortex_core_radius=1e-08, align_trailing_vortices_with_wind=False)[source]#

Bases: aerosandbox.ExplicitAnalysis

An implicit aerodynamics analysis based on lifting line theory, with modifications for nonzero sweep and dihedral + multiple wings.

Nonlinear, and includes viscous effects based on 2D data.

Usage example:
>>> analysis = asb.LiftingLine(
>>>     airplane=my_airplane,
>>>     op_point=asb.OperatingPoint(
>>>         velocity=100, # m/s
>>>         alpha=5, # deg
>>>         beta=4, # deg
>>>         p=0.01, # rad/sec
>>>         q=0.02, # rad/sec
>>>         r=0.03, # rad/sec
>>>     )
>>> )
>>> outputs = analysis.run()
Parameters:
  • airplane (aerosandbox.geometry.Airplane) –

  • op_point (aerosandbox.performance.OperatingPoint) –

  • xyz_ref (List[float]) –

  • model_size (str) –

  • run_symmetric_if_possible (bool) –

  • verbose (bool) –

  • spanwise_resolution (int) –

  • spanwise_spacing_function (Callable[[float, float, float], aerosandbox.geometry.np.ndarray]) –

  • vortex_core_radius (float) –

  • align_trailing_vortices_with_wind (bool) –

class AeroComponentResults#
property F_b: List[float | aerosandbox.geometry.np.ndarray]#

An [x, y, z] list of forces in body axes [N]

Return type:

List[Union[float, aerosandbox.geometry.np.ndarray]]

property F_w: List[float | aerosandbox.geometry.np.ndarray]#

An [x, y, z] list of forces in wind axes [N]

Return type:

List[Union[float, aerosandbox.geometry.np.ndarray]]

property M_b: List[float | aerosandbox.geometry.np.ndarray]#

An [x, y, z] list of moments about body axes [Nm]

Return type:

List[Union[float, aerosandbox.geometry.np.ndarray]]

property M_w: List[float | aerosandbox.geometry.np.ndarray]#

An [x, y, z] list of moments about wind axes [Nm]

Return type:

List[Union[float, aerosandbox.geometry.np.ndarray]]

property L: float | aerosandbox.geometry.np.ndarray#

The lift force [N]. Definitionally, this is in wind axes.

Return type:

Union[float, aerosandbox.geometry.np.ndarray]

property Y: float | aerosandbox.geometry.np.ndarray#

The side force [N]. Definitionally, this is in wind axes.

Return type:

Union[float, aerosandbox.geometry.np.ndarray]

property D: float | aerosandbox.geometry.np.ndarray#

The drag force [N]. Definitionally, this is in wind axes.

Return type:

Union[float, aerosandbox.geometry.np.ndarray]

property l_b: float | aerosandbox.geometry.np.ndarray#

The rolling moment [Nm] in body axes. Positive is roll-right.

Return type:

Union[float, aerosandbox.geometry.np.ndarray]

property m_b: float | aerosandbox.geometry.np.ndarray#

The pitching moment [Nm] in body axes. Positive is nose-up.

Return type:

Union[float, aerosandbox.geometry.np.ndarray]

property n_b: float | aerosandbox.geometry.np.ndarray#

The yawing moment [Nm] in body axes. Positive is nose-right.

Return type:

Union[float, aerosandbox.geometry.np.ndarray]

s_ref: float#
c_ref: float#
b_ref: float#
op_point: aerosandbox.performance.OperatingPoint#
F_g: List[float | aerosandbox.geometry.np.ndarray]#
M_g: List[float | aerosandbox.geometry.np.ndarray]#
__repr__()#

Return repr(self).

__repr__()[source]#

Return repr(self).

run()[source]#

Computes the aerodynamic forces.

Returns a dictionary with keys:

  • ‘F_g’ : an [x, y, z] list of forces in geometry axes [N]

  • ‘F_b’ : an [x, y, z] list of forces in body axes [N]

  • ‘F_w’ : an [x, y, z] list of forces in wind axes [N]

  • ‘M_g’ : an [x, y, z] list of moments about geometry axes [Nm]

  • ‘M_b’ : an [x, y, z] list of moments about body axes [Nm]

  • ‘M_w’ : an [x, y, z] list of moments about wind axes [Nm]

  • ‘L’ : the lift force [N]. Definitionally, this is in wind axes.

  • ‘Y’ : the side force [N]. This is in wind axes.

  • ‘D’ : the drag force [N]. Definitionally, this is in wind axes.

  • ‘l_b’, the rolling moment, in body axes [Nm]. Positive is roll-right.

  • ‘m_b’, the pitching moment, in body axes [Nm]. Positive is pitch-up.

  • ‘n_b’, the yawing moment, in body axes [Nm]. Positive is nose-right.

  • ‘CL’, the lift coefficient [-]. Definitionally, this is in wind axes.

  • ‘CY’, the sideforce coefficient [-]. This is in wind axes.

  • ‘CD’, the drag coefficient [-]. Definitionally, this is in wind axes.

  • ‘Cl’, the rolling coefficient [-], in body axes

  • ‘Cm’, the pitching coefficient [-], in body axes

  • ‘Cn’, the yawing coefficient [-], in body axes

Nondimensional values are nondimensionalized using reference values in the LiftingLine.airplane object.

Data types:
  • The “L”, “Y”, “D”, “l_b”, “m_b”, “n_b”, “CL”, “CY”, “CD”, “Cl”, “Cm”, and “Cn” keys are:

    • floats if the OperatingPoint object is not vectorized (i.e., if all attributes of OperatingPoint

    are floats, not arrays).

    • arrays if the OperatingPoint object is vectorized (i.e., if any attribute of OperatingPoint is an

    array).

  • The “F_g”, “F_b”, “F_w”, “M_g”, “M_b”, and “M_w” keys are always lists, which will contain either

floats or arrays, again depending on whether the OperatingPoint object is vectorized or not.

Return type:

Dict

run_with_stability_derivatives(alpha=True, beta=True, p=True, q=True, r=True)[source]#

Computes the aerodynamic forces and moments on the airplane, and the stability derivatives.

Arguments essentially determine which stability derivatives are computed. If a stability derivative is not needed, leaving it False will speed up the computation.

Parameters:
  • alpha (-) – If True, compute the stability derivatives with respect to the angle of attack (alpha).

  • beta (-) – If True, compute the stability derivatives with respect to the sideslip angle (beta).

  • p (-) – If True, compute the stability derivatives with respect to the body-axis roll rate (p).

  • q (-) – If True, compute the stability derivatives with respect to the body-axis pitch rate (q).

  • r (-) – If True, compute the stability derivatives with respect to the body-axis yaw rate (r).

Return type:

Dict[str, Union[Union[float, aerosandbox.geometry.np.ndarray], List[Union[float, aerosandbox.geometry.np.ndarray]]]]

Returns: a dictionary with keys:

  • ‘F_g’ : an [x, y, z] list of forces in geometry axes [N]

  • ‘F_b’ : an [x, y, z] list of forces in body axes [N]

  • ‘F_w’ : an [x, y, z] list of forces in wind axes [N]

  • ‘M_g’ : an [x, y, z] list of moments about geometry axes [Nm]

  • ‘M_b’ : an [x, y, z] list of moments about body axes [Nm]

  • ‘M_w’ : an [x, y, z] list of moments about wind axes [Nm]

  • ‘L’ : the lift force [N]. Definitionally, this is in wind axes.

  • ‘Y’ : the side force [N]. This is in wind axes.

  • ‘D’ : the drag force [N]. Definitionally, this is in wind axes.

  • ‘l_b’ : the rolling moment, in body axes [Nm]. Positive is roll-right.

  • ‘m_b’ : the pitching moment, in body axes [Nm]. Positive is pitch-up.

  • ‘n_b’ : the yawing moment, in body axes [Nm]. Positive is nose-right.

  • ‘CL’ : the lift coefficient [-]. Definitionally, this is in wind axes.

  • ‘CY’ : the sideforce coefficient [-]. This is in wind axes.

  • ‘CD’ : the drag coefficient [-]. Definitionally, this is in wind axes.

  • ‘Cl’ : the rolling coefficient [-], in body axes

  • ‘Cm’ : the pitching coefficient [-], in body axes

  • ‘Cn’ : the yawing coefficient [-], in body axes

Along with additional keys, depending on the value of the alpha, beta, p, q, and r arguments. For example, if alpha=True, then the following additional keys will be present:

  • ‘CLa’ : the lift coefficient derivative with respect to alpha [1/rad]

  • ‘CDa’ : the drag coefficient derivative with respect to alpha [1/rad]

  • ‘CYa’ : the sideforce coefficient derivative with respect to alpha [1/rad]

  • ‘Cla’ : the rolling moment coefficient derivative with respect to alpha [1/rad]

  • ‘Cma’ : the pitching moment coefficient derivative with respect to alpha [1/rad]

  • ‘Cna’ : the yawing moment coefficient derivative with respect to alpha [1/rad]

  • ‘x_np’: the neutral point location in the x direction [m]

Nondimensional values are nondimensionalized using reference values in the AeroBuildup.airplane object.

Data types:
  • The “L”, “Y”, “D”, “l_b”, “m_b”, “n_b”, “CL”, “CY”, “CD”, “Cl”, “Cm”, and “Cn” keys are:

    • floats if the OperatingPoint object is not vectorized (i.e., if all attributes of OperatingPoint

    are floats, not arrays).

    • arrays if the OperatingPoint object is vectorized (i.e., if any attribute of OperatingPoint is an

    array).

  • The “F_g”, “F_b”, “F_w”, “M_g”, “M_b”, and “M_w” keys are always lists, which will contain either

floats or arrays, again depending on whether the OperatingPoint object is vectorized or not.

wing_aerodynamics()[source]#
Return type:

AeroComponentResults

get_induced_velocity_at_points(points, vortex_strengths=None)[source]#

Computes the induced velocity at a set of points in the flowfield.

Parameters:
  • points (aerosandbox.geometry.np.ndarray) – A Nx3 array of points that you would like to know the induced velocities at. Given in geometry axes.

  • vortex_strengths (aerosandbox.geometry.np.ndarray) –

Return type:

aerosandbox.geometry.np.ndarray

Returns: A Nx3 of the induced velocity at those points. Given in geometry axes.

get_velocity_at_points(points, vortex_strengths=None)[source]#

Computes the velocity at a set of points in the flowfield.

Parameters:
  • points (aerosandbox.geometry.np.ndarray) – A Nx3 array of points that you would like to know the velocities at. Given in geometry axes.

  • vortex_strengths (aerosandbox.geometry.np.ndarray) –

Return type:

aerosandbox.geometry.np.ndarray

Returns: A Nx3 of the velocity at those points. Given in geometry axes.

calculate_fuselage_influences(points)[source]#
Parameters:

points (aerosandbox.geometry.np.ndarray) –

Return type:

aerosandbox.geometry.np.ndarray

calculate_streamlines(seed_points=None, n_steps=300, length=None)[source]#

Computes streamlines, starting at specific seed points.

After running this function, a new instance variable VortexLatticeFilaments.streamlines is computed

Uses simple forward-Euler integration with a fixed spatial stepsize (i.e., velocity vectors are normalized before ODE integration). After investigation, it’s not worth doing fancier ODE integration methods (adaptive schemes, RK substepping, etc.), due to the near-singular conditions near vortex filaments.

Parameters:
  • seed_points (aerosandbox.geometry.np.ndarray) – A Nx3 ndarray that contains a list of points where streamlines are started. Will be

  • specified. (not) –

  • n_steps (int) – The number of individual streamline steps to trace. Minimum of 2.

  • length (float) – The approximate total length of the streamlines desired, in meters. Will be auto-calculated if

  • specified.

Returns:

a 3D array with dimensions: (n_seed_points) x (3) x (n_steps). Consists of streamlines data.

Result is also saved as an instance variable, VortexLatticeMethod.streamlines.

Return type:

streamlines

draw(c=None, cmap=None, colorbar_label=None, show=True, show_kwargs=None, draw_streamlines=True, recalculate_streamlines=False, backend='pyvista')[source]#

Draws the solution. Note: Must be called on a SOLVED AeroProblem object. To solve an AeroProblem, use opti.solve(). To substitute a solved solution, use ap = sol(ap). :return:

Parameters:
  • c (aerosandbox.geometry.np.ndarray) –

  • cmap (str) –

  • colorbar_label (str) –

  • show (bool) –

  • show_kwargs (Dict) –

  • backend (str) –

class aerosandbox.aerodynamics.NonlinearLiftingLine(airplane, op_point, xyz_ref=None, run_symmetric_if_possible=False, verbose=False, spanwise_resolution=8, spanwise_spacing_function=np.cosspace, vortex_core_radius=1e-08, align_trailing_vortices_with_wind=False)[source]#

Bases: aerosandbox.ImplicitAnalysis

An implicit aerodynamics analysis based on lifting line theory, with modifications for nonzero sweep and dihedral + multiple wings.

Nonlinear, and includes viscous effects based on 2D data.

Usage example:
>>> analysis = asb.NonlinearLiftingLine(
>>>     airplane=my_airplane,
>>>     op_point=asb.OperatingPoint(
>>>         velocity=100, # m/s
>>>         alpha=5, # deg
>>>         beta=4, # deg
>>>         p=0.01, # rad/sec
>>>         q=0.02, # rad/sec
>>>         r=0.03, # rad/sec
>>>     )
>>> )
>>> outputs = analysis.run()
Parameters:
  • airplane (aerosandbox.geometry.Airplane) –

  • op_point (aerosandbox.performance.OperatingPoint) –

  • xyz_ref (List[float]) –

  • run_symmetric_if_possible (bool) –

  • verbose (bool) –

  • spanwise_spacing_function (Callable[[float, float, float], aerosandbox.numpy.ndarray]) –

  • vortex_core_radius (float) –

  • align_trailing_vortices_with_wind (bool) –

__repr__()[source]#

Return repr(self).

run(solve=True)[source]#

Computes the aerodynamic forces.

Returns a dictionary with keys:
  • ‘residuals’: a list of residuals for each horseshoe element

  • ‘F_g’ : an [x, y, z] list of forces in geometry axes [N]

  • ‘F_b’ : an [x, y, z] list of forces in body axes [N]

  • ‘F_w’ : an [x, y, z] list of forces in wind axes [N]

  • ‘M_g’ : an [x, y, z] list of moments about geometry axes [Nm]

  • ‘M_b’ : an [x, y, z] list of moments about body axes [Nm]

  • ‘M_w’ : an [x, y, z] list of moments about wind axes [Nm]

  • ‘L’ : the lift force [N]. Definitionally, this is in wind axes.

  • ‘Y’ : the side force [N]. This is in wind axes.

  • ‘D’ : the drag force [N]. Definitionally, this is in wind axes.

  • ‘l_b’, the rolling moment, in body axes [Nm]. Positive is roll-right.

  • ‘m_b’, the pitching moment, in body axes [Nm]. Positive is pitch-up.

  • ‘n_b’, the yawing moment, in body axes [Nm]. Positive is nose-right.

  • ‘CL’, the lift coefficient [-]. Definitionally, this is in wind axes.

  • ‘CY’, the sideforce coefficient [-]. This is in wind axes.

  • ‘CD’, the drag coefficient [-]. Definitionally, this is in wind axes.

  • ‘CDi’ the induced drag coefficient

  • ‘CDp’ the profile drag coefficient

  • ‘Cl’, the rolling coefficient [-], in body axes

  • ‘Cm’, the pitching coefficient [-], in body axes

  • ‘Cn’, the yawing coefficient [-], in body axes

Nondimensional values are nondimensionalized using reference values in the VortexLatticeMethod.airplane object.

Parameters:

solve (bool) –

Return type:

Dict[str, Any]

get_induced_velocity_at_points(points, vortex_strengths=None)[source]#

Computes the induced velocity at a set of points in the flowfield.

Parameters:
  • points (aerosandbox.numpy.ndarray) – A Nx3 array of points that you would like to know the induced velocities at. Given in geometry axes.

  • vortex_strengths (aerosandbox.numpy.ndarray) –

Return type:

aerosandbox.numpy.ndarray

Returns: A Nx3 of the induced velocity at those points. Given in geometry axes.

get_velocity_at_points(points, vortex_strengths=None)[source]#

Computes the velocity at a set of points in the flowfield.

Parameters:
  • points (aerosandbox.numpy.ndarray) – A Nx3 array of points that you would like to know the velocities at. Given in geometry axes.

  • vortex_strengths (aerosandbox.numpy.ndarray) –

Return type:

aerosandbox.numpy.ndarray

Returns: A Nx3 of the velocity at those points. Given in geometry axes.

calculate_fuselage_influences(points)[source]#
Parameters:

points (aerosandbox.numpy.ndarray) –

Return type:

aerosandbox.numpy.ndarray

calculate_streamlines(seed_points=None, n_steps=300, length=None)[source]#

Computes streamlines, starting at specific seed points.

After running this function, a new instance variable VortexLatticeFilaments.streamlines is computed

Uses simple forward-Euler integration with a fixed spatial stepsize (i.e., velocity vectors are normalized before ODE integration). After investigation, it’s not worth doing fancier ODE integration methods (adaptive schemes, RK substepping, etc.), due to the near-singular conditions near vortex filaments.

Parameters:
  • seed_points (aerosandbox.numpy.ndarray) – A Nx3 ndarray that contains a list of points where streamlines are started. Will be

  • specified. (not) –

  • n_steps (int) – The number of individual streamline steps to trace. Minimum of 2.

  • length (float) – The approximate total length of the streamlines desired, in meters. Will be auto-calculated if

  • specified.

Returns:

a 3D array with dimensions: (n_seed_points) x (3) x (n_steps). Consists of streamlines data.

Result is also saved as an instance variable, VortexLatticeMethod.streamlines.

Return type:

streamlines

draw(c=None, cmap=None, colorbar_label=None, show=True, show_kwargs=None, draw_streamlines=True, recalculate_streamlines=False, backend='pyvista')[source]#

Draws the solution. Note: Must be called on a SOLVED AeroProblem object. To solve an AeroProblem, use opti.solve(). To substitute a solved solution, use ap = sol(ap). :return:

Parameters:
  • c (aerosandbox.numpy.ndarray) –

  • cmap (str) –

  • colorbar_label (str) –

  • show (bool) –

  • show_kwargs (Dict) –

  • backend (str) –

class aerosandbox.aerodynamics.AeroBuildup(airplane, op_point, xyz_ref=None, model_size='small', include_wave_drag=True)[source]#

Bases: aerosandbox.ExplicitAnalysis

A workbook-style aerodynamics buildup.

Example usage:

>>> import aerosandbox as asb
>>> ab = asb.AeroBuildup(  # This sets up the analysis, but doesn't execute calculation
>>>     airplane=my_airplane,  # type: asb.Airplane
>>>     op_point=my_operating_point,  # type: asb.OperatingPoint
>>>     xyz_ref=[0.1, 0.2, 0.3],  # Moment reference and center of rotation.
>>> )
>>> aero = ab.run()  # This executes the actual aero analysis.
>>> aero_with_stability_derivs = ab.run_with_stability_derivatives()  # Same, but also gets stability derivatives.
Parameters:
class AeroComponentResults#
property F_b: List[float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]#

An [x, y, z] list of forces in body axes [N]

Return type:

List[Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]]

property F_w: List[float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]#

An [x, y, z] list of forces in wind axes [N]

Return type:

List[Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]]

property M_b: List[float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]#

An [x, y, z] list of moments about body axes [Nm]

Return type:

List[Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]]

property M_w: List[float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]#

An [x, y, z] list of moments about wind axes [Nm]

Return type:

List[Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]]

property L: float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray#

The lift force [N]. Definitionally, this is in wind axes.

Return type:

Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]

property Y: float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray#

The side force [N]. Definitionally, this is in wind axes.

Return type:

Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]

property D: float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray#

The drag force [N]. Definitionally, this is in wind axes.

Return type:

Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]

property l_b: float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray#

The rolling moment [Nm] in body axes. Positive is roll-right.

Return type:

Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]

property m_b: float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray#

The pitching moment [Nm] in body axes. Positive is nose-up.

Return type:

Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]

property n_b: float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray#

The yawing moment [Nm] in body axes. Positive is nose-right.

Return type:

Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]

s_ref: float#
c_ref: float#
b_ref: float#
op_point: aerosandbox.performance.OperatingPoint#
F_g: List[float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]#
M_g: List[float | aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]#
span_effective: float#
oswalds_efficiency: float#
__repr__()#

Return repr(self).

default_analysis_specific_options#
__repr__()[source]#

Return repr(self).

run()[source]#

Computes the aerodynamic forces and moments on the airplane.

Returns: a dictionary with keys:

  • ‘F_g’ : an [x, y, z] list of forces in geometry axes [N]

  • ‘F_b’ : an [x, y, z] list of forces in body axes [N]

  • ‘F_w’ : an [x, y, z] list of forces in wind axes [N]

  • ‘M_g’ : an [x, y, z] list of moments about geometry axes [Nm]

  • ‘M_b’ : an [x, y, z] list of moments about body axes [Nm]

  • ‘M_w’ : an [x, y, z] list of moments about wind axes [Nm]

  • ‘L’ : the lift force [N]. Definitionally, this is in wind axes.

  • ‘Y’ : the side force [N]. This is in wind axes.

  • ‘D’ : the drag force [N]. Definitionally, this is in wind axes.

  • ‘l_b’, the rolling moment, in body axes [Nm]. Positive is roll-right.

  • ‘m_b’, the pitching moment, in body axes [Nm]. Positive is pitch-up.

  • ‘n_b’, the yawing moment, in body axes [Nm]. Positive is nose-right.

  • ‘CL’, the lift coefficient [-]. Definitionally, this is in wind axes.

  • ‘CY’, the sideforce coefficient [-]. This is in wind axes.

  • ‘CD’, the drag coefficient [-]. Definitionally, this is in wind axes.

  • ‘Cl’, the rolling coefficient [-], in body axes

  • ‘Cm’, the pitching coefficient [-], in body axes

  • ‘Cn’, the yawing coefficient [-], in body axes

Nondimensional values are nondimensionalized using reference values in the AeroBuildup.airplane object.

Data types:
  • The “L”, “Y”, “D”, “l_b”, “m_b”, “n_b”, “CL”, “CY”, “CD”, “Cl”, “Cm”, and “Cn” keys are:

    • floats if the OperatingPoint object is not vectorized (i.e., if all attributes of OperatingPoint

    are floats, not arrays).

    • arrays if the OperatingPoint object is vectorized (i.e., if any attribute of OperatingPoint is an

    array).

  • The “F_g”, “F_b”, “F_w”, “M_g”, “M_b”, and “M_w” keys are always lists, which will contain either

floats or arrays, again depending on whether the OperatingPoint object is vectorized or not.

Return type:

Dict[str, Union[Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray], List[Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]]]]

run_with_stability_derivatives(alpha=True, beta=True, p=True, q=True, r=True)[source]#

Computes the aerodynamic forces and moments on the airplane, and the stability derivatives.

Arguments essentially determine which stability derivatives are computed. If a stability derivative is not needed, leaving it False will speed up the computation.

Parameters:
  • alpha (-) – If True, compute the stability derivatives with respect to the angle of attack (alpha).

  • beta (-) – If True, compute the stability derivatives with respect to the sideslip angle (beta).

  • p (-) – If True, compute the stability derivatives with respect to the body-axis roll rate (p).

  • q (-) – If True, compute the stability derivatives with respect to the body-axis pitch rate (q).

  • r (-) – If True, compute the stability derivatives with respect to the body-axis yaw rate (r).

Return type:

Dict[str, Union[Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray], List[Union[float, aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities.np.ndarray]]]]

Returns: a dictionary with keys:

  • ‘F_g’ : an [x, y, z] list of forces in geometry axes [N]

  • ‘F_b’ : an [x, y, z] list of forces in body axes [N]

  • ‘F_w’ : an [x, y, z] list of forces in wind axes [N]

  • ‘M_g’ : an [x, y, z] list of moments about geometry axes [Nm]

  • ‘M_b’ : an [x, y, z] list of moments about body axes [Nm]

  • ‘M_w’ : an [x, y, z] list of moments about wind axes [Nm]

  • ‘L’ : the lift force [N]. Definitionally, this is in wind axes.

  • ‘Y’ : the side force [N]. This is in wind axes.

  • ‘D’ : the drag force [N]. Definitionally, this is in wind axes.

  • ‘l_b’ : the rolling moment, in body axes [Nm]. Positive is roll-right.

  • ‘m_b’ : the pitching moment, in body axes [Nm]. Positive is pitch-up.

  • ‘n_b’ : the yawing moment, in body axes [Nm]. Positive is nose-right.

  • ‘CL’ : the lift coefficient [-]. Definitionally, this is in wind axes.

  • ‘CY’ : the sideforce coefficient [-]. This is in wind axes.

  • ‘CD’ : the drag coefficient [-]. Definitionally, this is in wind axes.

  • ‘Cl’ : the rolling coefficient [-], in body axes

  • ‘Cm’ : the pitching coefficient [-], in body axes

  • ‘Cn’ : the yawing coefficient [-], in body axes

Along with additional keys, depending on the value of the alpha, beta, p, q, and r arguments. For example, if alpha=True, then the following additional keys will be present:

  • ‘CLa’ : the lift coefficient derivative with respect to alpha [1/rad]

  • ‘CDa’ : the drag coefficient derivative with respect to alpha [1/rad]

  • ‘CYa’ : the sideforce coefficient derivative with respect to alpha [1/rad]

  • ‘Cla’ : the rolling moment coefficient derivative with respect to alpha [1/rad]

  • ‘Cma’ : the pitching moment coefficient derivative with respect to alpha [1/rad]

  • ‘Cna’ : the yawing moment coefficient derivative with respect to alpha [1/rad]

  • ‘x_np’: the neutral point location in the x direction [m]

Nondimensional values are nondimensionalized using reference values in the AeroBuildup.airplane object.

Data types:
  • The “L”, “Y”, “D”, “l_b”, “m_b”, “n_b”, “CL”, “CY”, “CD”, “Cl”, “Cm”, and “Cn” keys are:

    • floats if the OperatingPoint object is not vectorized (i.e., if all attributes of OperatingPoint

    are floats, not arrays).

    • arrays if the OperatingPoint object is vectorized (i.e., if any attribute of OperatingPoint is an

    array).

  • The “F_g”, “F_b”, “F_w”, “M_g”, “M_b”, and “M_w” keys are always lists, which will contain either

floats or arrays, again depending on whether the OperatingPoint object is vectorized or not.

wing_aerodynamics(wing, include_induced_drag=True)[source]#

Estimates the aerodynamic forces, moments, and derivatives on a wing in isolation.

Moments are given with the reference at Wing [0, 0, 0].

Parameters:
  • wing (aerosandbox.geometry.Wing) – A Wing object that you wish to analyze.

  • op_point – The OperatingPoint that you wish to analyze the fuselage at.

  • include_induced_drag (bool) –

Return type:

AeroComponentResults

Returns:

fuselage_aerodynamics(fuselage, include_induced_drag=True)[source]#

Estimates the aerodynamic forces, moments, and derivatives on a fuselage in isolation.

Assumes:
  • The fuselage is a body of revolution aligned with the x_b axis.

  • The angle between the nose and the freestream is less than 90 degrees.

Moments are given with the reference at Fuselage [0, 0, 0].

Uses methods from Jorgensen, Leland Howard. “Prediction of Static Aerodynamic Characteristics for Slender Bodies Alone and with Lifting Surfaces to Very High Angles of Attack”. NASA TR R-474. 1977.

Parameters:
Return type:

AeroComponentResults

Returns:

class aerosandbox.aerodynamics.AVL(airplane, op_point, xyz_ref=None, avl_command='avl', verbose=False, timeout=5, working_directory=None, ground_effect=False, ground_effect_height=0)[source]#

Bases: aerosandbox.common.ExplicitAnalysis

An interface to AVL, a 3D vortex lattice aerodynamics code developed by Mark Drela at MIT.

Requires AVL to be on your computer; AVL is available here: https://web.mit.edu/drela/Public/web/avl/

It is recommended (but not required) that you add AVL to your system PATH environment variable such that it can be called with the command avl. If this is not the case, you need to specify the path to your AVL executable using the avl_command argument of the constructor.

Usage example:

>>> avl = asb.AVL(
>>>     airplane=my_airplane,
>>>     op_point=asb.OperatingPoint(
>>>         velocity=100, # m/s
>>>         alpha=5, # deg
>>>         beta=4, # deg
>>>         p=0.01, # rad/sec
>>>         q=0.02, # rad/sec
>>>         r=0.03, # rad/sec
>>>     )
>>> )
>>> outputs = avl.run()
Parameters:
default_analysis_specific_options#
AVL_spacing_parameters#
__repr__()[source]#

Return repr(self).

open_interactive()[source]#

Opens a new terminal window and runs AVL interactively. This is useful for detailed analysis or debugging.

Returns: None

Return type:

None

run(run_command=None)[source]#

Private function to run AVL.

Args: run_command: A string with any AVL keystroke inputs that you’d like. By default, you start off within the OPER menu. All of the inputs indicated in the constructor have been set already, but you can override them here ( for this run only) if you want.

Returns: A dictionary containing all of your results.

Parameters:

run_command (str) –

Return type:

Dict[str, float]

_default_keystroke_file_contents()[source]#
Return type:

List[str]

write_avl(filepath=None)[source]#

Writes a .avl file corresponding to this airplane to a filepath.

For use with the AVL vortex-lattice-method aerodynamics analysis tool by Mark Drela at MIT. AVL is available here: https://web.mit.edu/drela/Public/web/avl/

Parameters:

filepath (Union[pathlib.Path, str]) – filepath (including the filename and .avl extension) [string] If None, this function returns the .avl file as a string.

Return type:

None

Returns: None

static write_avl_bfile(fuselage, filepath=None, include_name=True)[source]#

Writes an AVL-compatible BFILE corresponding to this fuselage to a filepath.

For use with the AVL vortex-lattice-method aerodynamics analysis tool by Mark Drela at MIT. AVL is available here: https://web.mit.edu/drela/Public/web/avl/

Parameters:
  • filepath (Union[pathlib.Path, str]) – filepath (including the filename and .avl extension) [string] If None, this function returns the would-be file contents as a string.

  • include_name (bool) – Should the name of the fuselage be included in the .dat file? (This should be True for use with AVL.)

Return type:

str

Returns:

static parse_unformatted_data_output(s, data_identifier=' = ', cast_outputs_to_float=True, overwrite=None)[source]#

Parses a (multiline) string of unformatted data into a nice and tidy dictionary.

The expected input string looks like what you might get as an output from AVL (or many other Drela codes), which may list data in ragged order.

An example input s that you might want to parse could look like the following:

```

Standard axis orientation, X fwd, Z down

Run case: -unnamed-

Alpha = 0.43348 pb/2V = -0.00000 p’b/2V = -0.00000 Beta = 0.00000 qc/2V = 0.00000 Mach = 0.003 rb/2V = -0.00000 r’b/2V = -0.00000

CXtot = -0.02147 Cltot = 0.00000 Cl’tot = 0.00000 CYtot = 0.00000 Cmtot = 0.28149 CZtot = -1.01474 Cntot = -0.00000 Cn’tot = -0.00000

CLtot = 1.01454 CDtot = 0.02915 CDvis = 0.00000 CDind = 0.0291513 CLff = 1.00050 CDff = 0.0297201 | Trefftz CYff = 0.00000 e = 0.9649 | Plane

```

Here, this function will go through this string and extract each key-value pair, as denoted by the data identifier (by default, “ = “). It will pull the next whole word without spaces to the left as the key, and it will pull the next whole word without spaces to the right as the value. Together, these will be returned as a Dict.

So, the output for the input above would be: {

‘Alpha’ : 0.43348, ‘pb/2V’ : -0.00000, ‘p’b/2V’ : -0.00000, ‘Beta’ : 0.00000, # and so on…

}

Parameters:
  • s (str) – The input string to identify. Can be multiline.

  • data_identifier (str) – The triggering substring for a new key-value pair. By default, it’s “ = “,

  • this (which is convention in many output files from Mark Drela's codes. Be careful if you decide to change) –

  • "=" (to) –

  • separators (as you could pick up on heading) –

  • cast_outputs_to_float (bool) – If this boolean flag is set true, the values of the key-value pairs are cast to

  • returning (floating-point numbers before) –

  • cast

  • downstream (a NaN is returned (guaranteeing that you can do floating-point math with the outputs in) –

  • applications.)

  • overwrite (bool) –

    Determines the behavior if you find a key that’s already in the dictionary.

    • By default, value is None. In this case, an error is raised.

    • If you set it to True, the new value will overwrite the old one. Thus, your dictionary will have

    the last matching value from the string.

    • If you set it to False, the new value will be discarded. Thus, your dictionary will have the first

    matching value from the string.

Return type:

Dict[str, float]

Returns: A dictionary of key-value pairs, corresponding to the unformatted data in the input string.

Keys are strings, values are floats if cast_outputs_to_float is True, otherwise also strings.