Skip to content

pyflightstream.fsi.driver (stable)

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

Coupling driver: the four-phase state machine of one FSI call (WP6).

Pipeline role: this is the brain of the coupling executable. Per call FlightStream has already run its post-processing script, so the run folder holds a fresh FS_SurfaceSection_Loads.txt; the driver parses it, assembles per-blade loads about the elastic axis, solves the rotating beam per blade, relaxes the displacements against the previous call, writes FSIDisp.txt in the single-source node order, persists state.json atomically, and then appends the convergence log. Everything is file-driven, so the offline replay harness of the tier 1 suite exercises the complete machine on archived fixtures with no FlightStream in the loop (DLV-007 Section 8).

The phase machine is keyed on the step counter (DLV-007 Section 4.5), with the step-to-revolution conversion taken from the configured Omega and the time increment printed in the loads file itself:

  1. Wake development: zero displacements while the wake develops on the rigid blade.
  2. Averaged coupling: loads averaged over the configured window, relaxed updates (FSI-R07).
  3. Convergence watch: as phase 2; per completed revolution the tip response and the integrated normal force enter both the log and the revolution history, and convergence is declared when BOTH criteria hold across consecutive revolutions: the tip elastic twist change below tip_twist_tolerance_deg, and the relative change of the integrated normal force below thrust_tolerance_fraction (FSI-R09). The applied tip twist must also be within the twist tolerance of the structural solution before the relaxed phase can finish.
  4. Recording: instantaneous loads, no relaxation (lambda = 1 by design: relaxing here would low-pass exactly the 1P amplitude and phase being measured), twist distributions recorded per step.

Frozen mode (FSI-R10) is first class: when the run folder holds a fsi_frozen_displacements.txt, every call replays it verbatim, with no loads parsing and no solve, so a stored deformation can be held fixed for sensitivity runs and Gate 2. The file holds one row per structural node, so a configuration with direct morphing, whose solver reads one row per surface vertex, is refused in frozen mode; direct morphing is honoured on the quasi-steady and the unsteady rotor routes.

The convergence log carries the config hash on every row (FSI-R15) and states the quasi-steady validity boundary in its header (DLV-007 Section 4.1).

A fixed wing (FSI-G, a configuration stating wing) has no revolution and no phase schedule: each call solves the clamped wing under its loads and its own weight (:func:pyflightstream.fsi.wing.solve_wing_static) and writes the relaxed displacement, steady or unsteady alike.

A quasi-steady rotor sector (a run folder holding :data:QUASI_STEADY_ROTOR_FILE) is steady too: its blade is held still and the free stream turns, so there is no revolution and no phase schedule, but its structure turns at the configured Omega. Each call solves the ROTATING blade under the loads of the solve before it (:func:pyflightstream.fsi.centrifugal.solve_rotating_static: the centrifugal tension and its stiffening, the propeller moment and the in-plane centrifugal softening) and writes the relaxed displacement.

Advanced

pyflightstream.fsi.driver.ALLOW_CONFIG_CHANGE_FILE module-attribute

ALLOW_CONFIG_CHANGE_FILE = 'fsi_allow_config_change'

pyflightstream.fsi.driver.CONFIG_FILE module-attribute

CONFIG_FILE = 'config.json'

pyflightstream.fsi.driver.FAMILY_MAP_FILE module-attribute

FAMILY_MAP_FILE = 'fsi_family_map.json'

pyflightstream.fsi.driver.FIXED_WING_PHASE module-attribute

FIXED_WING_PHASE = 'fixed_wing'

pyflightstream.fsi.driver.FROZEN_FILE module-attribute

FROZEN_FILE = 'fsi_frozen_displacements.txt'

pyflightstream.fsi.driver.LOG_FILE module-attribute

LOG_FILE = 'fsi_convergence_log.csv'

pyflightstream.fsi.driver.QUASI_STEADY_ROTOR_PHASE module-attribute

QUASI_STEADY_ROTOR_PHASE = 'quasi_steady_rotor'

pyflightstream.fsi.driver.STATE_FILE module-attribute

STATE_FILE = 'state.json'

pyflightstream.fsi.driver.StepResult dataclass

