buffalo_wings.airfoil.Airfoil

class buffalo_wings.airfoil.Airfoil[source]

Bases: Curve

Base class for airfoil specific geometries.

The airfoil coordinates and their derivatives can be queried using two parameterizations. The standard parameterization uses [-1, 0] for the lower surface, running from trailing edge to leading edge, and [0, 1] for the upper surface, running from leading edge to trailing edge. This provides a smooth parameterization across the full airfoil and matches how many analytic airfoil descriptions are written. The arc-length parameterization uses surface distance measured from the lower trailing edge to the upper trailing edge. Arc-length queries are more expensive because the mapping from surface distance to the native airfoil parameter is not available in closed form for general airfoil shapes.

__init__()[source]

Initialize the cached airfoil arc-length state.

Notes

Subclasses should call this initializer so cached geometric values remain synchronized with the current airfoil shape.

Return type:

None

Methods

__init__()

Initialize the cached airfoil arc-length state.

arc_length(t_s, t_e)

Calculate the arc-length distance between two points on surface.

chord()

Return the chord length of the airfoil.

d2ydx2(t)

Calculate the second derivative at parameter location.

dydx(t)

Calculate the slope at parameter location.

joints()

Return the locations of any joints/discontinuities in the curve.

k(t)

Calculate the curvature at parameter location.

leading_edge()

Return the location of the leading edge.

normal(t)

Calculate the unit normal at parameter location.

t_from_s(s)

Calculate the parametric value for arc-length provided.

t_from_x(x, upper)

Calculate the parametric value for x-location provided.

tangent(t)

Calculate the unit tangent at parameter location.

to_spec()

Return the schema definition needed to recreate this airfoil.

trailing_edge()

Return the location of the trailing edge.

xy(t)

Calculate the coordinates of geometry at parameter location.

xy_from_s(s)

Calculate the coordinates of geometry at arc-length location.

xy_s(s)

Calculate rates of change of the coordinates at arc-length location.

xy_ss(s)

Calculate second derivative of the coordinates at arc-length location.

xy_t(t)

Calculate rates of change of the coordinates at parameter location.

xy_tt(t)

Calculate second derivative of the coordinates at parameter location.

Attributes

spec

Return the schema definition used to create this airfoil.

surface_length

Return the full airfoil surface length.

property spec: AirfoilDefinitionSpec

Return the schema definition used to create this airfoil.

Returns:

Serialized airfoil definition that can recreate this runtime object.

Return type:

AirfoilDefinitionSpec

Raises:

NotImplementedError – If the concrete airfoil type does not preserve its source spec.

to_spec()[source]

Return the schema definition needed to recreate this airfoil.

Returns:

Serialized airfoil definition that can recreate this runtime object.

Return type:

AirfoilDefinitionSpec

property surface_length: float | floating[Any]

Return the full airfoil surface length.

Returns:

Arc length measured from the lower trailing edge to the upper trailing edge.

Return type:

float

t_from_x(x, upper)[source]

Calculate the parametric value for x-location provided.

Parameters:
Returns:

Parameteric value for location provided.

Return type:

numpy.ndarray

Raises:

ValueError – If there is no surface point at the given x-location.

t_from_s(s)[source]

Calculate the parametric value for arc-length provided.

Parameters:

s (numpy.ndarray) – Arc-length location of point.

Raises:

ValueError – When arc-length provided is larger than airfoil surface length.

Returns:

Parametric value for location provided.

Return type:

numpy.ndarray

dydx(t)[source]

Calculate the slope at parameter location.

Parameters:

t (numpy.ndarray) – Parameter for desired locations.

Returns:

Slope of surface at point.

Return type:

numpy.ndarray

Raises:

ValueError – If there is no surface point at the given x-location.

d2ydx2(t)[source]

Calculate the second derivative at parameter location.

Parameters:

t (numpy.ndarray) – Parameter for desired locations.

Returns:

Second derivative of surface at point.

Return type:

numpy.ndarray

Raises:

ValueError – If there is no surface point at the given x-location.

xy_from_s(s)[source]

Calculate the coordinates of geometry at arc-length location.

Parameters:

s (numpy.ndarray) – Arc-length location for point.

Returns:

  • numpy.ndarray – X-coordinate of point.

  • numpy.ndarray – Y-coordinate of point.

Return type:

tuple[ndarray[tuple[int, …], dtype[float64]], ndarray[tuple[int, …], dtype[float64]]]

