Skip to content

pyflightstream.fsi (stable)

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

Fluid-structure interaction coupling for rotating blades.

Pipeline role: this subpackage implements the external structural executable of the FlightStream Aeroelastic Toolbox loop (M6, DLV-007; FR-23a). Per coupling call FlightStream exports sectional loads on user-defined surface sections; the executable reads them together with its configuration and persisted state, solves one beam per blade, converts the solution to nodal translations, and writes the displacement file back for the solver to deform the mesh. All exchange happens in the rotating blade frames; this package never handles azimuth or global-frame transforms (FSI-R02).

the same executable couples a fixed wing, one clamped beam in the reference frame loaded by its own weight besides the aerodynamic loads (:mod:pyflightstream.fsi.wing).

The structural backend is PyNite (PyPI distribution PyNiteFEA, import name Pynite), pulled in only by the optional [fsi] extra; importing :mod:pyflightstream.fsi itself stays dependency free so the core package works without the extra installed.

The evidence status of the structural model is recorded in DLV-007 Section 2: formulas live in small isolated functions with their source cited in the docstring, so a later primary-source correction stays a localized change.

Advanced

pyflightstream.fsi.FsiConfig

Bases: BaseModel

Complete per-run configuration of the coupling executable.

Attributes:

Name Type Description
blade_count int

Number of blades; node sets, section groups, and solves are replicated per blade (FSI-R08).

omega_rad_per_s float

Rotor angular speed Omega [rad/s], constant over the run; source of the centrifugal tension and the propeller moment.

time_increment_s float or None

Unsteady time step of the coupled run [s]. The loads export header prints the increment with three decimals only (RPT-006: 0.003525 prints as .004, skewing the revolution bookkeeping), so a configured value takes precedence in the driver's phase schedule, with the printed value cross-checked against it at print precision. None falls back to the printed value.

blade BladeProperties

Shared per-station structural distributions.

stiffness_scale_factor float

Multiplier applied to EI and GJ at solve time. The near-rigid regression of the coupled pilot (WP7) scales a synthetic blade stiff with this knob instead of editing distributions.

node_offset_chord_fraction float

Chord fraction of the leading-edge and trailing-edge node offsets from the elastic axis used to encode twist as differential translations (DLV-007 Section 4.4).

phases PhaseSchedule

Driver phase parameters.

node_map_file str

Name, inside the run folder, of the node ordering map written by the node generator; the same generator emits the node file imported into FlightStream, keeping a single source of truth for the FSIDisp ordering (FSI-R14).

wing FixedWing or None

The fixed wing this structure is (FSI-G): its placement in the reference frame and its own weight. None for a rotor blade, and then it is not serialised, for the reason given for BladeProperties.provenance. A wing states omega_rad_per_s = 0 and blade_count = 1.

morphing str

How the solver moves the surface (FR-341): "mapped" (the default) through the imported structural nodes, or "direct", the solver's direct mesh morphing with RIGID aerodynamic nodes, where the structural program writes one displacement per surface vertex the solver lists. "direct" is offered on a rotor blade (a quasi-steady sector or an unsteady rotor, FR-3404), and the plan refuses it on a fixed wing; "direct_deflected" is the same route with DEFLECTED nodes, each call writing its increment (:data:DIRECT_NODE_TYPES). "mapped" is not serialised, so a configuration that does not choose a route dumps and hashes exactly as before.

export_surface_before_call bool

Off by default (FR-3408). On an unsteady_rotor row, the aeroelastic post-processing script also exports the surface as :data:pyflightstream.fsi.state.BEFORE_CALL_SURFACE_FILE after the loads, so the surface the solver holds just before each structural call is on disk when the call starts, and each call's archive (fsi_archive/call_NNNN/) keeps that copy; the row's per-step surface export shows the blade after the call. Another workflow warns and skips it. False is not serialised, so a configuration that leaves it off dumps and hashes exactly as before.

solver_frame_compensation bool

