Skip to content

Extract

Wall-normal profile extraction from unstructured FE-quad Tecplot meshes.

Functions

read_fequad_block_tecplot

from lst_tools.extract import read_fequad_block_tecplot

lst_tools.extract.read_fequad_block_tecplot

read_fequad_block_tecplot(path: str | Path) -> TecplotUnstructuredData

Read a FEQUADRILATERAL BLOCK Tecplot ASCII file.

The file must have: - Line 0: VARIABLES = x, y, z, ... - Line 1: ZONE N=<nodes>, E=<elements>, ... - Lines 2-3: DATAPACKING=BLOCK and ZONETYPE=FEQUADRILATERAL - Numeric body: nodal variables (N values each), then cell-centered variables (E values each), then connectivity (E rows × 4 columns).

Parameters:

Name Type Description Default
path str | Path

Input Tecplot ASCII file path.

required

Returns:

Type Description
TecplotUnstructuredData

Parsed nodal coordinates, cell-centered fields, and connectivity.

Raises:

Type Description
ValueError

If the zone header cannot be parsed.

build_quad_mesh_sampler

from lst_tools.extract import build_quad_mesh_sampler

lst_tools.extract.build_quad_mesh_sampler

build_quad_mesh_sampler(nodal_x: ndarray, nodal_y: ndarray, connectivity: ndarray, cell_fields: dict[str, ndarray], existing_nodal_fields: dict[str, ndarray] | None = None) -> QuadMeshSampler

Build a scalable quad mesh sampler with a uniform spatial bin index.

Parameters:

Name Type Description Default
nodal_x ndarray

Node x-coordinates.

required
nodal_y ndarray

Node y-coordinates.

required
connectivity ndarray

FE quad connectivity (E × 4, 1-based).

required
cell_fields dict[str, ndarray]

Cell-centered flow variable arrays.

required
existing_nodal_fields dict[str, ndarray] | None

Optional pre-existing nodal fields (skip reconstruction).

None

Returns:

Type Description
QuadMeshSampler

Populated QuadMeshSampler ready for point queries.

extract_lower_wall

from lst_tools.extract import extract_lower_wall

lst_tools.extract.extract_lower_wall

extract_lower_wall(nodal_x: ndarray, nodal_y: ndarray, connectivity: ndarray, nodal_fields: dict[str, ndarray] | None = None) -> tuple[np.ndarray, np.ndarray]

Extract the body-surface wall from the boundary loop.

Thin wrapper around extract_body_wall for backward compatibility.

Parameters:

Name Type Description Default
nodal_x ndarray

Node x-coordinates.

required
nodal_y ndarray

Node y-coordinates.

required
connectivity ndarray

FE quadrilateral connectivity (1-based).

required
nodal_fields dict[str, ndarray] | None

Optional canonical nodal flow fields. When u/v/w are available, the wall can be identified from the lowest-velocity boundary segment instead of only from geometry.

None

Returns:

Type Description
tuple[ndarray, ndarray]

Wall x and y arrays in loop order (arc from trailing edge to trailing edge).

sample_profiles

from lst_tools.extract import sample_profiles

lst_tools.extract.sample_profiles

sample_profiles(wall_x: ndarray, wall_y: ndarray, mesh_sampler: QuadMeshSampler, station_x: ndarray, target_y: float | None = None, n_eta: int = default_n_eta, eta_max: float | None = None, eta_distribution: str = default_eta_distribution, eta_stretch: float = default_eta_stretch, eta_wall_spacing: float | None = None, rgas: float = 287.15) -> SampledProfiles

Sample wall-normal profiles using barycentric interpolation on the quad mesh.

Parameters:

Name Type Description Default
wall_x ndarray

Lower-wall x-coordinates.

required
wall_y ndarray

Lower-wall y-coordinates.

required
mesh_sampler QuadMeshSampler

Populated quad mesh sampler.

required
station_x ndarray

Streamwise x-coordinates of extraction stations.

required
target_y float | None

Optional preferred wall branch. Positive chooses the upper surface and negative chooses the lower surface.

None
n_eta int

Number of wall-normal sample points per profile.

default_n_eta
eta_max float | None

Optional absolute wall-normal profile extent. When None, an automatic estimate is computed from mesh geometry.

None
eta_distribution str

Point distribution along the wall-normal coordinate.

default_eta_distribution
eta_stretch float