xy_s(s)[source]

Calculate rates of change of the coordinates at arc-length location.

Parameters:

s (numpy.ndarray) – Arc-length location for point.

Returns:

  • numpy.ndarray – Arc-length rate of change of the x-coordinate of point.

  • numpy.ndarray – Arc-length rate of change of the y-coordinate of point.

Return type:

tuple[ndarray[tuple[int, …], dtype[float64]], ndarray[tuple[int, …], dtype[float64]]]

xy_ss(s)[source]

Calculate second derivative of the coordinates at arc-length location.

Parameters:

s (numpy.ndarray) – Arc-length location for point.

Returns:

  • numpy.ndarray – Arc-length second derivative of the x-coordinate of point.

  • numpy.ndarray – Arc-length second derivative of the y-coordinate of point.

Return type:

tuple[ndarray[tuple[int, …], dtype[float64]], ndarray[tuple[int, …], dtype[float64]]]

chord()[source]

Return the chord length of the airfoil.

Returns:

Chord length.

Return type:

float

leading_edge()[source]

Return the location of the leading edge.

Returns:

  • float – X-coordinate of leading edge.

  • float – Y-coordinate of leading edge.

Return type:

tuple[float | floating[Any], float | floating[Any]]

trailing_edge()[source]

Return the location of the trailing edge.

Notes

Since some airfoil descriptions have gap between the upper and lower surface at the trailing edge (such as NACA 4-digit and 5-digit airfoils), the point returned is the average of the two trailing edge points. If the specific location of the upper or the lower surface of the trailing edge is desired, use xy() passing in either -1 (lower) or +1 (upper).

Returns:

  • float – X-coordinate of trailing edge.

  • float – Y-coordinate of trailing edge.

Return type:

tuple[float | floating[Any], float | floating[Any]]

arc_length(t_s, t_e)

Calculate the arc-length distance between two points on surface.

Parameters:
  • t_s (float) – Start point of distance calculation.

  • t_e (numpy.ndarray) – End point of distance calculation.

Returns:

Distance from start point to end point.

Return type:

numpy.ndarray

abstractmethod joints()

Return the locations of any joints/discontinuities in the curve.

The resulting list needs to contain any parametric locations where some non-standard discontinuity (slope, curvature, etc.) occurs as well as the end points for the curve (if they exist).

Returns:

Parametric coordinates of any discontinuities.

Return type:

List[float]

k(t)

Calculate the curvature at parameter location.

Parameters:

t (numpy.ndarray) – Parameter for desired locations.

Returns:

Curvature of surface at point.

Return type:

numpy.ndarray

normal(t)

Calculate the unit normal at parameter location.

Parameters:

t (numpy.ndarray) – Parameter for desired locations.

Returns:

Unit normal at point.

Return type:

numpy.ndarray, numpy.ndarray

tangent(t)

Calculate the unit tangent at parameter location.

Parameters:

t (numpy.ndarray) – Parameter for desired locations.

Returns:

Unit tangent at point.

Return type:

numpy.ndarray, numpy.ndarray

abstractmethod xy(t)

Calculate the coordinates of geometry at parameter location.

Parameters:

t (numpy.ndarray) – Parameter for desired locations.

Returns:

  • numpy.ndarray – X-coordinate of point.

  • numpy.ndarray – Y-coordinate of point.

Return type:

tuple[ndarray[tuple[int, …], dtype[float64]], ndarray[tuple[int, …], dtype[float64]]]

abstractmethod xy_t(t)

Calculate rates of change of the coordinates at parameter location.

Parameters:

t (numpy.ndarray) – Parameter for desired locations.

Returns:

  • numpy.ndarray – Parametric rate of change of the x-coordinate of point.

  • numpy.ndarray – Parametric rate of change of the y-coordinate of point.

Return type:

tuple[ndarray[tuple[int, …], dtype[float64]], ndarray[tuple[int, …], dtype[float64]]]

abstractmethod xy_tt(t)

Calculate second derivative of the coordinates at parameter location.

Parameters:

t (numpy.ndarray) – Parameter for desired locations.

Returns:

  • numpy.ndarray – Parametric second derivative of the x-coordinate of point.

  • numpy.ndarray – Parametric second derivative of the y-coordinate of point.

Return type:

tuple[ndarray[tuple[int, …], dtype[float64]], ndarray[tuple[int, …], dtype[float64]]]