buffalo_wings.airfoil.Airfoil

class buffalo_wings.airfoil.Airfoil[source]

Bases: Curve

Base class for airfoil specific geometries.

Airfoils are represented in a normalized local section frame with the leading edge at (0, 0) and the nominal trailing-edge midpoint at (1, 0). Concrete airfoil families are expected to follow this unit-chord convention. Note that some airfoils might have points that are before the leading edge point because of their definition.

The airfoil coordinates and their derivatives can be queried using a parameterization, u, that 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 is called the curve parameter, and it provides a smooth parameterization across the full airfoil. Coordinates can also be queried using the Curve arc-length parameterization interface, s. The final way that coordinates can be queried is through a chord-like parameterization for the upper and lower surfaces, xi. For this both surfaces leading to trailing edges are mapped to [0, 1].

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 curve parameter is not available in closed form for general airfoil shapes.

Airfoils inherit the Curve breakpoint contract. The ordinary derivative evaluators return the minus-side value when a query lands exactly on a reported breakpoint, while the paired *_breakpoint methods expose both one-sided values explicitly.

Methods

arc_length(u_s, u_e)

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

arc_length_breakpoints()

Return the breakpoint locations in arc-length coordinates.

breakpoint_parameter_limits(*, index)

Return parameter limits for one breakpoint.

breakpoints()

Return the sorted locations of any breakpoints in the curve.

camber_curve(*[, num_points, spacing])

Return a camber-curve representation for this airfoil.

chord()

Return the airfoil chord length.

curvature_from_xi(xi, *, surface)

Return one-surface curvature values at surface-local xi locations.

d2ydx2(u)

Return the second surface derivative at curve parameter locations.

dydx(u)

Return the surface slope at curve parameter locations.

k(u)

Calculate the curvature at parameter location.

leading_edge()

Return the leading-edge location.

normal(u)

Calculate the unit normal at parameter location.

slope_from_xi(xi, *, surface)

Return one-surface slope values at surface-local xi locations.

tangent(u)

Calculate the unit tangent at parameter location.

to_spec()

Return the schema definition needed to recreate this airfoil.

trailing_edge()

Return the midpoint of the trailing-edge points.

u_from_s(s)

Return curve parameters that correspond to arc length.

u_from_x(x, *, surface)

Return curve parameters that correspond to x.

u_from_xi(xi, *, surface)

Convert one-surface xi coordinates to curve parameters.

xi_from_u(u)

Convert curve airfoil parameters to surface-local xi values.

xy_from_s(s)

Return curve coordinates at arc-length locations.

xy_from_u(u)

Calculate the coordinates of geometry at parameter location.

xy_from_xi(xi, *, surface)

Return one-surface coordinates at surface-local xi locations.

xy_s(s)

Calculate first derivatives at arc-length location.

xy_s_breakpoint(*, index)

Return both sides of first derivatives at a breakpoint.

xy_ss(s)

Calculate second derivatives at arc-length location.

xy_ss_breakpoint(*, index)

Return one-sided second derivatives at a breakpoint.

xy_u(u)

Calculate rates of change of the coordinates at parameter location.

xy_u_breakpoint(*, index)

Return both sides of first derivatives at one breakpoint.

xy_uu(u)

Calculate second derivative of the coordinates at parameter location.

xy_uu_breakpoint(*, index)

Return one-sided second derivatives at one breakpoint.

Attributes

length

Return the full airfoil surface length.

spec

Return the schema definition used to create this airfoil.

property spec: Naca4AirfoilSpec | Naca4ModifiedAirfoilSpec | Naca5AirfoilSpec | Naca5ModifiedAirfoilSpec | Naca16AirfoilSpec | FlatPlateAirfoilSpec | BiconvexAirfoilSpec | BiconvexParabolaAirfoilSpec | PolygonAirfoilSpec | EllipseAirfoilSpec | CircularArcAirfoilSpec | JoukowskiAirfoilSpec | Naca6AirfoilSpec | Naca6AAirfoilSpec | FileAirfoilSpec | PointsAirfoilSpec | SplineAirfoilSpec | CstAirfoilSpec | ParsecAirfoilSpec

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.

