pterasoftware.geometry.wing

Contains the Wing class.

Classes

Wing

A class used to contain the wings of an Airplane.

Module Contents

class pterasoftware.geometry.wing.Wing(wing_cross_sections: list[pterasoftware.geometry.wing_cross_section.WingCrossSection], name: str = 'Untitled Wing', Ler_Gs_Cgs: numpy.ndarray | collections.abc.Sequence[float | int] = (0.0, 0.0, 0.0), angles_Gs_to_Wn_ixyz: numpy.ndarray | collections.abc.Sequence[float | int] = (0.0, 0.0, 0.0), symmetric: bool | numpy.bool_ = False, mirror_only: bool | numpy.bool_ = False, symmetryNormal_G: None | numpy.ndarray | collections.abc.Sequence[float | int] = None, symmetryPoint_G_Cg: None | numpy.ndarray | collections.abc.Sequence[float | int] = None, explode_into_strips: bool | numpy.bool_ = False, num_chordwise_panels: int = 8, chordwise_spacing: str = 'cosine')[source]

A class used to contain the wings of an Airplane.

Contains the following methods:

__deepcopy__: Creates a deep copy of this Wing, preserving mesh geometry but resetting wake state.

T_pas_G_Cg_to_Wn_Ler: The passive transformation matrix which maps in homogeneous coordinates from geometry axes relative to the CG to wing axes relative to the leading edge root point. It is None if the Wing’s symmetry type hasn’t been defined yet.

T_pas_Wn_Ler_to_G_Cg: The passive transformation matrix which maps in homogeneous coordinates from wing axes relative to the leading edge root point to geometry axes relative to the CG point. It is None if the Wing’s symmetry type hasn’t been defined yet.

WnX_G: The wing axes’ first basis vector (in geometry axes).

WnY_G: The wing axes’ second basis vector (in geometry axes).

WnZ_G: The wing axes’ third basis vector (in geometry axes).

children_T_pas_Wn_Ler_to_Wcs_Lp: A list of passive transformation matrices which map in homogeneous coordinates from wing axes, relative to the leading edge root point, to each of this Wing’s WingCrossSection’s axes, relative to their respective leading points.

children_T_pas_Wcs_Lp_to_Wn_Ler: A list of passive transformation matrices which map in homogeneous coordinates from each of this Wing’s WingCrossSection’s axes, relative to their respective leading points, to wing axes, relative to the leading edge root point.

children_T_pas_G_Cg_to_Wcs_Lp: A list of passive transformation matrices which map in homogeneous coordinates from geometry axes, relative to the CG, to each of this Wing’s WingCrossSection’s axes, relative to their respective leading points.

children_T_pas_Wcs_Lp_to_G_Cg: A list of passive transformation matrices which map in homogeneous coordinates from each of this Wing’s WingCrossSection’s axes, relative to their respective leading points, to geometry axes, relative to the CG.

symmetry_type: The symmetry type of this Wing.

num_spanwise_panels: The number of spanwise Panels on this Wing.

num_panels: The total number of Panels on this Wing.

panels: The 2D array of Panels on this Wing.

projected_area: The area of the Wing projected onto the plane defined by the wing axes’ xy plane.

wetted_area: The Wing’s wetted area.

average_panel_aspect_ratio: The average aspect ratio of the Wing’s Panels.

span: The Wing’s span.

standard_mean_chord: The Wing’s standard mean chord.

mean_aerodynamic_chord: The Wing’s mean aerodynamic chord.

generate_mesh: Generates this Wing’s mesh, which finishes the process of preparing the Wing to be used in a simulation. It is called by the Wing’s parent Airplane, after it’s determined its symmetry type.

get_plottable_data: Returns plottable data for this Wing’s Airfoils’ outlines and mean camber lines.

Notes:

Immutable attributes (wing_cross_sections, name, Ler_Gs_Cgs, angles_Gs_to_Wn_ixyz, num_chordwise_panels, and chordwise_spacing) are set during initialization and cannot be modified afterward. The numpy arrays Ler_Gs_Cgs and angles_Gs_to_Wn_ixyz are made read only to prevent in place mutation. The wing_cross_sections attribute is stored as a tuple to prevent external mutation.

Derived transformation matrices and basis vectors (T_pas_G_Cg_to_Wn_Ler, T_pas_Wn_Ler_to_G_Cg, WnX_G, WnY_G, WnZ_G, and the children_T_pas_* properties) are lazily evaluated and cached. Derived geometric properties (projected_area, wetted_area, average_panel_aspect_ratio, span, standard_mean_chord, and mean_aerodynamic_chord) are also lazily evaluated and cached.

The symmetry_type, num_spanwise_panels, num_panels, and panels attributes are set once by generate_mesh and cannot be modified after being set.