Off by default. On an unsteady_rotor row with a Direct route on a build of :data:SOLVER_FRAME_COMPENSATION_BUILDS, the structural program writes its field in the frames the solver was measured to apply it in, so the morphed blade lands where its motion puts it deformed by the beam field u (in the blade's rotating frame, at azimuth psi of call N about +X). Direct RIGID places a listed vertex at X0 + R(-psi) d from the import geometry X0 and lists X0 turned by -psi: the listing is turned back to X0 and the field is written absolute, d = R(psi) (R(psi) (X0 + u) - X0), in every phase. Direct DEFLECTED places it at R(psi) X0 + R(-psi) d: the field is written turned by +2 psi, d = R(2 psi) u. The state, the log and the station state keep u. The plan warns and stages it off where it does not apply (another build, the RBF route, another workflow, a rotor turning the other way, which was not measured). False is not serialised, so a configuration that leaves it off dumps and hashes exactly as before.

Examples:

>>> from pyflightstream.fsi.config import FsiConfig
>>> 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.3, 0.5], sections_m=[plate] * 3, chord_m=[0.04] * 3,
...     geometric_pitch_deg=[10.0] * 3, material="ti-6al-4v-grade5-annealed",
...     geometry_source="a flat 40 x 4 mm plate",
... )
>>> cfg = FsiConfig(blade_count=2, omega_rad_per_s=0.0, blade=blade)
>>> cfg.blade_count, frame_embedding(cfg)
(2, 'section_frame')

pyflightstream.fsi.StructuralSolver

Bases: Protocol

Contract of one structural coupling call (HND-008 loop).

FlightStream calls the executable between coupling iterations; the executable is stateless per call (FSI-R01) and all state persists in files inside the run folder. An implementation reads the exported sectional loads, config.json and state.json from run_dir, solves the structure, and writes FSIDisp.txt plus the updated state.json atomically (FSI-R13).

step

step(run_dir: Path) -> None

Execute one coupling call inside run_dir.

Parameters:

Name Type Description Default
run_dir Path

Run folder managed by :mod:pyflightstream.workspace (FR-28) containing the FlightStream loads export, config.json and state.json. The written FSIDisp.txt carries one translation vector (dx, dy, dz) per structural node, in meters, in the rotating blade frame, in exactly the node order imported into FlightStream (FSI-R14).

required

pyflightstream.fsi.config_sha256

config_sha256(cfg: FsiConfig) -> str

Return the canonical sha256 of a configuration.

The digest is computed over the JSON serialization with sorted keys and no whitespace, so it is independent of field order and formatting. Every convergence-log row carries it (FSI-R15).

The name states the algorithm, as RunRecord.script_sha256 and outputs_sha256 do: a reader meeting the value in a state.json or in a convergence-log row can tell what it is without opening this module, and the day the algorithm moves the data can say so. Renamed off a name that said only "hash"; the persisted state still ACCEPTS the legacy key on load, and :class:pyflightstream.fsi.state.FsiState is the one place that spells it, so the retired name has exactly one home.

This is NOT the manifest checksum of :mod:pyflightstream._digest, and the difference is the canonical form rather than the algorithm: that module hashes raw file bytes or a UTF-8 encoded string, where this one first renders a configuration into a canonical JSON text, which is a domain rule about what makes two configurations the same.

Parameters:

Name Type Description Default
cfg FsiConfig

Configuration to hash.

required

Returns:

Type Description
str

Lowercase hexadecimal sha256 digest.

Examples:

>>> from pyflightstream.fsi.config import FsiConfig
>>> 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.3, 0.5], sections_m=[plate] * 3, chord_m=[0.04] * 3,
...     geometric_pitch_deg=[10.0] * 3, material="ti-6al-4v-grade5-annealed",
...     geometry_source="a flat 40 x 4 mm plate",
... )
>>> cfg = FsiConfig(blade_count=2, omega_rad_per_s=0.0, blade=blade)
>>> digest = config_sha256(cfg)
>>> len(digest), digest == config_sha256(cfg.model_copy())
(64, True)

pyflightstream.fsi.load_config

load_config(path: str | Path) -> FsiConfig

Load and validate a config.json.

Parameters:

Name Type Description Default
path str or Path

JSON file with the :class:FsiConfig fields.

required

Returns:

Type Description
FsiConfig

Validated configuration.

Examples:

>>> from pyflightstream.fsi.config import FsiConfig
>>> 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.3, 0.5], sections_m=[plate] * 3, chord_m=[0.04] * 3,
...     geometric_pitch_deg=[10.0] * 3, material="ti-6al-4v-grade5-annealed",
...     geometry_source="a flat 40 x 4 mm plate",
... )
>>> cfg = FsiConfig(blade_count=2, omega_rad_per_s=0.0, blade=blade)
>>> import tempfile
>>> from pathlib import Path
>>> path = Path(tempfile.mkdtemp()) / "config.json"
>>> dump_config(cfg, path)
>>> config_sha256(load_config(path)) == config_sha256(cfg)
True