Skip to content

pyflightstream.results.native_surface (stable)

Generated from the docstrings at build time: every one of the 6 names in the public definitions (the module declares no __all__) of pyflightstream.results.native_surface has an entry below. The names a guide or an example uses come first; the others follow under Advanced.

Read the native FEPolygon export without inventing nodal values from panel data.

Only the BLOCK layout measured in RPT-074 is accepted, one zone per file or one zone per periodic copy (below). Native coordinates are in REFERENCE. :func:attach_native_strength matches two surfaces already in one frame; the translation of a VTK written in a loads frame carries the native INTO that frame instead and matches there (_strength_in_loads_frame in :mod:pyflightstream.results.surface), so the rounding of the written VTK is allowed along the axes it was written in. Matching includes connectivity, not just equal node counts.

ONE ZONE PER PERIODIC COPY. A row under SYMMETRY PERIODIC writes its native Tecplot as one zone per copy, each zone a complete file of its own (TITLE, VARIABLES, ZONE, payload), the modelled sector first and then its images turned about the axis. The 26.124 evidence (reports/RPT-087) is a six-copy sector: six zones of 5961 nodes, zone k equal to the k-th block of the VTK to 1e-13 m. The VTK route carries the images after the real surface (RPT-080), so the reading chosen is the VTK's: zone k joins the k-th copy of the VTK, the real surface first, then the images. Each copy is matched on its own, because the copies of a sector share the nodes of their seams (378 coincident positions on that sector) and one match over the whole disc would be ambiguous there. The zone count is the copy count the row declared, and a file holding any other count is refused naming both.

Advanced

pyflightstream.results.native_surface.attach_native_strength

attach_native_strength(
    surface: VtkSurface,
    native: VtkSurface,
    *,
    coordinate_tolerance: float | ndarray | None = None,
) -> tuple[VtkSurface, dict[str, object]]

Attach exact native strength after a unique coordinate/topology match.

