pterasoftware.geometry.airfoil

Contains the Airfoil class.

Classes

Airfoil

A class used to contain the Airfoil of a WingCrossSection.

Module Contents

class pterasoftware.geometry.airfoil.Airfoil(name: str = 'NACA0012', outline_A_lp: numpy.ndarray | collections.abc.Sequence[collections.abc.Sequence[float | int]] | None = None, resample: bool | numpy.bool_ = True, n_points_per_side: int = 400, _trust: object | None = None)[source]

A class used to contain the Airfoil of a WingCrossSection.

Contains the following methods:

__deepcopy__: Returns an independent deep copy of this Airfoil.

add_control_surface: Returns a version of the Airfoil with a control surface added at a given point.

draw: Plots this Airfoil’s outlines and mean camber line (MCL) using PyPlot.

get_plottable_data: Returns plottable data for this Airfoil’s outline and mean camber line.

get_resampled_mcl: Returns a ndarray of points along the mean camber line (MCL), resampled from the mcl_A_outline attribute. It is used to discretize the MCL for meshing.

Citation:

Adapted from: geometry.Airfoil in AeroSandbox

Author: Peter Sharpe

Date of retrieval: 04/27/2020

Parameters:
  • name – The name of the Airfoil. It should correspond to the name of a file the airfoils directory, or to a valid NACA 4 series airfoil (once converted to lower-case and stripped of leading and trailing whitespace) unless you are passing in your own array of points using outline_A_lp. Note that NACA0000 isn’t a valid NACA 4 series airfoil, NACA 4 series airfoils with thickness above 30% are not supported, the first two digits must either both be zero (symmetric) or both be non zero (cambered), and for cambered airfoils the position of maximum camber must be greater than or equal to the maximum camber plus half the maximum thickness. The default is “NACA0012”.

  • outline_A_lp – An array like object of numbers (int or float) with shape (N,2) representing the 2D points making up the Airfoil’s outline. If you wish to load coordinates from the airfoils directory, leave this as None, which is the default. Can be a tuple, list, or ndarray. Values are converted to floats internally. The outline is automatically normalized to canonical form (leading point at origin, chord on x axis, unit chord length), so position and scale do not need to match this. Minor rotation offsets (less than 15 degrees, such as implicit angle of attack in airfoil data) are also corrected; larger rotations will raise a ValueError. The topology must be correct: points must be ordered from upper trailing point to leading point to lower trailing point. Also, after correcting for rotation, the upper portion’s x values must be non increasing, the lower portion’s x values must be non decreasing. Finally, both portions must have at least 3 unique points, and the outline must not self intersect (upper y must be strictly greater than lower y at all interior x positions). Open and blunt trailing edges are supported. The default value is None.

  • resample – Determines whether to resample the points defining the Airfoil’s outline. This applies to points passed in by the user or to those from the airfoils directory. I highly recommended setting this to True. Can be a bool or a numpy bool and will be converted internally to a bool. The default is True.

  • n_points_per_side – The number of points to use when creating the Airfoil’s MCL and when resampling the upper and lower parts of the Airfoil’s outline. It must be a positive int greater than or equal to 3. The resampled outline will have a total number of points equal to (2 * n_points_per_side) - 1. I highly recommend setting this to at least 100. The default value is 400.

Returns:

None

add_control_surface(deflection: float | int, hinge_point: float | int) Airfoil[source]

Returns a version of the Airfoil with a control surface added at a given point. It is called during meshing.

Parameters:
  • deflection – The control deflection in degrees. Deflection downwards is positive. It must be a number (int or float) in the range [-5.0, 5.0] degrees. Values are converted to floats internally.

  • hinge_point – The location of the hinge as a fraction of chord length. It must be a number (int or float) in the range (0.0, 1.0). Values are converted to floats internally.

Returns:

The new Airfoil with the control surface added.

draw() None[source]

Plots this Airfoil’s outlines and mean camber line (MCL) using PyPlot.

Returns:

None

get_plottable_data(show: bool | numpy.bool_ = False) list[numpy.ndarray] | None[source]

Returns plottable data for this Airfoil’s outline and mean camber line.

Parameters:

show – Determines whether to display the plot. Can be a bool or a numpy bool, and will be converted internally to a bool. If True, the method displays the plot and returns None. If False, the method returns the data without displaying. The default is False.

Returns:

A list of two ndarrays containing the outline and MCL data, or None if show is True.

get_resampled_mcl(mcl_fractions: numpy.ndarray | collections.abc.Sequence[float]) numpy.ndarray[source]

Returns a ndarray of points along the mean camber line (MCL), resampled from the mcl_A_outline attribute. It is used to discretize the MCL for meshing.

Parameters:

mcl_fractions – A (N,) array like object of floats representing normalized distances along the MCL (from the leading to the trailing edge) at which to return the resampled MCL points. Can be a tuple, list, or ndarray. The first value must be 0.0, the last must be 1.0, and the remaining must be in the range [0.0, 1.0]. All values must be non duplicated and in ascending order.

Returns:

A (N,2) ndarray of floats that contains the positions of the resampled MCL points (in airfoil axes, relative to the leading point).