Skip to content

pyflightstream.fsi.sections (stable)

Generated from the docstrings at build time: every one of the 22 names in the __all__ of pyflightstream.fsi.sections has an entry below. The names a guide or an example uses come first; the others follow under Advanced.

Solid section properties of a blade, from its geometry and a material.

Pipeline role: generates the per-station structural distributions of :class:~pyflightstream.fsi.config.BladeProperties instead of having them typed into the configuration. Each station's section is a closed contour in the section frame of :mod:pyflightstream.fsi.config (chordwise toward the leading edge, normal toward the suction side, origin on the pitch axis); :func:solid_section_properties computes its area, centroid, second moments and torsion constant for a SOLID, homogeneous section, and :func:blade_properties_from_sections multiplies them by one entry of :mod:pyflightstream.fsi.materials and records where every number came from beside the distributions.

What is exact and what is numerical. The area, the centroid and the second moments of a polygon are closed forms of its vertices (Green's theorem), exact to rounding for the polygon handed in. The torsion constant J has no closed form for an airfoil, so it is computed numerically from the Prandtl stress function (laplacian(phi) = -2 inside, phi = 0 on the contour, J = 2 integral(phi dA)) with second-order finite differences on a structured grid over the section's bounding box, the grid cut exactly at the polygon (the Shortley-Weller stencil). The grid is recorded with the result, and refining it converges J at second order; the tier 1 suite holds it against the closed forms of the ellipse and the rectangle. The thin-section formula (1/3) integral t^3 ds is computed beside it as a cross-check only and never replaces it.

Stated hypotheses, recorded in the provenance of every generated blade:

  • the section is SOLID and HOMOGENEOUS: the whole contour is filled with one isotropic material. A hollow shell or a spar-and-skin section is a different distribution and is not built here;
  • the elastic axis passes through the CENTROID. The shear centre of a solid section is not computed; the centroid is its exact location for a doubly symmetric section and an approximation otherwise. The sectional center of gravity of a homogeneous section is the centroid, so the generated offset from the elastic axis to the center of gravity is zero;
  • the flapwise bending stiffness is E times the second moment of area about the chordwise axis through the centroid, the axis of flap bending in the section frame.

Stiffness enters ONCE: the generated EI and GJ are the values a typed configuration carries, and :mod:pyflightstream.fsi.beam keeps its unit-moduli material, so no modulus is applied twice.

Only numpy is needed, so this module imports on a base install; the beam that consumes its output needs the [fsi] extra.

Used in the guides

pyflightstream.fsi.sections.obj_group_surface

obj_group_surface(
    path: Path, name: str
) -> tuple[np.ndarray, np.ndarray]

Read the faces of one object or group of an OBJ, as vertices and 0-based triangles.

Polygons are split into a fan of triangles. The vertices are those the group's faces use. A coupled blade is its group of the imported OBJ (FR-3416, FR-3417).

Parameters:

Name Type Description Default
path Path

The OBJ file.

required
name str

The o or g name of the group, a boundary name of the mesh.

required

Returns:

Type Description
tuple of numpy.ndarray

The vertices (v, 3) and the 0-based triangles (f, 3).

Raises:

Type Description
InputValueError

If the file holds no face of name.

Examples:

>>> import tempfile
>>> from pathlib import Path
>>> with tempfile.TemporaryDirectory() as folder:
...     obj = Path(folder) / "blade.obj"
...     _ = obj.write_text("g blade\nv 0 0 0\nv 1 0 0\nv 0 1 0\nf 1 2 3\n")
...     vertices, triangles = obj_group_surface(obj, "blade")
>>> vertices.shape, triangles.tolist()
((3, 3), [[0, 1, 2]])

pyflightstream.fsi.sections.place_on_mesh_cut

place_on_mesh_cut(
    config: FsiConfig,
    vertices: ArrayLike,
    faces: ArrayLike,
    *,
    source: str | Path,
    target: str | Path,
) -> list[list[list[float]]]

Write the FSI input with its section contours moved onto the blade's cut of the mesh.

Each contour of config is translated in its section frame by its :func:contour_mesh_offsets, so its perimeter centroid lies on the mesh cut's; a station whose plane does not cut the mesh keeps its contour. target is written as a copy of the FSI input source (mode = "calculated") whose [sections] table states the moved contours as sections_m in place of sections_m, airfoil or naca, and whose geometry_source says the contours were placed on the mesh cut; a comment line opening the table names the key the contours replaced (the naca designation, the airfoil, or the earlier sections_m). Every other line of source is kept. source is written only when target is the same path.

Parameters:

Name Type Description Default
config FsiConfig

The configuration source resolves to, whose blade carries section_contours_m.

required
vertices array_like

The blade's surface as imported: vertices (v, 3) [m] and 0-based triangles (f, 3).

required
faces array_like

The blade's surface as imported: vertices (v, 3) [m] and 0-based triangles (f, 3).

required
source str or Path

The FSI input the contours come from.

required
target str or Path

Where the placed input is written.

required

Returns:

Type Description
list of list of list of float

Per station, the (chordwise, normal) points [m] written as sections_m.

Raises:

Type Description
FsiInputError

If the blade carries no section contours, or source holds no [sections] table of as many stations.

Examples:

A blade mesh whose sections sit 4 mm toward the suction side of the stated contours:

>>> import math, tempfile
>>> from pathlib import Path
>>> import numpy as np
>>> from pyflightstream.workspace.fsi_setup import load_fsi_setup
>>> text = "\n".join([
...     'mode = "calculated"', 'material = "ti-6al-4v-grade5-annealed"',
...     "[config]", "blade_count = 2", "omega_rad_per_s = 100.0", "[sections]",
...     "station_radii_m = [0.3, 0.6, 0.9]", "chord_m = [0.2, 0.15, 0.1]",
...     "geometric_pitch_deg = [30.0, 20.0, 10.0]", 'naca = "4412"',
...     "pitch_axis_chord_fraction = 0.25", 'geometry_source = "NACA 4412"',
...     "torsion_grid_cells = 16", ""])
>>> with tempfile.TemporaryDirectory() as folder:
...     source = Path(folder) / "f001.toml"
...     _ = source.write_text(text, encoding="utf-8")
...     config = load_fsi_setup(source)
...     vertices, faces = [], []
...     stations = zip([0.3, 0.6, 0.9], [30.0, 20.0, 10.0], config.blade.section_contours_m)
...     for radius, pitch, contour in stations:
...         beta, base, n = math.radians(pitch), len(vertices), len(contour)
...         lead = np.array([-math.sin(beta), -math.cos(beta), 0.0])
...         suction = np.array([-math.cos(beta), math.sin(beta), 0.0])
...         for z in (radius - 0.02, radius + 0.02):
...             vertices += [c * lead + (s + 0.004) * suction + (0, 0, z) for c, s in contour]
...         for i in range(n):
...             j = (i + 1) % n
...             faces.append((base + i, base + j, base + n + j))
...             faces.append((base + i, base + n + j, base + n + i))
...     placed = place_on_mesh_cut(
...         config, vertices, faces, source=source, target=Path(folder) / "f002.toml"
...     )
>>> len(placed)
3

Advanced

pyflightstream.fsi.sections.BENDING_STIFFNESS_RULE module-attribute

BENDING_STIFFNESS_RULE = "EI = E * second moment of area about the chordwise axis through the centroid (flap bending); GJ = G * J; mass per length = rho * A; mass moments per length = rho * principal second moments of area"

pyflightstream.fsi.sections.CONTOUR_PLACEMENT_TOLERANCE_M module-attribute

CONTOUR_PLACEMENT_TOLERANCE_M = 0.005

pyflightstream.fsi.sections.DEFAULT_TORSION_GRID_CELLS module-attribute

DEFAULT_TORSION_GRID_CELLS = 64

pyflightstream.fsi.sections.ELASTIC_AXIS_HYPOTHESIS module-attribute

ELASTIC_AXIS_HYPOTHESIS = "hypothesis: the elastic axis passes through the centroid of each section; the shear centre is not computed (the centroid is its exact location for a doubly symmetric section only). The center of gravity of a homogeneous section is its centroid, so the offset from the elastic axis to the center of gravity is zero"

pyflightstream.fsi.sections.MAX_TORSION_GRID_CELLS_LONG module-attribute

MAX_TORSION_GRID_CELLS_LONG = 2048

pyflightstream.fsi.sections.MeshSections dataclass

MeshSections(
    requested_radii_m: list[float],
    station_radii_m: list[float],
    chord_m: list[float],
    geometric_pitch_deg: list[float],
    sections_m: list[list[list[float]]],
    trailing_edge_closed: list[bool],
    left_out_radii_m: list[float],
)

A blade's sections cut from its mesh by :func:sections_from_mesh.

Attributes:

Name Type Description
requested_radii_m list of float

The evenly spaced radii asked for, root to tip [m].

station_radii_m list of float

The radius each kept section was cut at [m]: the requested one, or the nearest radius whose cut closes when the requested one does not.

chord_m, geometric_pitch_deg list of float

Chord [m] and geometric pitch [deg] of each kept section.

sections_m list of list of list of float

Each kept section's contour, (toward the leading edge, toward the suction side) [m] about the pitch axis, the frame of BladeProperties.section_contours_m.

trailing_edge_closed list of bool

Per kept section, whether its trailing edge was open in the mesh and closed by the segment joining its two sides.

left_out_radii_m list of float

The requested radii with no closed cut within half the distance to each neighbour.

pyflightstream.fsi.sections.PolygonMoments dataclass

PolygonMoments(
    area_m2: float,
    centroid_chordwise_m: float,
    centroid_normal_m: float,
    second_moment_flap_m4: float,
    second_moment_chord_m4: float,
    product_moment_m4: float,
)

Exact area properties of a polygonal section.

All second moments are about axes through the centroid, in the section frame of the contour (x chordwise, z normal).

Attributes:

Name Type Description
area_m2 float

Area A [m^2].

centroid_chordwise_m, centroid_normal_m float

Centroid in the contour's coordinates [m].

second_moment_flap_m4 float

Integral of z^2 dA about the chordwise centroidal axis [m^4]: the stiffness against flap bending (deflection normal to the chord).

second_moment_chord_m4 float

Integral of x^2 dA about the normal centroidal axis [m^4]: the stiffness against in-plane (chordwise) bending.

product_moment_m4 float

Integral of x z dA about the centroid [m^4]; zero for a section symmetric about either axis.

principal_max_m4 property

principal_max_m4: float

Larger principal second moment of area [m^4].

principal_min_m4 property

principal_min_m4: float

Smaller principal second moment of area [m^4].

principal_angle_rad property

principal_angle_rad: float

Angle of the principal axis of the SMALLER second moment [rad].

Measured from the chordwise axis toward the normal axis; zero for a section symmetric about its chord line, where that axis is the chordwise one.

pyflightstream.fsi.sections.SECTION_MODEL module-attribute

SECTION_MODEL = "solid homogeneous section: the whole contour is filled with one isotropic, linear elastic material"

pyflightstream.fsi.sections.SolidSectionProperties dataclass

SolidSectionProperties(
    moments: PolygonMoments,
    torsion: TorsionConstant,
    thin_section_torsion_m4: float,
)

Everything the blade properties need from one solid section.

Attributes:

Name Type Description
moments PolygonMoments

Exact area, centroid and second moments.

torsion TorsionConstant

Numerical torsion constant and its grid.

thin_section_torsion_m4 float

The thin-section estimate (1/3) integral t^3 ds [m^4], a cross-check on :attr:torsion and never a substitute for it.

pyflightstream.fsi.sections.TORSION_METHOD module-attribute

TORSION_METHOD = "Prandtl stress function: laplacian(phi) = -2 inside the contour, phi = 0 on it, J = 2 * integral(phi dA); second-order finite differences (Shortley-Weller) on a structured grid over the section's bounding box with nodes at the cell centres and the boundary distances cut exactly at the polygon, solved directly; the integral by the trapezoidal rule along each grid row closed at the polygon, then across the rows. The thin-section formula (1/3) integral t^3 ds is a cross-check only"

pyflightstream.fsi.sections.TorsionConstant dataclass

TorsionConstant(
    torsion_constant_m4: float,
    grid_cells: tuple[int, int],
    unknowns: int,
)

Saint-Venant torsion constant of a solid section, computed numerically.

Attributes:

Name Type Description
torsion_constant_m4 float

J [m^4]; the torsional stiffness is G J.

grid_cells tuple of (int, int)

(cells along the longer side, cells across the shorter side) of the section's bounding box.

unknowns int

Grid nodes strictly inside the contour, where phi was solved.

pyflightstream.fsi.sections.airfoil_section_contour

airfoil_section_contour(
    unit_contour: ArrayLike,
    *,
    chord_m: float,
    pitch_axis_chord_fraction: float = 0.25,
) -> NDArray[np.float64]

Place a unit-chord airfoil contour in the blade's section frame.

Airfoil coordinates run from the leading edge (x/c = 0) to the trailing edge (x/c = 1) with the upper surface at positive z/c; the section frame of :mod:pyflightstream.fsi.config has its chordwise axis pointing toward the LEADING edge and its origin on the pitch axis. This is the one conversion between the two, so the sign of the chordwise offsets cannot be got wrong at every call site.

Parameters:

Name Type Description Default
unit_contour (array_like, shape(n, 2))

Closed contour in (x/c, z/c), the upper surface being the suction side, for example :func:pyflightstream.qa.geometry.naca4_contour.

required
chord_m float

Local chord [m].

required
pitch_axis_chord_fraction float

Chordwise position of the pitch axis as a fraction of chord from the leading edge; 0.25 is the quarter chord.

0.25

Returns:

Type Description
(ndarray, shape(n, 2))

(chordwise toward the leading edge, normal toward the suction side) [m], origin on the pitch axis.

Raises:

Type Description
FsiInputError

If the contour is not an (n, 2) array, the chord is not a positive length, or the pitch-axis fraction is outside [0, 1].

Examples:

>>> from pyflightstream.qa.geometry import naca4_contour
>>> contour = airfoil_section_contour(naca4_contour("0012", 21), chord_m=0.1)
>>> contour.shape, round(float(contour[:, 0].max()), 4), round(float(contour[:, 0].min()), 4)
((43, 2), 0.025, -0.075)

pyflightstream.fsi.sections.blade_properties_from_sections

blade_properties_from_sections(
    station_radii_m: Sequence[float],
    *,
    sections_m: Sequence[ArrayLike],
    chord_m: Sequence[float],
    geometric_pitch_deg: Sequence[float],
    material: Material | str,
    geometry_source: str,
    geometry_file: str | Path | None = None,
    torsion_grid_cells: int = DEFAULT_TORSION_GRID_CELLS,
) -> BladeProperties

Generate a blade's structural distributions from its sections and a material.

At every station the solid section's properties (:func:solid_section_properties) are multiplied by the material: bending stiffness E I about the chordwise centroidal axis, torsional stiffness G J, running mass rho A, and mass moments of inertia per length rho times the larger (inertia_major_kg_m) and the smaller (inertia_minor_kg_m) principal second moment. The elastic axis is placed at the centroid, a stated hypothesis (:data:ELASTIC_AXIS_HYPOTHESIS), so the elastic-axis offset from the pitch axis is the centroid's position in the section frame and the offset from the elastic axis to the center of gravity is zero. The provenance of all of it (the material entry and its source, the geometry and its sha256 when a file, the hypotheses, the torsion method and grid per station) is recorded in :attr:BladeProperties.provenance.

The stiffnesses are the values a typed configuration would carry: the beam applies them through its unit-moduli material, so the modulus enters once, here.

Source: the flexural rigidity E I and the torsional rigidity G J of Saint-Venant beam theory, S. P. Timoshenko and J. N. Goodier, "Theory of Elasticity", 3rd ed., McGraw-Hill, 1970, Chapter 10 for G J; the mass and the mass moments per unit length of a homogeneous section are its density times its area and its second moments of area. [REF-08]

Parameters:

Name Type Description Default
station_radii_m sequence of float

Radial stations [m], root to tip, as in :attr:BladeProperties.station_radii_m.

required
sections_m sequence of array_like, shape (n, 2) each

One closed contour per station in the section frame (chordwise toward the leading edge, normal toward the suction side), with the pitch axis at the origin; :func:airfoil_section_contour places an airfoil there.

required
chord_m sequence of float

Local chord per station [m].

required
geometric_pitch_deg sequence of float

Built-in geometric pitch per station [deg].

required
material Material or str

An entry of :mod:pyflightstream.fsi.materials, or its key.

required
geometry_source str

What the contours were built or read from, in words. It enters the configuration's sha256, so describe the geometry and leave machine paths out of it.

required
geometry_file str or Path

The file the contours were read from, when there is one; its sha256 and its name (not its path) are recorded.

None
torsion_grid_cells int

Cells across the shorter side of every section for the torsion solve (:func:torsion_constant).

DEFAULT_TORSION_GRID_CELLS

Returns:

Type Description
BladeProperties

Validated distributions with their provenance, carrying the contours as section_contours_m.

Raises:

Type Description
FsiInputError

If a per-station sequence has a different count than the radii, geometry_source is empty, or geometry_file is not a file.

Examples:

>>> from pyflightstream.fsi.sections import blade_properties_from_sections
>>> plate = [(0.02, 0.002), (-0.02, 0.002), (-0.02, -0.002), (0.02, -0.002)]
>>> blade = blade_properties_from_sections(
...     [0.1, 0.5], sections_m=[plate, plate], chord_m=[0.04, 0.04],
...     geometric_pitch_deg=[20.0, 10.0], material="ti-6al-4v-grade5-annealed",
...     geometry_source="a flat 40 x 4 mm plate",
... )
>>> round(blade.mass_per_length_kg_per_m[0], 4)
0.7088
>>> blade.provenance.material.key
'ti-6al-4v-grade5-annealed'

pyflightstream.fsi.sections.contour_mesh_offsets

contour_mesh_offsets(
    config: FsiConfig, vertices: ArrayLike, faces: ArrayLike
) -> list[tuple[float, float] | None]

Return how far each placed section contour lies from the blade's cut of the mesh.

The package places a station's contour (c, n) at origin + r span + c e_le + n e_suction (:func:pyflightstream.fsi.nodes.node_positions, the axes of :func:pyflightstream.fsi.nodes.config_triads). The mesh is cut by the plane through origin + r span normal to the span; the offset is the translation, in the section frame, that carries the perimeter centroid of the placed contour onto that of the cut. The perimeter centroid moves with a translation exactly, so a contour that is the mesh's own section, displaced, gives that displacement.

Parameters:

Name Type Description Default
config FsiConfig

A configuration whose blade carries section_contours_m.

required
vertices array_like

The blade's surface as imported: vertices (v, 3) [m] and 0-based triangles (f, 3).

required
faces array_like

The blade's surface as imported: vertices (v, 3) [m] and 0-based triangles (f, 3).

required

Returns:

Type Description
list

Per station, (toward_leading_edge_m, toward_suction_m), or None where the station's plane does not cut the mesh.

Raises:

Type Description
FsiInputError

If the blade carries no section contours.

pyflightstream.fsi.sections.polygon_area_moments

polygon_area_moments(
    contour_m: ArrayLike,
) -> PolygonMoments

Area, centroid and centroidal second moments of a polygon, exactly.

The contour may be open or closed (a repeated first point is dropped) and in either orientation; it must be a simple polygon. The second moments are summed over vertices already moved to the centroid, which keeps them exact to rounding rather than a difference of two large parallel-axis terms.

Source: the vertex formulas obtained from Green's theorem for the moments of a simple polygon, C. Steger, "On the Calculation of Arbitrary Moments of Polygons", Technical Report FGBV-96-05, Technische Universitaet Muenchen, 1996. [REF-07]

Parameters:

Name Type Description Default
contour_m (array_like, shape(n, 2))

Vertices (chordwise, normal) [m].

required

Returns:

Type Description
PolygonMoments

Area, centroid and second moments about the centroid.

pyflightstream.fsi.sections.sections_from_mesh

sections_from_mesh(
    vertices_m: ArrayLike,
    faces: ArrayLike,
    stations: int,
    *,
    where: str = "the blade",
) -> MeshSections

Cut a blade's sections from its mesh at evenly spaced radii (PFS-2185.11).

The blade lies along +z from the hub at the origin with the shaft along x, the rotor frame :func:pyflightstream.fsi.nodes.config_triads places its sections in. The mesh is cut by planes normal to the span; the stations are stations radii evenly spaced from the first closed cut at the root to the last at the tip. A station whose cut does not close moves to the nearest radius whose cut closes, within half the distance to each neighbouring station; a station with no closed cut in that window is left out. Both are warned, naming the radii.

Each cut is chained into loops through the mesh's own edges. The loop around the beam axis (else the largest) is the section, and the other pieces of the cut are warned. A cut left open at its thin end, by less than 5 percent of its extent, is a trailing edge left open and is closed by the segment joining its two sides; the polygon checks of :func:solid_section_properties refuse a degenerate loop, which does not close. The trailing edge is the thinner end of the longest chord of the loop (its middle when closed by a segment), the leading edge the vertex farthest from it, the chord the line between them and the geometric pitch its angle, toward the leading edge (-sin b, -cos b, 0). The contour is the loop's own points stated toward the leading edge and toward the suction side, about the pitch axis, so :func:contour_mesh_offsets of a config built from it is zero.

Parameters:

Name Type Description Default
vertices_m (array_like, shape(v, 3))

The blade's vertices [m] about the hub.

required
faces (array_like, shape(f, 3))

Its triangles, 0-based.

required
stations int

How many evenly spaced radii to cut.

required
where str

What the warnings and the refusal name, such as "blade.obj family Blade1".

'the blade'

Returns:

Type Description
MeshSections

The kept sections and the radii asked for, moved and left out.

Raises:

Type Description
FsiInputError

If fewer than two stations are usable, naming the radii tried.

Examples:

A straight blade from r = 0.1 to 0.5 m, a 40 mm four-sided section turned 30 deg:

>>> import math
>>> import numpy as np
>>> beta = math.radians(30.0)
>>> lead = np.array([-math.sin(beta), -math.cos(beta)])
>>> suction = np.array([-math.cos(beta), math.sin(beta)])
>>> corners = [c * lead + n * suction for c, n in
...            [(0.02, 0.0), (0.01, 0.003), (-0.02, 0.0), (0.01, -0.002)]]
>>> vertices = [(x, y, z) for z in (0.1, 0.5) for x, y in corners]
>>> faces = [f for i in range(4) for f in ((i, (i + 1) % 4, 4 + (i + 1) % 4),
...                                         (i, 4 + (i + 1) % 4, 4 + i))]
>>> faces += [(0, 2, 1), (0, 3, 2), (4, 5, 6), (4, 6, 7)]
>>> cut = sections_from_mesh(vertices, faces, 3)
>>> [round(r, 3) for r in cut.station_radii_m], round(cut.geometric_pitch_deg[1], 6)
([0.1, 0.3, 0.5], 30.0)

pyflightstream.fsi.sections.solid_section_properties

solid_section_properties(
    contour_m: ArrayLike,
    *,
    grid_cells: int = DEFAULT_TORSION_GRID_CELLS,
) -> SolidSectionProperties

Area properties, torsion constant and its cross-check of one section.

Parameters:

Name Type Description Default
contour_m (array_like, shape(n, 2))

Vertices (chordwise, normal) [m] of a simple polygon; for a blade, in the section frame with the pitch axis at the origin (:func:airfoil_section_contour).

required
grid_cells int

Cells across the shorter side for :func:torsion_constant.

DEFAULT_TORSION_GRID_CELLS

Returns:

Type Description
SolidSectionProperties

The exact moments, the numerical J and the thin-section estimate.

Examples:

>>> plate = [(0.02, 0.002), (-0.02, 0.002), (-0.02, -0.002), (0.02, -0.002)]
>>> properties = solid_section_properties(plate)
>>> round(properties.moments.area_m2, 8), f"{properties.torsion.torsion_constant_m4:.3e}"
(0.00016, '7.993e-10')

pyflightstream.fsi.sections.thin_section_torsion_estimate

thin_section_torsion_estimate(
    contour_m: ArrayLike, samples: int = 4096
) -> float

Thin-section estimate of the torsion constant, (1/3) integral t^3 ds.

t is the section's thickness measured across its longer bounding-box side, integrated along that side by the midpoint rule over samples stations. Exact in the thin limit of a strip; for a thick or tapering section it differs from the true J, which is why it is a CROSS-CHECK on :func:torsion_constant and never its value: it tells a reader whether the computed J is of the right size.

Source: the torsion of thin sections, J = (1/3) integral t^3 ds, in S. P. Timoshenko and J. N. Goodier, "Theory of Elasticity", 3rd ed., McGraw-Hill, 1970, Chapter 10. [REF-08]

Parameters:

Name Type Description Default
contour_m (array_like, shape(n, 2))

Vertices of a simple polygon [m].

required
samples int

Midpoint-rule stations along the longer side.

4096

Returns:

Type Description
float

The estimate [m^4].

Raises:

Type Description
FsiInputError

If samples is not an integer of at least 2.

pyflightstream.fsi.sections.torsion_constant

torsion_constant(
    contour_m: ArrayLike,
    grid_cells: int = DEFAULT_TORSION_GRID_CELLS,
) -> TorsionConstant

Saint-Venant torsion constant J of a solid polygonal section.

Solves the Prandtl stress function problem, laplacian(phi) = -2 inside the contour with phi = 0 on it, and returns J = 2 integral(phi dA), for which the torsional stiffness is G J. The grid covers the section's bounding box with grid_cells cells across its shorter side and cells of the same size along the longer side (at most :data:MAX_TORSION_GRID_CELLS_LONG); nodes sit at the cell centres. A node next to the contour uses the Shortley-Weller stencil with its exact distance to the polygon along the grid line, which keeps the scheme second-order accurate on a curved or slanted boundary where a staircase grid would be first order. The linear system is block tridiagonal (one block per grid column) and is solved directly, so there is no iteration tolerance. The integral is taken by the trapezoidal rule along every grid row, closed with phi = 0 at the points where the row meets the polygon, then across the rows.

Refining the grid converges J at second order; doubling grid_cells divides the error by about four.

Source: the Prandtl stress function formulation of Saint-Venant torsion and its closed forms for the elliptic and rectangular sections, S. P. Timoshenko and J. N. Goodier, "Theory of Elasticity", 3rd ed., McGraw-Hill, 1970, Chapter 10; the stencil, G. H. Shortley and R. Weller, "The numerical solution of Laplace's equation", Journal of Applied Physics 9, 334-348, 1938. [REF-08], [REF-09]

Parameters:

Name Type Description Default
contour_m (array_like, shape(n, 2))

Vertices of a simple polygon [m], either orientation.

required
grid_cells int

Cells across the shorter side of the bounding box; at least 8.

DEFAULT_TORSION_GRID_CELLS

Returns:

Type Description
TorsionConstant

J [m^4], with the grid it was computed on.

Raises:

Type Description
FsiInputError

If grid_cells is not an integer of at least 8, or the grid places no node inside the section.

pyflightstream.fsi.sections.warn_of_contours_off_the_mesh_cut

warn_of_contours_off_the_mesh_cut(
    config: FsiConfig,
    vertices: ArrayLike,
    faces: ArrayLike,
    *,
    where: str,
    tolerance_m: float = CONTOUR_PLACEMENT_TOLERANCE_M,
) -> list[int]

Warn of each station whose placed contour lies off the mesh cut by over tolerance_m.

One warning names every such station, its radius and its offset toward the leading edge and toward the suction side, and points to :func:place_on_mesh_cut. Never a refusal: the beam is built from the contours as stated.

Parameters:

Name Type Description Default
config FsiConfig

A configuration whose blade carries section_contours_m; one without them is not judged.

required
vertices array_like

The blade's surface as imported.

required
faces array_like

The blade's surface as imported.

required
where str

What the warning is about, such as "case '7001' blade Blade1".

required
tolerance_m float

:data:CONTOUR_PLACEMENT_TOLERANCE_M by default.

CONTOUR_PLACEMENT_TOLERANCE_M

Returns:

Type Description
list of int

The 1-based stations warned of.