Notes

For schema-backed runtime families that participate in the current round-trip contract, this property preserves the original supported schema form exactly rather than normalizing it to a merely equivalent definition. Placeholder or not-yet-constructable families may still raise NotImplementedError until their schema contract is defined.

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

Notes

For runtime families covered by the current schema round-trip contract, this returns the same schema content as spec.

property length: buffalo_core.typing.FloatScalar

Return the full airfoil surface length.

Returns:

Total airfoil surface length measured from the lower trailing edge to the upper trailing edge.

Return type:

buffalo_core.typing.FloatScalar

chord()[source]

Return the airfoil chord length.

Returns:

Distance between the leading-edge reference and trailing-edge midpoint reference.

Return type:

buffalo_core.typing.FloatScalar

leading_edge()[source]

Return the leading-edge location.

Returns:

(x, y) location of the leading-edge reference point.

Return type:

tuple[FloatScalar, FloatScalar]

trailing_edge()[source]

Return the midpoint of the trailing-edge points.

Returns:

(x, y) location of the trailing-edge midpoint reference.

Return type:

tuple[FloatScalar, FloatScalar]

camber_curve(*, num_points=81, spacing='cosine')[source]

Return a camber-curve representation for this airfoil.

Parameters:
  • num_points (int, default 81) – Number of shared surface samples to use when an approximate camber line must be derived from the airfoil geometry.

  • spacing ({"uniform", "cosine"}, default "cosine") – Spacing rule used for the shared surface-local sample locations in the approximate extraction path.

Returns:

Exact or approximate camber-curve result for this airfoil.

Return type:

AirfoilCamberResult

Raises:

ValueError – If num_points or spacing is invalid for the approximate extraction path.

dydx(u)[source]

Return the surface slope at curve parameter locations.

Parameters:

u (buffalo_core.typing.FloatInput) – Airfoil parameters.

Returns:

Surface slope values dy/dx evaluated at u.

Return type:

buffalo_core.typing.FloatArray

d2ydx2(u)[source]

Return the second surface derivative at curve parameter locations.

Parameters:

u (buffalo_core.typing.FloatInput) – Airfoil parameters.

Returns:

Second derivative values d^2y/dx^2 evaluated at u.

Return type:

buffalo_core.typing.FloatArray

abstractmethod u_from_xi(xi, *, surface)[source]

Convert one-surface xi coordinates to curve parameters.

Parameters:
  • xi (buffalo_core.typing.FloatInput) – Surface-local coordinates in [0, 1] measured from the leading edge to the trailing edge.

  • surface ({"lower", "upper"}) – Surface to evaluate.

Returns:

Curve parameters matching xi on the selected surface.

Return type:

buffalo_core.typing.FloatArray

Notes

Concrete airfoil families define this mapping because the surface coordinate xi is airfoil-specific and need not be a sign-only transformation of the curve parameter u.

abstractmethod xi_from_u(u)[source]

Convert curve airfoil parameters to surface-local xi values.

Parameters:

u (buffalo_core.typing.FloatInput) – Curve airfoil parameters in [-1, 1].

Returns:

Surface-local xi values and upper-surface membership flags.

Return type:

SurfaceMappedValues

Notes

Concrete airfoil families define this mapping because xi need not equal |u| for every airfoil parameterization.

xy_from_xi(xi, *, surface)[source]

Return one-surface coordinates at surface-local xi locations.

Parameters:
  • xi (buffalo_core.typing.FloatInput) – Surface-local coordinates in [0, 1] measured from the leading edge to the trailing edge.

  • surface ({"lower", "upper"}) – Surface to evaluate.

Returns:

Tuple (x, y) of float64 arrays matching the normalized shape of xi.

Return type:

tuple[FloatArray, FloatArray]

slope_from_xi(xi, *, surface)[source]

Return one-surface slope values at surface-local xi locations.

