Skip to content

pyflightstream.fsi.nodes (stable)

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

Structural node file and FSIDisp ordering map, from one generator (WP5).

Pipeline role: FlightStream imports a structural node list per blade and later applies FSIDisp.txt translations to the nodes in exactly the import order (RPT-005 finding 5). Any disagreement between the file that was imported and the order the displacements are written in is a silent geometry corruption, so both come from the same generator reading the same configuration: :func:generate_node_layout builds the :class:NodeOrderingMap, and the node file, the serialized map, and the FSIDisp.txt writer all derive from it (FSI-R14).

Layout: three nodes per radial station (elastic axis, leading-edge offset, trailing-edge offset; DLV-007 Section 4.4), stations from root to tip. Every blade shares the same local coordinates in its own rotating frame, so one node file serves all blades: the import is repeated once per blade frame, in blade order, and the flat FSIDisp.txt rows follow that same blade-major order.

Geometric embedding: the beam solution lives in the section axes of :mod:pyflightstream.fsi.config (chordwise toward the leading edge, normal toward the suction side, span root to tip), but the import frame of a spinning blade is the rotor convention of the WP7 pilot evidence (RPT-006 finding 3): X along the rotor axis, Y in-plane, Z spanwise, with the section rotated by the local blade angle beta(r) about the span axis. The per-station triad (toward-LE, toward-suction, span) is therefore (-sin b, -cos b, 0), (-cos b, sin b, 0), (0, 0, 1); positions and translations embed as components along it, which keeps the scalar twist encoding dy = w + theta d exact (nose-up is the rotation about -Z for this geometry, and -theta z x (d toward-LE) = +theta d toward-suction). At Omega zero the embedding is the identity (section_frame), the frame of the wing case and of the dry-run node fixture. A fixed wing (FSI-G) embeds in the package's reference frame, x aft, y right, z up (wing_frame): toward the leading edge is -x and toward the suction side +z, turned nose up by the station's pitch, the span along +y or -y from the wing's origin. The rule choosing the embedding is :func:pyflightstream.fsi.config.frame_embedding, shared with the loads projection so both sides of the interface always agree.

Nodes inside the blade (FSI-1). When the configuration carries the blade's section at every station (BladeProperties.section_contours_m, the contours a calculated blade is generated from), the nodes are placed on that section's camber line: the elastic-axis node at the configured elastic-axis chord fraction (:data:ELASTIC_AXIS_FALLBACK_CHORD_FRACTION when the configured one lies outside :data:ELASTIC_AXIS_CHORD_FRACTION_WINDOW), the leading-edge and trailing-edge nodes at :data:LEADING_EDGE_NODE_CHORD_FRACTION and :data:TRAILING_EDGE_NODE_CHORD_FRACTION. A node moved to the fallback is no longer on the elastic axis the beam is solved about, so the map then keeps the configured elastic axis (NodeOrderingMap.ea_configured_chordwise_m) and the node's flap is written as the rigid section moves it, w + theta (e_node - e_true) (_elastic_axis_node_flap). The embedding at the local twist is unchanged, and so are the node order, the roles and the row count, so the FSIDisp rows keep their meaning. A node set with any node outside its section, or inside it by less than max(:data:MIN_NODE_CLEARANCE_CHORD_FRACTION times chord, :data:MIN_NODE_CLEARANCE_THICKNESS_FRACTION of the local thickness), is refused naming the node (:func:refuse_nodes_outside_sections): a structural node the solver finds outside the surface it morphs is a node the interpolation reads from the wrong side of the skin. Without section geometry the layout is the offset layout described above and no check can be made.

File formats, per the dry-run evidence (RPT-005 finding 5): both the node CSV and FSIDisp.txt are comma separated three-column files, one row per node, no header.

Advanced

pyflightstream.fsi.nodes.ELASTIC_AXIS_CHORD_FRACTION_WINDOW module-attribute

ELASTIC_AXIS_CHORD_FRACTION_WINDOW = (0.2, 0.5)

