Skip to content

Grid & Flow

Core data structures for representing base flow data.

Grid

from lst_tools import Grid

The Grid class holds the computational grid coordinates.

lst_tools.core.Grid dataclass

Grid(x: ndarray, y: ndarray, z: ndarray | None = None, attrs: Mapping[str, float | int | str] = None, cfg: dict[str, Any] | None = None)

Two- or three-dimensional structured grid.

shape property

shape: tuple[int, ...]

Return the shape of the grid arrays.

Flow

from lst_tools import Flow

The Flow class holds the flow field variables on the grid.

lst_tools.core.Flow dataclass

Flow(grid: Grid, fields: Mapping[str, ndarray], attrs: Mapping[str, float | int | str])

Flow fields defined on a Grid.

field

field(name: str) -> np.ndarray

Return the named field array, checking shape against the grid.

Parameters:

Name Type Description Default
name str

Key into the fields mapping.

required

Returns:

Type Description
ndarray

np.ndarray: The field array.

Raises:

Type Description
KeyError

If name is not in fields.

ValueError

If the field shape does not match the grid shape.