Both surfaces must already be in one frame and one length unit; the axes below are that frame's, the reference frame's for a caller holding reference geometry. An explicit tolerance is absolute, in that unit: a scalar, or a three-element array giving the tolerance along X, Y and Z, so a rounding that is large along one axis is not granted along the others (GOAL-034 Q8 CXQ8R4-1); any other shape is refused. By default it is, per axis, the larger of max(1e-10, 1e-6 of the native geometry's diagonal extent) and four single-precision epsilons of the largest native coordinate magnitude along that axis (:func:native_match_tolerance, the one home of the rule): a VTK written at single precision rounds with the coordinates' magnitude, which for a small part far from the origin exceeds any fraction of its extent. Ambiguous coincident vertices are refused; this function never averages, guesses orientation, or derives a strength from Cp. The resolved limits are returned in the mapping record as coordinate_tolerance_by_axis ([X, Y, Z], in the input length unit); coordinate_tolerance is their maximum.

Parameters:

Name Type Description Default
surface VtkSurface

The VTK surface whose nodes receive the strength.

required
native VtkSurface

The native surface carrying nodal Singularity_strength, in the same frame and length unit as surface.

required
coordinate_tolerance float or ndarray

Absolute match tolerance, a scalar or an X, Y, Z array in the surfaces' length unit. When None it is :func:native_match_tolerance.

None

Returns:

Type Description
tuple of (VtkSurface, dict)

surface with Singularity_strength attached as point data, and the mapping record, including coordinate_tolerance_by_axis.

Raises:

Type Description
MalformedOutputError

If the tolerance is not a positive finite scalar or XYZ array, the counts do not form a bijection, the native strength is missing or mis-sized, a coordinate is not finite, or the match is not unique.

pyflightstream.results.native_surface.attach_native_strength_by_copy

attach_native_strength_by_copy(
    surface: VtkSurface,
    zones: Sequence[VtkSurface],
    *,
    coordinate_tolerance: float | ndarray | None = None,
) -> tuple[VtkSurface, dict[str, object]]

Attach the strength of one native zone per periodic copy, copy by copy.

surface is the whole VTK, the modelled sector first and its images after it (RPT-080); zones are the native zones in file order, in the SAME frame as surface: the reference frame for a caller holding two reference surfaces, the loads frame when the translation carries the native into the frame the VTK was written in (_strength_in_loads_frame in :mod:pyflightstream.results.surface). Zone k is joined to the k-th copy of the VTK, of the zone's own node and polygon counts, by :func:attach_native_strength, so each copy keeps the unique coordinate and topology match. With one zone this is :func:attach_native_strength itself, record and all. The tolerance is resolved once, from every zone's nodes together, when none is given.

Parameters:

Name Type Description Default
surface VtkSurface

The whole VTK surface, the modelled sector first and its images after.

required
zones sequence of VtkSurface

The native zones in file order, in the same frame as surface.

required
coordinate_tolerance float or ndarray

Absolute match tolerance in the surfaces' length unit, a scalar or an X, Y, Z array. When None it is resolved from every zone's nodes by :func:native_match_tolerance.

None

Returns:

Type Description
tuple of (VtkSurface, dict)

surface with the native nodal strength attached, and the record of the node mapping.

Raises:

Type Description
MalformedOutputError

If there is no zone, the zones' node and polygon counts do not add up to the VTK's, or a copy cannot be matched uniquely.

pyflightstream.results.native_surface.native_match_tolerance

native_match_tolerance(
    points: ndarray, *, printed_digits: int | None = None
) -> np.ndarray

Return the per-axis match tolerance :func:attach_native_strength takes by default.

THE ONE HOME of the rule (the shared tolerance): the whole-surface match, the periodic-copy match and the time-averaged native strength all resolve it here. Per axis it is the largest of 1e-10, 1e-6 of the geometry's diagonal extent, and four single-precision epsilons of the largest coordinate magnitude (a VTK written at single precision rounds with the magnitude).

A native far from the origin also carries the rounding of its own printing. When the caller states printed_digits, the significant digits the native was printed at (:func:native_printed_digits), a fourth term joins: half a unit of the last printed digit of the largest coordinate, 0.5 * 10**(e + 1 - printed_digits) with e the decade of that magnitude, plus half a single-precision spacing. Absent, the rule is the one it always was, and a native printed at full precision (the measured 26.124 export prints sixteen digits) adds nothing.

Parameters:

Name Type Description Default
points ndarray

The native nodes, one row each, in the length unit of the match.

required
printed_digits int

Significant digits the native prints its coordinates at.

None

Returns:

Type Description
ndarray

Three limits, along X, Y and Z, in the unit of points.

Raises:

Type Description
MalformedOutputError

If printed_digits is not a whole number or is below 1.

pyflightstream.results.native_surface.native_printed_digits

native_printed_digits(source: str | Path) -> int | None

Return the significant digits a native export printed its coordinates at.

The most any coordinate of the first zone shows, which is the printing precision because a number printed at d digits shows d unless its tail is zeros. None when the file's first zone cannot be read that way, in which case the caller states nothing and the default rule stands. A count under :data:_MIN_PRINTED_DIGITS is a file of short exact numbers (whole coordinates, say), not a print precision: read as one it would grant half the coordinate as slack, so it also states nothing.

Parameters:

Name Type Description Default
source str or Path

The native Tecplot export to read.

required

Returns:

Type Description
int or None

The significant digits, or None when the file states none.

pyflightstream.results.native_surface.read_native_tecplot_surface

read_native_tecplot_surface(
    source: str | Path,
) -> VtkSurface

Read measured native nodal strength and its geometry; validate all blocks.

Non-strength result variables are validated and discarded: the caller keeps the VTK's original cell values rather than replacing them with native nodal interpolation. A second zone, connected boundaries and cell-centred strength are refused; the zones of a periodic row are read by :func:read_native_tecplot_zones.

Parameters:

Name Type Description Default
source str or Path

The native Tecplot export (<stem>_native_tecplot.dat).

required

Returns:

Type Description
VtkSurface

The single zone, carrying its nodal Singularity_strength.

Raises:

Type Description
MalformedOutputError

If the file holds another number of zones than one, or is not the measured BLOCK FEPolygon layout.

IncompleteOutputError

If the file ends inside the zone.

pyflightstream.results.native_surface.read_native_tecplot_zones

read_native_tecplot_zones(
    source: str | Path, *, zones: int = 1
) -> list[VtkSurface]

Read the zones zones of a native export, in file order; validate all blocks.

Parameters:

Name Type Description Default
source str or Path

The native Tecplot export (<stem>_native_tecplot.dat).

required
zones int

The zones the file must hold: 1, or the copy count of a row under SYMMETRY PERIODIC, whose native export writes one zone per copy, the modelled sector first. A zone may restate TITLE and VARIABLES before its ZONE line, as the solver writes it; a restated variable list must be the first zone's.

1

Returns:

Type Description
list of VtkSurface

One surface per zone, in file order, each carrying its nodal Singularity_strength.

Raises:

Type Description
MalformedOutputError

If the file holds another number of zones than zones (both counts are named), or if any zone is not the measured BLOCK FEPolygon layout.

IncompleteOutputError

If the file ends inside a zone.