buffalo_wings.airfoil.CstGeometry

class buffalo_wings.airfoil.CstGeometry(*, upper, lower, trailing_edge_thickness=0.0)[source]

Bases: Airfoil

General CST airfoil backed by upper and lower CST geometry sides.

Notes

The runtime stores the exact schema content used to construct it so supported CST geometry airfoils participate in the schema round-trip contract. This general runtime keeps the standard full-airfoil curve parameterization x = |u|. When n1 < 1, curve-parameter derivatives with respect to u can remain singular at the leading edge because they are inherited directly from the underlying dy/dx CST relation. Canonical airfoil CST definitions with n1 = 0.5 and n2 = 1.0 use CstAirfoil instead, which applies a different curve parameterization while preserving the same geometric shape.

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 boundary and leading-edge breakpoints.

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.

demote_degree(*[, count, continuity])

Lower the Bezier shape degree on both CST sides.

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.

promote_degree(*[, count])

Raise the Bezier shape degree on both CST sides.

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 surface-local xi coordinates to native parameters.

xi_from_u(u)

Convert native parameters to surface-local xi coordinates.

xy_from_s(s)

Return curve coordinates at arc-length locations.

xy_from_u(u)

Calculate the CST airfoil coordinates.

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 one-sided arc-length derivatives at one breakpoint index.

xy_ss(s)

Calculate second derivatives at arc-length location.

xy_ss_breakpoint(*, index)

Return one-sided arc-length second derivatives at one breakpoint.

xy_u(u)

Calculate first derivatives with respect to the airfoil parameter.

xy_u_breakpoint(*, index)

Return one-sided first derivatives at one breakpoint index.

xy_uu(u)

Calculate second derivatives with respect to the airfoil parameter.

xy_uu_breakpoint(*, index)

Return one-sided second derivatives at one breakpoint index.

Attributes

length

Return the full airfoil surface length.

lower

Return the lower-side CST geometry.

spec

Return the schema definition used to create this airfoil.

trailing_edge_thickness

Return the explicit trailing-edge thickness.

upper

Return the upper-side CST geometry.

property upper: CstGeometrySide

Return the upper-side CST geometry.

This property exposes the upper-side CST geometry definition.

property lower: CstGeometrySide

Return the lower-side CST geometry.

This property exposes the lower-side CST geometry definition.

property trailing_edge_thickness: buffalo_core.typing.FloatScalar

Return the explicit trailing-edge thickness.

This property reports the explicit trailing-edge gap as a fraction of chord.

promote_degree(*, count=1)[source]

Raise the Bezier shape degree on both CST sides.

Parameters:

count (int, default 1) – Number of Bezier degree-elevation steps applied to each side shape curve.

Returns:

Rebuilt CST airfoil with exact elevated side shape curves.

Return type:

CstGeometry

demote_degree(*, count=1, continuity='NOT_CONNECTED')[source]

Lower the Bezier shape degree on both CST sides.

Parameters:
  • count (int, default 1) – Number of Bezier degree-reduction steps applied to each side shape curve.

  • continuity ({"NOT_CONNECTED", "C0", "C1", "C2"},) – default=”NOT_CONNECTED” Symmetric endpoint continuity preserved during each side demotion step.

Returns:

Rebuilt CST airfoil with reduced-degree side shape curves.

Return type:

CstGeometry

Notes

This operation is intentionally approximate unless the side shape curves are exactly reducible to the requested lower degree.

property spec: CstAirfoilSpec

Return the schema definition used to create this airfoil.

The returned schema contains the current upper and lower side coefficients, exponents, and trailing-edge thickness.

xy_from_u(u)[source]

Calculate the CST airfoil coordinates.

Parameters:

u (buffalo_core.typing.FloatInput) – Signed airfoil parameter values in [-1, 1]. Negative values evaluate the lower surface and non-negative values evaluate the upper surface.

Returns:

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

Return type:

tuple[FloatArray, FloatArray]

Notes

This uses x = |u| on both surface branches.

