Skip to content

pyflightstream.cases.mesh (provisional)

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

The mesh models: how a geometry enters the solver and what its mesh declares.

Pipeline role: describes the geometry side of a case. :class:MeshImport and :class:CadImportOptions say how a mesh or a CAD file is imported; :class:MeshOperation the operations applied to it; :class:TrailingEdgeMarking how its trailing edges are found; :class:RawMeshConditions the boundary conditions a raw mesh's sidecar declares; and :class:BaseRegionOperation and :class:PortBoundary the base regions and the ports a setup declares.

The package root re-exports these models (AD-16). This module imports the shared configuration error from reference_blocks and never the package root; :mod:pyflightstream.cases.settings imports it.

Advanced

pyflightstream.cases.mesh.BaseRegionOperation

Bases: BaseModel

One explicit base-region action, executed in its declared order before initialization.

pyflightstream.cases.mesh.CadImportOptions

Bases: BaseModel

Native CAD tessellation and conversion declared under [import.cad].

The source file supplies its own units. These controls select how its bodies become a mesh; successful conversion does not establish mesh quality.

Examples:

>>> options = CadImportOptions(body_index=2)
>>> options.tessellation_density, options.num_curvature, options.body_index
('MEDIUM', 80, 2)

pyflightstream.cases.mesh.EVERY_SURFACE module-attribute

EVERY_SURFACE = 'all'

pyflightstream.cases.mesh.MeshImport

Bases: BaseModel

How a raw mesh is imported: the [import] table of its sidecar (G01).

A raw mesh (.obj, .stl) carries no length unit, so the file that names its boundaries, <stem>.boundaries.toml beside it, states the unit it is written in, and a workflow row naming the mesh is refused without it rather than imported under an assumed one.

units goes to IMPORT and nowhere else. The simulation's own length unit is always metres, because every length the reference and the row state is in metres; the builder sets it after the import (:data:pyflightstream.cases.workflows.SIMULATION_LENGTH_UNIT). The value is only normalised here: which spellings a build takes is read from the command database by the builder, per build.

CAD files additionally declare cad and units="FILE" because IMPORT_CAD has no units argument. CAD translations after conversion are in metres; tessellation is followed by explicit conversion to a mesh.

operations are the mesh operations applied right after the import, in the order written (G03, :class:MeshOperation); empty when the table declares none.

Attributes:

Name Type Description
units str

The raw mesh length unit, or FILE for CAD metadata; never assumed.

operations tuple of MeshOperation

The mesh operations applied right after the import, in the order written.

Examples:

>>> imported = MeshImport(units="mm")
>>> imported.units, imported.operations
('MM', ())

moving_operations property

moving_operations: tuple[MeshOperation, ...]

The operations that move, scale or copy the body: every one but rename.

A trailing-edge points file names edges of the mesh as the FILE holds it, and is checked against that file; one of these would carry the body's edges away from the points (G02).

names_after_renames

names_after_renames(
    names: Sequence[str],
) -> tuple[str, ...]

Return the boundary names as this import's renames leave them, in order.

The inventory a row cites for a raw mesh is the sidecar's boundaries as the rename operations leave them (G03), which is what the builder declares. This applies them and judges nothing: a rename whose surface is absent at its step, or carried twice, is passed over here and refused by the builder.

pyflightstream.cases.mesh.MeshOperation

Bases: BaseModel

One mesh operation applied right after a raw mesh is imported (G03).

Declared in the geometry's sidecar, beside the unit, as one [[import.operations]] table each, and applied in the order written, in the reference frame:

  • scale: factors = [fx, fy, fz], each greater than zero;
  • rename: surface and to, the new name;
  • mirror: surface and plane (YZ, XZ or XY); the mirrored copy joins its source, so the surface count is unchanged;
  • translate: vector = [x, y, z], in the [import] unit;
  • rotate: axis (X, Y or Z) and angle_deg.

surface names the surface acted on by the name the file gives it, or by a name an earlier rename gave; never by position. It is :data:EVERY_SURFACE by default, which rename and mirror do not take: each acts on one named surface.

Attributes:

Name Type Description
op {'scale', 'rename', 'mirror', 'translate', 'rotate'}

Which operation, and so which of the keys below it states.

surface str

The surface acted on, by the file's name or an earlier rename's; "all" for every surface, which a rename and a mirror do not take.

factors tuple of three floats, optional

A scale's factor along each axis, each greater than zero.

vector tuple of three floats, optional

A translation's vector, in the [import] unit.

axis ({'X', 'Y', 'Z'}, optional)

The axis a rotation turns about.

angle_deg (float, optional)

The angle of a rotation, in degrees.

plane ({'YZ', 'XZ', 'XY'}, optional)

The plane a mirror reflects in; the copy joins its source.

to (str, optional)

A rename's new name, one word.

pyflightstream.cases.mesh.RawMeshConditions

Bases: BaseModel

The boundary conditions a raw mesh's sidecar declares (G02, Q1).

trailing_edges is required of every raw mesh a workflow imports, and the builder refuses one without it. wake_termination detects wake-termination nodes, "auto" over every surface or by the surfaces named; base_regions = "auto" detects base regions over the whole mesh. Both are None unless written.

Examples:

>>> conditions = RawMeshConditions(
...     trailing_edges=TrailingEdgeMarking(route="detect"), base_regions="auto"
... )
>>> conditions.trailing_edges.route, conditions.wake_termination, conditions.base_regions
('detect', None, 'auto')

pyflightstream.cases.mesh.TrailingEdgeMarking

Bases: BaseModel

How a raw mesh's trailing edges are marked: its sidecar's [trailing_edges] (G02).

A raw mesh carries no trailing edge, and without one the solver makes no wake and runs and answers anyway, so a raw mesh declares one.

route = "file" is the default route. points_m are the mid-points of the trailing-edge mesh edges, in metres, read from the points file the table names and checked against the mesh when the row is bound (:mod:pyflightstream.workspace.wake_edges); the builder converts them, and tolerance, which is also in metres, into the simulation's length unit the setup states, writes them as the solver's node file in that unit and imports it with IMPORT_WAKE_EDGES_FROM_FILE, giving every edge edge_type and matching within tolerance. points_file is where they were read from, for a refusal to name; it is kept out of every dump, since it is a path on one machine.

route = "detect" marks by the solver's detection: detect_surfaces names the surfaces to detect on, by the sidecar's names, and is empty for every surface; sweep_angle_deg and bluntness_angle_deg are set before the detection when stated. Detection gives every edge the STANDARD type and reads no tolerance.

Examples:

>>> marking = TrailingEdgeMarking(route="detect")
>>> marking.route, marking.edge_type, marking.detect_surfaces
('detect', 'STANDARD', ())

edge_type property

edge_type: str

Return the first file's type for single-file callers.

points_m property

points_m: tuple[tuple[float, float, float], ...]

Return the first file's points in metres.

points_file property

points_file: str | None

Return the first file's local path, excluded from records.

model_copy

model_copy(*, update=None, deep=False)

Preserve the legacy first-file update spelling for existing callers.