pyflightstream.fsi: structural coupling for rotating blades¶
Tutorial companion of the FSI subpackage. Each module of the rotating-blade
coupling driver has a section below (FSI-R16); the fixed-wing route, the
external structural program, direct morphing and calibration are not covered
here. For those, for named structural inputs and for matrix calibration, see
the workspace FSI guide (docs/fsi-workspace.md); this tutorial explains the
coupling driver.
The loop in one paragraph¶
FlightStream orchestrates the coupling: its Aeroelastic Toolbox calls
an external executable between coupling iterations. Per call the
executable reads the sectional loads FlightStream exported, the run
configuration (config.json), and its own persisted state
(state.json); solves one beam per blade; converts the solution to
nodal translations; and writes FSIDisp.txt for the solver to deform
the mesh. The executable is stateless per call: kill it, restart it,
nothing is lost beyond state.json. Everything happens in the
rotating blade frames, so this package never sees azimuth.
Validity boundary, stated up front: the structure is solved quasi-statically at every step. The mean deformation is exact within the beam idealization; the azimuthal (1P) content is trustworthy only where the excitation stays well below resonance, roughly n Omega / omega_n at or below 0.3. The 0.3 figure is a design rule of thumb of the tool, printed in the convergence log header; no dated validation record backs it yet.
config: one JSON, one sha256 (config.py)¶
FsiConfig is the complete per-run configuration: blade count, Omega,
the per-station structural distributions of the blade, the twist-node
offsets, and the driver phase parameters. It is a pydantic model with
extra="forbid", so a typo in config.json fails loudly at load
time, and every validation error names the physical cause (a zero EI
reports that the static solve would be singular, not a bare "value
must be > 0").
from pyflightstream.fsi import FsiConfig, config_sha256, load_config
from pyflightstream.fsi.config import dump_config
cfg = load_config("config.json") # validates on load
print(config_sha256(cfg)) # sha256, formatting independent
dump_config(cfg, "config.json") # canonical pretty print
The digest is computed over the sorted, whitespace-free JSON dump, so it identifies the physics, not the file layout. Every convergence-log row carries it (FSI-R15): any point of a later parametric map is traceable to its exact configuration, the same discipline as the run manifest.
The function, the two exports, the FsiState field, the
check_state_matches_config keyword and the convergence-log column
were all named for a hash rather than for its algorithm in legacy releases;
they now say sha256, matching RunRecord.script_sha256 and
outputs_sha256. FsiState is the one place that still spells the
retired name, in the alias that accepts it.
Two consequences a resumed run meets. A state.json written by an
earlier release still loads: the old key is accepted on the way in and
the next write emits the new name alone, so the run folder migrates
itself once. And a run resumed into an existing
fsi_convergence_log.csv keeps that file's old header word, because
the header is written only when the file is absent; the column order,
the column count and the meaning of every column are unchanged.
Units are SI throughout and encoded in the field names
(bending_stiffness_n_m2, mass_per_length_kg_per_m). Frames: the
blade frame is right handed with spanwise from root to tip along the
pitch axis and chordwise toward the leading edge. Offsets chain as
pitch axis -> elastic axis (elastic_axis_offset_*, used by the load
transfer) and elastic axis -> CG (cg_offset_*, read by a fixed wing for its own
weight; a rotating blade carries it only as the parallel-axis term of
the twist inertia, with no centrifugal moment and no bend-twist
coupling, and a warning says so).
Only synthetic blades appear in tests and examples; real blade property sets are research data and never enter the repository.
sections and materials: the distributions from the geometry (sections.py, materials.py)¶
The distributions of BladeProperties can be typed, or generated from
the blade's sections and a material, scripted and reproducible.
blade_properties_from_sections takes one closed contour per station
in the section frame (chordwise toward the leading edge, normal toward
the suction side, origin on the pitch axis), the chord and geometric
pitch per station, and a material, and returns a validated
BladeProperties:
from pyflightstream.fsi.materials import material
from pyflightstream.fsi.sections import airfoil_section_contour, blade_properties_from_sections
from pyflightstream.qa.geometry import naca4_contour
sections = [
airfoil_section_contour(naca4_contour("2412", 120), chord_m=c) for c in chords
]
blade = blade_properties_from_sections(
radii,
sections_m=sections,
chord_m=chords,
geometric_pitch_deg=pitches,
material=material("ti-6al-4v-grade5-annealed"),
geometry_source="what the contours were built from",
)
airfoil_section_contour is the one conversion from airfoil
coordinates (x/c from the leading edge, upper surface at positive z/c)
into the section frame, with the pitch axis at a chord fraction (0.25
by default). Per station:
| Field | Generated as |
|---|---|
mass_per_length_kg_per_m |
rho A |
inertia_major_kg_m, inertia_minor_kg_m |
rho times the larger and the smaller principal second moment of area |
bending_stiffness_n_m2 |
E times the second moment about the chordwise axis through the centroid (flap bending) |
torsion_stiffness_n_m2 |
G J, J computed numerically |
elastic_axis_offset_* |
the centroid's position from the pitch axis |
cg_offset_* |
zero |
The area, the centroid and the second moments are closed forms of the
polygon (Green's theorem), exact to rounding. The torsion constant J
has no closed form for an airfoil: it is solved 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 grid
over the section's bounding box, the grid cut exactly at the polygon
(the Shortley-Weller stencil), and solved directly, one block per grid
column. torsion_grid_cells sets the cells across the section's
thickness (64 by default, the chord getting cells of the same size);
doubling it divides the error by about four. Tier 1
(tests/tier1_offline/test_g41_section_properties.py) holds it against
the closed forms of the ellipse and the rectangle: measured on a
circle, ellipses, a square, a 3:1 rectangle and a 10:1 plate, 16 cells
across are within about 1 percent, 32 within 0.3 percent and the
default 64 within 0.08 percent. The thin-section formula (1/3) integral t^3 ds is
computed beside J and recorded as a ratio, a cross-check only: it is
exact for a strip, about 2 percent high on a 12 percent airfoil, and
twice the true J on a circle.
Stated hypotheses, recorded with every generated blade:
- SOLID, HOMOGENEOUS sections. A hollow shell or a spar-and-skin section is a different distribution, declared here as a future option and not built.
- The elastic axis at the CENTROID. The shear centre is not computed; the centroid is its exact place for a doubly symmetric section and an approximation otherwise. A homogeneous section's center of gravity is its centroid, so the generated elastic-axis-to-CG offset is zero, and the bend-twist coupling that offset drives is absent from a generated blade.
- Flap bending about the chordwise axis. A cambered section's principal
axes turn by a fraction of a degree from the chord; the angle is
available as
PolygonMoments.principal_angle_rad.
Stiffness is applied once. The generated EI and GJ go where typed values go, and the beam keeps its unit-moduli material (see below), so no modulus is multiplied in twice; tier 1 checks a generated strip's tip deflection and twist through the PyNite beam against the closed forms.
The materials are a versioned database (MATERIALS,
MATERIALS_DATABASE_VERSION, material(key)). Each entry takes its
density, E, G and Poisson's ratio from ONE cited data set, recorded with
the table, the condition, the address and the date it was read; when a
source tabulates no G, the entry derives it as E / (2 (1 + nu)) and says
so. Today: Ti-6Al-4V grade 5, annealed (ti-6al-4v-grade5-annealed),
and aluminium 7075-T6 (al-7075-t6), both from the ASM Aerospace
Specification Metals data sheets.
The provenance travels in the configuration as
BladeProperties.provenance: the material entry and its source, the
geometry's description, the geometry file's NAME and sha256 (never its
path, which would tie the digest to one machine), the hypotheses, the
torsion method and its grid per station, and the thin-section ratio per
station. It enters config_sha256 when present and is not serialised
at all when absent, so every configuration typed by hand keeps the
digest it had, and every state.json keeps matching its run. Run
docs/examples/_sources/fsi_solid_blade_properties.py for a worked blade.
beam: the blade as a PyNite beam (beam.py)¶
One node per radial station on the elastic axis, one member per bay with bay-averaged EI and GJ, root clamped. The trick to keep the model didactic: unit elastic moduli (E = G = 1), so the section constants fed to PyNite are numerically the stiffnesses of the config, with no invented cross sections. That holds whether the stiffnesses were typed or generated from the sections: the modulus is in the config's EI and GJ already, and this material never adds it again. The structural model is (w, theta), flap plus torsion; only those degrees of freedom carry mass (lumped tributary masses, mu l for flap and (I1 + I2) l for twist), and every other DOF is condensed out of the eigenproblem exactly (Guyan condensation is exact for massless DOFs). Static solves run linear, or with P-Delta whenever axial tension is present.
from pyflightstream.fsi import beam
model = beam.build_beam_model(cfg)
beam.apply_station_loads(model, cfg, flap_load_n_per_m=[3.0] * 21)
beam.solve_static(model)
solution = beam.extract_solution(model, cfg) # (w, theta) per station
modal = beam.modal_frequencies(model, cfg) # flap/torsion classified
WP3 verification (tier 1, tests/tier1_offline/test_fsi_beam.py): tip deflection,
tip rotation, and the first flap and torsion frequencies of a clamped
uniform beam match the closed forms within 1 percent.
centrifugal: what rotation adds (centrifugal.py)¶
Three loads on top of the aerodynamic ones, recomputed analytically at every coupling call:
- Tension: the distributed axial force mu Omega^2 r makes N(r) emerge inside the solver, and P-Delta turns it into bending stiffness with no manual correction terms.
- Propeller moment: minus Omega^2 (I1 - I2) sin(theta) cos(theta)
drives every section toward flat pitch. It depends on the total
pitch, geometric plus elastic, so each call re-solves the beam a few
times (
solve_rotating_static) until the twist distribution stabilizes; the structural nonlinearity converges implicitly at millisecond cost, decoupled from the expensive aerodynamic loop. - In-plane flap softening (
in_plane_softening_coefficients): the flap degree of freedom lies along the section normal, which the blade angle turns out of the rotor plane, so the centrifugal field adds a destabilizing term mu Omega^2 sin^2(beta) w to the flap load and lowers the flap stiffness the tension raises.
The trapeze effect is not modeled, a declared limitation: omitting it is expected to overpredict elastic twist, which would be the conservative direction for relevance conclusions. That sign is argued from the formulation; no dated evidence or bound backs it, and the source formulas are unchecked (see the note below).
campbell_sweep plus southwell_fit deliver Gate 1: frequencies
versus rotor speed, straight in the (Omega^2, omega_n^2) plane, with
Southwell coefficients about 1.1 to 1.3 for the first flap mode and
near (I1 - I2) / (I1 + I2) for torsion. Run
docs/examples/_sources/fsi_campbell_diagram.py for the worked example and the
figure.
Every physics formula lives in a small function whose docstring cites its source, and a schema test enforces the discipline. The reason is worth stating plainly rather than behind a tracking number: the primary sources of the model have not been independently checked against the formulas implemented here, so read them as transcribed from the coupling plan and believed correct rather than as verified against the papers. One function per formula is what keeps a later correction a localized change.
loads: what FlightStream hands the structure (loads.py)¶
Per coupling call the post-processing script exports
FS_SurfaceSection_Loads.txt; parse_sectional_loads turns it into a
typed report using the anchor primitives of results/ (labels and
header rows, never line offsets). The parser is strict where errors
would be silent:
- SI assertion (FSI-R03): the unit-carrying header labels must be
present and the footer must read Newtons and Newton-Meter. Anything
else raises
UnitsErrornaming the fix (the post-processing script computes withCOMPUTE_SURFACE_SECTIONAL_LOADS NEWTONS), because a wrong unit here would silently rescale the structural response. - Completeness (FR-17): the declared section count, the table terminator, and the units footer are structural; a truncated file raises instead of returning fewer sections.
from pyflightstream.fsi import loads
report = loads.parse_sectional_loads(text)
blocks = report.split(family_map) # per-blade attribution
ea = loads.to_elastic_axis(blocks["blade_1"], cfg)
ea.flap_load_n_per_m # line densities for the beam
Attribution follows the family-per-blade convention (RPT-005 finding
6): the flat export concatenates the section distributions in creation
order, so the code that creates them owns the bookkeeping and emits a
SectionFamilyMap. split partitions the rows by that map and
cross-checks the geometry: inside a family the offsets march
monotonically along the span, and at a true boundary the offset
restarts or the chord jumps; a map that disagrees with the creation
order fails loudly instead of loading the wrong blade.
Units, settled by the WP7 pilot (RPT-006): the data rows are line
densities along the span ([N/m], [N m/m]) despite the footer naming
the computation unit, so the fields are named *_per_m, the beam
consumes them directly, and cross_check_totals integrates them over
the tributary widths against the integrated loads of the same run
(the pilot closed to a few percent on the axial component). A wing's
XZ cut moment is moved to the section's quarter chord with X_QC,
Z_QC and the section forces; a rotating blade's is read about the
pitch axis, its point not measured
(docs/definitions/the-sections-table-and-which-row-is-which.md);
to_elastic_axis transfers them with the configured e(r)
(M_EA = M_PA - e_c F_n + e_n F_c, FSI-R04), so refining the elastic axis estimate
never touches the FlightStream setup. Axes: the export columns are
the cut-plane axes (axial and in-plane on a rotating blade, RPT-006
finding 3); on a spinning configuration to_elastic_axis projects
them onto the section chordwise/normal axes with the local blade
angle from the geometric pitch distribution
(project_rotor_frame_loads; the export moment is positive
nose-down and flips sign into the nose-up convention). The embedding
rule (config.frame_embedding) is shared with the node generator, so
loads and displacements always live in the same triad; at Omega zero
everything passes through unchanged (the wing case).
kinematics: twist as differential translations (kinematics.py)¶
FSIDisp.txt carries translations only, so the elastic twist is
encoded geometrically (DLV-007 Section 4.4): three nodes per station,
one on the elastic axis and one toward each edge at a quarter chord,
and the beam solution maps to their normal translations by rigid
section kinematics, dy = w + theta d. The encoding is linear by
design, so the inverse is exact: w reads back from the elastic-axis
node and theta from the offset-node difference, and the round trip
closes at machine precision (the WP5 acceptance test).
nodes: one generator, one ordering (nodes.py)¶
FlightStream applies displacements to the imported nodes strictly in
import order, which makes any bookkeeping drift a silent geometry
corruption. generate_node_layout is therefore the single source of
truth (FSI-R14): the imported node CSV, the serialized
NodeOrderingMap, the flat FSIDisp.txt writer, and the reader that
reconstructs (w, theta) for the replay harness all derive from it.
from pyflightstream.fsi import kinematics, nodes
layout = nodes.generate_node_layout(cfg)
nodes.write_node_file(layout, "structural_nodes.csv") # imported per blade
nodes.write_node_map(layout, cfg.node_map_file)
flat = nodes.flatten_blade_translations(layout, per_blade_translations)
nodes.write_fsidisp("FSIDisp.txt", flat)
Every blade shares the same local coordinates in its own rotating frame, so one node file serves all blades: it is imported once per blade frame, in blade order, and the FSIDisp rows follow that same blade-major order. Formats are the dry-run evidence exactly: comma separated three-column files, no header (RPT-005 finding 5).
On a spinning blade the sections embed at the local blade angle
(station_triads: nodes on the actual twisted chord, displacements
along the local suction direction), so the scalar twist encoding
survives untouched while positions and FSIDisp rows live in the rotor
import frame; at Omega zero the embedding is the identity and nothing
changes for the wing case. The map records the embedding and the
blade angles, keeping the round trip exact either way.
driver and state: the four-phase machine (driver.py, state.py)¶
coupling_step(run_dir) is one complete coupling call, file-driven:
parse the fresh loads export, assemble per-blade elastic-axis loads,
solve the rotating beam per blade, relax the displacements against the
previous call, write FSIDisp.txt, append the convergence log, and
persist state.json atomically (temporary file plus rename, FSI-R13,
so a killed call resumes cleanly, which the crash-recovery test
holds it to).
The phase machine is keyed on the step counter, with steps converted
to revolutions from the configured Omega and the time increment. The
loads header prints dt with three decimals only (RPT-006: 0.003525
prints as .004), so a configured time_increment_s takes precedence
and the printed value is cross-checked at print precision:
| Phase | Behavior |
|---|---|
| 1, wake development | zero displacements on the rigid blade |
| 2, averaged coupling | loads averaged over the window, relaxed updates (FSI-R07) |
| 3, convergence watch | as 2; tip response and integrated normal force logged per revolution, convergence when BOTH hold across consecutive revolutions: tip twist change below tip_twist_tolerance_deg AND relative change of the integrated normal force below thrust_tolerance_fraction (FSI-R09). |
| 4, recording | instantaneous loads, lambda = 1 by design, twist recorded per step |
Freshness is asserted, not assumed: every call must see an advancing
solver iteration in the loads header; a repeated iteration means
FlightStream is running more than one FSI iteration per time step and
the driver refuses to continue (SET_AEROELASTIC_ITERATIONS must stay
1, FSI-R12). The node layout is regenerated from config.json on
every call and any staged map must agree with it (FSI-R14).
Frozen mode (FSI-R10) is first class: drop a
fsi_frozen_displacements.txt into the run folder and every call
replays it verbatim, no loads, no solve, for sensitivity runs and
Gate 2.
The convergence log (fsi_convergence_log.csv) states the
quasi-steady validity boundary in its header and carries the config
hash on every row (FSI-R15), so any point of a later parametric map is
traceable to its exact configuration. The whole machine runs offline
in the tier 1 replay harness (tests/tier1_offline/test_fsi_driver.py), fed by the
archived WP1 fixtures, no FlightStream in the loop.
cli: the executable FlightStream calls (cli.py)¶
pyfs-fsi is the console entry point; pip installs it as an .exe
shim under the environment's Scripts/ folder, and that path is what
the FlightStream script sets as the FSI executable
through the Aeroelastic Coupling Toolbox described below. A config.json
in the working directory selects the coupled driver. Without it, the
separately configured dummy writes zero displacements for interface
diagnostics. Real coupling archives each call's loads and displacement files,
records state and convergence, and writes any traceback to
pyfs_fsi_error.log. The native findings below describe the original WP1
dry run; they are not a new coupled-accuracy validation.
WP1 dry run: findings and the working recipe¶
Executed 2026-07-21 on 26.120 build 7012026 with the generic blade
case over half a revolution; full evidence in
reports/RPT-005_fsi-dry-run_2026-07-21.md, fixtures in
tests/tier1_offline/fixtures/fsi/. What the run established:
- The implemented scripting interface is the Aeroelastic Coupling
Toolbox family (FSM-26.120 pp.375-376;
aeroelastic_coupling.yamlin the command database). TheSET_MOTION_FSIpair of the motion chapter is rejected as unrecognized by the build; the manual section appears to predate the current interface, tracked as candidate broken (PLN-019). - The executable is called bare, no arguments, once per time step,
with its working directory equal to
SET_AEROELASTIC_WORKING_DIRECTORY; its console output lands inFSI_output.txtthere. FS_SurfaceSection_Loads.txtis produced by the post-processing script FlightStream runs between FSI iterations, before the executable:UPDATE_ALL_SURFACE_SECTIONS,COMPUTE_SURFACE_SECTIONAL_LOADS NEWTONS,EXPORT_SURFACE_SECTIONAL_LOADSwith the path on its own line. Fresh content each step (advancing solver iteration counter in the header); standard header with units in the labels, so the WP2 SI assertion anchors on labeled values; data rows carry per-section offset, chord, quarter-chord position, Fx, Fz, and the moment.- File formats: structural node import and
FSIDisp.txtare both comma separated three-column files, displacement order equal to node import order (FSM-26.120 pp.273-274). - Blade attribution, by the standing convention: every blade is meshed as its own geometry family, and each blade gets its own section distribution targeting that boundary in the blade's rotating frame. The export concatenates the families as one flat table in creation order (block sizes equal to each family's section count), so attribution is bookkeeping owned by the code that creates the distributions; offset and chord jumps at the block boundaries are the cross-check.
Working setup, in script form: assign the blade boundaries and the
rotating blade frames to the toolbox, import the node list in the
blade frame, set the working directory, the post-processing script,
the execution command (the pyfs-fsi shim path), iterations 1
(FSI-R12), coupling in unsteady ENABLE, then start the unsteady
solver. Seed the dummy first with
pyfs-fsi init-dummy --node-count <N> --dir <working directory>.
The loads parser (WP2) and the twist-encoding node machinery (WP5)
are built against these fixtures; see their sections above. The
coupled driver (WP6) now uses this same entry point when config.json
is present. The dummy remains a separately configured diagnostic mode.