Post · 11 min read· pp. 633–642

aerosandbox.geometry.fuselage

Attributes

Classes

FuselageDefinition for a Fuselage or other slender body (pod, fuel tank, etc.).
FuselageXSecDefinition for a fuselage cross-section ("X-section").

Module Contents

class aerosandbox.geometry.fuselage.Fuselage(name='Untitled', xsecs=None, color=None, analysis_specific_options=None, **kwargs) : Bases: aerosandbox.AeroSandboxObject

code
Definition for a Fuselage or other slender body (pod, fuel tank, etc.).

Anatomy of a Fuselage:

> A fuselage consists chiefly of a collection of cross-sections, or “xsecs”. A cross-section is a 2D “slice” of
> a fuselage. These can be accessed with Fuselage.xsecs, which gives a list of xsecs in the Fuselage. Each
> xsec is a FuselageXSec object, a class that is defined separately.
>
> You may also see references to fuselage “sections”, which are different from cross-sections (xsecs)! Sections
> are the portions of the fuselage that are in between xsecs. In other words, a fuselage with N cross-sections
> (xsecs, FuselageXSec objects) will always have N-1 sections. Sections are never explicitly defined,
> since you can get all needed information by lofting from the adjacent cross-sections. For example,
> section 0 (the first one) is a loft between cross-sections 0 and 1.
>
> Fuselages are lofted linearly between cross-sections.

