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 = N_ETA, eta_distribution: str = DEFAULT_ETA_DISTRIBUTION, 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.

N_ETA
eta_distribution str

Point distribution along the wall-normal coordinate.

DEFAULT_ETA_DISTRIBUTION
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.

compute_freestream_attrs

from lst_tools.extract import compute_freestream_attrs

lst_tools.extract.compute_freestream_attrs

compute_freestream_attrs(profiles: SampledProfiles, mach: float, t_inf: float, rgas: float = 287.15) -> dict[str, float]

Compute HDF5 root attributes from freestream conditions via Sutherland's law.

Parameters:

Name Type Description Default
profiles SampledProfiles

Sampled wall-normal profile data (used for edge-state pressure).

required
mach float

Freestream Mach number.

required
t_inf float

Freestream static temperature in Kelvin.

required
rgas float

Specific gas constant (J/(kg·K)). Should match [flow_conditions] rgas in lst.cfg.

287.15

Returns:

Type Description
dict[str, float]

Attribute dictionary with freestream metadata written as HDF5 root

dict[str, float]

attributes. Key names are read by convert_meanflow (lastrac subcommand).

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.