pterasoftware.WingCrossSection

class pterasoftware.WingCrossSection(
*,
airfoil: Airfoil,
num_spanwise_panels: int | None,
chord: float | int = 1.0,
Lp_Wcsp_Lpp: np.ndarray | Sequence[float | int] = (0.0, 0.0, 0.0),
angles_Wcsp_to_Wcs_ixyz: np.ndarray | Sequence[float | int] = (0.0, 0.0, 0.0),
control_surface_symmetry_type: str | None = None,
control_surface_hinge_point: float = 0.75,
control_surface_deflection: float | int = 0.0,
spanwise_spacing: str | None = None,
)

A class used to contain the wing cross sections of a Wing.

Immutable attributes (airfoil, num_spanwise_panels, chord, Lp_Wcsp_Lpp, angles_Wcsp_to_Wcs_ixyz, control_surface_hinge_point, control_surface_deflection, and spanwise_spacing) are set during initialization and cannot be modified afterward. The numpy arrays Lp_Wcsp_Lpp and angles_Wcsp_to_Wcs_ixyz are made read only to prevent in place mutation.

Derived transformation matrices (T_pas_Wcsp_Lpp_to_Wcs_Lp and T_pas_Wcs_Lp_to_Wcsp_Lpp) are lazily evaluated and cached.

The symmetry_type attribute is set once by the parent Wing and cannot be modified after being set.

The control_surface_symmetry_type attribute remains mutable as it may be modified by the parent Airplane for type 5 symmetry handling.

The first WingCrossSection in a Wing's wing_cross_section list is known as the root WingCrossSection. The last is known as the tip WingCrossSection.

Every WingCrossSection has its own wing cross section axes. For root WingCrossSections, their wing cross section axes are identical in position, orientation, and handedness to their Wing's wing axes. For all other WingCrossSections, their wing cross section axes are defined relative to the axes of the previous WingCrossSection. Locally, the x axis points from a cross section's leading point to its trailing point, the y axis points spanwise in the general direction of the next WingCrossSection, and the z axis points upwards.

Things can get a little confusing with respect to WingCrossSections for Wings with symmetric or mirror_only set to True. For more details, look in the Wing class's docstring. Also, remember that WingCrossSections themselves aren't used by the solvers, they are merely one of the Wing attributes that tell the meshing function how we'd like to generate the Wing's Panels.

Citation:

Adapted from: geometry.WingXSec in AeroSandbox

Author: Peter Sharpe

Date of retrieval: 04/26/2020