Parameters:
  • xi (buffalo_core.typing.FloatInput) – Surface-local coordinates in [0, 1] measured from the leading edge to the trailing edge.

  • surface ({"lower", "upper"}) – Surface to evaluate.

Returns:

Surface slope values dy/dx on the selected surface.

Return type:

buffalo_core.typing.FloatArray

curvature_from_xi(xi, *, surface)[source]

Return one-surface curvature values at surface-local xi locations.

Parameters:
  • xi (buffalo_core.typing.FloatInput) – Surface-local coordinates in [0, 1] measured from the leading edge to the trailing edge.

  • surface ({"lower", "upper"}) – Surface to evaluate.

Returns:

Surface-oriented curvature values on the selected surface.

Return type:

buffalo_core.typing.FloatArray

u_from_x(x, *, surface)[source]

Return curve parameters that correspond to x.

Parameters:
  • x (buffalo_core.typing.FloatInput) – Chordwise coordinates in the normalized airfoil frame.

  • surface ({"lower", "upper"}) – Surface to solve on.

Returns:

Curve parameters on the requested surface.

Return type:

buffalo_core.typing.FloatArray

Raises:

ValueError – If any requested chordwise coordinate lies outside the reachable x-range of the selected surface.

u_from_s(s)[source]

Return curve parameters that correspond to arc length.

Parameters:

s (buffalo_core.typing.FloatInput) – Arc lengths measured from the lower trailing edge.

Returns:

Curve parameters corresponding to s.

Return type:

buffalo_core.typing.FloatArray

Raises:

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

arc_length(u_s, u_e)

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

Parameters:
  • u_s (buffalo_core.typing.FloatScalar) – Start point of distance calculation.

  • u_e (buffalo_core.typing.FloatInput) – End point of distance calculation.

Returns:

Distance from start point to end point.

Return type:

buffalo_core.typing.FloatArray

arc_length_breakpoints()

Return the breakpoint locations in arc-length coordinates.

Returns:

Arc-length coordinates measured from the minimum native parameter.

Return type:

list[FloatScalar]

Notes

These values include the two curve endpoints as boundary markers. Interior breakpoints correspond to the native-parameter interior breakpoints returned by breakpoints().

breakpoint_parameter_limits(*, index)

Return parameter limits for one breakpoint.

Notes

Endpoint breakpoints return the exact boundary parameter. Interior breakpoints return nearby one-sided parameters chosen within the neighboring breakpoint interval for the current generic breakpoint-side implementation. These limits exist to support the sampled fallback in the generic *_breakpoint methods and should not be treated as the primary source of truth when a subclass can provide exact one-sided values directly.

Return type:

tuple[TypeAliasForwardRef(‘buffalo_core.typing.FloatScalar’), TypeAliasForwardRef(‘buffalo_core.typing.FloatScalar’)]

abstractmethod breakpoints()

Return the sorted locations of any breakpoints in the curve.

The resulting list must be in ascending parameter order and contain any parametric locations where one-sided derivative information may be needed, such as slope, curvature, or higher-derivative changes, as well as the end points for the curve (if they exist). Endpoints are included as boundary markers even though they are only one-sided breakpoints. Interior breakpoints are the locations where two-sided derivative information may differ.

Returns:

Parametric coordinates of any breakpoints.

Return type:

list[FloatScalar]

k(u)

Calculate the curvature at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Curvature of surface matching the normalized shape of u.

Return type:

buffalo_core.typing.FloatArray

normal(u)

Calculate the unit normal at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (n_x, n_y) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

tangent(u)

Calculate the unit tangent at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (t_x, t_y) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

xy_from_s(s)

Return curve coordinates at arc-length locations.

Parameters:

s (buffalo_core.typing.FloatInput) – Arc length location of point.

Returns:

(x, y) coordinates matching the normalized shape of s.

Return type:

tuple[FloatArray, FloatArray]

abstractmethod xy_from_u(u)

Calculate the coordinates of geometry at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (x, y) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

xy_s(s)

