pyflightstream.script.helpers (stable)¶
Generated from the docstrings at build time: every one of the 84 names in the __all__ of pyflightstream.script.helpers has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Curated helpers for the common FlightStream workflows (SAD Section 4.3).
Pipeline role: a small, curated set of thin typed functions sitting on
top of :class:~pyflightstream.script.Script. Each helper only
translates its typed arguments into emit() calls, so every line
still passes the database validation, phase ordering, and
cross-reference checks of the builder. Helpers own the conditional
argument combinations the manual documents in prose (which extras each
SET_FREESTREAM type takes, when INITIALIZE_SOLVER takes per-surface
lines or a PERIODIC copy count), because the database records grammar,
not conditionality.
One generated function per command was rejected in the SAD: it would reproduce the shape of the AGPL package, create a huge surface, and teach nothing. The curated workflows are: free stream and atmosphere, actuator disc (FSM-26.120 pp.323-324), rotary motion (pp.332-333), solver settings (pp.339-343), solver initialization (p.337), sweeps (p.406), analysis and export selection (pp.350-354), and probe management (pp.362-363).
Toggles: every parameter that switches a solver flag on or off takes a
Python bool or the solver's own ENABLE and DISABLE (any case),
resolved by :func:pyflightstream.script.toggles.resolve_toggle before
the helper emits anything; a word in neither vocabulary is refused
naming the helper and the argument. A setup carried over from the
solver speaks that vocabulary, and a bare string is truthy in Python,
so reading it is what keeps 'DISABLE' from emitting ENABLE.
Entity citations by label: every parameter that cites a frame,
actuator, motion, or mesh boundary accepts the 1-based index or the
label registered at creation (label=) or declared through
:meth:~pyflightstream.script.Script.declare_existing; labels resolve
to indices at emission through the script's entity registry.
Provenance: :func:solver_settings is the single entry point for every
solver flag of the runtime_settings, solver_settings, and
advanced_settings families. It carries the optional induced-drag
boundary selection (vorticity_drag_boundaries), emits the library
minimum-Cp default when the caller does not choose one, and attaches a
:class:~pyflightstream.script.solver_setup.SolverSetup snapshot of
every effective flag value to the script (script.solver_setup) for
the run manifest. The induced-drag selection itself is an
analysis-phase command, so when it is passed its emission is deferred
and a steady or quasi-steady script lands it right after the solver
starts: :func:start_solver (or the first analysis or export helper
call) flushes it. On an unsteady march the selection must precede
START_SOLVER to reach the step exports (FR-568); the workflow emitter
places it there with Script.emit_deferred_vorticity_before_solve.
ONE PAIR HERE EMITS NOTHING, and it is stated in the module docstring
rather than only beside itself, because the sentence above says every
helper translates typed arguments into emit() calls and this is the
exception. :func:parse_relaxed_trailing_edge and
:class:RelaxedTrailingEdge read and write the relaxed trailing-edge
COMPONENT specification, the Relaxed_TE;u;v1;v2;direction line a CCS
file writes where a component is defined; no command on any registered
build takes its values, so they take no script and produce text
(FSM-26.124 p.85).
Used in the guides¶
pyflightstream.script.helpers.AirfoilSeparation
¶
Bases: BaseModel
One airfoil (trailing-edge) separation assignment (FSM-26.120 p.341).
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Display name of the assignment in the interface. |
valarezo_criterion |
bool
|
Apply the Valarezo maximum-lift criterion to this assignment, on the
builds whose grammar carries it. FlightStream 26.125 replaced it with
|
leading_edge_type |
(str, optional)
|
The leading-edge type of the assignment on FlightStream 26.125 and later:
|
boundaries |
list of int or str, or ``"all"``
|
Mesh boundaries carrying the model, by 1-based index in
geometry-tree order or by declared boundary label; |
Examples:
Define an assignment without running a solver. Pass it in the
airfoil_separation list of :func:pyflightstream.script.helpers.solver_settings.
>>> from pyflightstream.script.solver_setup import AirfoilSeparation
>>> assignment = AirfoilSeparation(name="WING", boundaries=[1, 2], valarezo_criterion=True)
>>> assert assignment.boundaries == [1, 2] and assignment.valarezo_criterion
pyflightstream.script.helpers.CommandArgumentError
¶
Bases: PyflightstreamError, ValueError
An emitted argument does not satisfy the database specification.
The message names the command, the argument, the expectation, and the citation of the entry (a manual page or a committed probe report), so the fix can be checked against its source directly.
pyflightstream.script.helpers.Script
¶
Script(
version: str | FsVersion,
registry: CommandRegistry | None = None,
)
Bases: _ScriptRendering
One FlightStream script under construction, bound to one version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str or FsVersion
|
Target FlightStream version, canonical identifier (26.120); a vendor release name works only where it names exactly one registered build. Every emission is validated against this version's command view. |
required |
registry
|
CommandRegistry
|
Alternative database, used by tests; defaults to the packaged one. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
version |
FsVersion
|
The resolved target version. |
raw_flag |
bool
|
True once |
waived_commands |
tuple of BrokenCommandUse
|
Commands emitted under a :meth: |
entities |
EntityRegistry
|
Label-aware ledger of the frames, actuators, motions, and mesh boundaries the script created or declared (SAD Section 4.2); backs the cross-reference checks and the label-to-index resolution of entity citations. |
solver_setup |
SolverSetup or None
|
Snapshot of the effective solver flags and their provenance,
attached by
:func: |
registry |
CommandRegistry
|
The command database this script validates against, the one passed at construction or the packaged one. Read-only, and public for one reason: everything that records a per-version fact ABOUT this script has to read the same database the script used. The provenance snapshot did not, and asked the packaged database instead (PFS-2012.05), so a manifest could carry an availability, a default and an evidence sentence from a database no line of the script was checked against. |
unsteady_actions
property
¶
unsteady_actions: tuple[UnsteadyActionUse, ...]
Actions registered on this script, in creation order.
Returns:
| Type | Description |
|---|---|
tuple of UnsteadyActionUse
|
One record per registered action, carrying the evidence the command rests on for this build. |
pending_action_scripts
property
¶
pending_action_scripts: dict[str, str]
Child action scripts waiting to be written, by their filename.
Returns:
| Type | Description |
|---|---|
dict of str to str
|
A copy, keyed by the path the registration line names and valued by the text of the child script. The run layer writes these beside the script it renders; the script layer neither opens nor resolves a path. |
pending_input_files
property
¶
pending_input_files: dict[str, str | bytes]
Data files the script names, waiting to be written, by their path.
Returns:
| Type | Description |
|---|---|
dict of str to str or bytes
|
A copy, keyed by the path the emitted command names and valued
by the file's content: text, written in the platform's text
mode (the trailing-edge node file), or bytes, written exactly as
they are (the actuator disc's radial thrust profile, whose last
row must end the file, G06). The run layer writes these before
the solver starts, as it writes :attr: |
registry
property
¶
registry: CommandRegistry
Command database this script validates and is recorded against.
Returns:
| Type | Description |
|---|---|
CommandRegistry
|
The registry passed at construction, or the packaged one. |
Notes
Exposed so that a record ABOUT this script reads the database
the script itself used. Reaching for
:meth:~pyflightstream.commands.CommandRegistry.load while a
Script is in hand is the defect this property exists to remove:
the two answers agree for the packaged database and differ for
every other one, and the case where they differ is exactly the
case a provenance record is for.
num_local_frames
property
¶
num_local_frames: int
Local coordinate systems the script created or declared.
num_boundaries
property
¶
num_boundaries: int | None
Declared mesh boundary total, or None while undeclared.
None means the boundary inventory of the loaded geometry was never declared, so boundary citations pass unverified: the boundary count lives in the geometry file and cannot be known statically by the builder.
waived_commands
property
¶
waived_commands: tuple[BrokenCommandUse, ...]
Commands emitted under a waiver, in the order first emitted.
One entry per command however many times it was emitted, because
the fields that describe the BREAKAGE are properties of the
command, the version and the waiver, so repeating the emission
would repeat them without adding a fact. The exception is
first_line, which is a property of one emission and keeps the
FIRST: a script-lifetime waiver covers every later emission, and
the reason was written for a particular one.
:class:BrokenCommandUse is the single home of the field list.
Named for what the entries ARE (PFS-2022.01.05): each is a
waiver the recipe registered, and the former name
broken_commands read as the commands that broke in the run,
which is the opposite claim.
frame_motions
property
¶
frame_motions: dict[int, dict[str, object]]
Final emitted frame geometry/motion evidence, indexed by frame.
Read after setup emission: probe creation may precede motion attachments. Unknown trajectories retain their reason and partial geometric evidence.
frame_placements
property
¶
frame_placements: Mapping[int, FramePlacement]
Where this script placed each coordinate system, by frame index (FR-100).
READ ONLY. A translation moves a frame to an absolute origin computed
from this, so a caller writing into it would place a frame from a value
no command emitted; it is filled by :meth:emit and nowhere else.
loads_frame
property
¶
loads_frame: int
The analysis loads frame, as far as THIS SCRIPT set it (G45).
The frame of the last SET_SOLVER_ANALYSIS_LOADS_FRAME emitted, or 1,
the reference frame, while none has been. The solver writes the VTK
surface export in this frame (RPT-074), so the Tecplot the package
writes from it is undone by it.
Examples:
>>> from pyflightstream.script import Script
>>> script = Script("26.124")
>>> script.loads_frame
1
sets_loads_frame
property
¶
sets_loads_frame: bool
Whether THIS SCRIPT emitted SET_SOLVER_ANALYSIS_LOADS_FRAME (G45).
While it has not, :attr:loads_frame is the solver's default, the
reference frame, for a simulation the script builds. A simulation it
reopens keeps the loads frame it was saved with, which the script layer
cannot read, so a continuation takes that frame from the run it
continues.
Examples:
>>> from pyflightstream.script import Script
>>> Script("26.124").sets_loads_frame
False
periodic_copies
property
¶
periodic_copies: int | None
The copy count of the last INITIALIZE_SOLVER under PERIODIC symmetry.
None until the script initializes, and for any other symmetry. The solver writes a periodic row's native Tecplot surface as one zone per copy, the modelled sector first (measured on 26.124, reports/RPT-087), so the run reads that file by this count.
Examples:
>>> from pyflightstream.script import Script
>>> Script("26.124").periodic_copies is None
True
simulation_length_unit
property
¶
simulation_length_unit: str | None
The known simulation length unit (G05, G06, G32, G34).
Prefer the last SET_SIMULATION_LENGTH_UNITS emitted. When none
was emitted, use the saved unit explicitly recorded by the workflow
after reading the opened file's measured header. Return None when
neither source establishes a unit. Reading a saved unit records
provenance without emitting a command that changes the simulation.
Examples:
>>> from pyflightstream.script import Script
>>> script = Script("26.124")
>>> script.emit("SET_SIMULATION_LENGTH_UNITS", "MILLIMETER")
>>> script.simulation_length_unit
'MILLIMETER'
volume_sections
property
¶
volume_sections: int
How many volume sections this script has cut and not deleted (G05).
A create appends one, DELETE_VOLUME_SECTION removes one and
DELETE_ALL_VOLUME_SECTIONS removes them all, whoever emitted the
line, the builder or a raw line of the row. A create is taken to append
at the end of the solver's list and a delete to close the gap, as the
actuators and motions of this ledger are; neither is measured for
sections. A section a saved simulation already carries is not counted:
the script layer reads no file.
Examples:
>>> from pyflightstream.script import Script
>>> script = Script("26.124")
>>> circle = (1, "YZ", 0.5, 10, 12, 0.2, 1.0, "NONE", 0.1, 1, 1.2)
>>> script.emit("CREATE_NEW_CIRCLE_VOLUME_SECTION", *circle)
>>> script.emit("CREATE_NEW_CIRCLE_VOLUME_SECTION", *circle)
>>> script.emit("DELETE_VOLUME_SECTION", 1)
>>> script.volume_sections
1
park_input_file
¶
park_input_file(path: str, payload: str | bytes) -> None
Park an input beside the script, using the shared case-insensitive path rule.
An identical input may be parked again. The run layer writes the parked payload before starting the solver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relative file destination inside the point folder, without a drive, root or parent traversal. |
required |
payload
|
str or bytes
|
Text or exact bytes to stage at that destination. |
required |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the path escapes the point folder or collides case-insensitively with different input content or an action script. Nothing is replaced. |
Examples:
>>> script = Script("26.124")
>>> script.park_input_file("inputs/profile.txt", "profile data")
>>> script.pending_input_files["inputs/profile.txt"]
'profile data'
emit_deferred_vorticity_before_solve
¶
emit_deferred_vorticity_before_solve() -> None
Emit a pending unsteady selection before solving, preserving the phase guard.
The licensed pre-solve selection applies to each unsteady step. This exception admits only the deferred selection, never a later solver restart.
Raises:
| Type | Description |
|---|---|
ScriptOrderError
|
If a solver execution or export phase has already been reached. |
carry_unsteady_actions
¶
carry_unsteady_actions(
uses: Sequence[UnsteadyActionUse],
scripts: Mapping[str, str],
) -> None
Carry saved-state actions and their files without emitting registrations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uses
|
sequence of UnsteadyActionUse
|
Action records already registered in the saved solver state. |
required |
scripts
|
mapping of str to str
|
Child script paths and text to stage for those actions. |
required |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If an action name or parked-file destination conflicts. No partial update is retained on refusal. |
observe_commands
¶
observe_commands(
observer: Callable[
[
str,
tuple[object, ...],
dict[str, object],
str,
bool,
],
None,
],
) -> Iterator[None]
Observe accepted commands for this scope, without replacing validation.
The callback receives name, positional arguments, keyword arguments (including a stated label), rendered text, and whether emit_line was the source. Refused commands and raw text are never observed.
declare_existing
¶
declare_existing(
*,
frames: int = 0,
actuators: int = 0,
motions: int = 0,
boundaries: int | Mapping[str, int] = 0,
volume_sections: int = 0,
) -> None
Declare auxiliary objects already present in the opened project.
A simulation file loaded with OPEN can carry local coordinate systems, actuators, and motions saved earlier, and the loaded geometry brings its mesh boundaries; the builder cannot see inside those files, so scripts citing such objects declare them here to satisfy the cross-reference check.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
int
|
Local coordinate systems in the project, beyond the reference frame (index 1), which always exists. |
0
|
actuators
|
int
|
Actuators in the project. |
0
|
motions
|
int
|
Motions in the project. |
0
|
volume_sections
|
int
|
Volume sections already present in the project, numbered from one. |
0
|
boundaries
|
int or mapping of str to int
|
Mesh boundary count (zero keeps the inventory undeclared), or a
mapping of labels to 1-based indices in geometry-tree order, for
example |
0
|
resolve_boundary
¶
resolve_boundary(
value: int | str, *, context: str = "boundary citation"
) -> int
Resolve a mesh boundary citation to its 1-based index.
A label declared through :meth:declare_existing resolves to
its index; an integer passes through after the range check.
The two bounds are independent: the upper one needs a declared
inventory and is skipped without it, the lower one does not,
since indices are 1-based.
This method resolves a citation with no command attached, so it
applies the generic all-boundaries form, -1, rather than any
command's own. That is stated here and passed explicitly,
because the emitter has no per-kind default: a command's
all-form comes from its own argument, and six surface commands
state none at all (FSM-26.120 pp.309-313). Passing -1 to
:meth:emit for one of those is still refused, and correctly;
it is this generic entry point that accepts it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int or str
|
Boundary index (1-based, geometry-tree order; -1 selects all boundaries) or a declared boundary label. |
required |
context
|
str
|
Prefix naming the citing location in error messages. |
'boundary citation'
|
Returns:
| Type | Description |
|---|---|
int
|
The resolved boundary index. |
Raises:
| Type | Description |
|---|---|
ScriptReferenceError
|
If the label is unknown (the message lists the declared labels) or the index falls outside the declared inventory. |
emit
¶
emit(
name: str,
/,
*args: object,
label: str | None = None,
**kwargs: object,
) -> None
Validate and append one command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Command name as in the database; positional-only, so a
command argument may itself be called |
required |
*args
|
object
|
Argument values, positional in database order or by argument name. Optional arguments may be omitted. Arguments citing a frame, actuator, motion, or mesh boundary accept the entity's label instead of its index; labels resolve at emission through the entity registry. |
()
|
**kwargs
|
object
|
Argument values, positional in database order or by argument name. Optional arguments may be omitted. Arguments citing a frame, actuator, motion, or mesh boundary accept the entity's label instead of its index; labels resolve at emission through the entity registry. |
()
|
label
|
str
|
Only on a creation command (CREATE_NEW_COORDINATE_SYSTEM and the two that append a frame, DUPLICATE_COORDINATE_SYSTEM and MIRROR_COORDINATE_SYSTEM; CREATE_NEW_ACTUATOR; CREATE_NEW_MOTION and the four type-specific motion creations of 25.000): registers this label for the created entity, so later commands can cite it by name instead of by index. |
None
|
Raises:
| Type | Description |
|---|---|
CommandNotInVersionError
|
If the command does not exist in this version; the message carries the manual citation and successor when known. |
BrokenCommandError
|
If the command's record in this version is |
CommandArgumentError
|
If an argument violates the typed specification, or if
|
ScriptOrderError
|
If the command's phase precedes the phase already reached. |
ScriptReferenceError
|
If the command cites an entity index the script has not created or declared yet, or an unknown entity label. |
ScriptLabelError
|
If |
bind_native_solver_identity
¶
bind_native_solver_identity(
*, executable_sha256: str, build: str
) -> None
Bind an identity verified by the caller for exact motion-proof lookup.
This method records evidence supplied by the executor; it does not inspect an executable or establish that a nominal version denotes a particular build. Saved runs can instead resolve timing using their actual recorded identity.
loads_frame_record
¶
loads_frame_record() -> dict[str, object]
Return the loads frame and where this script placed it, as a run records it.
frame is :attr:loads_frame; origin and axes are its
placement in the reference frame (:attr:frame_placements), or None
where this script did not place it: a frame a reopened simulation
carries, or one a command moved in a way the ledger does not follow.
record_opened_length_unit
¶
record_opened_length_unit(unit: str) -> None
Record a decoded saved-geometry unit; an explicit command wins.
This records measured metadata for coordinate conversion without emitting a command that changes the geometry.
entry
¶
entry(name: str) -> CommandEntry
Return the database entry of name on this script's build.
The public reading of the per-version view a builder needs
before it emits (the phase of a command, its layout): a caller
outside this package read the private view in legacy releases, and the
architecture lens of REL-0140 asked for the door. Raises
:class:~pyflightstream.commands.CommandNotInVersionError as
:meth:emit would.
emit_line
¶
emit_line(line: str) -> None
Bind compact command input through the curated renderer (PFS-2033.01).
The line is split on whitespace; the first token is the command
and the rest its arguments, each coerced to the type the database
declares for its position (an int, a float, ENABLE/DISABLE or
True/False for a bool, or the token itself for an enum, a string or
a path), then handed to :meth:emit, so every check of a curated
emission applies. A list argument takes the run of following tokens
its element type reads, as the inline renderer writes it, so a
sweep line such as SWEEPER_SET_AOA_SWEEP CUSTOM 0.0 2.0 4.0
round-trips. Declared following-line arguments are rendered on their
own lines, preserving the compact input accepted before layouts
distinguished mixed commands. Other blocks and payloads are refused.
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the layout cannot bind compact input, a token is not the type its position declares, or tokens are left that no argument reads (a value containing a space, which splits into several). |
raw
¶
raw(text: str) -> None
Append unvalidated script text and flag the script (FR-07).
Unvalidated text may move any frame, so every placement but the
reference's is forgotten, as the motion ledger forgets its motions: a
reader of :attr:frame_placements then refuses the frame by name
rather than computing from geometry the text may have changed
(PFS-2104.021).
allow_broken
¶
allow_broken(name: str, /, *, reason: str) -> None
Permit one command recorded broken to be emitted (FR-48).
Registers a waiver for name; a later :meth:emit of it then
appends the command instead of raising
:class:BrokenCommandError, and records what was waived in
:attr:waived_commands, which the run manifest carries.
Two callers legitimately need this. A tier 2 probe re-measuring
the record cannot avoid emitting the command, since emitting it
is the measurement; and an operator may have established that
the recorded defect does not reach their case, which is a
judgement no database can make for them. reason is required
because it is the only part of the record nothing else can
supply.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Command name as in the database; positional-only for the
same reason as in :meth: |
required |
reason
|
str
|
Why this run may emit it anyway. Recorded verbatim in the manifest; a blank string is refused. |
required |
Raises:
| Type | Description |
|---|---|
CommandNotInVersionError
|
If the command is unknown, removed in this version, or has no recorded evidence for it. Checked here rather than left to the emission so a typo in the name fails at the waiver, where it was made. |
CommandArgumentError
|
If |
Notes
A waiver for a command that is not broken in this version is accepted and does nothing. That is deliberate: the same recipe is meant to run against several versions, and AIR_ALTITUDE is recorded broken in 26.120 and verified in 26.121, so refusing the unnecessary waiver would make a recipe fail on the version where the command is recorded working. Nothing is recorded in that case, so the manifest never reports a dependency the run did not have.
comment
¶
comment(text: str) -> None
Append a comment; FlightStream ignores lines starting with #.
A multi-line text becomes one comment line per physical line,
each independently prefixed. That is a fix rather than a
convenience: prefixing only the first line left every line after
it as an ordinary script line, so a comment carrying a newline
emitted an unvalidated command with raw_flag still False,
which is the comment half of the same defect the argument checks
above refuse. Commenting each line keeps the caller's intent (it
is all commentary) and cannot inject.
A blank line inside text becomes a bare # rather than an
empty line, so the block stays visibly one comment.
begin_point
¶
begin_point() -> None
Open a new POINT inside one script, rewinding the phase to init.
FR-95. A warm steady sweep is one script holding several points,
and each point runs the same cycle: set its condition, initialise
if it must, start the solver, analyse, export. The phase guard is
monotonic across a script, so the second point's
SOLVER_SET_AOA, an init command, was refused as arriving after
the export phase the first point had already reached.
THE REWIND STOPS AT INIT AND THAT IS THE POINT. Geometry and setup stay behind it, so a sweep still cannot open a second geometry or redefine a coordinate system halfway through, which is the half of the phase rule that catches real mistakes. What it allows is the cycle a sweep is made of, and nothing wider.
A single-point script never calls this, so its guard is unchanged.
emit_after_initialization
¶
emit_after_initialization(
name: str, /, *args: object, **kwargs: object
) -> None
Emit one setup command on an initialised solver, to be initialised again (G02).
:meth:emit refuses a setup command once INITIALIZE_SOLVER is
in the script, and that is right for nearly all of them: a frame,
a motion or a fluid is read when the solver initialises, so after
it they come too late. A few act on what only the initialisation
creates. On FlightStream 26.124 the wake-termination detection
emitted right after a file import of the trailing edges marks
nothing; emitted after an initialisation it marks the node, and
the solver uses what it marked only once it initialises again,
which clears the first initialisation (RPT-069, T07). The log
reports the trailing-edge groups only during an initialisation,
which is the inferred reason.
THIS IS THE ONE DOOR PAST THE PHASE GUARD, AND IT IS NARROW. The
command must be a setup command; an INITIALIZE_SOLVER must
precede it and the solver must not have started. The phase does
not move, so a frame or a motion after it is still refused. Until
INITIALIZE_SOLVER is emitted again, a command of the exec phase
or a later one, START_SOLVER first, is refused naming the
command that waits. Every other check of :meth:emit applies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
A setup command of this build's database. |
required |
*args
|
object
|
Its arguments, as :meth: |
()
|
**kwargs
|
object
|
Its arguments, as :meth: |
()
|
Raises:
| Type | Description |
|---|---|
ScriptOrderError
|
If |
(CommandNotInVersionError, CommandArgumentError, ScriptReferenceError)
|
As :meth: |
Examples:
>>> from pyflightstream.script import Script
>>> script = Script(version="26.124")
>>> initialization = dict(
... solver_model="INCOMPRESSIBLE", surfaces=-1,
... wake_termination_x="DEFAULT", symmetry="NONE",
... )
>>> script.emit("INITIALIZE_SOLVER", **initialization)
>>> script.emit_after_initialization("AUTO_DETECT_WAKE_TERMINATION_NODES")
>>> script.emit("INITIALIZE_SOLVER", **initialization)
>>> script.emit("START_SOLVER")
>>> script.render().count("INITIALIZE_SOLVER")
2
for_marking
classmethod
¶
for_marking(
version: str | FsVersion,
registry: CommandRegistry | None = None,
) -> Script
Construct the no-initialization policy used by the boundary-marking planner.
Late node selections, termination marks, combines and renames are permitted through setup only. All argument and reference checks remain active. Ordinary scripts retain their phase guard; marking scripts refuse init and execution.
Evidence: reports/compat/CMP-26124_2026-10-26_marking.yaml and CMP-26125_2026-10-26_marking.yaml measure saved marks and base/merge order without INITIALIZE_SOLVER. Command evidence admission remains the planner's separate per-build VERIFIED gate.
pyflightstream.script.helpers.atmosphere
¶
atmosphere(
script: Script,
*,
altitude: float | None = None,
altitude_units: str | None = None,
density: float | None = None,
pressure: float | None = None,
temperature: float | None = None,
viscosity: float | None = None,
specific_heat_ratio: float | None = None,
sonic_velocity: float | None = None,
) -> None
Set the working fluid state (FSM-26.120 p.328).
Either from a standard-atmosphere altitude (AIR_ALTITUDE) or from the five explicit fluid properties (FLUID_PROPERTIES); the two paths are mutually exclusive.
WHICH FIVE DEPENDS ON THE BUILD, and this helper reads its script's
version to find out rather than making the caller discover it from a
refusal. Builds from 26.100 on derive the sonic velocity from
temperature and specific heat ratio and take
specific_heat_ratio; the three pre-26.100 editions take
sonic_velocity and have no specific-heat-ratio argument at all
(FSM-25.000 p.286).
Validate against the target edition's grammar so required arguments and accepted keywords agree with the page that governs this build.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
altitude
|
float
|
Standard-atmosphere altitude, in |
None
|
altitude_units
|
str
|
|
None
|
density
|
float
|
Fluid density in kg/m^3. |
None
|
pressure
|
float
|
Static pressure in Pa. |
None
|
temperature
|
float
|
Static temperature in K. |
None
|
viscosity
|
float
|
Dynamic viscosity in Pa s. |
None
|
specific_heat_ratio
|
float
|
Ratio of specific heats (1.4 for air). Taken by builds from 26.100 on; the older three have no such argument. |
None
|
sonic_velocity
|
float
|
Speed of sound in m/s. Taken by the three pre-26.100 builds, where it is an input rather than a derived quantity; the newer builds compute it from temperature and specific heat ratio and have no such argument. |
None
|
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If an altitude and fluid properties are both given, the explicit properties are incomplete
or include the one the build does not take, or the build reads the altitude in feet and
|
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.124")
>>> helpers.atmosphere(script, altitude=1000.0)
>>> script.render().splitlines()
['AIR_ALTITUDE 1000.0 METERS']
pyflightstream.script.helpers.free_stream
¶
free_stream(
script: Script,
kind: str = "CONSTANT",
*,
frame: int | str | None = None,
axis: str | None = None,
rpm: float | None = None,
profile: str | None = None,
filetype: str | None = None,
) -> None
Set the free-stream velocity definition (FSM-26.120 p.322).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
kind
|
str
|
|
'CONSTANT'
|
frame
|
int or str
|
ROTATION only: local coordinate system carrying the rotation axis, cited by index or by its creation label; it must exist earlier in the script. |
None
|
axis
|
str
|
ROTATION only: rotation axis of |
None
|
rpm
|
float
|
ROTATION only: angular velocity in rev/min. |
None
|
profile
|
str
|
CUSTOM only: path of the velocity profile file. |
None
|
filetype
|
str
|
CUSTOM only: |
None
|
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the arguments do not match |
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.124")
>>> helpers.free_stream(script)
>>> script.render().splitlines()
['SET_FREESTREAM CONSTANT']
pyflightstream.script.helpers.initialize_solver
¶
initialize_solver(
script: Script,
*,
solver_model: str = "INCOMPRESSIBLE",
surfaces: Sequence[tuple[int | str, Toggle]]
| Literal["all"] = "all",
wake_termination_x: float | str = "DEFAULT",
symmetry: str = "NONE",
periodic_copies: int | None = None,
wall_collision_avoidance: Toggle | None = None,
) -> None
Initialize the solver, covering the extended forms (FSM-26.120 p.337).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
solver_model
|
str
|
|
'INCOMPRESSIBLE'
|
surfaces
|
sequence of (int or str, toggle) pairs or ``"all"``
|
|
'all'
|
wake_termination_x
|
float or str
|
X location of wake termination in the reference frame, or
|
'DEFAULT'
|
symmetry
|
str
|
|
'NONE'
|
periodic_copies
|
int
|
Number of periodic copies; required with PERIODIC symmetry and forbidden otherwise. |
None
|
wall_collision_avoidance
|
bool or 'ENABLE' or 'DISABLE'
|
Applies to solver models 1 to 3. |
None
|
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
On FlightStream 25.000, whose INITIALIZE_SOLVER this helper
cannot express: that edition takes ten arguments, spells
symmetry SYMMETRY_TYPE with its own token set and has no
SOLVER_MODEL, so the defaults here would bind two names it does
not carry. Refused at entry, before anything is emitted, and the
message points at |
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.124")
>>> helpers.initialize_solver(script, symmetry="NONE")
>>> script.render().splitlines()[:2]
['INITIALIZE_SOLVER', 'SOLVER_MODEL INCOMPRESSIBLE']
pyflightstream.script.helpers.solver_settings
¶
solver_settings(
script: Script,
*,
vorticity_drag_boundaries: Sequence[int | str]
| Literal["all"]
| None = None,
mode: str | None = None,
time_iterations: int | None = None,
delta_time: float | None = None,
aoa: float | None = None,
sideslip: float | None = None,
velocity: float | None = None,
mach: float | None = None,
ref_velocity: float | None = None,
ref_mach: float | None = None,
ref_area: float | None = None,
ref_length: float | None = None,
iterations: int | None = None,
convergence: float | None = None,
forced_iterations: Toggle | None = None,
max_threads: int | None = None,
boundary_layer: str | None = None,
viscous_coupling: Toggle | None = None,
viscous_excluded: Sequence[int | str] | None = None,
surface_roughness: float | None = None,
thin_boundaries: Sequence[int | str]
| Literal["all"]
| None = None,
bulk_separation: BulkSeparation | Mapping | None = None,
airfoil_separation: Sequence[
AirfoilSeparation | Mapping
]
| None = None,
axial_vortex_separation: Sequence[
AxialVortexSeparation | Mapping
]
| None = None,
cylindrical_bulk_separation: Sequence[
CylindricalBulkSeparation | Mapping
]
| None = None,
stratford_bulk_separation: Sequence[
StratfordBulkSeparation | Mapping
]
| None = None,
delete_separations: int | Literal["all"] | None = None,
axial_separation_boundaries: Sequence[int | str]
| Literal["all"]
| None = None,
valarezo_separation_boundaries: Sequence[int | str]
| Literal["all"]
| None = None,
crossflow_separation_boundaries: Sequence[int | str]
| Literal["all"]
| None = None,
crossflow_separation_diameter: float | None = None,
crossflow_separation_axisymmetric: Toggle | None = None,
laminar_separation: Toggle | None = None,
convergence_iterations: int | None = None,
minimum_cp: float | None = None,
reynolds_averaged_drag: Toggle | None = None,
mesh_induced_wake_velocity: Toggle | None = None,
farfield_layers: int | None = None,
unsteady_pressure_and_kutta: Toggle | None = None,
wake_termination_time_steps: int | None = None,
wake_on_wake_induction: Toggle | None = None,
additional_wake_relaxation: Toggle | None = None,
aeroelastic_rbf_type: str | None = None,
kutta_joukowski_lift: Toggle | None = None,
print_rotor_induced_velocities: Toggle | None = None,
adaptive_field_grid_refinement: Toggle | None = None,
jet_wake_filaments_grid_induction: Toggle | None = None,
rotor_induced_velocity_blending: float | None = None,
wake_numerical_relaxation: float | None = None,
jet_wake_decay_normalized_length: float | None = None,
wake_decay_constant: float | None = None,
solver_stabilization: float | None = None,
disable_ref_velocity: bool = False,
solver_model: str | None = None,
valarezo_criterion: Toggle | None = None,
crossflow_separation_mean_diameter: float | None = None,
wake_relaxation: Toggle | None = None,
wake_streamwise_agglomeration: Toggle | None = None,
adverse_gradient_boundary_layer: Toggle | None = None,
vortex_ring_normalization: Toggle | None = None,
) -> SolverSetup
Set the solver flags, record their provenance, and return the snapshot.
Single entry point for every command of the runtime_settings
(FSM-26.120 pp.339-340), solver_settings (pp.341-343), and
advanced_settings (pp.344-346) families. Only the provided flags
are emitted (plus the library minimum-Cp default, below), so the
helper serves both the initial setup and the re-emission between
campaign points; the returned
:class:~pyflightstream.script.solver_setup.SolverSetup snapshot
records the effective value and provenance of every flag, passed or
not, and is attached to the script as script.solver_setup for
the run manifest. On a re-emission call a flag this call did not
pass keeps the record of the earlier call that emitted it, since its
line is still in the script.
Two flags have library-level behavior:
vorticity_drag_boundariesselects the boundaries whose induced drag comes from surface vorticity integration. Omitting it leaves this script's selection as it stands: nothing, on the first settings call, which is the solver default of surface pressure integration on every boundary (FSM-26.120 p.202); the selection of the earlier call, on a second settings call of the same script, since the line it emitted stays in the script. The selection is an analysis-phase command, so when it is passed its emission is deferred to the first curated call that reaches the analysis phase: :func:start_solver, :func:sweep, :func:analysis_setup, or :func:export_results. A rawscript.emit("START_SOLVER")does not flush it.minimum_cpunset emitsSOLVER_MINIMUM_CP -100while the script carries no SOLVER_MINIMUM_CP yet: the solver's own default -20 (FSM-26.120 p.221) clips the suction peaks of rotor blades, so -100 is the library default; pass the flag to override. A re-emission that omits it leaves the existing limiter unchanged. The physics reference check found 30 of 30 metrics bit-identical (report PHY-26120_2026-07-23_reseed-cp100-2026-07-23). On a FlightStream version without the command nothing is emitted and the snapshot honestly records the flag as unknown.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
vorticity_drag_boundaries
|
sequence of int or str, ``"all"``, or None
|
Boundaries whose induced drag comes from surface vorticity
integration, by 1-based index or declared boundary label;
|
None
|
mode
|
str
|
Solver time regime: |
None
|
time_iterations
|
int
|
UNSTEADY only: number of physical time steps. |
None
|
delta_time
|
float
|
UNSTEADY only: physical time step in s. For rotary cases the manual recommends 8 to 12 degrees of blade rotation per step and at least two full rotations (FSM-26.120 p.210). |
None
|
aoa
|
float
|
Angle of attack in deg, magnitude below 90. |
None
|
sideslip
|
float
|
Side-slip angle in deg, magnitude below 90. |
None
|
velocity
|
float
|
Free-stream magnitude in native simulation length units per second. The case workflow converts its physical m/s value before this call. |
None
|
mach
|
float
|
Free-stream Mach number. |
None
|
ref_velocity
|
float
|
Reference velocity in native length units per second for normalization; for rotary or hover cases use the largest characteristic velocity, such as the rotor tip speed (FSM-26.120 p.201). |
None
|
ref_mach
|
float
|
Reference Mach number. |
None
|
ref_area
|
float
|
Reference area S_ref in simulation length units squared (Q*S_ref force normalization, FSM-26.120 p.223). |
None
|
ref_length
|
float
|
Reference length L_ref in simulation length units (QS_refL_ref moment normalization, FSM-26.120 p.223). |
None
|
iterations
|
int
|
Solver iteration count. |
None
|
convergence
|
float
|
Residual threshold declaring convergence (FSM-26.120 p.200). |
None
|
forced_iterations
|
bool or 'ENABLE' or 'DISABLE'
|
Run the full iteration count regardless of convergence. |
None
|
max_threads
|
int
|
Parallel core count. |
None
|
boundary_layer
|
str
|
|
None
|
viscous_coupling
|
bool or 'ENABLE' or 'DISABLE'
|
Couple the semi-empirical boundary layer model to the potential flow solution (attached-flow viscosity only, FSM-26.120 pp.207-208). |
None
|
surface_roughness
|
float
|
Surface roughness height in NANOMETRES, which is the manual's own unit and unlike every other length this helper takes (FSM-26.120 p.341). Zero states a smooth surface, so there is no separate toggle and the value carries the choice. |
None
|
thin_boundaries
|
sequence of int or str, ``"all"``, or None
|
Boundaries the solver treats as thin, so both faces of a surface
are resolved, by 1-based index or declared label
(FSM-26.120 p.343). Three states, and they are all distinct: None
leaves the solver's own list untouched, |
None
|
viscous_excluded
|
sequence of int or str
|
Boundaries excluded from viscous coupling, by 1-based index or declared boundary label; verified against the inventory declared with declare_existing(boundaries=...) when one exists. The empty sequence emits DELETE_VISCOUS_EXCLUDED_BOUNDARIES, which is the solver's own way of erasing the list (FSM-26.120 p.341); pass None, or omit the flag, to leave the list as the script found it. |
None
|
bulk_separation
|
BulkSeparation or mapping
|
Bulk (bluff-body) flow-separation assignment
(CREATE_BULK_SEPARATION, FSM-26.120 p.342); see
:class: |
None
|
airfoil_separation
|
sequence of AirfoilSeparation or mapping
|
Airfoil (trailing-edge) separation assignments, one per CREATE_AIRFOIL_SEPARATION emission (FSM-26.120 p.341). |
None
|
axial_vortex_separation
|
sequence of AxialVortexSeparation or mapping
|
Axial vortex separation assignments for slender bodies (CREATE_AXIAL_VORTEX_SEPARATION, FSM-26.120 p.342). |
None
|
cylindrical_bulk_separation
|
sequence of CylindricalBulkSeparation or mapping
|
Cylindrical bulk separation assignments (FSM-26.121 p.345); documented on 26.121. |
None
|
stratford_bulk_separation
|
sequence of StratfordBulkSeparation or mapping
|
Stratford bulk separation assignments (FSM-26.121 p.345); documented on 26.121. |
None
|
delete_separations
|
int or 'all'
|
Delete one separation model by its 1-based creation index, or
every one of them with |
None
|
axial_separation_boundaries
|
sequence of int or str, or 'all'
|
Boundaries on the axial flow separation list of 26.100
(SET_AXIAL_SEPARATION_BOUNDARIES, FSM-26.100 p.339). The empty
sequence emits the matching DELETE. Documented for 26.100 alone
and refused elsewhere; RPT-018 measured this command reported
deprecated and then refused by the 26.101 and 26.121 solvers,
and did not run it on 26.120. What the later builds want in its
place is a judgement rather than a measurement: the solver's
deprecation notice leaves its replacement field empty, and
|
None
|
valarezo_separation_boundaries
|
sequence of int or str, or 'all'
|
Boundaries on the Valarezo maximum-lift criterion list of
26.100 (FSM-26.100 p.339). The empty sequence emits the erase,
like every other boundary-list keyword. It was REFUSED for one
day: RPT-018 measured the name FSM-26.100 prints for that erase as
unrecognised by the solver, and the working spelling could not
be recorded until an entry was allowed to rest on a probe report
instead of a manual page. It is recorded now, so the erase is
emitted under the name that works. Superseded from 26.101 by the
|
None
|
crossflow_separation_boundaries
|
sequence of int or str, or 'all'
|
Boundaries on the cross-flow separation list of 26.100 (FSM-26.100 pp.339-340). The empty sequence emits the matching DELETE. |
None
|
crossflow_separation_diameter
|
float
|
Maximum diameter of the body carrying the 26.100 cross-flow separation model, in simulation length units (FSM-26.100 p.339). One diameter applies to the whole list, unlike the later named models, which carry a diameter per assignment. |
None
|
crossflow_separation_axisymmetric
|
bool or 'ENABLE' or 'DISABLE'
|
Axisymmetric vortex shedding for the 26.100 cross-flow separation model (FSM-26.100 p.340). |
None
|
laminar_separation
|
bool or 'ENABLE' or 'DISABLE'
|
Laminar boundary layer separation (FSM-26.120 p.345); the one separation-family member documented by FSM-26.100, FSM-26.101, FSM-26.120 and FSM-26.121. It carries no row for the three pre-26.100 builds, so it is refused there. |
None
|
convergence_iterations
|
int
|
Iterations the solver must stay below the convergence threshold before convergence is declared (FSM-26.120 p.344). |
None
|
minimum_cp
|
float
|
Lower limiter on the pressure coefficient, dimensionless (FSM-26.120 p.345); see the library-default note above. |
None
|
reynolds_averaged_drag
|
bool or 'ENABLE' or 'DISABLE'
|
Toggle the Reynolds-averaged (flat plate) boundary layer calculations (FSM-26.120 p.344). |
None
|
mesh_induced_wake_velocity
|
bool or 'ENABLE' or 'DISABLE'
|
Toggle the mesh-induced wake velocity computation (FSM-26.120 p.344). |
None
|
farfield_layers
|
int
|
Far-field agglomeration layer count, integer between 1 and 5; the solver default is 3 (FSM-26.120 p.344). |
None
|
unsteady_pressure_and_kutta
|
bool or 'ENABLE' or 'DISABLE'
|
Toggle the unsteady Bernoulli and Kutta terms of the unsteady solver (FSM-26.120 p.344). |
None
|
wake_termination_time_steps
|
int
|
Time steps after which a fully faded wake vortex filament edge is removed (FSM-26.120 p.344). |
None
|
wake_on_wake_induction
|
bool or 'ENABLE' or 'DISABLE'
|
Toggle the wake-on-wake induced velocity computation (FSM-26.120 pp.344-345). |
None
|
additional_wake_relaxation
|
bool or 'ENABLE' or 'DISABLE'
|
Perform one additional wake relaxation iteration (FSM-26.120 p.345). |
None
|
aeroelastic_rbf_type
|
str
|
RBF mesh morphing algorithm of the aeroelastic coupling:
|
None
|
kutta_joukowski_lift
|
bool or 'ENABLE' or 'DISABLE'
|
Compute the inviscid lift from the bound circulation by the Kutta-Joukowski theorem instead of by integrating the surface pressure. Changes a reported coefficient, not the flow field (FSM-26.120 p.344). |
None
|
print_rotor_induced_velocities
|
bool or 'ENABLE' or 'DISABLE'
|
Write the rotor-induced velocities to the log at every time step of an unsteady run. A diagnostic whose output volume is unbounded on a long run (FSM-26.120 p.345). |
None
|
adaptive_field_grid_refinement
|
bool or 'ENABLE' or 'DISABLE'
|
Refine the field-source grid where the solution needs it. The manual marks this transonic only, so on a subsonic case it has nothing to act on (FSM-26.120 p.345). |
None
|
jet_wake_filaments_grid_induction
|
bool or 'ENABLE' or 'DISABLE'
|
Let the jet wake filaments induce velocity on the mesh (FSM-26.120 p.346). NOT AVAILABLE ON 26.121, where passing this raises rather than emitting: the build does not recognise the command (RPT-021). Documented by the 26.101 and 26.120 editions and by neither neighbour. |
None
|
rotor_induced_velocity_blending
|
float
|
Blending factor for wake stabilization, dimensionless, between 0 and 1, solver default 0.25. Not available on 26.100 (FSM-26.120 p.345). |
None
|
wake_numerical_relaxation
|
float
|
Relaxation factor applied to the wake between iterations, dimensionless, between 0 and 1, solver default 0.15. Lowering it steadies a wake that will not settle, at the cost of iterations. Not available on 26.100 (FSM-26.120 p.346). |
None
|
jet_wake_decay_normalized_length
|
float
|
Distance at which a jet wake decays to a tenth of its initial strength, in MULTIPLES OF THE JET WAKE DIAMETER rather than in length units. Solver default 100.0 through 26.124 and 10.0 on 26.125 (FSM-26.125 p.358), minimum 1.0. The 26.125 snapshot records an omitted value as unknown until version defaults have a structured database field. Not available on 26.100 (FSM-26.120 p.346). |
None
|
solver_stabilization
|
float
|
Maximum level of stabilization applied to the main convergence, dimensionless, from 0 to 1. The manual states that 0 is the same as disabling it, so this is a strength and not a switch, and it takes intermediate values. Not available on 26.100 (FSM-26.120 p.346). |
None
|
disable_ref_velocity
|
bool
|
Make the solver reference velocity track the free-stream
velocity instead of holding what |
False
|
wake_decay_constant
|
float
|
Rate at which wake vorticity decays with distance, in units of 1/m. The manual gives it as 19.1 divided by a characteristic length in METRES, so the unit is derived and is printed nowhere; a value computed with the length scale in other units gives a wake that decays orders of magnitude too fast or not at all, and the number itself does not reveal which. The characteristic length is the wing semi-span or largest fin for steady state, the blade radius for a rotor or rotor, and the larger of the two where both are present. Documented by the 26.121 edition alone (FSM-26.121 p.346). |
None
|
solver_model
|
str
|
Flow model the solver runs, one of INCOMPRESSIBLE, SUBSONIC, TRANSONIC and LOW_ORDER_SUPERSONIC. Documented by the 25.000 edition alone (FSM-25.000 p.302), which is the last one to carry it as a command: the 25.100 edition drops the command and gives INITIALIZE_SOLVER a SOLVER_MODEL argument in the same release. On any build from 25.100 on, set the model there instead. |
None
|
valarezo_criterion
|
bool or 'ENABLE' or 'DISABLE'
|
Enable the Valarezo pressure-difference criterion for predicting the onset of separation. Documented by the three pre-26.100 editions (FSM-26.000 p.316) and by none after them. |
None
|
crossflow_separation_mean_diameter
|
float
|
Mean diameter of the body the cross-flow separation model applies to, strictly positive, in the simulation length units. The model needs it because the critical pressure coefficient it uses depends on the cross-sectional scale. NAMED FOR THE QUANTITY AND NOT FOR THE COMMAND, unlike its
siblings, and deliberately: the vendor spells the command
SET_CROSSFLOW_SEPARATION_CP, so mirroring it would put a
keyword reading |
None
|
wake_relaxation
|
bool or 'ENABLE' or 'DISABLE'
|
Enable relaxation of the wake geometry between solver iterations, which damps the wake movement and helps a case that oscillates rather than converging. Documented by the three pre-26.100 editions (FSM-26.000 p.319). |
None
|
wake_streamwise_agglomeration
|
bool or 'ENABLE' or 'DISABLE'
|
Enable agglomeration of wake filament edges along the streamwise direction, trading wake resolution for fewer wake elements. Documented by the three pre-26.100 editions (FSM-26.000 p.318). |
None
|
adverse_gradient_boundary_layer
|
bool or 'ENABLE' or 'DISABLE'
|
Enable the adverse-pressure-gradient treatment in the boundary-layer model, which lets the layer thicken approaching separation instead of following the flat-plate relation everywhere. Documented by the three pre-26.100 editions (FSM-26.000 p.318). |
None
|
vortex_ring_normalization
|
bool or 'ENABLE' or 'DISABLE'
|
Enable normalization of the vortex-ring strengths on the wake panels. The page gives the switch and no definition of what the normalization does, so nothing further is stated here. Documented by the three pre-26.100 editions (FSM-26.000 p.318). |
None
|
Returns:
| Type | Description |
|---|---|
SolverSetup
|
The snapshot of effective flag values and provenance, also
attached to the script as |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the unsteady arguments and |
CommandNotInVersionError
|
If a requested command is unavailable on the script's build. Availability is checked before the first emission, leaving the script unchanged. |
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.124")
>>> setup = helpers.solver_settings(script, aoa=2.0, velocity=30.0, iterations=500)
>>> for line in script.render().splitlines():
... print(line)
SOLVER_SET_AOA 2.0
SOLVER_SET_VELOCITY 30.0
SOLVER_SET_ITERATIONS 500
SOLVER_MINIMUM_CP -100
pyflightstream.script.helpers.start_solver
¶
start_solver(script: Script) -> None
Start the solver and land the deferred induced-drag selection.
Emits START_SOLVER (FSM-26.120 p.338) and then the
SET_VORTICITY_DRAG_BOUNDARIES emission that
:func:solver_settings recorded, if any: the selection is an
analysis-phase command (FSM-26.120 p.350) that cannot precede the
exec phase, so pairing it with the solver start is what makes a
selection built during the settings call actually reach the
script. When no selection was passed nothing is flushed and the
solver default applies, which is surface pressure integration on
every boundary (FSM-26.120 p.202).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
Notes
The selection lands AFTER START_SOLVER here, the placement a steady or
quasi-steady script uses. An unsteady workflow lands it before the solve
instead (:meth:~pyflightstream.script.Script.emit_deferred_vorticity_before_solve),
so a caller assembling an unsteady script by hand must call that method
before this function, or the selection reaches the script after the solve.
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.124")
>>> helpers.initialize_solver(script, symmetry="NONE")
>>> helpers.start_solver(script)
>>> script.render().splitlines()[-1]
'START_SOLVER'
pyflightstream.script.helpers.sweep
¶
sweep(
script: Script,
*,
aoa: Sequence[float] | None = None,
beta: Sequence[float] | None = None,
velocity_file: str | None = None,
clear_solution: Toggle | None = None,
ref_velocity_same: Toggle | None = None,
post_run_script: str | None = None,
start: Toggle = True,
export_spreadsheet: str | None = None,
) -> None
Configure and run a Sweeper Toolbox sweep (FSM-26.120 pp.358-360).
Covers the CUSTOM mode only, which is a SUBSET of what the four sweep commands document, and the shape of the subset is an accident of how this chapter was first read rather than a design: the database and this helper were both written from the worked example at FSM-26.120 p.406, which sweeps three axes in one mode. The reference pages give every axis the same grammar, so what is missing here is the UNIFORM mode on all axes, the file form on the two angle axes, the inline list form on velocity, and the Mach axis entirely (PLN-20260806-1100).
The database no longer has that gap, so the low-level path already reaches the whole grammar today::
script.emit("SWEEPER_SET_AOA_SWEEP", "UNIFORM", [-10.0, 20.0, 1.0])
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
aoa
|
sequence of float
|
Custom angle of attack values in deg. |
None
|
beta
|
sequence of float
|
Custom side-slip values in deg. |
None
|
velocity_file
|
str
|
Path of the custom velocity list file. |
None
|
clear_solution
|
bool or 'ENABLE' or 'DISABLE'
|
Clear the solution between sweep runs instead of reusing it. |
None
|
ref_velocity_same
|
bool or 'ENABLE' or 'DISABLE'
|
Keep the reference velocity equal to the free-stream velocity at every sweep point. |
None
|
post_run_script
|
str
|
Script executed after each sweep point, for example a surface section extraction script. |
None
|
start
|
bool or 'ENABLE' or 'DISABLE'
|
Emit SWEEPER_START after the configuration. Starting the sweep
also lands the induced-drag selection deferred by
:func: |
True
|
export_spreadsheet
|
str
|
Path of the sweep results spreadsheet export. |
None
|
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If no axis is given ( |
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.124")
>>> helpers.initialize_solver(script, symmetry="NONE")
>>> helpers.sweep(script, aoa=[0.0, 2.0, 4.0])
>>> script.render().splitlines()[-2:]
['SWEEPER_SET_AOA_SWEEP CUSTOM 0.0 2.0 4.0', 'SWEEPER_START']
Advanced¶
pyflightstream.script.helpers.AZIMUTH_BASIS
module-attribute
¶
AZIMUTH_BASIS: dict[
str,
tuple[
tuple[float, float, float],
tuple[float, float, float],
],
] = {
"X": ((0.0, 1.0, 0.0), (0.0, 0.0, 1.0)),
"Y": ((0.0, 0.0, 1.0), (1.0, 0.0, 0.0)),
"Z": ((1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
}
pyflightstream.script.helpers.AxialVortexSeparation
¶
Bases: BaseModel
One axial vortex separation assignment (FSM-26.120 p.342).
Slender bodies at incidence shed a pair of vortices along the body axis; the model assigns that behavior to the listed boundaries.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Display name of the assignment in the interface. |
diameter |
float
|
Maximum body diameter, in simulation length units. |
frame |
int or str
|
Coordinate system acting as the body axes, by 1-based index (1 is the reference frame, FSM-26.120 p.342) or by the label a recipe declared for it, which the emitter resolves like every other frame citation in the library. |
body_axis |
str
|
Body axis within that frame, |
sharp_nose_vortices |
bool
|
Apply the sharp-nose vortex treatment to this assignment. |
boundaries |
list of int or str, or ``"all"``
|
Mesh boundaries carrying the model, as for
:class: |
pyflightstream.script.helpers.BLADE_ANCHOR_ANGLES_DEG
module-attribute
¶
BLADE_ANCHOR_ANGLES_DEG: tuple[float, ...] = (
0.0,
90.0,
180.0,
270.0,
)
pyflightstream.script.helpers.BulkSeparation
¶
Bases: BaseModel
One bulk (bluff-body) flow-separation assignment (FSM-26.120 p.342).
Bluff bodies shed their wake from a separation line rather than a trailing edge; the bulk model assigns that behavior to the listed mesh boundaries (FSM-26.120 p.207). This is the 26.12 four-argument grammar with SEPARATION_TYPE; the three-argument 26.1 form (FSM-26.101 p.341) is not covered by the helper and needs direct emission.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Display name of the separation assignment in the interface. |
separation_type |
str
|
Bulk model sub-type, |
diameter |
float
|
Characteristic body diameter, in simulation length units. |
boundaries |
list of int or str, or ``"all"``
|
Mesh boundaries carrying the model, by 1-based index in
geometry-tree order or by declared boundary label; |
pyflightstream.script.helpers.CylindricalBulkSeparation
¶
Bases: BaseModel
One cylindrical bulk separation assignment (FSM-26.121 p.345).
The 26.121 split of the CYLINDRICAL value that
:class:BulkSeparation carried in its separation_type
argument on 26.120.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Display name of the assignment in the interface. |
diameter |
float
|
Characteristic body diameter, in simulation length units. |
boundaries |
list of int or str, or ``"all"``
|
Mesh boundaries carrying the model, as for
:class: |
pyflightstream.script.helpers.DEFAULT_SHEDDING_DIRECTION
module-attribute
¶
DEFAULT_SHEDDING_DIRECTION = 'AXIAL'
pyflightstream.script.helpers.EUCLIDEAN_ROTOR_UNIT
module-attribute
¶
EUCLIDEAN_ROTOR_UNIT = 'rad/s'
pyflightstream.script.helpers.PyflightstreamDeprecationWarning
¶
Bases: PyflightstreamWarning, FutureWarning
A part of this package's own interface is going away.
Through :class:PyflightstreamWarning, one warning filter selects it
with the rest of this package's warnings. Through :class:FutureWarning,
a person reading a TOML file or using the command line sees the rename
under the interpreter's default filters, once per message and location.
A caller can filter this category explicitly; dependency deprecations
retain their own categories and filters.
Use it where this package deprecates one of its OWN arguments, names or behaviours. An upstream deprecation this package merely passes on is not ours and keeps its own category.
Examples:
>>> from pyflightstream._errors import (
... PyflightstreamDeprecationWarning,
... PyflightstreamWarning,
... )
>>> issubclass(PyflightstreamDeprecationWarning, PyflightstreamWarning)
True
>>> issubclass(PyflightstreamDeprecationWarning, FutureWarning)
True
pyflightstream.script.helpers.PyflightstreamWarning
¶
Bases: UserWarning
The category that says a warning came from THIS package.
It exists for one job: the executable-examples run promotes warnings to errors so a stale example fails CI, and promoting every warning means a dependency's next release turns that build red for something nobody here can fix. Naming one category scopes the promotion to what this repository is responsible for.
UserWarning is kept as the base, so -W error::UserWarning,
simplefilter("ignore", UserWarning) and every other selection a
caller already had keep catching what they caught. The addition is
widening, exactly as :class:PyflightstreamError was.
NOT a subclass of :class:PyflightstreamError, and the split is the
same one that requirement FR-39 draws: the base is for every
catalogued EXCEPTION, and a warning is delivered through
:mod:warnings and selected by category rather than raised and
caught. Calling it an Error would misname it for the reader of a
traceback.
Import the category from :mod:pyflightstream.exceptions, the public
exception and warning catalog. The package's warning categories derive
from this class, so filtering it selects package warnings without
selecting unrelated dependency warnings.
Examples:
>>> import warnings
>>> from pyflightstream.exceptions import PyflightstreamWarning
>>> with warnings.catch_warnings(record=True) as caught:
... warnings.simplefilter("always")
... warnings.warn("the campaign declares no outputs", PyflightstreamWarning)
>>> caught[0].category.__name__
'PyflightstreamWarning'
>>> issubclass(PyflightstreamWarning, UserWarning)
True
pyflightstream.script.helpers.RELAXED_SHEDDING_DIRECTIONS
module-attribute
¶
RELAXED_SHEDDING_DIRECTIONS: Mapping[str, int] = {
"AXIAL": 0,
"AZIMUTH": 1,
}
pyflightstream.script.helpers.RELAXED_TE_FIELDS_WITHOUT_DIRECTION
module-attribute
¶
RELAXED_TE_FIELDS_WITHOUT_DIRECTION = 3
pyflightstream.script.helpers.RELAXED_TE_FIELDS_WITH_DIRECTION
module-attribute
¶
RELAXED_TE_FIELDS_WITH_DIRECTION = 4
pyflightstream.script.helpers.RELAXED_TE_KEYWORD
module-attribute
¶
RELAXED_TE_KEYWORD = 'Relaxed_TE'
pyflightstream.script.helpers.REMOVED_FORMS
module-attribute
¶
REMOVED_FORMS: dict[str, RetiredName] = {
"analysis_setup.vorticity_drag_boundaries": RetiredName(
owner="analysis_setup",
old="vorticity_drag_boundaries",
new="solver_settings(vorticity_drag_boundaries=)",
retired_in="0.58.0",
why="The induced-drag boundary selection is a parameter of solver_settings, and analysis_setup only forwarded it.",
),
"plan_matrix.fs_version": RetiredName(
owner="plan_matrix",
old="fs_version",
new="default_fs_version",
retired_in="0.58.0",
why=_MATRIX_DEFAULT_BUILD,
),
"run_matrix.fs_version": RetiredName(
owner="run_matrix",
old="fs_version",
new="default_fs_version",
retired_in="0.58.0",
why=_MATRIX_DEFAULT_BUILD,
),
"pyfs-matrix.--sweep-csv": RetiredName(
owner="pyfs-matrix run",
old="--sweep-csv",
new="the group files of each polar",
retired_in="0.58.0",
why=_THE_CAMPAIGN_SWEEP_SENTENCE,
instead="Join",
),
"run_matrix.sweep_csv": RetiredName(
owner="run_matrix",
old="sweep_csv",
new="the group files of each polar",
retired_in="0.58.0",
why=_THE_CAMPAIGN_SWEEP_SENTENCE,
instead="Join",
),
"run_campaign.sweep_csv": RetiredName(
owner="run_campaign",
old="sweep_csv",
new="the group files of each polar",
retired_in="0.58.0",
why=_THE_CAMPAIGN_SWEEP_SENTENCE,
instead="Join",
),
**_command_moves(
"pyfs-matrix",
{
"refine": "pyfs-mesh refine",
"audit-mesh": "pyfs-mesh audit",
"inventory": "pyfs-mesh inventory",
"degenerate": "pyfs-mesh degenerate",
},
_GEOMETRY_TOOLS,
),
"refine.chordwise": RetiredName(
owner="refine_mesh and a [families.<name>] table",
old="chordwise",
new="normal (keyword) or normal_factor (family key)",
retired_in="0.58.0",
why=_REFINE_DIRECTIONS,
),
"refine.spanwise": RetiredName(
owner="refine_mesh and a [families.<name>] table",
old="spanwise",
new="parallel (keyword) or parallel_factor (family key)",
retired_in="0.58.0",
why=_REFINE_DIRECTIONS,
),
"refine.keep_first_row": RetiredName(
owner="refine_mesh and a [families.<name>] table",
old="keep_first_row",
new="nothing: a row kept at an interface is its own family, which families selects",
retired_in="0.58.0",
why="The refinement no longer offers a kept first row.",
instead="Use",
),
"refine.--chordwise": RetiredName(
owner="the refine command",
old="--chordwise",
new="--normal",
retired_in="0.58.0",
why=_REFINE_DIRECTIONS,
),
"refine.--spanwise": RetiredName(
owner="the refine command",
old="--spanwise",
new="--parallel",
retired_in="0.58.0",
why=_REFINE_DIRECTIONS,
),
"refine.--keep-first-row": RetiredName(
owner="the refine command",
old="--keep-first-row",
new="nothing: a row kept at an interface is its own family, which --families selects",
retired_in="0.58.0",
why="The refinement no longer offers a kept first row.",
instead="Use",
),
"refine.--out-dir": RetiredName(
owner="the refine command",
old="--out-dir",
new="--out",
retired_in="0.58.0",
why=_ONE_OUTPUT_FLAG,
),
"audit-mesh.--csv": RetiredName(
owner="the audit-mesh command",
old="--csv",
new="--out",
retired_in="0.58.0",
why=_ONE_OUTPUT_FLAG,
),
"kind.normal": RetiredName(
owner="a [[probes]] or [volume_section] entry",
old='kind = "normal"',
new='kind = "default"',
retired_in="0.58.0",
why=_PROBE_KINDS,
),
"kind.unsteady": RetiredName(
owner="a [[probes]] or [volume_section] entry",
old='kind = "unsteady"',
new='kind = "instantaneous"',
retired_in="0.58.0",
why=_PROBE_KINDS,
),
"archive.root": RetiredName(
owner="pyfs-workspace archive",
old="the positional root (archive ROOT SIM_ID)",
new="archive SIM_ID --workspace ROOT",
retired_in="0.58.0",
why="Every subcommand names its campaign with --workspace, so archive does too.",
),
"hub_rings.width": RetiredName(
owner="the [hub_rings] table",
old="width",
new="band_width",
retired_in="0.58.0",
why="One key states the total height of the rings.",
),
"sector_to_wheel.hub": RetiredName(
owner="sector_to_wheel",
old="hub (CLI: --hub)",
new="center (CLI: --center)",
retired_in="0.58.0",
why="One spelling states the rotor-axis point, in the mesh's unit.",
),
"motions.MOVING_BOUNDARIES": RetiredName(
owner="a MOTIONS record",
old="MOVING_BOUNDARIES",
new="MOVING_BC_ALIAS",
retired_in="0.15.0",
why="A MOTIONS record names a rotor alias from the reference. Flat rotor row keys remain accepted.",
),
"rotation.FAMILIES": RetiredName(
owner="a rotation record",
old="FAMILIES",
new="ALIAS",
retired_in="0.15.0",
why="A rotation and a motion cite a set the same way, so the reference is the one place a study says what its groups are. A record listing families is a record that has to be edited when the mesh is renamed, and the alias is what stops that.",
),
"pproc.each_blade": RetiredName(
owner="a post-processing entry",
old="families = 'each_blade'",
new="frame = 'LOCAL_AXIS'",
retired_in="0.15.0",
why="The FRAME decides how an entry expands, and a blade's own axes are one per blade, so the selector that said so is a second statement of one fact.",
),
"families.airframe": RetiredName(
owner="a families cell",
old="families = 'airframe'",
new="an alias the reference declares, for example airframe = [...]",
retired_in="0.15.0",
why="The selector decides what is NOT a blade from a pattern over the family name, so a mesh whose blades are spelled another way gets an airframe with blades in it and nothing says so. An alias names the surfaces, and a study that named them cannot be guessed wrong.",
),
"families.blades": RetiredName(
owner="a families cell",
old="families = 'blades'",
new="the rotor's own alias, or an alias the reference declares",
retired_in="0.15.0",
why="A rotor's block lists families_blades, so naming the rotor in a frame that expands per blade gives one emission per blade with no pattern in it.",
),
"setup.physics_auto_trailing_edges": RetiredName(
owner="a setup",
old="physics_auto_trailing_edges",
new=_THE_DETECTION_HOME,
retired_in="0.58.0",
why=_THE_PHYSICS_COMMAND,
instead="Declare",
),
"setup.physics_auto_wake_nodes": RetiredName(
owner="a setup",
old="physics_auto_wake_nodes",
new=_THE_DETECTION_HOME,
retired_in="0.58.0",
why=_THE_PHYSICS_COMMAND,
instead="Declare",
),
"setup.sonic_velocity_m_per_s": RetiredName(
owner="a setup",
old="sonic_velocity_m_per_s",
new="nothing: the speed of sound follows from the air state, the flight-condition columns of the row (temperature and specific-heat ratio)",
retired_in="0.58.0",
why="The SONIC_VELOCITY command was removed by build 26.101 and has no row on any registered build.",
instead="Write",
),
"setup.symmetry_loads": RetiredName(
owner="a setup",
old="symmetry_loads",
new="the SYMMETRY_LOADS column of the run matrix row (true or false)",
retired_in="0.58.0",
why="Whether the loads are the meshed half's or the whole model's is a per-row choice, and the column is the one route to SET_ANALYSIS_SYMMETRY_LOADS.",
instead="Write",
),
"setup.thin_boundaries": RetiredName(
owner="a setup",
old="thin_boundaries",
new='thin_boundaries in the boundaries file beside the geometry, as thin_boundaries = ["Wing"]',
retired_in="0.58.0",
why="Which surfaces are thin is a property of the geometry, declared with it.",
instead="Declare",
),
"pproc.base_regions": RetiredName(
owner="a pproc",
old="base_regions",
new="[base_regions.<family>] in the boundaries file beside the geometry, or the run matrix row's BASE_REGIONS column for a per-row choice",
retired_in="0.58.0",
why="A base region is part of the geometry's declaration, and post-processing does not state what the solver meshes; the setup's base_region_operations act on an opened simulation.",
instead="Declare it with",
),
"pyfs-workspace.geometry": RetiredName(
owner="pyfs-workspace",
old="geometry",
new="pyfs-mesh for the mesh verbs, pyfs-geom iges-convert and pyfs-fsi beam",
retired_in="0.58.0",
why=_GEOMETRY_TOOLS,
instead="Use",
),
**_command_moves(
"pyfs-workspace geometry",
_GEOMETRY_VERB_HOMES,
_GEOMETRY_TOOLS,
),
**_command_moves(
"pyfs-matrix",
_WORKSPACE_VERB_HOMES,
_WORKSPACE_VERBS_WHY,
),
**_command_moves(
"pyfs-matrix",
{"visual-inspect": "pyfs-matrix plot-sweeps"},
"The matrix's plot is named for what it draws, the sweeps of its rows, so that visual-inspect means the mesh inspection of pyfs-mesh alone; the output is identical.",
),
}
pyflightstream.script.helpers.ROTATION_COMMANDS
module-attribute
¶
ROTATION_COMMANDS: tuple[str, ...] = (
"ROTATE_SURFACE",
"SURFACE_ROTATE",
)
pyflightstream.script.helpers.ROTATION_SENSE_SIGN
module-attribute
¶
ROTATION_SENSE_SIGN: dict[RotationSense, float] = {
"counterclockwise": 1.0,
"clockwise": -1.0,
}
pyflightstream.script.helpers.RelaxedTrailingEdge
dataclass
¶
RelaxedTrailingEdge(
fields: tuple[str, ...],
direction: str | None = None,
keyword: bool = False,
)
One relaxed trailing-edge component specification, read apart.
The specification is the line a CCS file writes where a component is
defined, not a script line: Relaxed_TE;u;v1;v2;direction
(FSM-26.124 p.85). u is a chordwise or radial location and v1,
v2 the spanwise or axial bounds; this package does not interpret
them and carries them verbatim, because the edition that added the
direction changed nothing about them. The keyword may be written or
left out, and the specification renders the way it was written.
THE THREE-VALUE FORM IS NOT SILENTLY WIDENED. A specification parsed with three values renders with three, so an artifact written before 26.123 stays readable by the builds that wrote it; the direction appears only where one was read or one was asked for.
Attributes:
| Name | Type | Description |
|---|---|---|
fields |
tuple of str
|
The three values |
direction |
str or None
|
|
keyword |
bool
|
Whether the text opened with |
Examples:
>>> from pyflightstream.script import helpers
>>> edge = helpers.parse_relaxed_trailing_edge("0.5;0.1;0.9")
>>> edge.direction is None
True
>>> edge.shedding_direction
'AXIAL'
>>> edge.render()
'0.5;0.1;0.9'
>>> edge.with_shedding("AZIMUTH").render()
'0.5;0.1;0.9;1'
>>> helpers.parse_relaxed_trailing_edge("Relaxed_TE;0.5;0.1;0.9;1").render()
'Relaxed_TE;0.5;0.1;0.9;1'
shedding_direction
property
¶
shedding_direction: str
The direction this specification MEANS, stated or defaulted.
Returns:
| Type | Description |
|---|---|
str
|
|
with_shedding
¶
with_shedding(direction: str | int) -> RelaxedTrailingEdge
Return this specification stating one shedding direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str or int
|
|
required |
Returns:
| Type | Description |
|---|---|
RelaxedTrailingEdge
|
A new specification. Asking for the axial direction on one that already leaves the direction unwritten returns it UNCHANGED, at three values: the two say the same thing, and writing the 0 would hand a four-value specification to a build that reads three. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the direction is neither, naming the value and both. |
render
¶
render() -> str
Return the specification as a component definition writes it.
Returns:
| Type | Description |
|---|---|
str
|
The values, semicolon separated, with the direction's integer
appended only where :attr: |
pyflightstream.script.helpers.RotationSense
module-attribute
¶
RotationSense = Literal['clockwise', 'counterclockwise']
pyflightstream.script.helpers.SEPARATION_MODELS
module-attribute
¶
SEPARATION_MODELS: dict[str, type[BaseModel]] = {
"airfoil_separation": AirfoilSeparation,
"axial_vortex_separation": AxialVortexSeparation,
"cylindrical_bulk_separation": CylindricalBulkSeparation,
"stratford_bulk_separation": StratfordBulkSeparation,
}
pyflightstream.script.helpers.SolverSetup
¶
Bases: BaseModel
The complete solver-flag snapshot of one built script.
One :class:FlagRecord per command of the three settings families
plus the induced-drag boundary selection, keyed by command name.
Serialize with model_dump_json() (or model_dump(mode="json")
for the manifest) and restore with model_validate_json();
:func:script_from_setup then regenerates the settings emissions.
Attributes:
| Name | Type | Description |
|---|---|---|
fs_version |
str
|
Canonical FlightStream version the script was built for; the per-version defaults were resolved against it. |
flags |
mapping of str to FlagRecord
|
The snapshot, keyed by FlightStream command name. |
explicit_kwargs
¶
explicit_kwargs() -> dict[str, object]
Return the helper keywords that reproduce the explicit flags.
Only explicit records are reconstructed: the library
defaults (the minimum-Cp emission) are regenerated by
:func:pyflightstream.script.helpers.solver_settings itself,
so a snapshot replays to the same emitted lines without ever
freezing a library default as if the user had chosen it.
Returns:
| Type | Description |
|---|---|
dict of str to object
|
Keyword arguments for
:func: |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
A flag marked explicit whose selection is empty (PFS-2012.01), named by command and keyword. The record is what to fix, and the message says so rather than naming an argument for removal, since no call wrote one. |
provenance_counts
¶
provenance_counts() -> dict[str, int]
Return how many flags carry each provenance marker.
pyflightstream.script.helpers.StratfordBulkSeparation
¶
Bases: BaseModel
One Stratford bulk separation assignment (FSM-26.121 p.345).
Takes no diameter, which is the visible difference from
:class:CylindricalBulkSeparation.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Display name of the assignment in the interface. |
boundaries |
list of int or str, or ``"all"``
|
Mesh boundaries carrying the model, as for
:class: |
pyflightstream.script.helpers.Toggle
module-attribute
¶
Toggle = bool | Literal['ENABLE', 'DISABLE']
pyflightstream.script.helpers.UNMARKED_EUCLIDEAN_ROTOR_UNIT
module-attribute
¶
UNMARKED_EUCLIDEAN_ROTOR_UNIT = 'rev/min'
pyflightstream.script.helpers.UNSTEADY_ACTION_COMMAND
module-attribute
¶
UNSTEADY_ACTION_COMMAND = 'SET_NEW_UNSTEADY_SOLVER_ACTION'
pyflightstream.script.helpers.UNSTEADY_ACTION_KINDS
module-attribute
¶
UNSTEADY_ACTION_KINDS = ('SCRIPT', 'COMMAND_LINE')
pyflightstream.script.helpers.UnsteadyActionUse
¶
Bases: BaseModel
One action the solver runs after each unsteady time step.
Provenance, like :class:BrokenCommandUse: the script collects one
per registered action so the run record can say what ran beside the
solver, under which name, and on what evidence.
THE EVIDENCE FIELD IS THE POINT. SET_NEW_UNSTEADY_SOLVER_ACTION is documented on the two newest builds and PROBED ON NONE, so a workflow resting on it rests on a page rather than on a run. The status is read from the command database at the moment the action is registered and carried here, so it is stated once, at build time, instead of being assumed by every reader downstream.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Action name as registered, unique within one script. |
kind |
str
|
|
filename |
str
|
The path the registration line names, exactly as passed. WHAT IT IS RELATIVE TO IS UNSTATED BY BOTH EDITIONS: no manual page says which working directory the solver runs an action from (RPT-030), so this library records the caller's own string and claims nothing about how the solver resolves it. On 26.123 the action was measured to run from the simulation folder (RPT-041, the script-action re-read probe). |
evidence |
str or None
|
Recorded status of the command on the script's build
( |
inherited |
bool
|
Whether that status was recorded for this build or inherited from its base release. An inherited status is an assumption, and a record that cannot show the difference presents one as a measurement. |
pyflightstream.script.helpers.VERTEX_IMPORT_ROUTE
module-attribute
¶
VERTEX_IMPORT_ROUTE = 'TRAILING_EDGES_IMPORT'
pyflightstream.script.helpers.WAKE_EDGE_ANGLE_ROUTE
module-attribute
¶
WAKE_EDGE_ANGLE_ROUTE = 'AUTO_DETECT_TRAILING_EDGES'
pyflightstream.script.helpers.WAKE_EDGE_FILE_ROUTE_MEASURED_ON
module-attribute
¶
WAKE_EDGE_FILE_ROUTE_MEASURED_ON = '26.124'
pyflightstream.script.helpers.WAKE_EDGE_FILE_ROUTE_REPORT
module-attribute
¶
WAKE_EDGE_FILE_ROUTE_REPORT = 'RPT-061'
pyflightstream.script.helpers.WAKE_EDGE_IMPORT_ROUTE
module-attribute
¶
WAKE_EDGE_IMPORT_ROUTE = 'IMPORT_WAKE_EDGES_FROM_FILE'
pyflightstream.script.helpers.WAKE_EDGE_NODE_PLACEHOLDER
module-attribute
¶
WAKE_EDGE_NODE_PLACEHOLDER = '0,0,0'
pyflightstream.script.helpers.WAKE_STABILIZATION_COMMAND
module-attribute
¶
WAKE_STABILIZATION_COMMAND = (
"SET_MOTION_SLIPSTREAM_WAKE_STABILIZATION"
)
pyflightstream.script.helpers.actuator_disc
¶
actuator_disc(
script: Script,
name: str,
*,
frame: int | str,
axis: str,
offset: float,
r_tip: float,
r_hub: float,
rpm: float,
thrust: float | None = None,
thrust_type: str = "NEWTONS",
profile: str | None = None,
profile_force_unit: str = "NEWTONS",
n_blades: int | None = None,
profile_text: str | None = None,
swirl: float | None = None,
wake_type: str | None = None,
enable: Toggle = True,
label: str | None = None,
) -> int
Create and configure one rotor actuator disc (FSM-26.120 pp.323-324).
The disc is the linearized rotor slipstream surrogate
(FSM-26.120 pp.185-187). Exactly one thrust specification is taken:
a net thrust (ELLIPTICAL profile) or a radial force
distribution file profile (CUSTOM profile, which also needs
n_blades).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
name
|
str
|
Actuator name shown in the interface. |
required |
frame
|
int or str
|
Local coordinate system carrying the disc axis (index greater than 1, or its creation label); it must exist earlier in the script. |
required |
axis
|
str
|
Disc axis within |
required |
offset
|
float
|
Disc position along the axis, in simulation length units. |
required |
r_tip
|
float
|
Tip and hub radii, in simulation length units. |
required |
r_hub
|
float
|
Tip and hub radii, in simulation length units. |
required |
rpm
|
float
|
Rotational speed in rev/min; the sign selects the rotation direction about the axis. |
required |
thrust
|
float
|
Net thrust for the ELLIPTICAL model, in |
None
|
thrust_type
|
str
|
|
'NEWTONS'
|
profile
|
str
|
Path of the radial thrust profile file for the CUSTOM model, the
path the command's next line names. Refused, before anything is
emitted, on a build whose |
None
|
profile_force_unit
|
str
|
Force unit used inside the profile file: |
'NEWTONS'
|
n_blades
|
int
|
Blade count; required with |
None
|
profile_text
|
str
|
The profile's text, when the run is to write the file |
None
|
swirl
|
float
|
Fraction between 0 and 1 of the swirl velocity kept downstream; below 1 mimics a de-swirling stator (FSM-26.120 p.186). |
None
|
wake_type
|
str
|
RIGID or RELAXED, as documented from 26.122; omitted emits no wake setter. |
None
|
enable
|
bool or 'ENABLE' or 'DISABLE'
|
Emit ENABLE_ACTUATOR at the end. |
True
|
label
|
str
|
Label registered for the created actuator in the script's entity registry, so later commands can cite it by name instead of by index. |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Index of the created actuator, for later citations. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If not exactly one thrust specification is given, a profile file lacks |
(ScriptReferenceError, ScriptLabelError)
|
If the frame does not exist or the creation label is already used. |
pyflightstream.script.helpers.analysis_setup
¶
analysis_setup(
script: Script,
*,
loads_frame: int | str | None = None,
moments_model: str | None = None,
symmetry_loads: Toggle | None = None,
load_units: str | None = None,
boundaries: Sequence[int | str] | None = None,
inviscid_only: Toggle | None = None,
vorticity_drag_boundaries: object = None,
) -> None
Select how loads and moments are analyzed (FSM-26.120 pp.350-351).
TWO GROUPS, TWO POSITIONS. symmetry_loads, loads_frame and
moments_model are init-phase settings and go in a call made
BEFORE :func:start_solver: the solve reads them, and an unsteady
run's step exports, written during the march, state their moments in
the frame set when they are written (RPT-064). The other arguments
are analysis-phase selections and go in a call made after it. A call
mixing the two groups fits neither position: before the start it
reaches the analysis phase and the phase guard then refuses
START_SOLVER; after the start the guard refuses the init setting.
The induced-drag boundary selection is not an argument of this call: on an
unsteady march the step exports read it only when it precedes START_SOLVER
(FR-568), so it is stated through solver_settings(vorticity_drag_boundaries=...)
and the workflow emitter, which places it there.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
loads_frame
|
int or str
|
Coordinate system for evaluating loads and moments; index 1 is the reference frame, and created frames may be cited by their creation label. Init phase: set after START_SOLVER it reached the final export only (RPT-064). |
None
|
moments_model
|
str
|
|
None
|
symmetry_loads
|
bool or 'ENABLE' or 'DISABLE'
|
Include symmetry boundary loads; relevant to half-model runs. |
None
|
load_units
|
str
|
|
None
|
boundaries
|
sequence of int or str
|
Boundaries enabled in the analysis, by 1-based index or declared boundary label; boundaries not listed are disabled (FSM-26.120 p.351). Indices are verified against the inventory declared with declare_existing(boundaries=...) when one exists. |
None
|
inviscid_only
|
bool or 'ENABLE' or 'DISABLE'
|
Restrict the analysis to inviscid loads and moments. |
None
|
vorticity_drag_boundaries
|
None
|
Removed: any other value is refused, naming
|
None
|
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
The removed |
pyflightstream.script.helpers.assign_selected_ccs_curves
¶
assign_selected_ccs_curves(
script: Script, kind: str
) -> str | None
Emit the CCS curve assignment of kind where the build carries it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
The script being built, after its curves were selected. |
required |
kind
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
str or None
|
The command emitted, or None on a build that does not carry it. |
pyflightstream.script.helpers.azimuth_basis
¶
azimuth_basis(
rotor_axis: str, *, caller: str = "azimuth_basis"
) -> tuple[
tuple[float, float, float], tuple[float, float, float]
]
Return the in-plane datum and quadrature vectors of a rotor axis.
The single reader of :data:AZIMUTH_BASIS, so the convention has one
home and changing it is one edit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rotor_axis
|
str
|
Rotation axis of the rotor in the reference frame: |
required |
caller
|
str
|
Name of the public helper to put in the refusal; a direct call
leaves it as |
'azimuth_basis'
|
Returns:
| Type | Description |
|---|---|
tuple of tuple of float
|
The unit vector azimuth zero points along, then the unit vector 90 degrees of positive azimuth from it. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the axis is not one of the three, naming what was passed. |
Examples:
>>> from pyflightstream.script.helpers import azimuth_basis
>>> azimuth_basis("Z")
((1.0, 0.0, 0.0), (0.0, 1.0, 0.0))
pyflightstream.script.helpers.blade_frames
¶
blade_frames(
script: Script,
*,
hub_origin: Sequence[float],
rotor_axis: str,
n_blades: int,
blade1_azimuth_deg: float,
rotation: RotationSense,
names: Sequence[str] | None = None,
labels: Sequence[str] | None = None,
) -> list[int]
Create one motion-following coordinate system per blade.
Places n_blades local frames 360/N apart around the rotor disc,
anchored on the first blade, each with its x axis along that blade's
radial direction and its z axis along the rotor axis, so an azimuthal
reduction afterwards has a frame per blade to reduce in. The returned
indices are what :func:rotary_motion is handed as moving_frames,
which is what binds the frames to the motion and makes them follow it.
THE PLACEMENT IS ARITHMETIC AND NOT GEOMETRY. Nothing here reads a
mesh and nothing computes a centroid: N blades sit 360/N apart, and
the only measured quantity is the first blade's azimuth, which must
be one of :data:BLADE_ANCHOR_ANGLES_DEG.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
hub_origin
|
sequence of float
|
Hub position in the reference frame, in simulation length units. Every blade frame shares it: the frames differ in orientation and not in origin, because they rotate about the same hub. |
required |
rotor_axis
|
str
|
Rotation axis in the reference frame, |
required |
n_blades
|
int
|
Blade count, at least 1. |
required |
blade1_azimuth_deg
|
float
|
Azimuth of the first blade, in deg, measured from the datum of
:func: |
required |
rotation
|
('clockwise', 'counterclockwise')
|
Sense of rotation, viewed from behind the aircraft looking
forward, the vocabulary a rotor descriptor records in its
Required, with no safe default. A wrong sense silently renumbers the blades and changes every phase-locked reduction keyed to blade index. |
"clockwise"
|
names
|
sequence of str
|
Display names of the created frames, one per blade; |
None
|
labels
|
sequence of str
|
Labels registered in the script's entity registry, one per blade, so later commands can cite a blade frame by name. A frame label and a boundary label are different entity kinds and cannot collide. |
None
|
Returns:
| Type | Description |
|---|---|
list of int
|
The created frame indices, in blade order, ready to pass to
:func: |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the blade count is below one, the rotor axis is not one of the
three, the rotation sense is not one of the two, the first
blade's azimuth is not one of the four anchors (the measured
angle is named), or a |
ScriptLabelError
|
If a blade label is invalid or already used. Duplicate labels are refused with CommandArgumentError before any blade frame is created. |
Notes
The azimuth datum this places blades against is a PROPOSAL awaiting the domain expert's decision (RPT-036). A wrong datum rotates every blade frame together, and every phase-locked reduction keyed to blade index with them, and it produces plausible numbers rather than an error, which is why it is written down where the placement is made.
Deleting a coordinate system renumbers the frames above it downward (RPT-021 section 3), and this helper creates N of them per rotor. Do not delete a frame between this call and the citations of the indices it returned.
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.120")
>>> frames = helpers.blade_frames(
... script,
... hub_origin=(1.2, 0.0, 0.0),
... rotor_axis="Z",
... n_blades=3,
... blade1_azimuth_deg=90.0,
... rotation="counterclockwise",
... )
>>> frames
[2, 3, 4]
>>> motion = helpers.rotary_motion(
... script, frame=frames[0], axis="Z", rpm=2400.0, moving_frames=frames
... )
pyflightstream.script.helpers.build_setup
¶
build_setup(
*,
version: str,
passed: Mapping[str, object],
minimum_cp_default_emitted: bool,
registry: CommandRegistry | None = None,
) -> SolverSetup
Build the snapshot of one solver_settings call.
Called by :func:pyflightstream.script.helpers.solver_settings
after its emissions succeeded; the snapshot covers every command of
the three settings families whether passed or not, so nothing is
silently missing from the record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
FlightStream version of the script, canonical identifier (26.120); a vendor release name works only where it names exactly one registered build. |
required |
passed
|
mapping of str to object
|
The helper keywords exactly as received (None meaning not
passed), plus the validated |
required |
minimum_cp_default_emitted
|
bool
|
Whether the helper emitted the library minimum-Cp default (it
does whenever |
required |
registry
|
CommandRegistry
|
Database every availability, default and evidence field of the
snapshot is read from; the packaged one when omitted. The caller
passes the database its Script was built with
(:attr: |
None
|
Returns:
| Type | Description |
|---|---|
SolverSetup
|
The snapshot, ready to attach to the script. |
Raises:
| Type | Description |
|---|---|
SolverSetupError
|
If a command of the three families has no snapshot flag; the model must never silently lag the command database. |
pyflightstream.script.helpers.coordinate_frame
¶
coordinate_frame(
script: Script,
*,
name: str,
origin: Sequence[float],
x_axis: Sequence[float],
y_axis: Sequence[float],
z_axis: Sequence[float] | None = None,
label: str | None = None,
) -> int
Create and define a local coordinate system, returning its index.
Emits CREATE_NEW_COORDINATE_SYSTEM followed by
EDIT_COORDINATE_SYSTEM with the origin and the three axis vectors
in the reference frame (coordinate_systems chapter). Use it when
the solver should carry the same plane a probe grid was
prescribed on; probe positions written by :func:probe_points and
:func:probe_line are in the reference frame (frame 1), so this
helper is presentation, not placement for them. A lattice imported
with :func:probes_from_file is read in the frame its frame
argument cites, which may be a frame created here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
name
|
str
|
Name of the new coordinate system. |
required |
origin
|
sequence of float
|
Frame origin in the reference frame (simulation length units). |
required |
x_axis
|
sequence of float
|
Axis direction vectors in the reference frame. |
required |
y_axis
|
sequence of float
|
Axis direction vectors in the reference frame. |
required |
z_axis
|
sequence of float
|
Third axis; computed as the right-handed cross product of x_axis and y_axis when omitted. When given it must point along that cross product. |
None
|
label
|
str
|
Label registered for the created frame in the script's entity
registry, so later commands can cite it by name instead of by
index. Distinct from |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Index of the created frame (the reference frame is 1; created local frames follow). |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the axes define no coordinate system, because an axis has zero
length, the two are parallel or not orthogonal
(:func: |
pyflightstream.script.helpers.detect_every_boundary
¶
detect_every_boundary(script: Script, kind: str) -> str
Emit the every-boundary detection of kind in the build's form.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
The script being built. |
required |
kind
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
str
|
The command emitted. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
The build requires a boundary inventory and none has been declared. |
Examples:
>>> from pyflightstream.script import Script
>>> old, new = Script(version="26.124"), Script(version="26.125")
>>> new.declare_existing(boundaries=2)
>>> detect_every_boundary(old, "trailing_edges"), detect_every_boundary(new, "trailing_edges")
('AUTO_DETECT_TRAILING_EDGES', 'DETECT_TRAILING_EDGES_BY_SURFACE')
>>> print(new.render().strip())
DETECT_TRAILING_EDGES_BY_SURFACE
SURFACES 2
1,2
pyflightstream.script.helpers.euclidean_rotor
¶
euclidean_rotor(view: VersionView) -> bool
Return whether a rotor is written as a marked Euclidean motion on view's build.
THE ONE PLACE THE SUBSTITUTION IS DECIDED, with
:func:unmarked_euclidean_rotor:
:func:pyflightstream.script.helpers.rotary_motion writes by it and
cases.workflows derives coverage from it. True when the build
documents no rotary rotor speed and documents the whole Euclidean rotor
(:data:EUCLIDEAN_ROTOR_COMMANDS).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
VersionView
|
The command view of the script's build. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when the build documents no rotary rotor speed and every command of
:data: |
pyflightstream.script.helpers.every_boundary_detection
¶
every_boundary_detection(
script: Script, kind: str
) -> tuple[str, tuple[int, ...]]
Return the command and arguments that detect kind on every boundary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
The script whose build decides the form. |
required |
kind
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
tuple of (str, tuple of int)
|
The automatic command with no argument where the build carries it,
else the by-surface command with the every-boundary index. For
|
Raises:
| Type | Description |
|---|---|
KeyError
|
If |
pyflightstream.script.helpers.export_probes
¶
export_probes(
script: Script,
path: str,
*,
update: Toggle = True,
source: str = "export_probes",
) -> None
Export the probe values, refreshing them first (FSM-26.120 pp.362-363).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
path
|
str
|
Export file path. |
required |
update
|
bool or 'ENABLE' or 'DISABLE'
|
Emit UPDATE_PROBE_POINTS first, so the export reflects the current solution; the manual instructs refreshing before exporting (FSM-26.120 p.362). |
True
|
source
|
str
|
Public calling entry point to name in collision diagnostics. |
'export_probes'
|
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If this script has already exported to The message names the conflicting path and the EARLIER call: the helper name the script stored with the path and, for this helper, the file and line it was called from, because one naming only the second sends the reader to the wrong line: the one they need to change is usually the earlier one. The second site is the traceback's. |
Notes
The register lives on the :class:~pyflightstream.script.Script
rather than here, because the collision is between two CALLS and
only the script sees both.
pyflightstream.script.helpers.export_results
¶
export_results(
script: Script,
*,
spreadsheet: str | None = None,
tecplot: str | None = None,
vtk: str | None = None,
vtk_boundaries: Sequence[int | str]
| Literal["all"] = "all",
vtk_variables: Sequence[str]
| Literal["all"]
| None = None,
vtk_wake: Toggle = False,
force_distributions: str | None = None,
) -> None
Export the solver results that were requested (FSM-26.120 pp.352-354).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
spreadsheet
|
str
|
Path of the loads and moments spreadsheet, the primary quantitative output of a steady run. |
None
|
tecplot
|
str
|
Path of the Tecplot .dat export. |
None
|
vtk
|
str
|
Path of the VTK export. |
None
|
vtk_boundaries
|
sequence of int or str, or ``"all"``
|
Boundaries included in the VTK export, by 1-based index or declared boundary label. |
'all'
|
vtk_variables
|
sequence of str, ``"all"``, or None
|
Variables selected before the VTK export; None keeps the
current selection. |
None
|
vtk_wake
|
bool or 'ENABLE' or 'DISABLE'
|
Include the wake in the VTK variable selection. Written only by
that selection, so True without |
False
|
force_distributions
|
str
|
Path of the force distribution vectors export, all boundaries. |
None
|
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If |
pyflightstream.script.helpers.fluid_fifth_property
¶
fluid_fifth_property(script: Script) -> str
Name the fifth FLUID_PROPERTIES argument this build takes.
The editions state one physical fact two ways: the three pre-26.100
builds take sonic_velocity and the later ones take
specific_heat_ratio. :func:atmosphere REFUSES the one its
build does not take, which is right -- passing it would emit a
keyword the build rejects -- but it leaves a caller holding both
values with no way to ask which to pass without reaching into the
script's private command view.
So the question is answerable here, where the view belongs, and a caller one layer up chooses instead of guessing or catching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
The script whose build is asked. |
required |
Returns:
| Type | Description |
|---|---|
str
|
|
pyflightstream.script.helpers.frame_axes_problem
¶
frame_axes_problem(
x_axis: Sequence[float],
y_axis: Sequence[float],
z_axis: Sequence[float] | None = None,
) -> str | None
Return why the axes do not define a coordinate system, or None when they do.
A coordinate system needs two directions that are finite, not zero, not
parallel and orthogonal: the cosine of their angle within
:data:FRAME_AXES_TOLERANCE, the test the motion ledger applies. Their
lengths are free (they are directions), so (2, 0, 0) and (0, 1, 0)
are accepted. A z_axis, when given, must point along the right-handed cross
product of the other two.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_axis
|
sequence of float
|
The two axes, three components each, in the reference frame. |
required |
y_axis
|
sequence of float
|
The two axes, three components each, in the reference frame. |
required |
z_axis
|
sequence of float
|
A third axis the caller states. |
None
|
Returns:
| Type | Description |
|---|---|
str or None
|
The reason, in words naming the axis at fault, or None. |
Examples:
>>> frame_axes_problem((1.0, 0.0, 0.0), (0.0, 1.0, 0.0)) is None
True
>>> frame_axes_problem((1.0, 0.0, 0.0), (2.0, 0.0, 0.0))
'x_axis and y_axis are parallel, so they define no plane'
pyflightstream.script.helpers.known_versions
cached
¶
known_versions() -> tuple[FsVersion, ...]
Return every registered FlightStream version, in release order.
The list is read from commands/_meta.yaml inside the installed
package, so it is available from the wheel without repository access.
Returns:
| Type | Description |
|---|---|
tuple of FsVersion
|
Registered versions, ordered oldest first. The tuple position is the ordering authority (CONTRIBUTING.md invariant 4). |
pyflightstream.script.helpers.mark_trailing_edge_vertices
¶
mark_trailing_edge_vertices(
script: Script,
*,
node_file: str | PathLike[str],
vertices: Sequence[Sequence[float]],
) -> str
Mark one rim on 26.100 by a file of its vertices, one rim per file.
A file that named the vertices of two rims of a blunt trailing edge could also mark the edges between them, so each rim has its own file and its own import (FR-3470). The text is parked on the script like a wake-edge node file and written by the run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Marking script targeting the measured vertex-file build. |
required |
node_file
|
str or path - like
|
Path emitted in the import command and parked for the run to write. |
required |
vertices
|
sequence of sequence of float
|
Coordinates of one rim in metres, three values per vertex. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The emitted vertex-file import command name. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the script targets another build or the rim has no vertices. |
pyflightstream.script.helpers.mark_wake_edges
¶
mark_wake_edges(
script: Script,
*,
edge_type: str,
tolerance: float,
units: str,
node_file: str | PathLike[str],
midpoints: Sequence[Sequence[float]],
) -> str
Mark trailing edges from a file of edge mid-points, not by angle.
Emits the import route INSTEAD of the angle criterion, which is what the route is for: auto detection marks an edge because the surface creases there, and a strongly twisted blade has a trailing edge that is not a crease. The file marks exactly the edges it names, since initialisation does not add the ones detection would find (RPT-065), so this replaces rather than runs beside.
THE FORM IS THE ONE 26.124 READS (RPT-061):
IMPORT_WAKE_EDGES_FROM_FILE <TYPE> <TOLERANCE> <UNITS> with the
node file's path on the next line. The manual prints a two-value line,
which that build refuses as a syntax error, and the path is read only
when the line carries a third token. The third token is required and
had no measured effect on 26.124; that build receives the simulation's
length unit. On 26.125 the third token is EDGE_TYPE 1 for mid-points
(FSM-26.125 p.329). :mod:pyflightstream.script._build_forms selects the form.
The node file's text is parked on the script
(:attr:~pyflightstream.script.Script.pending_input_files) and the
run writes it before the solver starts, and the number of points is
recorded (:attr:~pyflightstream.script.Script.wake_edge_points) so
the run can compare it with the count the solver logs as imported.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
edge_type
|
str
|
Edge type applied to every edge the import matches: the same four values SET_TRAILING_EDGE_TYPE takes, so this sets for a whole imported file what that command sets for one edge. |
required |
tolerance
|
float
|
Maximum distance between a mesh edge mid-point and an imported point for the two to count as the same edge, in the simulation's own length units. |
required |
units
|
str
|
The length unit of |
required |
node_file
|
str or path - like
|
Where the node file is written and read, the path the command's next line names. |
required |
midpoints
|
sequence of (x, y, z)
|
The mid-points of the mesh edges to mark, in |
required |
Returns:
| Type | Description |
|---|---|
str
|
The command emitted, for a run record that has to name the route it took. |
Raises:
| Type | Description |
|---|---|
CommandNotInVersionError
|
If the build does not document the import route, or documents only the two-value line (26.122, 26.123), which has not been run and which 26.124 refuses. The message names the build and the angle criterion this library will NOT substitute unasked: a campaign that silently fell back would mark a twisted blade by an angle criterion and report nothing about it. |
CommandArgumentError
|
If |
Notes
NEITHER THE TYPE NOR THE TOLERANCE HAS A DEFAULT HERE, deliberately.
The vendor's own defaults live one layer up, on
:class:~pyflightstream.workspace.wake_edges.WakeEdgeImport,
together with the refusals a grammatically perfect call still needs.
Two calls on one script import two files, and
:attr:~pyflightstream.script.Script.wake_edge_points is their sum,
since the solver logs one imported count per import.
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.124")
>>> helpers.mark_wake_edges(
... script,
... edge_type="STANDARD",
... tolerance=0.0001,
... units="METER",
... node_file="wing.wake_nodes.txt",
... midpoints=[(1.0, -3.75, 0.0), (1.0, -3.25, 0.0)],
... )
'IMPORT_WAKE_EDGES_FROM_FILE'
>>> print(script.render().strip())
IMPORT_WAKE_EDGES_FROM_FILE STANDARD 0.0001 METER
wing.wake_nodes.txt
>>> script.wake_edge_points
2
pyflightstream.script.helpers.marking_import
¶
marking_import(script: Script)
Scope B1's measured marking phase to a fresh FSI import before initialization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Fresh import whose marking-only state is restored on context exit. |
required |
Yields:
| Type | Description |
|---|---|
None
|
The marking context before solver initialization. |
Raises:
| Type | Description |
|---|---|
ScriptOrderError
|
If the script has already been initialized. |
pyflightstream.script.helpers.one_file_key
¶
one_file_key(path: str | Path) -> str
Return one key for every spelling of the file path names.
For the record's rule that one key of inputs_sha256 is one file:
the real path, so a parent folder, a symbolic link or an existing
8.3 short name folds into the file it names; each part without a trailing
dot or space, which Windows drops; and case-folded, because a
case-insensitive file system reads names equal but for case as one file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The file, relative to the working directory or absolute. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The key; two paths with the same key are one file where the run writes. |
pyflightstream.script.helpers.parse_relaxed_trailing_edge
¶
parse_relaxed_trailing_edge(
specification: str,
) -> RelaxedTrailingEdge
Read one relaxed trailing-edge component specification.
Accepts both shapes the editions print, with or without the leading
Relaxed_TE keyword: the three values of FSM-26.122 p.85 (u,
v1, v2) and the four of FSM-26.123 p.85, whose last value is the
direction the relaxed wake sheds (FSM-26.124 p.85 unchanged).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specification
|
str
|
The semicolon-separated line, as a component definition carries it, or its values without the keyword. Whitespace around a value is not part of it. |
required |
Returns:
| Type | Description |
|---|---|
RelaxedTrailingEdge
|
The parsed specification, whose :attr: |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the text is not a string, if it carries a value count that is neither of the two documented ones, if a value is blank, or if the direction is one the edition does not define. The direction refusal names the value and both accepted directions. |
Examples:
>>> from pyflightstream.script import helpers
>>> helpers.parse_relaxed_trailing_edge("0.5; 0.1; 0.9; 1").shedding_direction
'AZIMUTH'
pyflightstream.script.helpers.plain_decimal
¶
plain_decimal(value: float) -> str
Spell a finite float as a plain decimal that reads back to the same float.
The shortest round-trip digits, never an exponent: a number such as 1.665e-17, which a trailing-edge vertex of a committed wing mesh carries, would otherwise be written with the letter e, and a letter on any line of the node file makes the import mark nothing (RPT-061).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
Finite floating-point value to spell without exponent notation. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Plain decimal text that reads back to the same floating-point value. |
Examples:
>>> plain_decimal(1.665e-17)
'0.00000000000000001665'
>>> plain_decimal(-3.75)
'-3.75'
pyflightstream.script.helpers.probe_line
¶
probe_line(
script: Script,
*,
points: int,
start: tuple[float, float, float],
end: tuple[float, float, float],
) -> None
Create a survey line of probe points (FSM-26.120 p.362).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
points
|
int
|
Number of probe vertices between start and end. |
required |
start
|
(x, y, z) triples
|
Line ends in the reference frame, simulation length units. |
required |
end
|
(x, y, z) triples
|
Line ends in the reference frame, simulation length units. |
required |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If |
pyflightstream.script.helpers.probe_points
¶
probe_points(
script: Script,
points: Sequence[tuple[float, float, float]],
*,
kind: str = "VOLUME",
) -> None
Create individual probe points (FSM-26.120 p.362).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
points
|
sequence of (x, y, z) triples
|
Probe positions in the reference frame, simulation length units. |
required |
kind
|
str
|
|
'VOLUME'
|
pyflightstream.script.helpers.probes_from_file
¶
probes_from_file(
script: Script,
path: str,
*,
units: str,
frame: int | str = 1,
) -> None
Import a probe lattice from a CSV file (FSM-26.120 pp.362-363).
The file rows are X,Y,Z,TYPE with TYPE 0 for surface and 1 for volume probes; the first line holds the point count. This is the programmatic path for probe lattice generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
path
|
str
|
Probe lattice CSV path. |
required |
units
|
str
|
Length unit of the file coordinates ( |
required |
frame
|
int or str
|
Coordinate system of the file coordinates; index 1 is the reference frame, and created frames may be cited by their creation label. |
1
|
pyflightstream.script.helpers.render_actuator_profile
¶
render_actuator_profile(
text: str, *, source: str = "the radial thrust profile"
) -> str
Return a radial thrust profile's rows in the one form 26.124 was measured to read.
MEASURED ON 26.124 (RPT-070): SET_PROP_ACTUATOR_PROFILE reads every
line of the file as a point, the empty one after a final newline
included. Eleven rows ending in a newline were read as twelve points, the
file was logged as unreadable and refused in a modal dialog that holds
the solver until a person closes it; the same eleven rows with no final
newline were read, radii and forces. A first line that is a count or a
header was read as one more point too, and every value then read as
zero. Line ends, spaces, tabs and a dimensional radius changed nothing
of the refusal.
So the text returned is the rows, each r,F with its two numbers as
written, joined by a newline, and NO final newline. What an editor adds
is removed rather than refused: blank lines, the whitespace around a
line and around each number, a byte-order mark. The numbers are not
converted, so r stays normalised or dimensional as written.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The profile file's text, as the user saved it. |
required |
source
|
str
|
What the refusals call the text, the file's path for one read from disk. |
'the radial thrust profile'
|
Returns:
| Type | Description |
|---|---|
str
|
The file's text for the solver: newline separated, NOT newline terminated. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
Naming the line, 1-based with blank lines counted: a first row that is one number (a count) or holds a word (a header); a row that is not two numbers separated by one comma; a number that is not finite; or fewer than two rows. |
Examples:
>>> from pyflightstream.script import helpers
>>> print(helpers.render_actuator_profile("0.2, 0.0\n0.6,127.3\n1.0,0.0\n"))
0.2,0.0
0.6,127.3
1.0,0.0
pyflightstream.script.helpers.render_trailing_edge_vertex_file
¶
render_trailing_edge_vertex_file(
vertices: Sequence[Sequence[float]],
) -> str
Return the text of the vertex file TRAILING_EDGES_IMPORT reads on 26.100.
The layout paraphrases FSM-26.100 p.314: the number of vertices, a unit token, then one line per vertex with an id and its three coordinates. The package states the unit as METER because the marking pass sets the simulation to metres. The probe of CMP-26100_2026-11-02_mark-26100-vertex read this layout back from the saved simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertices
|
sequence of sequence of float
|
Rim vertex coordinates in metres, three values per vertex. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Vertex count, METER unit token and numbered rows, newline-terminated. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the rim contains no vertices. |
pyflightstream.script.helpers.render_wake_edge_node_file
¶
render_wake_edge_node_file(
midpoints: Sequence[Sequence[float]],
) -> str
Return the text of the node file the wake-edge import reads on 26.124.
The layout is the one measured to mark (RPT-061): the number of points,
then :data:WAKE_EDGE_NODE_PLACEHOLDER, the coordinate line the solver
consumes and does not use, then one x,y,z row per trailing-edge
MID-POINT, in the simulation's length unit. There is no unit line and
no id column: the file's unit is not read, and a word or an id on any
line makes the import mark nothing, in silence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
midpoints
|
sequence of (x, y, z)
|
The mid-points of the mesh edges to mark, already in the simulation's length unit. Any sequence of three-number rows, including an (n, 3) array. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The file's text, newline separated and newline terminated. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If there is no point, a row is not three coordinates, or a coordinate is not a finite number. Each names the point. |
Examples:
>>> from pyflightstream.script import helpers
>>> print(helpers.render_wake_edge_node_file([(1.0, -3.75, 0.0)]), end="")
1
0,0,0
1.0,-3.75,0.0
pyflightstream.script.helpers.resolve_shedding_direction
¶
resolve_shedding_direction(
value: str | int, *, context: str
) -> str
Resolve one relaxed-wake shedding direction to its token.
Takes either vocabulary, because the specification writes the
integer and a caller reads the word: 0 and "AXIAL" are the
same request, as are 1 and "AZIMUTH". Tokens are matched
without regard to case and a numeric string is read as the integer
it spells, which is what a matrix cell carries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str or int
|
The direction, as a token or as the integer the direction value carries. |
required |
context
|
str
|
What is being resolved, prefixed to the refusal so the caller learns which call refused. A helper passes its own name; a campaign passes the case and the key. |
required |
Returns:
| Type | Description |
|---|---|
str
|
|
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the value is neither. The message names the value received and both accepted directions, because there is no third: the field is an integer with exactly two documented values, and a direction outside them would make the solver read a wake shedding in a direction the manual does not define. |
Examples:
>>> from pyflightstream.script import helpers
>>> helpers.resolve_shedding_direction(1, context="rotor")
'AZIMUTH'
>>> helpers.resolve_shedding_direction("axial", context="rotor")
'AXIAL'
pyflightstream.script.helpers.resolve_toggle
¶
resolve_toggle(
value: object, *, context: str = "a solver toggle"
) -> bool
Resolve a solver toggle written in either vocabulary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool or str
|
True or False, or |
required |
context
|
str
|
What is being resolved, quoted in the refusal; callers inside
the library use the |
'a solver toggle'
|
Returns:
| Type | Description |
|---|---|
bool
|
The toggle state. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the value is neither a bool nor one of the solver's words.
It is a |
Examples:
A preset line carried over from the solver:
>>> resolve_toggle("DISABLE", context="solver_settings: viscous_coupling")
False
pyflightstream.script.helpers.rotary_motion
¶
rotary_motion(
script: Script,
*,
frame: int | str,
axis: str,
rpm: float,
boundaries: Sequence[int | str]
| Literal["all"] = "all",
moving_frames: Sequence[int | str]
| Literal["all"]
| None = None,
start_time: float | None = None,
wake_stabilization_blades: int | None = None,
label: str | None = None,
) -> int
Create and configure one rotary motion (FSM-26.120 pp.332-333).
Rotary motion is the blade-resolved alternative to the actuator
disc surrogate (FSM-26.120 p.234); it requires the unsteady solver
(see :func:unsteady_solver).
ON A BUILD WITHOUT THE ROTARY TYPE THAT DOCUMENTS THE EUCLIDEAN ROTOR
(25.100 and 26.000, whose manuals name the motion type EUCLIDEAN) the
same rotor is written in that build's own vocabulary: a Euclidean
motion whose angular velocity is the speed converted to rad/s along
the axis, marked as a rotor whose slipstream convects along that axis.
The manual's rotor tutorial has the reader convert the rotor speed to
radians per second for that field (FSM-26.100 p.394), and RPT-049
measured the same unit for the script command
(:data:pyflightstream.script.rotor_vocabulary.EUCLIDEAN_ROTOR_UNIT).
The caller writes the same arguments on every build. The vocabulary is
chosen by :func:pyflightstream.script.rotor_vocabulary.euclidean_rotor,
which also holds on 25.000; the workflow refuses that build for its
missing CREATE_NEW_MOTION.
ON 26.100, WHICH NAMES THE TYPE EUCLIDEAN AND HAS NO SCRIPTED ROTOR MARK (RPT-049), the angular velocity is written in rev/min. The native Tecplot rotation measurement in licensed/EVIDENCE-5.md batch 8 settles this unit for the script command (PFS-2004.01).
Each Euclidean speed is converted from rev/min by the unit its constant
names (:data:_FROM_REV_PER_MIN), so a constant and the value written
cannot disagree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
frame
|
int or str
|
Local coordinate system of the rotation (index greater than 1, or its creation label); it must exist earlier in the script. |
required |
axis
|
str
|
Rotor axis within |
required |
rpm
|
float
|
Rotor speed in rev/min. |
required |
boundaries
|
sequence of int or str, or ``"all"``
|
Geometry boundaries assigned to the motion, by 1-based index
or declared boundary label; |
'all'
|
moving_frames
|
sequence of int or str, ``"all"``, or None
|
Local frames attached to the motion, by index or creation label; None attaches none. |
None
|
start_time
|
float
|
Motion start within the solver physical time, in s; a positive value converges a steady base flow before the motion begins. Refused on a ROTARY motion on every build: the solver stops the script there with "Start time cannot be set for rotary motion" (RPT-026), although the command runs on a 6DOF motion (RPT-166). |
None
|
wake_stabilization_blades
|
int
|
Enables slipstream wake stabilization with this blade count, which is PER ROTOR and not a total across the motion (FSM-26.120 p.333). The February 2026 build's grammar for that command has two arguments and no blade count at all, and 25.100 and 26.000 document no such command, so on a Euclidean build this argument is refused by name rather than emitted without the count it states. |
None
|
label
|
str
|
Label registered for the created motion in the script's entity registry, so later commands can cite it by name instead of by index. |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Identifier of the created motion, for later citations. |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
On a Euclidean build, marked or not, if the axis is given by index or a wake stabilization blade count is asked for, neither of which that vocabulary can state, or if a rotary axis is outside its build's accepted vocabulary. A wake stabilization blade count below 1 is refused as well. |
(ScriptReferenceError, ScriptLabelError)
|
If a cited frame or boundary does not exist, or the motion label is already used. These checks precede entity creation. |
pyflightstream.script.helpers.rotate_surfaces
¶
rotate_surfaces(
script: Script,
*,
frame: int | str,
axis: str,
angle_deg: float,
component: str | None = None,
boundaries: Sequence[int | str]
| Literal["all"] = "all",
detach: Toggle = False,
split_vertices: Toggle = False,
adaptive_mesh: Toggle = False,
after_initialization: bool = False,
) -> None
Rotate existing mesh surfaces about an axis of a named frame.
THIS ACTS ON THE MESH AND NOT ON THE GEOMETRY, which is what decides which command family is meant: the surface transforms, never the CAD-body or curve ones. The rotation is about an axis of the named coordinate system, so the system's origin is the point it turns about.
The command is chosen from the script's own build, because the
capability changed name at 26.122 and the two grammars are not
interchangeable (:data:ROTATION_COMMANDS).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
frame
|
int or str
|
Coordinate system the rotation is about, by 1-based index or by
creation label. Its origin is the point rotated about and its
|
required |
axis
|
str
|
Axis of |
required |
angle_deg
|
float
|
Rotation angle in deg, about |
required |
component
|
str
|
Rotate every declared boundary whose label belongs to this
component, which is the label with its trailing index removed
and matched without regard to case. |
None
|
boundaries
|
sequence of int or str, or ``"all"``
|
Explicit selection, by 1-based index or declared boundary label;
|
'all'
|
detach
|
bool or 'ENABLE' or 'DISABLE'
|
Emitted as DETACH_NORMAL_TO_AXIS on the older command and as DETACH_VERTICES on the newer one. WHETHER THOSE ARE ONE OPTION RENAMED IS UNMEASURED: it is read from their position on the manual page and no probe has asked, which the command database records for the pair. Left off by default for that reason. |
False
|
split_vertices
|
bool or 'ENABLE' or 'DISABLE'
|
Options of the older command only. Asking for either on a build that documents the newer one is refused rather than dropped: a silently discarded mesh option produces a different mesh, on a build the helper chose rather than the caller. |
False
|
adaptive_mesh
|
bool or 'ENABLE' or 'DISABLE'
|
Options of the older command only. Asking for either on a build that documents the newer one is refused rather than dropped: a silently discarded mesh option produces a different mesh, on a build the helper chose rather than the caller. |
False
|
after_initialization
|
bool
|
Emit the rotation through
:meth: |
False
|
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If both |
ScriptReferenceError
|
If |
Notes
Component matching reads the boundary inventory declared with
:meth:~pyflightstream.script.Script.declare_existing, because the
boundary names live in the geometry file and the builder cannot know
them otherwise. A script that declared no inventory has no component
to expand and is told so.
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.123")
>>> script.declare_existing(frames=1, boundaries={"Blade_1": 1, "Blade_2": 2})
>>> helpers.rotate_surfaces(script, frame=1, axis="Z", angle_deg=2.5, component="Blade")
>>> print(script.render().strip())
ROTATE_SURFACE 1 Z 2.5 2 DISABLE
1,2
pyflightstream.script.helpers.selection_before_the_solve
¶
selection_before_the_solve(
script: Script, name: str, /, *args: object
) -> None
Emit one loads selection of a march right before START_SOLVER (FR-3404).
The loads selections are analysis-phase commands in the database. On a
march a selection stated after the solve starts reached the final export
and no step export where it was measured (RPT-064 for the loads frame,
RPT-133 for the vorticity drag list), so a march states them before. This
carries one of :data:SELECTIONS_BEFORE_THE_SOLVE past the phase guard
without moving the phase, as
:meth:~pyflightstream.script.Script.emit_deferred_vorticity_before_solve
does for the drag list; every other check of the emitter applies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
The march's script, before |
required |
name
|
str
|
One of :data: |
required |
*args
|
object
|
The command's arguments, as :meth: |
()
|
Raises:
| Type | Description |
|---|---|
ScriptOrderError
|
If |
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.124")
>>> helpers.selection_before_the_solve(script, "DELETE_VORTICITY_DRAG_BOUNDARIES")
>>> script.emit("START_SOLVER")
>>> script.render().split()
['DELETE_VORTICITY_DRAG_BOUNDARIES', 'START_SOLVER']
pyflightstream.script.helpers.solver_time_averaging
¶
solver_time_averaging(
script: Script, window: tuple[int, int]
) -> None
Emit ENABLE_SOLVER_TIME_AVERAGING over a window of time iterations.
The command it replaces, SOLVER_TIME_AVERAGING, hung the 26.124 solver
(C01). This one is a different command of a different build and no run
has measured it, so on a build where it is documented and not verified
the line is written and a warning says so, naming the remedy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
The script being built. |
required |
window
|
tuple of (int, int)
|
The first and the last time iteration of the average, both counted from 1 in the solver's own time steps (FSM-26.125 p.360). |
required |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If the window is not two positive integers in order. |
pyflightstream.script.helpers.takes_every_boundary
¶
takes_every_boundary(
view: VersionView, command: str
) -> bool
Say whether a build's grammar of a by-surface detection takes the -1 form.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
VersionView
|
The command database's view of one build. |
required |
command
|
str
|
A |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True where the build carries the command and its grammar takes the every-boundary index or omits the index list (26.125); False on the builds whose by-surface detection names its surfaces only. |
pyflightstream.script.helpers.unmarked_euclidean_rotor
¶
unmarked_euclidean_rotor(view: VersionView) -> bool
Return whether a rotor is written as a Euclidean motion WITHOUT the rotor mark.
True when the build documents no rotary rotor speed, documents the
angular velocity, and does not carry SET_MOTION_IS_ROTOR. 26.100 is
that build: its solver does not recognize the rotor mark its manual
prints (RPT-049). The motion is written with no mark, so the solver is
never told the motion is a rotor (RPT-051). :func:euclidean_rotor and
this function never both hold on one build.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
VersionView
|
The command view of the script's build. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when the build documents no rotary rotor speed, documents the angular velocity, and
carries no |
pyflightstream.script.helpers.unsteady_action
¶
unsteady_action(
script: Script,
*,
name: str,
kind: str,
filename: str,
action_script: str | None = None,
) -> UnsteadyActionUse
Register an action the solver runs after each unsteady time step.
This is what lets a section export come out mid-run instead of by stopping the solver and restarting it: the solver executes the registered action after each time step, in the order the actions were created.
THE EVIDENCE IS STATED ONCE, HERE. The command is documented on the two newest builds, and the database promotes no status for it from a probe on either (the script-action re-read probe of RPT-041 ran on 26.123 only), so the returned record carries the status the database holds for this script's build and whether it was inherited. A build that does not document the command at all is refused by the emitter, naming the command and the build, rather than the workflow degrading into a run whose sections never appear.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
name
|
str
|
Name of the action, unique within this script. The solver accepts several actions and runs them in creation order, so the name is how a reader tells two apart. |
required |
kind
|
str
|
|
required |
filename
|
str
|
The path the registration line names, passed through unchanged. NOTHING IN EITHER MANUAL EDITION SAYS WHICH DIRECTORY THE SOLVER RUNS AN ACTION FROM (RPT-030), so this helper neither resolves nor rewrites it. Measured on 26.123 (RPT-041, the script-action re-read probe): the action runs from the directory the solver was started in, the simulation folder. That a relative path resolves there follows from it and was not measured; the probe used absolute paths. |
required |
action_script
|
str
|
Text of the child FlightStream script, parked on the script for
the run layer to write at |
None
|
Returns:
| Type | Description |
|---|---|
UnsteadyActionUse
|
The record of the registration, also appended to
:attr: |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If |
CommandNotInVersionError
|
If the build does not document the command. Raised by the emitter, so the message carries the recorded evidence of every build that does. |
Notes
WHAT THE ACTION RECEIVES IS UNSTATED, on all four of the things a
step-aware action would need: arguments, working directory, step
index or physical time, and environment (RPT-030). An action that
has to behave differently on different steps therefore needs state
of its own, and the correctness of that route rests on the
invocation count being exactly the step count. On 26.123
(RPT-041, the script-action re-read probe), a SCRIPT
action's file is re-read on every
invocation, the count is exactly the step count with nothing before
the first step, the action gets no arguments and no solver-named
environment, runs from the simulation folder, and an export it makes
is stamped _iteration=<step> on its name. That is evidence about
one build; nothing here builds on it for another.
Examples:
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.123")
>>> record = helpers.unsteady_action(
... script,
... name="sections",
... kind="SCRIPT",
... filename="actions/sections.txt",
... action_script="EXPORT_SOLVER_ANALYSIS_SPREADSHEET",
... )
>>> record.evidence
'documented'
>>> sorted(script.pending_action_scripts)
['actions/sections.txt']
pyflightstream.script.helpers.unsteady_solver
¶
unsteady_solver(
script: Script,
*,
time_iterations: int,
delta_time: float,
) -> None
Select unsteady physical time stepping (FSM-26.120 p.341).
For rotary cases the manual recommends 8 to 12 degrees of blade rotation per time step and at least two full rotations (FSM-26.120 p.210).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
time_iterations
|
int
|
Number of physical time steps. |
required |
delta_time
|
float
|
Physical time step in s. |
required |
Raises:
| Type | Description |
|---|---|
CommandArgumentError
|
If |
Notes
The solver-setup snapshot records this emission (PFS-2103.037): an
existing script.solver_setup is restamped here, and a later
:func:~pyflightstream.script.helpers.solver_settings call that states
no mode records it too, so an unsteady run no longer reports its
regime as unknown and not emitted.
pyflightstream.script.helpers.wake_edge_import_token
¶
wake_edge_import_token(script: Script, units: str) -> str
Return the third token of the wake-edge import on the script's build.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
The script whose build decides the token. |
required |
units
|
str
|
The simulation's length unit, the token 26.124 was measured with. |
required |
Returns:
| Type | Description |
|---|---|
str
|
:data: |
pyflightstream.script.helpers.with_vorticity_selection
¶
with_vorticity_selection(
setup: SolverSetup,
selection: Sequence[int] | Literal["all"],
) -> SolverSetup
Return the snapshot with the induced-drag selection replaced.
:func:build_setup uses this update when the validated settings call
states a selection. It records that selection as explicit and emitted,
without default evidence, so the manifest describes the selection the
script will apply. The frozen input snapshot remains unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
setup
|
SolverSetup
|
Snapshot built by the settings call. |
required |
selection
|
sequence of int, or ``"all"``
|
Boundaries the later call selected, as resolved 1-based indices, the same vocabulary the settings call records. |
required |
Returns:
| Type | Description |
|---|---|
SolverSetup
|
A new snapshot; the input is left untouched (the model is frozen). |