Parameters:
  • airfoil -- The Airfoil to be used at this WingCrossSection.

  • num_spanwise_panels -- The number of spanwise Panels to be used between this WingCrossSection and the next one. For tip WingCrossSections, it must be None. For all other WingCrossSections, it must be a positive integer.

  • chord -- The Wing's chord at this WingCrossSection. It must be greater than 0.0 and a number (int or float), and will be converted internally to a float. The units are in meters. The default value is 1.0.

  • Lp_Wcsp_Lpp -- An array-like object of 3 numbers (int or float) representing the position in meters of this WingCrossSection's leading edge in parent wing cross section axes, relative to the parent leading edge point. Can be a tuple, list, or ndarray. Values are converted to floats internally. If this is the root WingCrossSection, the parent wing cross section axes are the wing axes and the parent leading point is the Wing's leading edge root point. If not, the parent axes and point are those of the previous WingCrossSection. If this is the root WingCrossSection, it must be a zero vector. The second component must be non negative. For non root WingCrossSections, the second component must be strictly positive. The units are in meters. The default is (0.0, 0.0, 0.0).

  • angles_Wcsp_to_Wcs_ixyz -- An array-like object of 3 numbers (int or float) representing the angle vector of rotation angles that define the orientation of this WingCrossSection's axes relative to the parent wing cross section axes. Can be a tuple, list, or ndarray. Values are converted to floats internally. If this is a root WingCrossSection, these are the wing axes. If not, the parent axes are the previous WingCrossSection's axes. For the root WingCrossSection, this must be a zero vector. For other WingCrossSections, all angles must be in the range [-90, 90] degrees. Rotations are intrinsic, and proceed in the xy'z" order. The units are in degrees. The default is (0.0, 0.0, 0.0).

  • control_surface_symmetry_type -- Determines how control surfaces behave when the Wing has symmetry. Can be "symmetric", "asymmetric", or None. With "symmetric", mirrored control surfaces have the same deflection (like flaps). With "asymmetric", mirrored control surfaces have opposite deflections (like ailerons). The default is None. For Wings with type 4 or 5 symmetry, this parameter must be specified. For Wings with type 1, 2, or 3 symmetry, this parameter must be None. The root WingCrossSection of a type 4 Wing cannot be "asymmetric" with a nonzero deflection, since the mirrored halves would tear the mesh at the shared centerline. This validation is performed by the parent Airplane during Wing processing.

  • control_surface_hinge_point -- The location of the control surface hinge from the leading edge as a fraction of chord. It must be a float in the range (0.0, 1.0). The default is 0.75.

  • control_surface_deflection -- The control deflection in degrees. Deflection downwards is positive. It must be a number (int or float) in the range [-5.0, 5.0] degrees. It will be converted to a float internally. The default is 0.0 degrees.

  • spanwise_spacing -- For non tip WingCrossSections, this can be "cosine" or "uniform". I highly recommend using cosine spacing. For tip WingCrossSections it must be None. If the parent Wing has explode_into_strips=True, every non tip WingCrossSection must use "uniform" because the explosion distributes parent-relative offsets and twists uniformly across each WingCrossSection's intermediates.

Returns:

None

property T_pas_Wcsp_Lpp_to_Wcs_Lp: np.ndarray | None

Defines a property for the passive transformation matrix which maps in homogeneous coordinates from parent wing cross section axes, relative to the parent leading point, to wing cross section axes, relative to the leading point. Is None if the WingCrossSection hasn't been fully validated yet.

Returns:

A (4,4) ndarray of floats representing the transformation matrix or None if the WingCrossSection hasn't been fully validated yet.

property T_pas_Wcs_Lp_to_Wcsp_Lpp: np.ndarray | None

Defines a property for the passive transformation matrix which maps in homogeneous coordinates from wing cross section axes, relative to the leading point, to parent wing cross section axes, relative to the parent leading point. Is None if the WingCrossSection hasn't been fully validated yet.

Returns:

A (4,4) ndarray of floats representing the transformation matrix or None if the WingCrossSection hasn't been fully validated yet.

property symmetry_type: int | None

The symmetry type inherited from the parent Wing.

Returns:

The symmetry type (1, 2, 3, or 4) or None if not yet set.

diagram(
*,
show_airfoil_axes_and_points: bool | np.bool = True,
show_airfoil: bool | np.bool = True,
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 WingCrossSection's Airfoil, placed and scaled by this WingCrossSection, along with its axes and its parent axes.

The diagram is drawn in parent wing cross section axes, relative to the parent leading point. It shows this WingCrossSection's axes at its leading point and its parent axes at its parent leading point. For a WingCrossSection whose symmetry type is 2 or 3, the diagram is reflected across the parent wing cross section axes' xz plane, so the WingCrossSection appears as it does on its reflected Wing. The units are in meters.

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_airfoil_axes_and_points -- Determines whether to draw the Airfoil's axes at its leading point, which coincides with this WingCrossSection's leading point. Can be a bool or a numpy bool and will be converted internally to a bool. The default is True.

  • show_airfoil -- Determines whether to draw the Airfoil's outline and mean camber line. Can be a bool or a numpy bool and will be converted internally to a bool. The default is True.

  • show_mcl -- Determines whether to draw the Airfoil's mean camber line. It has no effect if show_airfoil is False. 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