The symmetric, mirror_only, symmetryNormal_G, and symmetryPoint_G_Cg attributes remain mutable as they may be modified by Airplane.process_wing_symmetry() for type 5 symmetry handling. The gridWrvp_GP1_CgP1 attribute is mutable as it is modified during simulation.

Every Wing has its own axis system, known as wing axes. The user sets the relationship between these axes and geometry axes with the Ler_Gs_Cgs and angles_Gs_to_Wn_ixyz parameters. However, the steps for transforming a vector from geometry axes to wing axes, and the interpretation of the wing axes orientation and position relative to an Airplane’s geometry axes, also depend on the parameters symmetric, mirror_only, symmetryNormal_G, and symmetryPoint_G_Cg. In all cases, the order of transformations from geometry axes to wing axes is reflection (if applicable), translation, and then rotation.

There are five symmetry types. Type 1: symmetric=False, mirror_only=False, and the symmetry plane must be undefined. Type 2: symmetric=False, mirror_only=True, and the symmetry plane is coincident with the wing axes’ xz plane. Type 3: symmetric=False, mirror_only=True, and the symmetry plane is not coincident with the wing axes’ xz plane. Type 4: symmetric=True, mirror_only=False, and the symmetry plane is coincident with the wing axes’ xz plane. Type 5: symmetric=True, mirror_only=False, and the symmetry plane is not coincident with the wing axes’ xz plane.

Citation:

Adapted from: geometry.Wing in AeroSandbox

Author: Peter Sharpe

Date of retrieval: 04/24/2020

Parameters:
  • wing_cross_sections – A list of WingCrossSections representing the wing’s cross sections in order from root to tip. It must contain at least two WingCrossSections.

  • name – A sensible name for the Wing. The default is “Untitled Wing”.

  • Ler_Gs_Cgs – An array-like object of 3 numbers (int or float) representing the position of the origin of this Wing’s axes (in geometry axes after accounting for symmetry, relative to the CG after accounting for symmetry). Can be a tuple, list, or ndarray. Values are converted to floats internally. The units are meters. The default is (0.0, 0.0, 0.0).

  • angles_Gs_to_Wn_ixyz – An array-like object of 3 numbers (int or float) representing the angle vector that defines the orientation of this Wing’s axes relative to the geometry axes (after accounting for symmetry). Can be a tuple, list, or ndarray. Values are converted to floats internally. All angles must be in the range [-90, 90] degrees. Rotations are intrinsic, and proceed in the xy’z” order. The units are degrees. The default is (0.0, 0.0, 0.0).

  • symmetric – Set this to True if the Wing’s geometry should be mirrored across the symmetry plane while retaining the non mirrored side. If mirror_only is True, symmetric must be False. If symmetric is True, then neither symmetryNormal_G nor symmetryPoint_G_Cg can be None. If the symmetry plane is coincident with this Wing’s axes’ xz plane, the mirrored and non mirrored geometry will be meshed as a single wing. If not, this Wing’s Airplane will automatically create another Wing with the mirrored geometry, modify both Wings’ parameters, and add the reflected Wing to its list of Wings immediately following this one. For more details on that process, and how this parameter interacts with symmetryNormal_G, symmetryPoint_G_Cg, and mirror_only, see the class docstring. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.

  • mirror_only – Set this to True if the Wing’s geometry should be reflected about the symmetry plane without retaining the non reflected geometry. If symmetric is True, mirror_only must be False. If mirror_only is True, then neither symmetryNormal_G nor symmetryPoint_G_Cg can be None. For more details on how this parameter interacts with symmetryNormal_G, symmetryPoint_G_Cg, and symmetric, see the class docstring. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.

  • symmetryNormal_G – None, or an array-like of 3 numbers (int or float) representing the unit normal vector (in geometry axes) that, together with symmetryPoint_G_Cg, defines the plane used for symmetry or mirroring. Can be None, or a tuple, list, or ndarray. If not None, values are converted to floats and normalized internally. Note that reversing the normal direction (using the antiparallel vector) defines the same plane and produces the same result. This value must be None if both symmetric and mirror_only are False, and cannot be None if either are True. For more details on how this parameter interacts with symmetryPoint_G_Cg, symmetric, and mirror_only, see the class docstring. The default is None.

  • symmetryPoint_G_Cg – None or an array-like object of 3 numbers (int or float) representing a point (in geometry axes, relative to the CG) that, along with symmetryNormal_G, defines the location of the plane about which symmetry or mirroring is applied. Can be None, or a list, tuple, or ndarray. If not None, values are converted to floats internally. This value must be None if both symmetric and mirror_only are False, and cannot be None if either are True. For more details on how this parameter interacts with symmetryNormal_G, symmetric, and mirror_only, see the class docstring. The units are meters. The default is None.

  • explode_into_strips – Set this to True to have the explode_wing method called on this Wing during initialization, replacing wing_cross_sections with a new list in which every panel is broken into single spanwise strips for deformation. When True, every non tip WingCrossSection in wing_cross_sections must have spanwise_spacing=”uniform”; the explosion assumes uniformly spaced intermediates and rejects other spacings rather than silently overriding them. This parameter is consumed during initialization and is not stored as an attribute.

  • num_chordwise_panels – The number of chordwise panels to be used on this Wing, which must be set to a positive integer. The default is 8.

  • chordwise_spacing – The type of spacing between the Wing’s chordwise panels. Can be “cosine” or “uniform”. Using cosine spacing is highly recommended for steady simulations and uniform spacing is highly recommended for unsteady simulations. The default is “cosine”.