pyflightstream.fsi.nodes.ELASTIC_AXIS_FALLBACK_CHORD_FRACTION module-attribute

ELASTIC_AXIS_FALLBACK_CHORD_FRACTION = 0.3

pyflightstream.fsi.nodes.EMBEDDINGS module-attribute

EMBEDDINGS = ('section_frame', 'rotor_frame', 'wing_frame')

pyflightstream.fsi.nodes.LEADING_EDGE_NODE_CHORD_FRACTION module-attribute

LEADING_EDGE_NODE_CHORD_FRACTION = 0.1

pyflightstream.fsi.nodes.MIN_NODE_CLEARANCE_CHORD_FRACTION module-attribute

MIN_NODE_CLEARANCE_CHORD_FRACTION = 0.001

pyflightstream.fsi.nodes.MIN_NODE_CLEARANCE_M module-attribute

MIN_NODE_CLEARANCE_M = 0.001

pyflightstream.fsi.nodes.MIN_NODE_CLEARANCE_THICKNESS_FRACTION module-attribute

MIN_NODE_CLEARANCE_THICKNESS_FRACTION = 0.1

pyflightstream.fsi.nodes.NodeClearance dataclass

NodeClearance(
    row: int,
    station: int,
    radius_m: float,
    role: str,
    inside: bool,
    clearance_m: float,
    thickness_m: float,
    required_m: float,
)

Where one structural node sits against its station's section.

Attributes:

Name Type Description
row int

The node's 0-based row in the node file (one blade's import).

station int

Station index, 0-based from the root.

radius_m float

The station's radius [m].

role str

One of :data:~pyflightstream.fsi.kinematics.NODE_ROLES.

inside bool

Whether the node lies inside the section outline.

clearance_m float

Distance from the node to the outline [m].

thickness_m float

Local section thickness at the node's chord fraction [m]; zero where the chord-normal line there misses the section.

required_m float

The clearance the node must keep: max(:data:MIN_NODE_CLEARANCE_CHORD_FRACTION times chord, :data:MIN_NODE_CLEARANCE_THICKNESS_FRACTION times the thickness).

ok property

ok: bool

Whether the node is inside by at least the required clearance.

pyflightstream.fsi.nodes.NodeOrderingMap

Bases: BaseModel

Single source of truth for node identity and FSIDisp row order.

Serialized into the run folder under the node_map_file name of the configuration, so every consumer (the driver, the replay harness, post-processing) reads the same bookkeeping that generated the imported node file (FSI-R14).

Attributes:

Name Type Description
blade_count int

Number of blades; the node file is imported once per blade, in blade order, and the FSIDisp rows are blade-major.

station_radii_m list of float

Radial stations [m], root to tip, as in the configuration.

roles list of str

Per-station node roles in row order; fixed to :data:~pyflightstream.fsi.kinematics.NODE_ROLES and stored so the serialized map is self-describing.

ea_offset_chordwise_m, ea_offset_normal_m list of float

Elastic-axis position per station [m] in the section plane; the elastic-axis node sits there.

le_offset_m, te_offset_m list of float

Chordwise offsets [m] of the leading-edge (positive) and trailing-edge (negative) nodes from the elastic axis.

le_offset_normal_m, te_offset_normal_m list of float or None

Normal position [m] of the leading-edge and trailing-edge nodes in the section plane, when they sit on the camber line of a section-generated layout. None places them at the elastic axis's normal position (the offset layout), and is then not serialised, so a map written before the fields existed reads back and dumps exactly as it did.

embedding str

Geometric embedding of the section frame in the import frame (module docstring): "section_frame" (identity, Omega zero), "rotor_frame" (section rotated by the local blade angle) or "wing_frame" (a fixed wing in the reference frame).

blade_angle_deg list of float or None

Local blade angle beta per station [deg] of the rotor-frame embedding, or the nose-up section pitch of the wing-frame one; None normalizes to zeros (identity sections).