Stretching strength for tanh eta distribution.

default_eta_stretch
eta_wall_spacing float | None

First off-wall interval for geometric distribution.

None
rgas float

Specific gas constant (J/(kg·K)). Used for ideal-gas wall density.

287.15

Returns:

Type Description
SampledProfiles

Sampled profile arrays for all requested stations.

Raises:

Type Description
ValueError

If station_x is not strictly increasing or lies outside the wall x-range.

detect_dimensional

from lst_tools.extract import detect_dimensional

lst_tools.extract.detect_dimensional

detect_dimensional(profiles: SampledProfiles) -> bool

Return True if the profiles appear to contain dimensional data.

Heuristic: the mean edge velocity (outermost wall-normal point) is compared against a threshold of 5 m/s. Non-dimensional profiles always have u/u_e close to 1; dimensional profiles have velocities typically > 100 m/s.

Parameters:

Name Type Description Default
profiles SampledProfiles

Sampled wall-normal profiles.

required

Returns:

Type Description
bool

True when the profiles look dimensional; False when they look

bool

non-dimensional.

normalize_profiles

from lst_tools.extract import normalize_profiles

lst_tools.extract.normalize_profiles

normalize_profiles(profiles: SampledProfiles) -> tuple[SampledProfiles, dict[str, np.ndarray]]

Normalize dimensional profiles by their local edge values.

Each profile is divided by the value at the outermost wall-normal point (the edge condition), giving ratios u/u_e, T/T_e, rho/rho_e, p/(rho_e*u_e^2).

The edge values are returned separately so they can be stored as HDF5 attributes for downstream reconstruction.

Parameters:

Name Type Description Default
profiles SampledProfiles

Sampled wall-normal profiles (assumed dimensional).

required

Returns:

Type Description
SampledProfiles

Tuple of (normalized profiles, edge_values dict).

dict[str, ndarray]

edge_values has keys: "uvel_e", "temp_e", "rho_e", "pres_e" each with

tuple[SampledProfiles, dict[str, ndarray]]

shape (n_stations,).

Raises:

Type Description
ValueError

If any edge value is zero or negative.

write_profiles_hdf5

from lst_tools.extract import write_profiles_hdf5

lst_tools.extract.write_profiles_hdf5

write_profiles_hdf5(path: str | Path, profiles: SampledProfiles, attrs: dict[str, float]) -> Path

Write the extracted profiles to HDF5.

All datasets have shape (N_ETA, n_stations) — rows are wall-normal points, columns are streamwise stations.

Parameters:

Name Type Description Default
path str | Path

Output HDF5 file path.

required
profiles SampledProfiles

Sampled wall-normal profile data.

required
attrs dict[str, float]

Freestream attribute dictionary for root-level metadata.

required

Returns:

Type Description
Path

Resolved output path.

write_profiles_tecplot

from lst_tools.extract import write_profiles_tecplot

lst_tools.extract.write_profiles_tecplot

write_profiles_tecplot(path: str | Path, profiles: SampledProfiles) -> Path

Write the extracted wall-normal profiles as a multi-zone Tecplot file.

Parameters:

Name Type Description Default
path str | Path

Output Tecplot ASCII file path.

required
profiles SampledProfiles

Sampled wall-normal profile data.

required

Returns:

Type Description
Path

Resolved output path.

write_wall_profile_tecplot

from lst_tools.extract import write_wall_profile_tecplot

lst_tools.extract.write_wall_profile_tecplot

write_wall_profile_tecplot(path: str | Path, wall_x: ndarray, wall_y: ndarray) -> Path

Write the extracted wall curve as a 1-D Tecplot line zone.

Parameters:

Name Type Description Default
path str | Path

Output Tecplot ASCII file path.

required
wall_x ndarray

Wall x-coordinates.

required
wall_y ndarray

Wall y-coordinates.

required

Returns:

Type Description
Path

Resolved output path.

Classes

SampledProfiles

from lst_tools.extract import SampledProfiles

lst_tools.extract.SampledProfiles dataclass

SampledProfiles(station_x: ndarray, station_y: ndarray, station_s: ndarray, eta: ndarray, sample_x: ndarray, sample_y: ndarray, uvel: ndarray, vvel: ndarray, wvel: ndarray, temp: ndarray, pres: ndarray, rho: ndarray)

Container for sampled wall-normal profile data.