Returns:

None

property T_pas_G_Cg_to_Wn_Ler: None | numpy.ndarray

The passive transformation matrix which maps in homogeneous coordinates from geometry axes relative to the CG to wing axes relative to the leading edge root point. Is None if the Wing’s symmetry type hasn’t been defined yet.

Returns:

A (4,4) ndarray of floats representing the transformation matrix or None if the Wing’s symmetry type hasn’t been defined yet.

property T_pas_Wn_Ler_to_G_Cg: None | numpy.ndarray

The passive transformation matrix which maps in homogeneous coordinates from wing axes relative to the leading edge root point to geometry axes relative to the CG. Is None if the Wing’s symmetry type hasn’t been defined yet.

Returns:

A (4,4) ndarray of floats representing the transformation matrix or None if the Wing’s symmetry type hasn’t been defined yet.

property WnX_G: None | numpy.ndarray

The wing axes’ first basis vector (in geometry axes).

Returns:

A (3,) ndarray of floats representing the wing axes’ first basis vector (in geometry axes) or None if the Wing’s symmetry type hasn’t been defined yet.

property WnY_G: None | numpy.ndarray

The wing axes’ second basis vector (in geometry axes).

Returns:

A (3,) ndarray of floats representing the wing axes’ second basis vector (in geometry axes) or None if the Wing’s symmetry type hasn’t been defined yet.

property WnZ_G: None | numpy.ndarray

The wing axes’ third basis vector (in geometry axes).

Returns:

A (3,) ndarray of floats representing the wing axes’ third basis vector (in geometry axes) or None if the Wing’s symmetry type hasn’t been defined yet.

property children_T_pas_Wn_Ler_to_Wcs_Lp: list[numpy.ndarray]

A list of passive transformation matrices which map in homogeneous coordinates from wing axes, relative to the leading edge root point, to each of this Wing’s WingCrossSection’s axes, relative to their respective leading points.

Returns:

A list of (4,4) ndarrays of floats representing the homogeneous transformation matrices.

property children_T_pas_Wcs_Lp_to_Wn_Ler: list[numpy.ndarray]

A list of passive transformation matrices which map in homogeneous coordinates from each of this Wing’s WingCrossSection’s axes, relative to their respective leading points, to wing axes, relative to the leading edge root point.

Returns:

A list of (4,4) ndarrays of floats representing the homogeneous transformation matrices.

property children_T_pas_G_Cg_to_Wcs_Lp: list[numpy.ndarray]

A list of passive transformation matrices which map in homogeneous coordinates from geometry axes, relative to the CG, to each of this Wing’s WingCrossSection’s axes, relative to their respective leading points.

Returns:

A list of (4,4) ndarrays of floats representing the homogeneous transformation matrices.

property children_T_pas_Wcs_Lp_to_G_Cg: list[numpy.ndarray]

A list of passive transformation matrices which map in homogeneous coordinates from each of this Wing’s WingCrossSection’s axes, relative to their respective leading points, to geometry axes, relative to the CG.

Returns:

A list of (4,4) ndarrays of floats representing the homogeneous transformation matrices.

property symmetry_type: int | None

The symmetry type of this Wing.

Returns:

An integer from 1-4 representing the symmetry type, or None if the Wing’s symmetry type hasn’t been determined yet.

property num_spanwise_panels: int | None

The total number of spanwise Panels on this Wing.

Returns:

A positive integer representing the number of spanwise Panels, or None if the Wing hasn’t been meshed yet.

property num_panels: int | None

The total number of Panels on this Wing.

Returns:

A positive integer representing the total number of Panels, or None if the Wing hasn’t been meshed yet.

property panels: numpy.ndarray | None

The 2D array of Panels on this Wing.

Returns:

A (num_chordwise_panels, num_spanwise_panels) ndarray of Panel objects, or None if the Wing hasn’t been meshed yet.

property projected_area: None | float

The area of the Wing projected onto the plane defined by the wing axes’ xy plane.

Notes:

If the Wing is symmetric and continuous, the area of the mirrored half is included.

Returns:

The projected area of the Wing. It has units of square meters. If the Wing hasn’t been meshed yet, None is returned instead.

property wetted_area: None | float

The Wing’s wetted area.

Notes:

If the Wing is symmetric and continuous, the area of the mirrored half is included.

Returns:

The wetted area of the Wing. It has units of square meters. If the Wing hasn’t been meshed yet, None is returned instead.

property average_panel_aspect_ratio: None | float

The average aspect ratio of the Wing’s Panels.

Returns:

The average aspect ratio of the Wing’s Panels. If the Wing hasn’t been meshed yet, None is returned instead.

property span: None | float

The Wing’s span.

Notes:

The span is derived by first finding the vector connecting the leading edges of the root and tip WingCrossSections. Then, this vector is projected onto the wing axes’ second basis vector. The span is defined as the magnitude of this projection.

If the Wing is symmetric and continuous, this method includes the span of the mirrored half.

Returns:

The Wing’s span. It has units of meters. None is returned if the Wing’s symmetry type hasn’t been defined yet.

property standard_mean_chord: None | float

The Wing’s standard mean chord.

Notes:

The standard mean chord is defined as the projected area divided by the span. See their respective methods for the definitions of span and projected area.

Returns:

The standard mean chord of the Wing. It has units of meters. None is returned if the Wing’s symmetry type hasn’t been defined yet.

property mean_aerodynamic_chord: None | float

The Wing’s mean aerodynamic chord.

Returns:

The mean aerodynamic chord of the Wing. It has units of meters. None is returned if the Wing’s symmetry type hasn’t been defined yet.

generate_mesh(symmetry_type: int) None[source]

Generates this Wing’s mesh, which finishes the process of preparing the Wing to be used in a simulation. It is called by the Wing’s parent Airplane, after it’s determined its symmetry type.

Parameters:

symmetry_type – The symmetry type of this Wing as an int from 1-4. See the class docstring for details on how to interpret the symmetry types.

Returns:

None

get_plottable_data(show: bool | numpy.bool_ = False) list[list[numpy.ndarray]] | None[source]

Returns plottable data for this Wing’s Airfoils’ outlines and mean camber lines.

Parameters:

show – Determines whether to display the plot. If True, the method displays the plot and returns None. If False, the method returns the data without displaying. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.

Returns:

None if the Wing’s symmetry type hasn’t been set yet, or if show is True. Otherwise, returns a list of two lists, each containing one ndarray for every one of this Wing’s Airfoils. These ndarrays represent points on each Airfoil’s outline and mean camber lines, respectively. The points are in wing axes, relative to the leading edge root point. The units are in meters.

interpolate_between_wing_cross_sections(wcs1: pterasoftware.geometry.wing_cross_section.WingCrossSection, wcs2: pterasoftware.geometry.wing_cross_section.WingCrossSection, first_wcs: bool) list[pterasoftware.geometry.wing_cross_section.WingCrossSection][source]

Wing cross section panels are between the line of wcs1 and wcs2.

When exploding a wing to 1 spanwise panel per cross section, we need to interpolate the intermediate cross sections.

Parameters:
  • wcs1 – The first WingCrossSection.

  • wcs2 – The second WingCrossSection.

  • first_wcs – Whether wcs1 is the first WingCrossSection of the wing. If True, the method will include a WingCrossSection with the same parameters as wcs1 in the output list. If False, it will not, since it will have already been included as the last interpolated WingCrossSection between the previous pair of WingCrossSections.

Returns:

A list of WingCrossSections representing the interpolated cross sections

explode_wing(wing_cross_sections: list[pterasoftware.geometry.wing_cross_section.WingCrossSection]) list[pterasoftware.geometry.wing_cross_section.WingCrossSection][source]

Takes a list of WingCrossSections and returns a new list where all cross sections have num_spanwise_panels = 1.

The interpolation distributes each non-tip WingCrossSection’s parent-relative offset and twist uniformly across its N intermediates, which is exact only when the source WingCrossSection specifies uniform spanwise spacing. Non uniform spacings (for example “cosine”) would silently be replaced with uniform spacing in the output mesh, so this method rejects them up front.

Parameters:

wing_cross_sections – The list of wing cross sections to explode. Every non tip WingCrossSection must have spanwise_spacing=”uniform”.

Returns:

A new list of exploded wing cross sections.

Raises:

ValueError – If any non tip WingCrossSection has a spanwise_spacing other than “uniform”.