span_sign {1, -1} or None

Which way a wing_frame span runs along y; stated by that embedding alone, and not serialised for any other.

origin_m tuple of float or None

The reference-frame point a wing_frame layout's stations are measured from; None is the origin, and is not serialised.

ea_configured_chordwise_m list of float or None

The configured elastic axis's chordwise position per station [m], stated when a section-generated layout moved an elastic-axis node off it (a configured axis outside :data:ELASTIC_AXIS_CHORD_FRACTION_WINDOW). The beam is solved about the configured axis, so a moved node's flap is w + theta (e_node - e_true) (_elastic_axis_node_flap). None when every node sits on the configured axis, and is then not serialised.

station_count property

station_count: int

Number of radial stations.

nodes_per_blade property

nodes_per_blade: int

Node rows of one blade's import.

total_nodes property

total_nodes: int

FSIDisp row count across all blades.

row_index

row_index(blade: int, station: int, role: str) -> int

Flat FSIDisp row of one node (blade-major, station, role).

Parameters:

Name Type Description Default
blade int

Blade index, 0-based, in import (creation) order.

required
station int

Station index, 0-based from the root.

required
role str

One of :data:~pyflightstream.fsi.kinematics.NODE_ROLES.

required

pyflightstream.fsi.nodes.TRAILING_EDGE_NODE_CHORD_FRACTION module-attribute

TRAILING_EDGE_NODE_CHORD_FRACTION = 0.9

pyflightstream.fsi.nodes.camber_point

camber_point(
    polygon: ndarray, fraction: float
) -> tuple[np.ndarray, float]

Return the camber-line point of a section at a chord fraction, and its thickness.

The line normal to the chord at fraction crosses the section's outline; the camber point is the midpoint of its outermost two crossings and the thickness is their distance.

Parameters:

Name Type Description Default
polygon ndarray

One section, shape (n, 2), in the section frame.

required
fraction float

Chord fraction from the leading edge, strictly between 0 and 1.

required

Returns:

Type Description
tuple of (numpy.ndarray, float)

The (chordwise, normal) point [m] and the local thickness [m].

Raises:

Type Description
FsiInputError

If the chord-normal line at fraction does not cross the outline twice.

pyflightstream.fsi.nodes.config_triads

config_triads(cfg: FsiConfig) -> np.ndarray

Per-station section axes in the import frame, from the configuration.

