Skip to content

pyflightstream.post.surfaces (stable)

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

The surface averaged over a window by the package, from the per-step exports (G25).

Pipeline role: the product a pproc's [time_averaging] asks for. The run exports the surface as VTK at every step of the window (the per-step export machinery of EXPORT_UNSTEADY_AFTER_ITER, which [time_averaging] sets where the row states no threshold of its own), and this module averages those exports into ONE surface, written as a Tecplot by the writer the Tecplot of every point is written with (:func:pyflightstream.results.write_tecplot_surface), and as a VTK too where the pproc asks [exports] vtk.

WHAT THE AVERAGE IS. The same PANEL (the VTK's cell index) across the steps of the window, each step's values written back in the reference frame first, the velocity components included (the solver writes them in the analysis loads frame, as a point, RPT-074); every step weighs the same; nothing is interpolated. The steps must share one topology (the node and polygon counts and the nodes around every polygon), or the average is REFUSED by name; a step of the window that was not exported SKIPS the average by name, never a partial one, and one that free-space deleted (prune_step_exports) REFUSES it naming the step and the storage call. The nodes of the averaged file are those of the window's LAST step: on a turning rotor the nodes move from step to step and their mean would be a surface nobody flew. The average itself is :func:~pyflightstream.post.unsteady.blade_passage_average, the package's one averaging routine: the panels are its samples and the steps its frames.

SOLVER_TIME_AVERAGING is never emitted: it hangs 26.124 (C01, see reports/compat/CMP-26124_2026-09-19_time-averaging.yaml). The per-step instants stay on disk and in products.json as kind: instant.

Advanced

pyflightstream.post.surfaces.SURFACES_DIR module-attribute

SURFACES_DIR = 'surfaces'

pyflightstream.post.surfaces.SurfaceAverage dataclass

SurfaceAverage(
    surface: VtkSurface,
    window: tuple[int, int],
    steps: tuple[int, ...],
    inputs: dict[str, str],
    frame: SurfaceFrame,
    native_matching: dict[int, dict[str, object]]
    | None = None,
)

One surface averaged over a window of per-step exports.

Attributes:

Name Type Description
surface VtkSurface

The average, in the reference frame: the nodes of the window's last step, and each panel's values averaged over the window.

window tuple of int

Inclusive (first_step, last_step) in solver time steps.

steps tuple of int

The steps averaged, every one of the window.

inputs dict of str to str

Each per-step VTK and paired native source, by path to its SHA-256.

frame SurfaceFrame

The loads frame the exports were written in and were undone by.

native_matching (dict, optional)

Coordinate and topology matching evidence for each native STEP.

pyflightstream.post.surfaces.average_surface_exports

average_surface_exports(
    exports: Mapping[int, str | Path],
    *,
    window: tuple[int, int],
    frame: SurfaceFrame,
    native_exports: Mapping[int, str | Path] | None = None,
    periodic_copies: int | None = None,
) -> SurfaceAverage

Average the per-step VTK surface exports of a window, panel by panel.

Parameters:

Name Type Description Default
exports mapping of int to path

Each stamped VTK by the time step it was exported at.

required
window tuple of int

Inclusive (first_step, last_step); every step of it must be there.

required
frame SurfaceFrame

The analysis loads frame the solver wrote the exports in.

required
native_exports mapping of int to path

A native nodal source for each selected STEP, matched geometrically and topologically before its separate temporal average.

None
periodic_copies int

The copy count of a row under SYMMETRY PERIODIC, whose native export holds one zone per copy, joined copy by copy; None for the one-zone export of every other row.

None

Returns:

Type Description
SurfaceAverage

The average and what it was taken over.

Raises:

Type Description
ProductError

If the window ends before it starts, if a step of the window was not exported (the average is skipped, never partial), if an export is not a surface export, or if two steps do not share one topology (the average is refused: a panel cannot be followed).

pyflightstream.post.surfaces.write_point_surface_average

write_point_surface_average(
    root: Path,
    *,
    sim_dir: Path,
    record: RunRecord,
    out: Path,
    target: Callable[[Path], Path],
    vtk: bool = False,
    skipped: dict[str, str] | None = None,
    judge: Callable[[str, tuple[int, int]], str | None]
    | None = None,
    overwrite: bool = True,
) -> tuple[list[Path], dict[str, dict[str, object]]]

Write the time-averaged surface of one point from its per-step exports (G25).

Nothing for a record whose run stated no [time_averaging]. Otherwise the window the RECORD carries is averaged, never one re-read from a pproc edited since, from the stamped VTK files where the point ran.

Parameters:

Name Type Description Default
root Path

The workspace root, which the inputs are named relative to.

required
sim_dir Path

The simulation folder.

required
record RunRecord

The point's record: its surface_average_window and the translation that names its VTK and the loads frame.

required
out Path

The matrix's products folder; the average lands under surfaces/.

required
target callable

Called with each file's path before it is written, as every other product's is: the products stage passes its archiver.

required
vtk bool

Write the average as a VTK as well, which [exports] vtk asks for.

False
skipped dict

Receives the reason under the product's name where the average is skipped or refused.

None
judge callable

Called with the product's name and the window's first and last time step BEFORE anything is written; a reason it returns refuses the average, which is then neither written nor listed. The products stage passes the frozen-solve rule every other average answers to.

None
overwrite bool

Replace a file that already exists, as the writer always did (the default). False refuses an existing file, naming it, before it is replaced.

True

Returns:

Type Description
tuple

The files written and their products.json entries, keyed by the path each was written to, relative to out.

pyflightstream.post.surfaces.write_surface_average

write_surface_average(
    dat: str | Path,
    average: SurfaceAverage,
    *,
    vtk: str | Path | None = None,
    overwrite: bool = False,
    run_block: Mapping[str, object] | None = None,
) -> list[Path]

Write an averaged surface as Tecplot, and as VTK where asked.

The Tecplot is written by :func:~pyflightstream.results.write_tecplot_surface, the writer of every point's Tecplot, and says in its DATASETAUXDATA what it is an average of. The VTK, in the reference frame, is the same surface.

Parameters:

Name Type Description Default
dat str or Path

The Tecplot file to write.

required
average SurfaceAverage

The averaged surface.

required
vtk str or Path

The VTK file to write as well.

None
overwrite bool

Replace files that exist.

False
run_block mapping

The point's run block row: the Tecplot carries it as one DATASETAUXDATA record per column, before the other records, and the VTK as dataset field data.

None

Returns:

Type Description
list of pathlib.Path

The files written, the Tecplot first.

Raises:

Type Description
ProductError

If a field name holds a blank or a quote, or the two destinations are one file; nothing is written then.

ProductExistsError

If either destination exists and overwrite is false; both are tested first, so nothing is written then.