pterasoftware.Airfoil

class pterasoftware.Airfoil(
*,
name: str = 'NACA0012',
outline_A_Lp: np.ndarray | Sequence[Sequence[float | int]] | None = None,
resample: bool | np.bool = True,
n_points_per_side: int = 400,
)

A class used to contain the airfoil of a WingCrossSection.

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 in 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 recommend 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

diagram(
*,
show_mcl: bool | np.bool = True,
math_labels: bool | np.bool = False,
save: bool | np.bool = False,
path: str | Path = 'diagram.webp',
quality: int | float = 75.0,
) → None

Displays a diagram of this Airfoil's outline and mean camber line (MCL), along with its axes.

The diagram is drawn in airfoil axes, relative to the leading point, and viewed along the negative z direction with parallel projection, so the Airfoil appears with its leading point on the left and its upper line on top. It shows the airfoil axes at the leading point. The points are normalized by the chord and are unitless.

A label can be edited by double-clicking it in the diagram's window. Its raw text is then shown in a monospaced font with a caret, which the left and right arrow keys move. Enter keeps the new text, Escape restores the old text, and entering empty text deletes the label. Text between pairs of dollar signs is written as math in Matplotlib's mathtext syntax, and the label is shown in red while that math isn't valid.

Parameters:
  • show_mcl -- Determines whether to draw the MCL. Can be a bool or a numpy bool and will be converted internally to a bool. The default is True.

  • math_labels -- Determines whether to write the axes and point labels as math, set in the STIX font. Each basis direction arrow is then labeled with a unit vector whose superscript lists its axes' abbreviations, and each point with its name in capitals, whose subscript lists what it belongs to, if anything. If False, each label is the plain ID, set in a monospaced font. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.

  • save -- Determines whether to save the diagram as a WebP with a white background once its window is closed, which keeps the view's orientation and any labels dragged by hand. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.

  • path -- The file path to save the diagram to. It can be a str or a Path, must end with ".webp", and its directory must already exist. It has no effect if save is False. The default is "diagram.webp".

  • quality -- The quality of the saved WebP, where 0.0 is the smallest file with the most compression artifacts and 100.0 is the largest file with the fewest. It can be an int or a float and will be converted internally to a float. It has no effect if save is False. The default is 75.0.

Returns:

None