xy_u(u)[source]

Calculate first derivatives with respect to the airfoil parameter.

Parameters:

u (buffalo_core.typing.FloatInput) – Signed airfoil parameter values in [-1, 1].

Returns:

Tuple (dx/du, dy/du) of float64 arrays.

Return type:

tuple[FloatArray, FloatArray]

Notes

At listed breakpoints, this method returns the minus-side derivative so array-valued evaluations remain single-valued. For CST class exponents with singular dy/dx behavior at the leading edge, this native derivative can remain singular.

xy_uu(u)[source]

Calculate second derivatives with respect to the airfoil parameter.

Parameters:

u (buffalo_core.typing.FloatInput) – Signed airfoil parameter values in [-1, 1].

Returns:

Tuple (d2x/du2, d2y/du2) of float64 arrays.

Return type:

tuple[FloatArray, FloatArray]

Notes

At listed breakpoints, this method returns the minus-side second derivative so array-valued evaluations remain single-valued. For CST class exponents with singular dy/dx or d2y/dx2 behavior at the leading edge, this native derivative can remain singular.

u_from_xi(xi, *, surface)[source]

Convert surface-local xi coordinates to native 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:

Signed native CST airfoil parameters matching xi on the selected surface.

Return type:

buffalo_core.typing.FloatArray

Notes

General CST geometry uses the linear mapping u = +/- xi, with the sign determined by surface.

xi_from_u(u)[source]

Convert native parameters to surface-local xi coordinates.

Parameters:

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

Returns:

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

Return type:

SurfaceMappedValues

Notes

General CST geometry uses the linear mapping xi = |u|.

breakpoints()[source]

Return the boundary and leading-edge breakpoints.

Returns:

Ordered parameter locations where surface branches meet or derivative one-sided limits may differ.

Return type:

list[float]

xy_u_breakpoint(*, index)[source]

Return one-sided first derivatives at one breakpoint index.

Parameters:

index (int) – Index into breakpoints().

Returns:

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

Return type:

tuple[tuple[FloatScalar, FloatScalar], tuple[FloatScalar, FloatScalar]]

Notes

Endpoint breakpoints return the same exact boundary value for both entries. The interior leading-edge breakpoint returns the lower and upper side values explicitly.

xy_uu_breakpoint(*, index)[source]

Return one-sided second derivatives at one breakpoint index.

Parameters:

index (int) – Index into breakpoints().

Returns:

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

Return type:

tuple[tuple[FloatScalar, FloatScalar], tuple[FloatScalar, FloatScalar]]

Notes

Endpoint breakpoints return the same exact boundary value for both entries. The interior leading-edge breakpoint returns the lower and upper side values explicitly.

xy_s_breakpoint(*, index)[source]

Return one-sided arc-length derivatives at one breakpoint index.

Notes

This method composes the exact arc-length tangent values from the exact native breakpoint derivatives returned by xy_u_breakpoint().

Return type:

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

xy_ss_breakpoint(*, index)[source]

Return one-sided arc-length second derivatives at one breakpoint.

Notes

This method composes the exact arc-length curvature-vector values from the exact native breakpoint derivatives returned by xy_u_breakpoint() and xy_uu_breakpoint().

Return type:

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

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’)]

camber_curve(*, num_points=81, spacing='cosine')

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.

chord()

Return the airfoil chord length.

Returns:

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

Return type:

buffalo_core.typing.FloatScalar

curvature_from_xi(xi, *, surface)

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

d2ydx2(u)

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

dydx(u)

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

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

leading_edge()

Return the leading-edge location.

Returns:

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

Return type:

tuple[FloatScalar, FloatScalar]

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

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]

slope_from_xi(xi, *, surface)

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

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]

to_spec()

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.

trailing_edge()

Return the midpoint of the trailing-edge points.

Returns:

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

Return type:

tuple[FloatScalar, FloatScalar]

u_from_s(s)

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.

u_from_x(x, *, surface)

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.

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]

xy_from_xi(xi, *, surface)

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]

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_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.