Parameters:
:   - **name** (*Optional**[**str**]*) –
    - **xsecs** (*List**[*[*FuselageXSec*](#aerosandbox.geometry.fuselage.FuselageXSec)*]*) –
    - **color** (*Optional**[**Union**[**str**,* *Tuple**[**float**]**]**]*) –
    - **analysis\_specific\_options** (*Optional**[**Dict**[**type**,* *Dict**[**str**,* *Any**]**]**]*) –

name *= 'Untitled'*

xsecs *= None*

color *= None*

analysis\_specific\_options *= None*

\_\_repr\_\_()
:   Return type:
    :   str

*abstract* add\_loft(*kind*, *to\_xsec*, *from\_xsec=None*, *n\_points=5*, *spacing=np.cosspace*)
:   Parameters:
    :   - **kind** (*str*) –
        - **to\_xsec** ([*FuselageXSec*](#aerosandbox.geometry.fuselage.FuselageXSec)) –
        - **from\_xsec** ([*FuselageXSec*](#aerosandbox.geometry.fuselage.FuselageXSec)) –
        - **n\_points** (*int*) –
        - **spacing** (*Callable**[**[**float**,* *float**,* *int**]**,* *aerosandbox.geometry.common.np.ndarray**]*) –

    Return type:
    :   [Fuselage](#aerosandbox.geometry.fuselage.Fuselage)

translate(*xyz*)
:   Translates the entire Fuselage by a certain amount.

    Parameters:
    :   **xyz** (*Union**[**aerosandbox.geometry.common.np.ndarray**,* *List**[**float**]**]*) –

    Return type:
    :   [Fuselage](#aerosandbox.geometry.fuselage.Fuselage)

    Returns: self

area\_wetted()
:   Returns the wetted area of the fuselage.

    Returns:

    Return type:
    :   float

area\_projected(*type='XY'*)
:   Returns the area of the fuselage as projected onto one of the principal planes.

    Parameters:
    :   **type** (*str*) –

        A string, which determines which principal plane to use for projection. One of:

        - ”XY”, in which case the projected area is onto the XY plane (i.e., top-down)
        - ”XZ”, in which case the projected area is onto the XZ plane (i.e., side-view)

    Return type:
    :   float

    Returns: The projected area.

area\_base()
:   Returns the area of the base (i.e. “trailing edge”) of the fuselage. Useful for certain types of drag
    calculation.

    Returns:

    Return type:
    :   float

fineness\_ratio(*assumed\_shape='cylinder'*)
:   Approximates the fineness ratio using the volume and length. The fineness ratio of a fuselage is defined as:

    > FR = length / max\_diameter

    Parameters:
    :   **assumed\_shape** –

        A string, which determines the assumed shape of the fuselage for the approximation. One of:

        - ”cylinder”, in which case the fuselage is assumed to have a cylindrical shape.
        - ”sears-haack”, in which case the fuselage is assumed to have Sears-Haack fuselage shape.

    Return type:
    :   float

    Returns: An approximate value of the fuselage’s fineness ratio.

length()
:   Returns the total front-to-back length of the fuselage. Measured as the difference between the x-coordinates
    of the leading and trailing cross-sections.
    :return:

    Return type:
    :   float

volume(*\_sectional=False*)
:   Computes the volume of the Fuselage.

    Parameters:
    :   - **\_sectional** (*bool*) – A boolean. If False, returns the total volume. If True, returns a list of volumes for each of
        - **sections** (*the n-1 lofted*) –

    Returns:
    :   The computed volume.

    Return type:
    :   Union[float, List[float]]

x\_centroid\_projected(*type='XY'*)
:   Returns the x\_g coordinate of the centroid of the planform area.

    Parameters:
    :   **type** (*str*) –

        A string, which determines which principal plane to use for projection. One of:

        - ”XY”, in which case the projected area is onto the XY plane (i.e., top-down)
        - ”XZ”, in which case the projected area is onto the XZ plane (i.e., side-view)

    Return type:
    :   float

    Returns: The x\_g coordinate of the centroid.

mesh\_body(*method='quad'*, *tangential\_resolution=36*)
:   Meshes the fuselage as a solid (thickened) body.

    Uses the (points, faces) standard mesh format. For reference on this format, see the documentation in
    aerosandbox.geometry.mesh\_utilities.

    Parameters:
    :   - **method** –

          A string, which determines whether to mesh the fuselage as a series of quadrilaterals or triangles.

          - ”quad” meshes the fuselage as a series of quadrilaterals.
          - ”tri” meshes the fuselage as a series of triangles.
        - **tangential\_resolution** (*int*) – An integer, which determines the number of points to use to mesh each cross-section.

    Return type:
    :   Tuple[aerosandbox.geometry.common.np.ndarray, aerosandbox.geometry.common.np.ndarray]

    Returns: Standard unstructured mesh format: A tuple of`points` and faces, where:

    > - points is a n x 3 array of points, where n is the number of points in the mesh.
    > - faces is a m x 3 array of faces if method is “tri”, or a m x 4 array of faces if method is “quad”.
    >
    >   > - Each row of faces is a list of indices into points, which specifies a face.

mesh\_line(*y\_nondim=0.0*, *z\_nondim=0.0*)
:   Returns points along a line that goes through each of the FuselageXSec objects in this Fuselage.

    Parameters:
    :   - **y\_nondim** (*Union**[**float**,* *List**[**float**]**]*) – The nondimensional (width-normalized) y-coordinate that the line should go through. Can either
        - **cross-sections** (*be a single value used at all*) –
        - **the** (*or can be an iterable* *of* *values to be used at*) –
        - **cross-sections.** (*respective*) –
        - **z\_nondim** (*Union**[**float**,* *List**[**float**]**]*) – The nondimensional (height-normalized) z-coordinate that the line should go through. Can either
        - **cross-sections** –
        - **the** –
        - **cross-sections.** –

    Return type:
    :   List[aerosandbox.geometry.common.np.ndarray]

    Returns: A list of points, where each point is a 3-element array of the form [x, y, z]. Goes from the nose
    to the tail.

draw(*\*args*, *\*\*kwargs*)
:   An alias to the more general Airplane.draw() method. See there for documentation.

    Parameters:
    :   - **\*args** – Arguments to pass through to Airplane.draw()
        - **\*\*kwargs** – Keyword arguments to pass through to Airplane.draw()

    Returns: Same return as Airplane.draw()

draw\_wireframe(*\*args*, *\*\*kwargs*)
:   An alias to the more general Airplane.draw\_wireframe() method. See there for documentation.

    Parameters:
    :   - **\*args** – Arguments to pass through to Airplane.draw\_wireframe()
        - **\*\*kwargs** – Keyword arguments to pass through to Airplane.draw\_wireframe()

    Returns: Same return as Airplane.draw\_wireframe()

draw\_three\_view(*\*args*, *\*\*kwargs*)
:   An alias to the more general Airplane.draw\_three\_view() method. See there for documentation.

    Parameters:
    :   - **\*args** – Arguments to pass through to Airplane.draw\_three\_view()
        - **\*\*kwargs** – Keyword arguments to pass through to Airplane.draw\_three\_view()

    Returns: Same return as Airplane.draw\_three\_view()

subdivide\_sections(*ratio*, *spacing\_function=np.linspace*)
:   Generates a new Fuselage that subdivides the existing sections of this Fuselage into several smaller ones. Splits
    each section into N=`ratio` smaller subsections by inserting new cross-sections (xsecs) as needed.

    This can allow for finer aerodynamic resolution of sectional properties in certain analyses.

    Parameters:
    :   - **ratio** (*int*) – The number of new sections to split each old section into.
        - **spacing\_function** (*Callable**[**[**float**,* *float**,* *float**]**,* *aerosandbox.geometry.common.np.ndarray**]*) –

          A function that takes in three arguments: the start, end, and number of points to generate.

          The default is np.linspace, which generates a linearly-spaced array of points.

          Other options include np.cosspace, which generates a cosine-spaced array of points.

    Return type:
    :   [Fuselage](#aerosandbox.geometry.fuselage.Fuselage)

    Returns: A new Fuselage object with subdivided sections.

\_compute\_frame\_of\_FuselageXSec(*index*)
:   Computes the local frame of a FuselageXSec, given the index of the FuselageXSec in the Fuselage.xsecs list.

    Parameters:
    :   **index** (*int*) – The index of the FuselageXSec in the Fuselage.xsecs list.

    Return type:
    :   Tuple[aerosandbox.geometry.common.np.ndarray, aerosandbox.geometry.common.np.ndarray, aerosandbox.geometry.common.np.ndarray]

    Returns: A tuple:
    :   xg\_local: The x-axis of the local coordinate frame, in aircraft geometry axes.
        yg\_local: The y-axis of the local coordinate frame, in aircraft geometry axes.
        zg\_local: The z-axis of the local coordinate frame, in aircraft geometry axes.

class aerosandbox.geometry.fuselage.FuselageXSec(xyz_c=None, xyz_normal=None, radius=None, width=None, height=None, shape=2.0, analysis_specific_options=None) : Bases: aerosandbox.AeroSandboxObject

code
Definition for a fuselage cross-section (“X-section”).

Parameters:
:   - **xyz\_c** (*Union**[**aerosandbox.geometry.common.np.ndarray**,* *List**[**float**]**]*) –
    - **xyz\_normal** (*Union**[**aerosandbox.geometry.common.np.ndarray**,* *List**[**float**]**]*) –
    - **radius** (*float*) –
    - **width** (*float*) –
    - **height** (*float*) –
    - **shape** (*float*) –
    - **analysis\_specific\_options** (*Optional**[**Dict**[**type**,* *Dict**[**str**,* *Any**]**]**]*) –

xyz\_c

xyz\_normal

shape *= 2.0*

analysis\_specific\_options *= None*

\_\_repr\_\_()
:   Return type:
    :   str

xsec\_area()
:   Computes the FuselageXSec’s cross-sectional (xsec) area.

    The computation method is a closed-form approximation for the area of a superellipse. The exact equation for
    the area of a superellipse with shape parameter s is:

    > area = width \* height \* (gamma(1 + 1/n))^2 / gamma(1 + 2/n)

    where gamma() is the gamma function. The gamma function is (relatively) computationally expensive to evaluate
    and differentiate, so we replace this area calculation with a closed-form approximation (with essentially no
    loss in accuracy):

    > area = width \* height / (s^-1.8717618013591173 + 1)

    This approximation has the following properties:

    > - It is numerically exact for the case of s = 1 (a diamond)
    > - It is numerically exact for the case of s = 2 (a circle)
    > - It is correct in the asymptotic limit where s -> infinity (a square)
    > - In the range of sensible s values (1 < s < infinity), its error is less than 0.6%.
    > - It always produces a positive area for any physically-meaningful value of s (s > 0). In the range of s
    >
    > values where s is physically-meaningful but not in a sensible range (0 < s < 1), this equation will
    > over-predict area.

    The value of the constant seen in this expression (1.872…) is given by log(4/pi - 1) / log(2), and it is
    chosen as such so that the expression is exactly correct in the s=2 (circle) case.

    Returns:

xsec\_perimeter()
:   Computes the FuselageXSec’s perimeter. (“Circumference” in the case of a circular cross-section.)

    The computation method is a closed-form approximation for the perimeter of a superellipse. The exact equation
    for the perimeter of a superellipse is quite long and is not repeated here for brevity; a Google search will
    bring it up. More importantly, this exact equation can only be represented as an infinite sum - not
    particularly useful for fast computation.

    We replace this exact equation with the following closed-form approximation obtained from symbolic regression:

    > Imagine a superellipse centered on the origin of a 2D plane. Now, imagine that the superellipse is
    > stretched such that the first quadrant (e.g., x>0, y>0) goes from (1, 0) to (0, h). Assume it has shape
    > parameter s (where, as a reminder, s=1 is a diamond, s=2 is a circle, s=Inf is a square).
    >
    > Then, the perimeter of that single quadrant is:
    >
    > h + (((((s-0.88487077) \* h + 0.2588574 / h) ^ exp(s / -0.90069205)) + h) + 0.09919785) ^ (-1.4812293 / s)
    >
    > See AeroSandbox/studies/SuperellipseProperties for details about how this was obtained.

    We can extrapolate from here to the general case of a superellipse, as shown in the code below.

    This approximation has the following properties:

    > - For the s=1 case (diamond), the error is +0.2%.
    > - For the s=2 case (circle), the error is -0.1%.
    > - In the s -> infinity limit (square), the error is +0.1%.

    Returns:

compute\_frame()
:   Computes the local coordinate frame of the FuselageXSec, in aircraft geometry axes.

    xg\_local is aligned with the FuselageXSec’s normal vector.

    zg\_local is roughly aligned with the z-axis of the aircraft geometry axes, but projected onto the FuselageXSec’s plane.

    yg\_local is the cross product of zg\_local and xg\_local.

    Returns: A tuple:
    :   xg\_local: The x-axis of the local coordinate frame, in aircraft geometry axes.
        yg\_local: The y-axis of the local coordinate frame, in aircraft geometry axes.
        zg\_local: The z-axis of the local coordinate frame, in aircraft geometry axes.

    Return type:
    :   Tuple[aerosandbox.geometry.common.np.ndarray, aerosandbox.geometry.common.np.ndarray, aerosandbox.geometry.common.np.ndarray]

get\_3D\_coordinates(*theta=None*)
:   Samples points from the perimeter of this FuselageXSec.

    Parameters:
    :   - **theta** (*Union**[**float**,* *aerosandbox.geometry.common.np.ndarray**]*) – Coordinate in the tangential-ish direction to sample points at. Given in the 2D FuselageXSec
        - **system** (*coordinate*) –

          - y\_2D points along the (global) y\_g
          - z\_2D points along the (global) z\_g

          In other words, a value of:

          > - theta=0 -> samples points from the right side of the FuselageXSec
          > - theta=pi/2 -> samples points from the top of the FuselageXSec
          > - theta=pi -> samples points from the left side of the FuselageXSec
          > - theta=3pi/2 -> samples points from the bottom of the FuselageXSec
        - **where** –

          - y\_2D points along the (global) y\_g
          - z\_2D points along the (global) z\_g

          In other words, a value of:

          > - theta=0 -> samples points from the right side of the FuselageXSec
          > - theta=pi/2 -> samples points from the top of the FuselageXSec
          > - theta=pi -> samples points from the left side of the FuselageXSec
          > - theta=3pi/2 -> samples points from the bottom of the FuselageXSec

    Return type:
    :   Tuple[Union[float, aerosandbox.geometry.common.np.ndarray]]

    Returns: Points sampled from the perimeter of the FuselageXSec, as a [x, y, z] tuple.

    > If theta is a float, then each of x, y, and z will be floats.
    >
    > If theta is an array, then x, y, and z will also be arrays of the same size.

equivalent\_radius(*preserve='area'*)
:   Computes an equivalent radius for non-circular cross-sections. This may be necessary when doing analysis that
    uses axisymmetric assumptions.

    Can either hold area or perimeter fixed, depending on whether cross-sectional area or wetted area is more
    important.

    Parameters:
    :   **preserve** –

        One of:

        - ”area”: holds the cross-sectional area constant
        - ”perimeter”: holds the cross-sectional perimeter (i.e., the wetted area of the Fuselage) constant

    Return type:
    :   float

    Returns: An equivalent radius value.

translate(*xyz*)
:   Returns a copy of this FuselageXSec that has been translated by xyz.

    Parameters:
    :   **xyz** (*Union**[**aerosandbox.geometry.common.np.ndarray**,* *List**[**float**]**]*) – The amount to translate the FuselageXSec. Given as a 3-element NumPy vector.

    Return type:
    :   [FuselageXSec](#aerosandbox.geometry.fuselage.FuselageXSec)

    Returns: A copy of this FuselageXSec, translated by xyz.

aerosandbox.geometry.fuselage.fuse