pyflightstream.workspace.trailing_edges (stable)¶
Generated from the docstrings at build time: every one of the 6 names in the __all__ of pyflightstream.workspace.trailing_edges has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Trailing-edge extraction from a blade surface mesh.
The rotor axis and hub define the spanwise and tangential directions used to identify the aft end of a section. Returned points are selected mesh vertices and mesh-edge midpoints, expressed in the mesh's own reference frame and length units.
Pipeline role: workspace layer. It turns a surface mesh the user already
has into the trailing-edge points file a geometry names: the mid-point of
every mesh edge on the trailing edge, under a unit line
(:func:pyflightstream.workspace.wake_edges.write_trailing_edge_points),
which the run converts into the node file the wake-edge import reads.
The extraction is the last piece of a rotor campaign that the user had to
do by hand.
MID-POINTS, BECAUSE THAT IS WHAT THE IMPORT MATCHES (RPT-061). The import
marks an edge whose mid-point lies within its tolerance of a point in
the file, and a list of the edges' end vertices marks only the edges shorter
than twice the tolerance (an end vertex lies half an edge length from the
mid-point), which on a mesh of ordinary edges is none. So
:func:trailing_edge_midpoints finds the EDGES: the sections below give
one aftmost vertex each, consecutive ones are joined by the shortest path
along mesh edges that are the aft ridge of both their faces, and each
edge of that path contributes its mid-point.
Extraction uses the section geometry rather than a dihedral-angle criterion. A strongly
twisted blade can have a trailing edge that is not a crease; see
:mod:pyflightstream.script.helpers.
WHAT IS COMPUTED INSTEAD. Given a surface mesh, a rotor axis and a hub position:
- the SPANWISE coordinate of a vertex is its distance from the rotor axis, measured radially from the hub and perpendicular to the axis;
- the vertices are binned into chordwise SECTIONS by that coordinate;
- within each section the CHORDWISE direction is taken from the section's own extent, never from a global axis, which is what makes the answer survive twist;
- the trailing-edge node of the section is the AFTMOST vertex along that direction, and the node list is those vertices ordered by span;
- for the mid-points, an interior mesh edge is a trailing-edge CANDIDATE when the far vertex of each of its two faces lies forward of it, forward meaning against the aft chord of its section with the edge's own direction removed. That is a question about which side of the edge the surface is on, in the rotor frame, and no angle is compared with a threshold;
- consecutive sections' aftmost vertices are joined by the shortest path through candidate edges, the chain is extended past the first and last section along the one outward candidate edge while there is exactly one, and the chain's edges give the mid-points.
It needs vertices, faces and a section plane. It needs no adjacency
angle, no watertightness test and no proximity query, so it runs on a
base install with none of this package's optional extras
(PFS-2025.20.03).
WHICH END OF THE CHORD IS AFT is decided by the rotor frame and not
guessed. A section's extent gives a LINE, which has two ends and no
sign; the sense comes from the tangential direction
axis x radial, and aft is the end AGAINST it. So the axis vector
carries the rotation sense by the right-hand rule, and a rotor turning
the other way is described by passing the axis the other way round. The
sign is resolved once, on the section whose chord is most nearly
tangential (the least twisted one, ordinarily near the tip), and carried
to the other sections by continuity, so a strongly twisted root section
whose chord is nearly axial never has to decide the question on its own.
IT REFUSES RATHER THAN GUESSES. With no axis and hub there is no spanwise direction and no chord direction, so the extraction refuses naming both. Guessing a global axis is exactly how a twisted blade gets the wrong edge silently, which is the failure this capability exists to remove.
WHAT IT IS EVIDENCE ABOUT. The mid-point criterion was scored against the solver's own detection stored in a saved simulation of a twisted blade, and finds exactly the twelve edges the solver marked there; the import itself was run on a straight wing (RPT-061). The twisted blade has not been marked by a file on a licensed machine.
Advanced¶
pyflightstream.workspace.trailing_edges.MINIMUM_SECTION_VERTICES
module-attribute
¶
MINIMUM_SECTION_VERTICES = 3
pyflightstream.workspace.trailing_edges.TrailingEdge
dataclass
¶
TrailingEdge(
nodes: ndarray,
span: ndarray,
axis: ndarray,
hub: ndarray,
sections: int,
)
One extracted trailing edge, and what it was extracted with.
Coordinates are in the MESH's own length units throughout. This
class never learns what that unit is, because the mesh file does not
carry one; the unit is declared when the points file is written
(:func:write_trailing_edge_node_file).
Attributes:
| Name | Type | Description |
|---|---|---|
nodes |
ndarray
|
The trailing-edge node coordinates, shape (n, 3), in the mesh's reference frame and length units, ordered by increasing span. One node per section. |
span |
ndarray
|
Spanwise coordinate of each node, shape (n,), in mesh length units: the distance from the rotor axis, measured perpendicular to it. Increasing, by construction. |
axis |
ndarray
|
The rotor axis the extraction used, shape (3,), normalised to unit length. Its SENSE carries the rotation sense by the right-hand rule; see the module docstring. |
hub |
ndarray
|
The hub position the extraction used, shape (3,), in mesh length units and the mesh's reference frame. |
sections |
int
|
Number of chordwise sections the span was cut into, which is
also |
write_node_file
¶
write_node_file(
path: str | Path, *, unit: str, overwrite: bool = False
) -> Path
Refuse: a list of section vertices marks nothing.
This wrote the extraction's vertices as the node list in legacy releases.
The wake-edge import matches an edge by its MID-POINT, and a file of
the edges' end vertices marks nothing, in silence (RPT-061); the
vertices here are one per section, not even consecutive mesh
vertices, so no pairing of them gives the edges either. The points
file is written from the mesh's edges by
:func:write_trailing_edge_node_file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The destination that is not written. |
required |
unit
|
str
|
Unused. |
required |
overwrite
|
bool
|
Unused. |
False
|
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Always, naming the report and the call that writes the mid-points. |
pyflightstream.workspace.trailing_edges.extract_trailing_edge
¶
extract_trailing_edge(
mesh: Any,
*,
axis: Any = None,
hub: Any = None,
sections: int = DEFAULT_SECTIONS,
) -> TrailingEdge
Extract the trailing edge of a blade mesh in the rotor frame.
The criterion is the aftmost vertex of each chordwise section, with the chordwise direction taken from the section's own extent. Read the module docstring for why it is not a crease criterion and how the aft sense is fixed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
(str, Path or Trimesh)
|
The blade surface, as a mesh file to read ( |
required |
axis
|
array_like
|
REQUIRED. There is no default and the Rotor axis of rotation, three components in the mesh's reference
frame. Normalised internally, so only the direction matters, but
the SENSE matters: the rotor is taken to turn the right-handed
way about it, and that is what decides which end of the chord is
aft. It is a second vocabulary for which way a rotor turns,
beside the sign a matrix row states in |
None
|
hub
|
array_like
|
REQUIRED, on the same terms as |
None
|
sections
|
int
|
Number of chordwise sections to cut the span into, which is the number of nodes returned. At least two: one section yields one point, and a single point names no edge. |
DEFAULT_SECTIONS
|
Returns:
| Type | Description |
|---|---|
TrailingEdge
|
The node list and what it was extracted with. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If NOT among them, and named because the list would otherwise read as exhaustive of what can go wrong: two sections choosing one vertex. The sections partition the vertices, so that cannot happen; it is an internal invariant rather than a refusal (see the comment at the end of this function). |
Examples:
>>> from pyflightstream.workspace.trailing_edges import extract_trailing_edge
>>> edge = extract_trailing_edge(
... "blade.obj", axis=(0.0, 0.0, 1.0), hub=(0.0, 0.0, 0.0)
... )
>>> edge.nodes.shape
(20, 3)
pyflightstream.workspace.trailing_edges.trailing_edge_midpoints
¶
trailing_edge_midpoints(
mesh: Any,
*,
axis: Any = None,
hub: Any = None,
sections: int = DEFAULT_SECTIONS,
) -> numpy.ndarray
Return the mid-point of every mesh edge on a blade's trailing edge.
The form the wake-edge import matches (RPT-061): an edge is marked when a point in the file lies within the tolerance of its mid-point, and the edges' end vertices mark nothing. The criterion is in the module docstring: the aftmost vertex of each chordwise section, joined section to section along the edges that are the aft ridge of both their faces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
(str, Path or Trimesh)
|
The blade surface, as a mesh file to read ( |
required |
axis
|
array_like
|
REQUIRED. Rotor axis of rotation; see :func: |
None
|
hub
|
array_like
|
REQUIRED. A point on the axis of rotation; see
:func: |
None
|
sections
|
int
|
Chordwise sections the span is cut into. Unlike the vertex extraction it does NOT set how many points come back: every mesh edge on the trailing edge gives one, whatever the count, as long as each section holds a vertex of it. |
DEFAULT_SECTIONS
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The mid-points, shape (m, 3), in the mesh's reference frame and length unit, in order along the edge from the root to the tip. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Every refusal of :func: |
Examples:
>>> from pyflightstream.workspace.trailing_edges import trailing_edge_midpoints
>>> points = trailing_edge_midpoints(
... "blade.obj", axis=(0.0, 0.0, 1.0), hub=(0.0, 0.0, 0.0)
... )
pyflightstream.workspace.trailing_edges.write_trailing_edge_node_file
¶
write_trailing_edge_node_file(
mesh: Any,
path: str | Path,
*,
axis: Any = None,
hub: Any = None,
unit: str,
sections: int = DEFAULT_SECTIONS,
overwrite: bool = False,
) -> Path
Extract a blade's trailing edge and write it as its points file.
The whole route PFS-2025.16 names, in one call: read the mesh,
find the mid-point of every mesh edge on the trailing edge
(:func:trailing_edge_midpoints), and write them under a unit line
(:func:pyflightstream.workspace.wake_edges.write_trailing_edge_points),
the points file a geometry names. The run converts it into the node
file the wake-edge import reads. Nothing of the mesh library crosses
into the file: what is written is coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
(str, Path or Trimesh)
|
The blade surface; see :func: |
required |
path
|
str or Path
|
Destination points file. |
required |
axis
|
array_like
|
Rotor axis of rotation; see :func: |
None
|
hub
|
array_like
|
A point on the axis of rotation; see
:func: |
None
|
unit
|
str
|
Length unit the MESH coordinates are in, one of
:func: |
required |
sections
|
int
|
Number of chordwise sections; see :func: |
DEFAULT_SECTIONS
|
overwrite
|
bool
|
Replace an existing destination. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The file written. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Every refusal of :func: |
Examples:
>>> from pyflightstream.workspace.trailing_edges import (
... write_trailing_edge_node_file,
... )
>>> write_trailing_edge_node_file(
... "blade.obj",
... "blade.te.txt",
... axis=(0.0, 0.0, 1.0),
... hub=(0.0, 0.0, 0.0),
... unit="METER",
... )