Skip to content

pyflightstream.fsi.cli (stable)

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

pyfs-fsi console entry point: the FSI coupling executable.

Pipeline role: FlightStream's Aeroelastic Coupling Toolbox calls an external executable bare, once per time step, in the directory set by SET_AEROELASTIC_WORKING_DIRECTORY (FSM-26.120 pp.375-376; evidence reports/RPT-005). This module is that executable, with two modes dispatched on the run folder's content:

  • Coupled mode (WP7): a config.json in the working directory makes every call run :func:pyflightstream.fsi.driver.coupling_step, the complete four-phase machine of WP6. The loads and displacement files of every call, and the solver's FSInodes.txt when it wrote one (direct morphing), are archived under fsi_archive/ so a run is replayable offline afterwards; a call that fails archives the same files under fsi_archive/failed_<stamp>/, so the loads that broke it are kept too.
  • Dummy mode (WP1, kept as the fallback): with no config.json, write zero displacements so the blade stays rigid and archive every interface file FlightStream produces; this is how the dry-run fixtures were collected.

Both modes log to files so their evidence does not depend on whether the solver displays stdout. Any coupled-mode failure lands with its traceback in pyfs_fsi_error.log instead of a silent nonzero exit, a missing [fsi] extra included. A failure of the explicit pyfs-fsi step, which a person runs, also prints its one-line cause and the log's path to stderr.

pyfs-fsi beam, run by a person before the study, cuts a blade's sections from its mesh into the <geometry>.<family>.beam.toml an FSI input reads. It reads a mesh, which the workspace layer does, so a higher layer registers it here at import (:func:register_command), and this module never imports that layer.

Used in the guides

pyflightstream.fsi.cli.main

main(argv: list[str] | None = None) -> int

Entry point of the pyfs-fsi console script.

Parameters:

Name Type Description Default
argv list of str

The command-line arguments, sys.argv[1:] by default. With none, or with arguments of an unknown convention, one coupling step runs in the working directory.

None

Returns:

Type Description
int

The process exit code, 0 on success.

Advanced

pyflightstream.fsi.cli.ARCHIVE_DIR module-attribute

ARCHIVE_DIR = 'fsi_archive'

pyflightstream.fsi.cli.ARCHIVE_PATTERNS module-attribute

ARCHIVE_PATTERNS = (
    "FS_*.txt",
    "FSLoad*",
    "FSI_output.txt",
    "FSIDisp.txt",
    "FSInodes.txt",
    "*.sldl",
)

pyflightstream.fsi.cli.CALL_LOG module-attribute

CALL_LOG = 'pyfs_fsi_calls.log'

pyflightstream.fsi.cli.COUPLED_CONFIG module-attribute

COUPLED_CONFIG = 'config.json'

pyflightstream.fsi.cli.DUMMY_CONFIG module-attribute

DUMMY_CONFIG = 'pyfs_fsi_dummy.json'

pyflightstream.fsi.cli.ERROR_LOG module-attribute

ERROR_LOG = 'pyfs_fsi_error.log'

pyflightstream.fsi.cli.STATE_FILE module-attribute

STATE_FILE = 'pyfs_fsi_dummy_state.json'

pyflightstream.fsi.cli.coupled_step

coupled_step(
    cwd: Path,
    received_argv: tuple[str, ...] = (),
    *,
    echo_failure: bool = False,
) -> int

Execute one real coupling call in cwd (WP7 wiring).

Runs :func:pyflightstream.fsi.driver.coupling_step, archives the call's loads, displacement and (under direct morphing) aerodynamic node files for offline replay, and logs the outcome. Any failure, a missing [fsi] extra included, writes its traceback to the error log, archives the files under failed_<stamp> and returns a nonzero exit code. The solver's response to that code has not been measured; this function does not guarantee that coupling stops.

Parameters:

Name Type Description Default
cwd Path

The coupling working directory.

required
received_argv tuple of str

The arguments the solver passed, recorded in the call log as evidence.

()
echo_failure bool

Also print a failure's one-line cause and the error log's path to stderr: the explicit pyfs-fsi step is run by a person, who reads the console; the solver's bare call shows no console.

False

Returns:

Type Description
int

0 when the step succeeded, 1 when it failed and its traceback was written to the error log.

pyflightstream.fsi.cli.dummy_step

dummy_step(
    cwd: Path,
    received_argv: tuple[str, ...] = (),
    *,
    echo_failure: bool = False,
) -> int

Execute one dummy coupling call in cwd.

Archives the visible interface files, writes zero displacements, and appends to the call log. The working directory and any received arguments are recorded on every call: both are open questions of the WP1 dry run. Returns a process exit code.

Parameters:

Name Type Description Default
cwd Path

The coupling working directory.

required
received_argv tuple of str

The arguments the solver passed, recorded in the call log as evidence.

()
echo_failure bool

Also print a failure's one-line cause and the error log's path to stderr, as :func:coupled_step does for the explicit step.

False

Returns:

Type Description
int

0 when the call succeeded, 1 when it failed.

pyflightstream.fsi.cli.init_dummy

init_dummy(directory: Path, node_count: int) -> None

Write the dummy configuration into the future run directory.

Parameters:

Name Type Description Default
directory Path

Directory FlightStream will run the executable in (the simulation folder of the dry run).

required
node_count int

Number of structural nodes of the imported node list; the dummy writes one zero translation per node, in list order.

required

pyflightstream.fsi.cli.register_command

register_command(
    name: str,
    add: Callable[[Any], None],
    handler: Callable[[Namespace], int],
) -> None

Register a pyfs-fsi command that a higher layer defines.

Parameters:

Name Type Description Default
name str

The subcommand, such as beam.

required
add callable

Adds the command's parser to the subparsers it is given.

required
handler callable

Runs the parsed command and returns its exit code.

required