Calculate first derivatives at arc-length location.

Parameters:

s (buffalo_core.typing.FloatInput) – Arc length location of point.

Returns:

(dx/ds, dy/ds) coordinates matching the normalized shape of s.

Return type:

tuple[FloatArray, FloatArray]

Notes

If s matches one of arc_length_breakpoints() exactly, this method returns the minus-side derivative limit. Subclasses should override xy_s_breakpoint() when exact one-sided breakpoint derivatives are available analytically.

xy_s_breakpoint(*, index)

Return both sides of first derivatives at a breakpoint.

Parameters:

index (int) – Index into arc_length_breakpoints().

Returns:

((x_s_minus, y_s_minus), (x_s_plus, y_s_plus)).

Return type:

CurveBreakpointSides

Notes

Endpoint breakpoints return the same boundary value for both entries. This method is the exact-breakpoint contract that pairs with xy_s(). Subclasses should override it whenever exact one-sided arc-length derivatives are available. The generic implementation evaluates nearby one-sided native- parameter samples and therefore serves only as an approximation fallback.

xy_ss(s)

Calculate second derivatives at arc-length location.

Parameters:

s (buffalo_core.typing.FloatInput) – Arc length location of point.

Returns:

(d^2x/ds^2, d^2y/ds^2) coordinates matching the normalized shape of s.

Return type:

tuple[FloatArray, FloatArray]

Notes

If s matches one of arc_length_breakpoints() exactly, this method returns the minus-side derivative limit. Subclasses should override xy_ss_breakpoint() when exact one-sided breakpoint second derivatives are available analytically.

xy_ss_breakpoint(*, index)

Return one-sided second derivatives at a breakpoint.

Parameters:

index (int) – Index into arc_length_breakpoints().

Returns:

((x_ss_minus, y_ss_minus), (x_ss_plus, y_ss_plus)).

Return type:

CurveBreakpointSides

Notes

Endpoint breakpoints return the same boundary value for both entries. This method is the exact-breakpoint contract that pairs with xy_ss(). Subclasses should override it whenever exact one-sided arc-length second derivatives are available. The generic implementation evaluates nearby one-sided native- parameter samples and therefore serves only as an approximation fallback.

abstractmethod xy_u(u)

Calculate rates of change of the coordinates at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (dx/du, dy/du) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

Notes

If u matches one of breakpoints() exactly, this method returns the minus-side derivative limit.

xy_u_breakpoint(*, index)

Return both sides of first derivatives at one breakpoint.

Parameters:

index (int) – Index into breakpoints().

Returns:

((x_u_minus, y_u_minus), (x_u_plus, y_u_plus)).

Return type:

CurveBreakpointSides

Notes

Endpoint breakpoints return the same boundary value for both entries. This method is the exact-breakpoint contract that pairs with xy_u(). Subclasses should override it whenever they can return exact one-sided derivative values. The generic implementation evaluates nearby one-sided parameter samples and therefore serves only as an approximation fallback.

abstractmethod xy_uu(u)

Calculate second derivative of the coordinates at parameter location.

Parameters:

u (buffalo_core.typing.FloatInput) – Parameter for desired locations.

Returns:

Tuple (d^2x/du^2, d^2y/du^2) of float64 arrays matching the normalized shape of u.

Return type:

tuple[FloatArray, FloatArray]

Notes

If u matches one of breakpoints() exactly, this method returns the minus-side derivative limit.

xy_uu_breakpoint(*, index)

Return one-sided second derivatives at one breakpoint.

Parameters:

index (int) – Index into breakpoints().

Returns:

((x_uu_minus, y_uu_minus), (x_uu_plus, y_uu_plus)).

Return type:

CurveBreakpointSides

Notes

Endpoint breakpoints return the same boundary value for both entries. This method is the exact-breakpoint contract that pairs with xy_uu(). Subclasses should override it whenever they can return exact one-sided second-derivative values. The generic implementation evaluates nearby one-sided parameter samples and therefore serves only as an approximation fallback.