The rule of :func:station_triads, asked of a configuration without placing any node, so a caller that needs only the axes (the wing's weight, :func:pyflightstream.fsi.wing.weight_loads) reads the same embedding the node file is written in.

Parameters:

Name Type Description Default
cfg FsiConfig

The configuration whose embedding and pitch give the axes.

required

Returns:

Type Description
ndarray

Shape (station_count, 3, 3): per station the toward-leading-edge, toward-suction and span unit vectors.

pyflightstream.fsi.nodes.flatten_blade_translations

flatten_blade_translations(
    node_map: NodeOrderingMap,
    per_blade_translations: list[ndarray],
) -> np.ndarray

Order per-blade station translations into flat FSIDisp rows.

Parameters:

Name Type Description Default
node_map NodeOrderingMap

Layout defining the row order.

required
per_blade_translations list of numpy.ndarray

One array per blade in import order, each shaped (n_stations, 3, 3) as produced by :func:pyflightstream.fsi.kinematics.encode_station_translations.

required

Returns:

Type Description
ndarray

Shape (total_nodes, 3): blade-major, then station, then role, matching the import order (FSI-R14), with the section components embedded along the station triads into the import frame.

Raises:

Type Description
FsiInputError

If the number of blades differs from the map's, or a blade's array is not shaped (n_stations, 3, 3).

pyflightstream.fsi.nodes.generate_node_layout

generate_node_layout(cfg: FsiConfig) -> NodeOrderingMap

Build the node layout of a configuration (FSI-R14 single source).

Three nodes per station. With the blade's sections known (BladeProperties.section_contours_m) they sit on each section's camber line at the chord fractions of the module docstring, and the layout is checked inside its sections before it is returned (:func:refuse_nodes_outside_sections). Without them, the elastic-axis node sits at e(r) in the section plane and the leading-edge and trailing-edge nodes are offset chordwise from it by plus and minus node_offset_chord_fraction of the local chord (DLV-007 Section 4.4). The embedding follows :func:pyflightstream.fsi.config.frame_embedding: a spinning blade embeds its sections at the local blade angle, taken from the geometric pitch distribution.

Parameters:

Name Type Description Default
cfg FsiConfig

Validated configuration.

required

Returns:

Type Description
NodeOrderingMap

The map every node-related file derives from.

Raises:

Type Description
FsiInputError

If a section-generated node lies outside its section, or inside it by less than the clearance, naming the node.

pyflightstream.fsi.nodes.load_node_map

load_node_map(path: str | Path) -> NodeOrderingMap

Load and validate a serialized ordering map.

Parameters:

Name Type Description Default
path str or Path

JSON written by :func:write_node_map.

required

Returns:

Type Description
NodeOrderingMap

The validated map.

pyflightstream.fsi.nodes.node_clearances

node_clearances(
    node_map: NodeOrderingMap,
    sections_m: Sequence[Sequence[Sequence[float]]],
) -> list[NodeClearance]

Measure every serialized node of one blade against its station's section.

The six-decimal import coordinates are projected back to the section plane so rounding cannot turn a passing clearance into an exterior node.

Parameters:

Name Type Description Default
node_map NodeOrderingMap

The layout whose nodes are measured, in the section plane (before the embedding at the local twist, which turns the section and its nodes together).

required
sections_m sequence of polygons

One section per station, (chordwise, normal) points [m] in the section frame (BladeProperties.section_contours_m).

required

Returns:

Type Description
list of NodeClearance

One entry per node row, in the node file's row order.

Raises:

Type Description
FsiInputError

If the number of sections differs from the map's station count.

pyflightstream.fsi.nodes.node_positions

node_positions(node_map: NodeOrderingMap) -> np.ndarray

Local node coordinates of one blade, in file row order.

Parameters:

Name Type Description Default
node_map NodeOrderingMap

Layout from :func:generate_node_layout.

required

Returns:

Type Description
ndarray

Shape (nodes_per_blade, 3) [m] in the import frame: section components (chordwise offset, normal offset, radius) embedded along the station triads of :func:station_triads, stations root to tip, roles in :data:~pyflightstream.fsi.kinematics.NODE_ROLES order.

pyflightstream.fsi.nodes.read_fsidisp

read_fsidisp(
    path: str | Path, expected_rows: int | None = None
) -> np.ndarray

Read an FSIDisp.txt back into translation rows.

Parameters:

Name Type Description Default
path str or Path

Displacement file, comma separated dx,dy,dz per node.

required
expected_rows int

When given (normally NodeOrderingMap.total_nodes), a row count mismatch raises: applying displacements to the wrong node count is exactly the silent corruption FSI-R14 exists to prevent.

None

Returns:

Type Description
ndarray

Shape (n_rows, 3) in file order.

Raises:

Type Description
FsiInputError

If the file is not UTF-8, a line does not hold three values, a field is empty, not a number or not finite, or expected_rows is given and the row count differs.

pyflightstream.fsi.nodes.refuse_nodes_outside_sections

refuse_nodes_outside_sections(
    node_map: NodeOrderingMap,
    sections_m: Sequence[Sequence[Sequence[float]]],
) -> None

Refuse a node set with any node outside its section or too near its skin.

Parameters:

Name Type Description Default
node_map NodeOrderingMap

The layout to check.

required
sections_m sequence of polygons

One section per station, as :func:node_clearances takes them.

required

Raises:

Type Description
FsiInputError

Naming the offending nodes: row, station, radius, role, and the clearance against the one required.

pyflightstream.fsi.nodes.render_node_file

render_node_file(node_map: NodeOrderingMap) -> str

Render the existing import CSV without writing a planning-time file.

Parameters:

Name Type Description Default
node_map NodeOrderingMap

The layout whose nodes are rendered.

required

Returns:

Type Description
str

The node CSV :func:write_node_file writes, one X,Y,Z row per node, ending in a newline.

pyflightstream.fsi.nodes.section_chord_fraction

section_chord_fraction(
    polygon: ndarray, point: ndarray
) -> float

Chord fraction from the leading edge of a point projected on the chord line.

Parameters:

Name Type Description Default
polygon ndarray

One section, shape (n, 2), in the section frame.

required
point ndarray

A point of the section plane, (chordwise, normal) [m].

required

Returns:

Type Description
float

0 at the leading edge, 1 at the trailing edge.

pyflightstream.fsi.nodes.station_triads

station_triads(node_map: NodeOrderingMap) -> np.ndarray

Per-station section axes in the import frame (module docstring).

Parameters:

Name Type Description Default
node_map NodeOrderingMap

Layout from :func:generate_node_layout.

required

Returns:

Type Description
ndarray

Shape (station_count, 3, 3): per station the rows are the toward-leading-edge, toward-suction, and span unit vectors. Identity axes for the section-frame embedding; rotated by the local blade angle for the rotor frame. The chordwise/suction pair may form a left-handed triad with the span axis (a mirrored section); the scalar beam kinematics are mirror invariant, so components still embed and extract by dot products.

pyflightstream.fsi.nodes.unflatten_translations

unflatten_translations(
    node_map: NodeOrderingMap, flat: ndarray
) -> list[np.ndarray]

Split flat FSIDisp rows back into per-blade station translations.

The exact inverse of :func:flatten_blade_translations; the replay harness and the round-trip verification use it to reconstruct (w, theta) from an archived FSIDisp.txt.

Parameters:

Name Type Description Default
node_map NodeOrderingMap

Layout defining the row order.

required
flat ndarray

Shape (total_nodes, 3) in FSIDisp row order.

required

Returns:

Type Description
list of numpy.ndarray

One (n_stations, 3, 3) array per blade in import order, back in section components (the exact inverse of the embedding: components extract by dot products with the station triads).

Raises:

Type Description
FsiInputError

If flat is not shaped (total_nodes, 3) for the map.

pyflightstream.fsi.nodes.write_fsidisp

write_fsidisp(
    path: str | Path, translations: ndarray
) -> None

Write FSIDisp.txt: one dx,dy,dz row per node, import order.

Comma separated per the dry-run evidence (RPT-005 finding 5); written at full float64 precision so an archived file replays the exact displacements.

Parameters:

Name Type Description Default
path str or Path

Destination file inside the working directory.

required
translations ndarray

Shape (total_nodes, 3) from :func:flatten_blade_translations, in meters, blade frame.

required

Raises:

Type Description
FsiInputError

If translations is not shaped (n_nodes, 3) or holds a non-finite displacement.

pyflightstream.fsi.nodes.write_node_file

write_node_file(
    node_map: NodeOrderingMap, path: str | Path
) -> None

Write the structural node CSV FlightStream imports per blade.

Comma separated X,Y,Z per node, no header, the format the dry run imported cleanly (RPT-005 finding 5). The same file is imported once per blade, each time in that blade's rotating frame.

Parameters:

Name Type Description Default
node_map NodeOrderingMap

Layout from :func:generate_node_layout.

required
path str or Path

Destination CSV; overwritten if present.

required

pyflightstream.fsi.nodes.write_node_map

write_node_map(
    node_map: NodeOrderingMap, path: str | Path
) -> None

Serialize the ordering map next to the node file (FSI-R14).

Parameters:

Name Type Description Default
node_map NodeOrderingMap

Layout to persist.

required
path str or Path

Destination JSON, normally the node_map_file name of the configuration inside the run folder.

required