Skip to content

pyflightstream.post.boundary_layer (stable)

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

Raw VTK boundary-layer scalars at recorded surface-section cut points.

A shared edge belongs to every incident source cell. Values are never averaged, interpolated to nodes, converted to a guessed thickness unit, or turned into a wall-normal velocity profile.

Advanced

pyflightstream.post.boundary_layer.BL_COLUMNS module-attribute

BL_COLUMNS = (
    "SECTION",
    "CUT_POINT",
    "CELL_ID",
    "INCIDENT_CELLS",
    "X",
    "Y",
    "Z",
    *BL_FIELDS,
)

pyflightstream.post.boundary_layer.BL_FIELDS module-attribute

BL_FIELDS = (
    "BL_Thickness",
    "BL_displacement_thickness",
    "BL_momentum_thickness",
    "BL_shape_factor",
    "BL_streamline_length",
    "Transition_marker",
    "Separation_marker",
    "skin_friction_coeff.",
    "Normalized_Vorticity",
    "Cp_freestream",
    "Static_pressure_ratio",
    "Boundary_Index",
)

pyflightstream.post.boundary_layer.BoundaryLayerSamples dataclass

BoundaryLayerSamples(
    rows: tuple[dict[str, object], ...],
    available_fields: tuple[str, ...],
    missing_fields: tuple[str, ...],
    tolerance: float,
)

Cell-associated rows and the exact fields available in their VTK source.

pyflightstream.post.boundary_layer.sample_boundary_layer

sample_boundary_layer(
    surface: VtkSurface,
    sections: Sequence[SurfaceSection],
    *,
    surface_frame: SurfaceFrame,
    section_frames: Mapping[int, SurfaceFrame],
    section_normals: Mapping[int, Sequence[float]]
    | None = None,
    tolerance: float | None = None,
) -> BoundaryLayerSamples

Associate actual cut points with source cells in a common reference frame.

Coordinates and placement origins use the simulation length unit. Scalars retain their native values. CELL_ID is the original zero-based VTK polygon index; Boundary_Index remains the raw solver scalar, with no inferred name. Shared edges produce one row per incident cell. Missing scalar fields are None (NA in CSV); missing geometry or placement is refused explicitly.

Parameters:

Name Type Description Default
surface VtkSurface

The point's surface VTK export, with its boundary-layer cell data.

required
sections sequence of SurfaceSection

The surface section cuts, with their point positions.

required
surface_frame SurfaceFrame

The placement that carries the surface's coordinates into the reference frame.

required
section_frames mapping of int to SurfaceFrame

Each section's placement into the reference frame, by section index.

required
section_normals mapping of int to sequence of float

Each section's cut normal, by section index; with it a cut point is also associated with a cell whose chord along the cut it lies on.

None
tolerance float

The distance within which a cut point lies on a cell, in the simulation length unit; a ten-millionth of the surface's extent when None, never below an absolute floor of 1e-10 (which only dominates for an extent below 1e-3 length units).

None

Returns:

Type Description
BoundaryLayerSamples

One row per cut point and incident cell, the fields available and missing, and the tolerance used.

Raises:

Type Description
ProductError

If the VTK carries no boundary-layer cell data or no cells, a field is not one finite value per cell, the tolerance is not finite and positive, a section has no placement, a cut normal is not a finite non-zero three-vector, or a cut point has no incident cell.

pyflightstream.post.boundary_layer.write_boundary_layer_products

write_boundary_layer_products(
    *,
    sim_dir: Path,
    record: RunRecord,
    stem: str,
    out: Path,
    target: Callable[[Path], Path],
    skipped: dict[str, str],
    step: int | None,
    pproc: PprocSpec | None,
    condition: Mapping[str, object] | None = None,
    reference: Mapping[str, object] | None = None,
    overwrite: bool = True,
) -> tuple[list[Path], dict[str, dict[str, object]]]

Write a final-state point product from its exact VTK and section exports.

Missing source fields are named in the manifest and written NA. Missing placement, cut coordinates, state or original-cell association skips this product explicitly. No solver is run and no nearest-cell substitute is used.

Parameters:

Name Type Description Default
sim_dir Path

Simulation directory containing the recorded exports.

required
record RunRecord

Run metadata, including outputs, section layout and export clock.

required
stem str

Point's export filename stem.

required
out Path

Root directory for the products.

required
target callable

Prepare a destination path, applying the caller's archive policy.

required
skipped dict of str to str

Mutable mapping of product names to skip reasons.

required
step int or None

The point's final step, recorded with the product.

required
pproc PprocSpec or None

The recorded post-processing specification; a point that declares no boundary-layer product writes nothing.

required
condition mapping

The point's condition and reference values, written in the condition block after POL; NA where not given.

None
reference mapping

The point's condition and reference values, written in the condition block after POL; NA where not given.

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 of (list of Path, dict of str to dict)

The written path and its product-manifest entry; both empty when the product is not written, the reason then named in skipped.

pyflightstream.post.boundary_layer.write_boundary_layer_table

write_boundary_layer_table(
    path: str | Path,
    samples: BoundaryLayerSamples,
    *,
    pol: str,
    context: Sequence[object] | None = None,
    overwrite: bool = True,
) -> Path

Write raw cell values with round-trip float precision and explicit NA fields.

The table opens with POL and the point's condition block, as every table the post writes does, through the shared CSV writer.

The caller applies its archive/overwrite policy before invoking this writer.

Parameters:

Name Type Description Default
path str or Path

The table to write.

required
samples BoundaryLayerSamples

The samples of :func:sample_boundary_layer.

required
pol str

The polar of the point, written in the first column of every row.

required
context sequence of object

The point's condition values, in the order of the condition columns; NA for every one where not given.

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
Path

The written table.