pyflightstream.script.solver_setup (stable)¶
Generated from the docstrings at build time: every one of the 13 names in the __all__ of pyflightstream.script.solver_setup has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Solver-setup snapshot: total provenance of the solver flags.
Pipeline role: records, for every solver flag of the runtime_settings,
solver_settings, and advanced_settings command families (plus the
induced-drag boundary selection of SET_VORTICITY_DRAG_BOUNDARIES), the
effective value of one built script and where that value came from:
explicit when the caller passed it, default when the library or
the manual documents the value that applies without user input (the
citation travels with the record), and unknown when no in-repo
evidence exists. Unknown is stated honestly, never guessed: an opened
simulation file can carry saved solver settings, so the library refuses
to claim knowledge it does not have (evidence rule, CONTRIBUTING.md
invariant 3).
The snapshot travels with the run. The curated helper
:func:pyflightstream.script.helpers.solver_settings builds it and
attaches it to the :class:~pyflightstream.script.Script as
script.solver_setup; the campaign loop serializes it into the
manifest record (:attr:pyflightstream.workspace.RunRecord.solver_setup);
and :func:script_from_setup regenerates the same settings emissions
from a stored snapshot, closing the provenance loop.
Used in the guides¶
pyflightstream.script.solver_setup.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
Advanced¶
pyflightstream.script.solver_setup.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.solver_setup.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.solver_setup.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.solver_setup.FLAG_SPECS
module-attribute
¶
FLAG_SPECS: tuple[FlagSpec, ...] = (
FlagSpec("mode", "SET_SOLVER_STEADY", "mode_steady"),
FlagSpec(
"mode", "SET_SOLVER_UNSTEADY", "mode_unsteady"
),
FlagSpec("aoa", "SOLVER_SET_AOA", "scalar"),
FlagSpec("sideslip", "SOLVER_SET_SIDESLIP", "scalar"),
FlagSpec("velocity", "SOLVER_SET_VELOCITY", "scalar"),
FlagSpec("mach", "SOLVER_SET_MACH_NUMBER", "scalar"),
FlagSpec(
"ref_velocity", "SOLVER_SET_REF_VELOCITY", "scalar"
),
FlagSpec(
"ref_mach", "SOLVER_SET_REF_MACH_NUMBER", "scalar"
),
FlagSpec("ref_area", "SOLVER_SET_REF_AREA", "scalar"),
FlagSpec(
"ref_length", "SOLVER_SET_REF_LENGTH", "scalar"
),
FlagSpec(
"iterations", "SOLVER_SET_ITERATIONS", "scalar"
),
FlagSpec(
"convergence", "SOLVER_SET_CONVERGENCE", "scalar"
),
FlagSpec(
"max_threads", "SET_MAX_PARALLEL_THREADS", "scalar"
),
FlagSpec(
"forced_iterations",
"SOLVER_SET_FORCED_ITERATIONS",
"toggle",
),
FlagSpec(
"boundary_layer", "SET_BOUNDARY_LAYER_TYPE", "enum"
),
FlagSpec(
"viscous_coupling",
"SET_SOLVER_VISCOUS_COUPLING",
"toggle",
),
FlagSpec(
"viscous_excluded",
"SET_VISCOUS_EXCLUDED_BOUNDARIES",
"boundary_list",
),
FlagSpec(
"viscous_excluded",
"DELETE_VISCOUS_EXCLUDED_BOUNDARIES",
"boundary_list_clear",
),
FlagSpec(
"surface_roughness",
"SET_SURFACE_ROUGHNESS",
"scalar",
),
FlagSpec(
"thin_boundaries",
"SET_THIN_BOUNDARIES",
"boundary_list",
),
FlagSpec(
"thin_boundaries",
"DELETE_THIN_BOUNDARIES",
"boundary_list_clear",
),
FlagSpec(
"bulk_separation",
"CREATE_BULK_SEPARATION",
"bulk_separation",
),
*_WAKE_AND_ROTOR_ADVANCED,
FlagSpec(
"solver_stabilization",
"SOLVER_STABILIZATION",
"scalar",
),
FlagSpec(
"disable_ref_velocity",
"DISABLE_SOLVER_REF_VELOCITY",
"bare_request",
),
FlagSpec("solver_model", "SET_SOLVER_MODEL", "enum"),
FlagSpec(
"valarezo_criterion", "VALAREZO_CRITERION", "toggle"
),
FlagSpec(
"crossflow_separation_mean_diameter",
"SET_CROSSFLOW_SEPARATION_CP",
"scalar",
),
FlagSpec(
"wake_relaxation", "SET_WAKE_RELAXATION", "toggle"
),
FlagSpec(
"wake_streamwise_agglomeration",
"SET_WAKE_STREAMWISE_AGGLOMERATION",
"toggle",
),
FlagSpec(
"adverse_gradient_boundary_layer",
"SOLVER_SET_ADVERSE_GRADIENT_BOUNDARY_LAYER",
"toggle",
),
FlagSpec(
"vortex_ring_normalization",
"SOLVER_VORTEX_RING_NORMALIZATION",
"toggle",
),
FlagSpec(
"delete_separations",
"DELETE_SEPARATION",
"separation_delete",
),
FlagSpec(
"airfoil_separation",
"CREATE_AIRFOIL_SEPARATION",
"separation_models",
),
FlagSpec(
"axial_vortex_separation",
"CREATE_AXIAL_VORTEX_SEPARATION",
"separation_models",
),
FlagSpec(
"cylindrical_bulk_separation",
"CREATE_CYLINDRICAL_BULK_SEPARATION",
"separation_models",
),
FlagSpec(
"stratford_bulk_separation",
"CREATE_STRATFORD_BULK_SEPARATION",
"separation_models",
),
FlagSpec(
"axial_separation_boundaries",
"SET_AXIAL_SEPARATION_BOUNDARIES",
"separation_boundaries",
),
FlagSpec(
"axial_separation_boundaries",
"DELETE_AXIAL_SEPARATION_BOUNDARIES",
"separation_boundaries_clear",
),
FlagSpec(
"valarezo_separation_boundaries",
"SET_VALAREZO_SEPARATION_BOUNDARIES",
"separation_boundaries",
),
FlagSpec(
"valarezo_separation_boundaries",
"DELETE_VALAREZO_SEPARATION_BOUNDARIES",
"separation_boundaries_clear",
),
FlagSpec(
"valarezo_separation_boundaries",
"DELETE_VALAREZO_CRITERION_BOUNDARIES",
"never_emitted",
),
FlagSpec(
"crossflow_separation_boundaries",
"SET_CROSSFLOW_SEPARATION_BOUNDARIES",
"separation_boundaries",
),
FlagSpec(
"crossflow_separation_boundaries",
"DELETE_CROSSFLOW_SEPARATION_BOUNDARIES",
"separation_boundaries_clear",
),
FlagSpec(
"crossflow_separation_diameter",
"SET_CROSSFLOW_SEPARATION_DIAMETER",
"scalar",
),
FlagSpec(
"crossflow_separation_axisymmetric",
"SET_CROSSFLOW_SEPARATION_AXISYMMETRIC",
"toggle",
),
FlagSpec(
"laminar_separation", "LAMINAR_SEPARATION", "toggle"
),
FlagSpec(
"convergence_iterations",
"SET_SOLVER_CONVERGENCE_ITERATIONS",
"scalar",
),
FlagSpec("minimum_cp", "SOLVER_MINIMUM_CP", "scalar"),
FlagSpec(
"reynolds_averaged_drag",
"REYNOLDS_AVERAGED_DRAG_FORCES",
"toggle",
),
FlagSpec(
"mesh_induced_wake_velocity",
"SOLVER_SET_MESH_INDUCED_WAKE_VELOCITY",
"toggle",
),
FlagSpec(
"farfield_layers",
"SOLVER_SET_FARFIELD_LAYERS",
"scalar",
),
FlagSpec(
"unsteady_pressure_and_kutta",
"SOLVER_UNSTEADY_PRESSURE_AND_KUTTA",
"toggle",
),
FlagSpec(
"wake_termination_time_steps",
"SET_WAKE_TERMINATION_TIME_STEPS",
"scalar",
),
FlagSpec(
"wake_on_wake_induction",
"SET_WAKE_ON_WAKE_INDUCTION",
"toggle",
),
FlagSpec(
"additional_wake_relaxation",
"ADDITIONAL_WAKE_RELAXATION_ITERATION",
"toggle",
),
FlagSpec(
"aeroelastic_rbf_type",
"AEROELASTIC_RBF_TYPE",
"enum",
),
FlagSpec(
"vorticity_drag_boundaries",
VORTICITY_COMMAND,
"boundary_selection",
),
)
pyflightstream.script.solver_setup.FlagRecord
¶
Bases: BaseModel
Effective value and provenance of one solver flag in one script.
Attributes:
| Name | Type | Description |
|---|---|---|
command |
str
|
FlightStream command the flag belongs to. |
family |
str
|
Command-database chapter of the command ( |
provenance |
str
|
|
value |
JSON value
|
Recorded value in helper vocabulary (bool for toggles,
mapping for the unsteady mode and the bulk separation); None
when unknown. A boundary selection is a list of indices or
labels, or the string |
emitted |
bool
|
Whether the script this snapshot describes carries the
emission. The induced-drag selection is emitted deferred, at
the first curated call reaching the analysis phase, and may
have been emitted by an earlier settings call on the same
script, so this is a fact about the script rather than about
the single call. A documented default with |
evidence |
(str, optional)
|
Citation of a |
pyflightstream.script.solver_setup.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.solver_setup.SNAPSHOT_FAMILIES
module-attribute
¶
SNAPSHOT_FAMILIES = (
"runtime_settings",
"solver_settings",
"advanced_settings",
)
pyflightstream.script.solver_setup.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.solver_setup.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.solver_setup.VORTICITY_COMMAND
module-attribute
¶
VORTICITY_COMMAND = 'SET_VORTICITY_DRAG_BOUNDARIES'
pyflightstream.script.solver_setup.script_from_setup
¶
script_from_setup(
script: Script, setup: SolverSetup
) -> SolverSetup
Regenerate the settings portion of a script from a snapshot.
Replays the explicit flags of setup through
:func:pyflightstream.script.helpers.solver_settings, so the
emitted settings lines (including the library minimum-Cp default
and the deferred induced-drag selection) are identical to the ones
the original call produced, and a fresh snapshot is attached to the
script. Boundary labels stored in the snapshot need the same
declarations (:meth:~pyflightstream.script.Script.declare_existing)
on the target script.
Replay onto a fresh script: the induced-drag selection and the minimum Cp already emitted have per-script rather than per-call lifetime, so a target script that already carries either keeps it, and the returned snapshot then records that value instead of the stored one. The campaign loop builds one script per point, which is the shape this function is written for.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction, bound to a FlightStream version in which every explicit flag of the snapshot exists; fresh, per the note above. |
required |
setup
|
SolverSetup
|
Stored snapshot, for example
|
required |
Returns:
| Type | Description |
|---|---|
SolverSetup
|
The fresh snapshot of the regenerated call. |