aerosandbox.geometry.airfoil.airfoil_families#

Module Contents#

Functions#

get_NACA_coordinates([name, n_points_per_side, ...])

Returns the coordinates of a 4-series NACA airfoil.

get_kulfan_coordinates([lower_weights, upper_weights, ...])

Given a set of Kulfan parameters, computes the coordinates of the resulting airfoil.

get_kulfan_parameters(coordinates[, ...])

Given a set of airfoil coordinates, reconstructs the Kulfan parameters that would recreate that airfoil. Uses a

get_coordinates_from_raw_dat(raw_text)

Returns a Nx2 ndarray of airfoil coordinates from the raw text of a airfoil *.dat file.

get_file_coordinates(filepath)

get_UIUC_coordinates([name])

Returns the coordinates of a specified airfoil in the UIUC airfoil database.

Attributes#

aerosandbox.geometry.airfoil.airfoil_families._default_n_points_per_side = 200[source]#
aerosandbox.geometry.airfoil.airfoil_families.get_NACA_coordinates(name=None, n_points_per_side=_default_n_points_per_side, max_camber=None, camber_loc=None, thickness=None)[source]#

Returns the coordinates of a 4-series NACA airfoil.

Can EITHER specify name, or all three of max_camber, camber_loc, and thickness - not both.

Parameters:
  • Either

    • name: Name of the NACA airfoil, as a string (e.g., “naca2412”)

  • Or

    • All three of:

      max_camber: Maximum camber of the airfoil, as a fraction of chord (e.g., 0.02)

      camber_loc: The location of maximum camber, as a fraction of chord (e.g., 0.40)

      thickness: The maximum thickness of the airfoil, as a fraction of chord (e.g., 0.12)

  • n_points_per_side (int) – Number of points per side of the airfoil (top/bottom).

  • name (str) –

  • max_camber (float) –

  • camber_loc (float) –

  • thickness (float) –

Return type:

aerosandbox.numpy.ndarray

Returns: The coordinates of the airfoil as a Nx2 ndarray [x, y]

aerosandbox.geometry.airfoil.airfoil_families.get_kulfan_coordinates(lower_weights=-0.2 * np.ones(8), upper_weights=0.2 * np.ones(8), leading_edge_weight=0.0, TE_thickness=0.0, n_points_per_side=_default_n_points_per_side, N1=0.5, N2=1.0, **deprecated_kwargs)[source]#

Given a set of Kulfan parameters, computes the coordinates of the resulting airfoil.

This function is the inverse of get_kulfan_parameters().

Kulfan parameters are a highly-efficient and flexible way to parameterize the shape of an airfoil. The particular flavor of Kulfan parameterization used in AeroSandbox is the “CST with LEM” method, which is described in various papers linked below. In total, the Kulfan parameterization consists of:

  • A vector of weights corresponding to the lower surface of the airfoil

  • A vector of weights corresponding to the upper surface of the airfoil

  • A scalar weight corresponding to the strength of a leading-edge camber mode shape of the airfoil (optional)

  • The trailing-edge (TE) thickness of the airfoil (optional)

These Kulfan parameters are also referred to as CST (Class/Shape Transformation) parameters.

References on Kulfan (CST) airfoils:

Notes on N1, N2 (shape factor) combinations:
  • 0.5, 1: Conventional airfoil

  • 0.5, 0.5: Elliptic airfoil

  • 1, 1: Biconvex airfoil

  • 0.75, 0.75: Sears-Haack body (radius distribution)

  • 0.75, 0.25: Low-drag projectile

  • 1, 0.001: Cone or wedge airfoil

  • 0.001, 0.001: Rectangle, circular duct, or circular rod.

To make a Kulfan (CST) airfoil, use the following syntax:

>>> import aerosandbox as asb
>>> asb.Airfoil("My Airfoil Name", coordinates=asb.get_kulfan_coordinates(*args))
Parameters:
  • lower_weights (iterable) – The Kulfan weights to use for the lower surface.

  • upper_weights (iterable) – The Kulfan weights to use for the upper surface.

  • TE_thickness (float) – The trailing-edge thickness to add, in terms of y/c.

  • n_points_per_side (int) – The number of points to discretize with, when generating the coordinates.

  • N1 (float) – The shape factor corresponding to the leading edge of the airfoil. See above for examples.

  • N2 (float) – The shape factor corresponding to the trailing edge of the airfoil. See above for examples.

  • leading_edge_weight (float) –

Returns:

The coordinates of the airfoil as a Nx2 array.

Return type:

np.ndarray

aerosandbox.geometry.airfoil.airfoil_families.get_kulfan_parameters(coordinates, n_weights_per_side=8, N1=0.5, N2=1.0, n_points_per_side=_default_n_points_per_side, normalize_coordinates=True, use_leading_edge_modification=True, method='least_squares')[source]#

Given a set of airfoil coordinates, reconstructs the Kulfan parameters that would recreate that airfoil. Uses a curve fitting (optimization) process.

This function is the inverse of get_kulfan_coordinates().

Kulfan parameters are a highly-efficient and flexible way to parameterize the shape of an airfoil. The particular flavor of Kulfan parameterization used in AeroSandbox is the “CST with LEM” method, which is described in various papers linked below. In total, the Kulfan parameterization consists of:

  • A vector of weights corresponding to the lower surface of the airfoil

  • A vector of weights corresponding to the upper surface of the airfoil

  • A scalar weight corresponding to the strength of a leading-edge camber mode shape of the airfoil (optional)

  • The trailing-edge (TE) thickness of the airfoil (optional)

These Kulfan parameters are also referred to as CST (Class/Shape Transformation) parameters.

References on Kulfan (CST) airfoils:

Notes on N1, N2 (shape factor) combinations:
  • 0.5, 1: Conventional airfoil

  • 0.5, 0.5: Elliptic airfoil

  • 1, 1: Biconvex airfoil

  • 0.75, 0.75: Sears-Haack body (radius distribution)

  • 0.75, 0.25: Low-drag projectile

  • 1, 0.001: Cone or wedge airfoil

  • 0.001, 0.001: Rectangle, circular duct, or circular rod.

The following demonstrates the reversibility of this function:

>>> import aerosandbox as asb
>>> from aerosandbox.geometry.airfoil.airfoil_families import get_kulfan_parameters
>>>
>>> af = asb.Airfoil("dae11")  # A conventional airfoil
>>> params = get_kulfan_parameters(
>>>     coordinates=af.coordinates,
>>> )
>>> af_reconstructed = asb.Airfoil(
>>>     name="Reconstructed Airfoil",
>>>     coordinates=get_kulfan_coordinates(
>>>         **params
>>>     )
Parameters:
  • coordinates (np.ndarray) – The coordinates of the airfoil as a Nx2 array.

  • n_weights_per_side (int) – The number of Kulfan weights to use per side of the airfoil.

  • N1 (float) – The shape factor corresponding to the leading edge of the airfoil. See above for examples.

  • N2 (float) – The shape factor corresponding to the trailing edge of the airfoil. See above for examples.

  • n_points_per_side (int) – The number of points to discretize with, when formulating the curve-fitting optimization problem.

  • normalize_coordinates (bool) –

  • use_leading_edge_modification (bool) –

  • method (str) –

Returns:

  • “lower_weights” (np.ndarray): The weights corresponding to the lower surface of the airfoil.
    • ”upper_weights” (np.ndarray): The weights corresponding to the upper surface of the airfoil.

    • ”TE_thickness” (float): The trailing-edge thickness of the airfoil.

    • ”leading_edge_weight” (float): The strength of the leading-edge camber mode shape of the airfoil.

These can be passed directly into get_kulfan_coordinates() to reconstruct the airfoil.

Return type:

A dictionary containing the Kulfan parameters. The keys are

aerosandbox.geometry.airfoil.airfoil_families.get_coordinates_from_raw_dat(raw_text)[source]#

Returns a Nx2 ndarray of airfoil coordinates from the raw text of a airfoil *.dat file.

Parameters:

raw_text (List[str]) – A list of strings, where each string is one line of the *.dat file. One good way to get this input is to read the file via the with open(file, “r”) as file:, file.readlines() interface.

Return type:

aerosandbox.numpy.ndarray

Returns: A Nx2 ndarray of airfoil coordinates [x, y].

aerosandbox.geometry.airfoil.airfoil_families.get_file_coordinates(filepath)[source]#
Parameters:

filepath (Union[str, os.PathLike]) –

aerosandbox.geometry.airfoil.airfoil_families.get_UIUC_coordinates(name='dae11')[source]#

Returns the coordinates of a specified airfoil in the UIUC airfoil database. :param name: Name of the airfoil to retrieve from the UIUC database.

Returns: The coordinates of the airfoil as a Nx2 ndarray [x, y]

Parameters:

name (str) –

Return type:

aerosandbox.numpy.ndarray

aerosandbox.geometry.airfoil.airfoil_families.af[source]#