StepResult(
    call: int,
    step: int,
    phase: int | str,
    revolutions: float | None,
    relaxation: float | None,
    displacements: ndarray,
    solutions: tuple[StaticBeamSolution, ...] | None,
)

Summary of one executed coupling call.

Attributes:

Name Type Description
call, step int

Counters after the call (equal while iterations stay 1).

phase int or str

Executed phase (1 to 4) or "frozen".

revolutions float or None

Rotor revolutions completed at this step; None in frozen mode.

relaxation float or None

Relaxation factor applied to the displacement update; None in phase 1 (zeros are written unconditionally) and frozen mode.

displacements ndarray

The FSIDisp rows written, shape (total_nodes, 3) [m].

solutions tuple of beam.StaticBeamSolution or None

Per-blade beam solutions of this call; None when no solve ran (phase 1 and frozen mode).

pyflightstream.fsi.driver.VERDICT_FILE module-attribute

VERDICT_FILE = 'fsi_convergence_verdicts.log'

pyflightstream.fsi.driver.coupling_step

coupling_step(run_dir: str | Path) -> StepResult

Execute one coupling call inside a run folder.

Reads config.json, state.json (or starts fresh), fsi_family_map.json, and the loads export; writes FSIDisp.txt, the atomically updated state.json and then the convergence log row. With a fsi_frozen_displacements.txt present the call replays it instead (FSI-R10).

Parameters:

Name Type Description Default
run_dir str or Path

Working directory set by SET_AEROELASTIC_WORKING_DIRECTORY.

required

Returns:

Type Description
StepResult

Summary of the executed call.

Raises:

Type Description
FsiInputError

If the folder holds a convergence log with no state.json beside it. That pair means a NEW run is reusing a folder a previous run left behind, and the log APPENDS by design, so the new run's rows would be written under the old run's history with nothing separating them (PFS-2011.02).

The signal is deliberately the ABSENCE of the state file rather than the presence of the log: within one run the log is present on every call after the first, and refusing that would refuse the normal case.

Also if the log's columns do not match the expected trace layout (FR-339), or the loads export has no finite time increment.

Also if the configuration asks for direct morphing in a frozen replay, whose file holds the structural node rows and not the vertex rows the solver then reads.

StaleLoadsError

If the loads export's solver iteration is not ahead of the previous call's: the solver is running more than one FSI iteration per time step (FSI-R12).

pyflightstream.fsi.driver.relax_displacements

relax_displacements(
    previous: ndarray, computed: ndarray, relaxation: float
) -> np.ndarray

Relaxed displacement update d_new = d_old + lambda (d_calc - d_old).

Under-relaxation (lambda below 1) damps the aeroelastic feedback of the averaged coupling phases; lambda = 1 returns the computed displacements unchanged, the phase 4 behavior (FSI-R07).

Source: DLV-007 Section 4.5 (relaxation and phases).

Parameters:

Name Type Description Default
previous ndarray

The displacements of the previous coupling call, d_old [m].

required
computed ndarray

The displacements the structural solve computed, d_calc [m].

required
relaxation float

The relaxation factor lambda; 1 returns computed.

required

Returns:

Type Description
ndarray

The relaxed displacements d_new [m].

pyflightstream.fsi.driver.revolutions_per_step

revolutions_per_step(
    omega_rad_per_s: float, time_increment_s: float
) -> float

Rotor revolutions swept by one unsteady time step.

Omega dt / (2 pi): constant-speed rotation kinematics, the conversion the phase schedule of DLV-007 Section 4.5 is keyed on. Omega comes from the configuration and dt from the loads file of the run itself, so a config/run mismatch shows up as a wrong phase schedule instead of hiding.

Source: DLV-007 Section 4.5 (phase schedule in revolutions); elementary kinematics of rotation at constant angular speed.

Parameters:

Name Type Description Default
omega_rad_per_s float

The rotor's angular speed [rad/s], positive and finite.

required
time_increment_s float

The unsteady time step [s], positive and finite.

required

Returns:

Type Description
float

Omega dt / (2 pi), in revolutions.

Raises:

Type Description
FsiInputError

If the angular speed, time step or computed revolution increment is not positive and finite.