pterasoftware.geometry.airplane¶
Contains the Airplane class.
Classes¶
A class used to contain airplanes. |
Module Contents¶
- class pterasoftware.geometry.airplane.Airplane(
- wings: list[pterasoftware.geometry.wing.Wing],
- name: str = 'Untitled Airplane',
- Cg_GP1_CgP1: numpy.ndarray | collections.abc.Sequence[float | int] = (0.0, 0.0, 0.0),
- weight: float | int = 0.0,
- s_ref: float | int | None = None,
- c_ref: float | int | None = None,
- b_ref: float | int | None = None,
A class used to contain airplanes.
Contains the following methods:
__deepcopy__: Creates a deep copy of this Airplane, preserving mesh geometry but resetting solver state.
deep_copy_with_Cg_GP1_CgP1: Creates a deep copy of this Airplane with a different Cg_GP1_CgP1 position.
num_panels: The total number of Panels across all Wings.
T_pas_G_Cg_to_GP1_CgP1: The passive transformation matrix from this Airplane’s geometry axes, relative to this Airplane’s CG to the first Airplane’s geometry axes, relative to the first Airplane’s CG.
inducedDrag_W: The total induced drag force experienced by this Airplane (in wind axes).
sideForce_W: The total side force experienced by this Airplane (in wind axes).
lift_W: The total lift force experienced by this Airplane (in wind axes).
inducedDragCoefficient_W: The total induced drag force coefficient experienced by this Airplane (in wind axes).
sideForceCoefficient_W: The total side force coefficient experienced by this Airplane (in wind axes).
liftCoefficient_W: The total lift force coefficient experienced by this Airplane (in wind axes).
rollingMoment_W_Cg: The total rolling moment experienced by this Airplane (in wind axes, relative to the CG).
pitchingMoment_W_Cg: The total pitching moment experienced by this Airplane (in wind axes, relative to the CG).
yawingMoment_W_Cg: The total yawing moment experienced by this Airplane (in wind axes, relative to the CG).
rollingMomentCoefficient_W_Cg: The total rolling moment coefficient experienced by this Airplane (in wind axes, relative to the CG).
pitchingMomentCoefficient_W_Cg: The total pitching moment coefficient experienced by this Airplane (in wind axes, relative to the CG).
yawingMomentCoefficient_W_Cg: The total yawing moment coefficient experienced by this Airplane (in wind axes, relative to the CG).
draw: Draws the 3D geometry of this Airplane.
get_plottable_data: Returns plottable data for this Airplane’s Airfoils’ outlines and mean camber lines.
validate_first_airplane_constraints: Validates that the first Airplane in a simulation has Cg_GP1_CgP1 set to zeros.
process_wing_symmetry: Processes a Wing to determine what type of symmetry it has. If necessary, it then modifies the Wing. If type 5 symmetry is detected, it also creates a second reflected Wing. Finally, it returns a list of Wings.
Notes:
The Airplane class is responsible for: (1) Defining the local body axes and geometry axes, (2) managing Wings and their coordinate transformations, (3) processing symmetric Wings and converting them to separate wings when the symmetry plane is not coincident with the Wing’s axes xz plane (type 5 symmetry), and (4) providing reference dimensions for aerodynamic calculations.
Every Airplane has a body axis system, where +x points forward along fuselage, +y points to the right (starboard direction), and +z points downward (completing a right-handed system).
Every Airplane also has a geometry axis system, where +x points aft along fuselage, +y points to the right (starboard direction), and +z points upward (completing a right-handed system).
Immutable attributes (wings, name, Cg_GP1_CgP1, weight, s_ref, c_ref, and b_ref) are set during initialization and cannot be modified afterward. The numpy array Cg_GP1_CgP1 is made read only to prevent in place mutation. The wings attribute is stored as a tuple to prevent external mutation.
Derived properties (num_panels and T_pas_G_Cg_to_GP1_CgP1) are lazily evaluated and cached since they depend only on immutable attributes.
The load attributes remain mutable as they are set by the solver during simulation. The forces_W, forceCoefficients_W, moments_W_CgP1, and momentCoefficients_W_CgP1 attributes hold the total force (in wind axes), the total moment (in wind axes, relative to the first Airplane’s CG), and their coefficients. The forces_G, forceCoefficients_G, moments_G_Cg, momentCoefficients_G_Cg, moments_W_Cg, and momentCoefficients_W_Cg attributes hold the total force (in geometry axes), the total moment (in geometry axes, relative to the CG), the total moment (in wind axes, relative to the CG), and their coefficients. Because every Airplane’s geometry axes are parallel to the first Airplane’s geometry axes, the components of forces_G equal the components of the total force (in the first Airplane’s geometry axes). For the first Airplane, moments_W_Cg equals moments_W_CgP1, and momentCoefficients_W_Cg equals momentCoefficients_W_CgP1.
Citation:
Adapted from: geometry.Airplane in AeroSandbox
Author: Peter Sharpe
Date of retrieval: 04/23/2020
- Parameters:
wings – A list of the airplane’s wings defined as Wings. It must contain at least one Wing. Wings with symmetric=True and non coincident symmetry planes will be automatically processed into separate Wings during initialization (type 5 symmetry).
name – A sensible name for your airplane. The default is “Untitled Airplane”.
Cg_GP1_CgP1 – An array-like object of 3 numbers representing the position of this Airplane’s CG (in the first Airplane’s geometry axes, relative to the first Airplane’s CG). Can be a list, tuple, or ndarray. Values are converted to floats internally. For the first Airplane in a simulation, this must be equivalent to (0.0, 0.0, 0.0) by definition. The units are in meters. The default is (0.0, 0.0, 0.0).
weight – A number (int or float) representing the weight of the aircraft in Newtons. This is used by the trim functions. It must be greater than or equal to zero. The default is 0.0. In free flight, it must also be consistent with the FreeFlightUnsteadyProblem’s mass and the OperatingPoint’s gravitational acceleration, satisfying weight == mass * |g_E| within floating point tolerance.
s_ref – A number (int or float) representing the reference wetted area. If not set or set to None (the default), it populates from first Wing. If set, it must be greater than zero, and will be converted to a float internally. The units are square meters.
c_ref – A number (int or float) representing the reference chord length. If not set or set to None (the default), it populates from first Wing. If set, it must be greater than zero, and will be converted to a float internally. The units are meters.
b_ref – A number (int or float) representing the reference span. If not set or set to None (the default value), it populates from first Wing. If set, it must be greater than zero, and will be converted to a float internally. The units are meters.
- deep_copy_with_Cg_GP1_CgP1(
- new_Cg_GP1_CgP1: numpy.ndarray | collections.abc.Sequence[float | int],
Creates a deep copy of this Airplane with a different Cg_GP1_CgP1 position.
This method is used by AirplaneMovement to create Airplanes at different time steps that share the same geometry but have different positions in the formation. It maintains immutability by returning a new Airplane rather than modifying the existing one.
Only Cg_GP1_CgP1 and its derived cache (_T_pas_G_Cg_to_GP1_CgP1) need to differ from a standard deep copy because (1) Wing geometry (Ler_Gs_Cgs, panels, etc.) is defined relative to this Airplane’s own CG, not the formation position, so it remains valid, (2) Panel local coordinates (_G_Cg) are independent of formation position (global coordinates (_GP1_CgP1) are reset to None by Panel’s __deepcopy__ and will be recomputed by the Problem using the new transformation matrix), and (3) all other child objects (WingCrossSections, Airfoils, vortices) have no dependency on Cg_GP1_CgP1.
- Parameters:
new_Cg_GP1_CgP1 – An array-like object of 3 numbers representing the position of the new Airplane’s CG (in the first Airplane’s geometry axes, relative to the first Airplane’s CG). Can be a list, tuple, or ndarray. Values are converted to floats internally. The units are in meters.
- Returns:
A new Airplane with the specified position and deep copied geometry.
- property num_panels: int¶
The total number of Panels across all Wings.
- Returns:
The total number of Panels.
- property T_pas_G_Cg_to_GP1_CgP1: numpy.ndarray¶
The passive transformation matrix from this Airplane’s geometry axes, relative to this Airplane’s CG to the first Airplane’s geometry axes, relative to the first Airplane’s CG.
Computes the transformation chain: G_Cg > GP1_CgP1. This transformation matrix is used to position Airplanes relative to one another, in problems with more than one Airplane. If this Airplane is the first Airplane (where Cg_GP1_CgP1 = [0, 0, 0]), it returns an identity transformation.
- Returns:
A (4,4) ndarray of floats representing the passive transformation matrix from this Airplane’s geometry axes, relative to its CG to the first Airplane’s geometry axes, relative to its CG.
- property inducedDrag_W: float | None¶
The total induced drag force experienced by this Airplane (in wind axes).
Induced drag points along the wind axes’ -x basis direction, so it is the negative of the wind axes’ x force component.
- Returns:
The induced drag force in Newtons, or None if forces_W has not been set.
- property sideForce_W: float | None¶
The total side force experienced by this Airplane (in wind axes).
Side force points along the wind axes’ +y basis direction, so it equals the wind axes’ y force component.
- Returns:
The side force in Newtons, or None if forces_W has not been set.
- property lift_W: float | None¶
The total lift force experienced by this Airplane (in wind axes).
Lift points along the wind axes’ -z basis direction, so it is the negative of the wind axes’ z force component.
- Returns:
The lift force in Newtons, or None if forces_W has not been set.
- property inducedDragCoefficient_W: float | None¶
The total induced drag force coefficient experienced by this Airplane (in wind axes).
Induced drag coefficient corresponds to the wind axes’ -x basis direction, so it is the negative of the wind axes’ x force coefficient component.
- Returns:
The induced drag coefficient, or None if forceCoefficients_W has not been set.
- property sideForceCoefficient_W: float | None¶
The total side force coefficient experienced by this Airplane (in wind axes).
Side force coefficient corresponds to the wind axes’ +y basis direction, so it equals the wind axes’ y force coefficient component.
- Returns:
The side force coefficient, or None if forceCoefficients_W has not been set.
- property liftCoefficient_W: float | None¶
The total lift force coefficient experienced by this Airplane (in wind axes).
Lift coefficient corresponds to the wind axes’ -z basis direction, so it is the negative of the wind axes’ z force coefficient component.
- Returns:
The lift coefficient, or None if forceCoefficients_W has not been set.
- property rollingMoment_W_Cg: float | None¶
The total rolling moment experienced by this Airplane (in wind axes, relative to the CG).
Rolling moment acts about the wind axes’ +x basis direction, so it equals the wind axes’ x moment component.
- Returns:
The rolling moment in Newton-meters, or None if moments_W_Cg has not been set.
- property pitchingMoment_W_Cg: float | None¶
The total pitching moment experienced by this Airplane (in wind axes, relative to the CG).
Pitching moment acts about the wind axes’ +y basis direction, so it equals the wind axes’ y moment component.
- Returns:
The pitching moment in Newton-meters, or None if moments_W_Cg has not been set.
- property yawingMoment_W_Cg: float | None¶
The total yawing moment experienced by this Airplane (in wind axes, relative to the CG).
Yawing moment acts about the wind axes’ +z basis direction, so it equals the wind axes’ z moment component.
- Returns:
The yawing moment in Newton-meters, or None if moments_W_Cg has not been set.
- property rollingMomentCoefficient_W_Cg: float | None¶
The total rolling moment coefficient experienced by this Airplane (in wind axes, relative to the CG).
Rolling moment coefficient corresponds to the wind axes’ +x basis direction, so it equals the wind axes’ x moment coefficient component.
- Returns:
The rolling moment coefficient, or None if momentCoefficients_W_Cg has not been set.
- property pitchingMomentCoefficient_W_Cg: float | None¶
The total pitching moment coefficient experienced by this Airplane (in wind axes, relative to the CG).
Pitching moment coefficient corresponds to the wind axes’ +y basis direction, so it equals the wind axes’ y moment coefficient component.
- Returns:
The pitching moment coefficient, or None if momentCoefficients_W_Cg has not been set.
- property yawingMomentCoefficient_W_Cg: float | None¶
The total yawing moment coefficient experienced by this Airplane (in wind axes, relative to the CG).
Yawing moment coefficient corresponds to the wind axes’ +z basis direction, so it equals the wind axes’ z moment coefficient component.
- Returns:
The yawing moment coefficient, or None if momentCoefficients_W_Cg has not been set.
- draw( ) None¶
Draws the 3D geometry of this Airplane.
This method provides a convenient way to visualize the Airplane’s Panels without needing to create a solver object first. It shows the Panel’s surfaces in 3D using PyVista.
- Parameters:
save – Set to True to save the image as a WebP. Can be a bool or a numpy bool and will be converted internally to bool. The default value is False.
testing – Set to True to close the image after 1 second, which is useful for running test suites. Can be a bool or a numpy bool and will be converted internally to bool. The default value is False.
- Returns:
None
- get_plottable_data(
- show: bool | numpy.bool_ = False,
Returns plottable data for this Airplane’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:
If show is True, returns None. If show is False, returns a list of sub lists (one sub list for each of this Airplane’s Wings). Each sub list contains sub sub lists (one for each of this Wing’s WingCrossSections). Each sub sub list contains two ndarrays. The first ndarray contains points on that WingCrossSection’s Airfoil’s outline and the second contains points on its mean camber line. The points are in geometry axes, relative to the CG. The units are in meters.
- validate_first_airplane_constraints() None¶
Validates that the first Airplane in a simulation has Cg_GP1_CgP1 set to zeros.
This method should be called by SteadyProblem or UnsteadyProblem.
- Returns:
None
- static process_wing_symmetry( ) list[pterasoftware.geometry.wing.Wing]¶
Processes a Wing to determine what type of symmetry it has.
If necessary, it then modifies the Wing. If type 5 symmetry is detected, it also creates a second reflected Wing. Finally, it returns a list of Wings.
- Parameters:
wing – The Wing to process for symmetry analysis and potential modification.
- Returns:
The list of processed Wings. For types 1-4 symmetry it contains only the one modified Wing, but for type 5 symmetry it contains the modified Wing followed by the new reflected Wing. Before returning them, it also calls each Wing’s generate_mesh method, preparing them for use simulation.