Skip to content

pyflightstream.probes.lattice (stable)

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

The survey lattice of a far-field extraction: one source of probe positions.

Pipeline role: defines the serializable cylindrical probe lattice (stations, ring edges, uniform azimuths) that both the FlightStream probe export and the companion CFD extraction sample. One lattice object is the single source of probe positions for every solver, so cross-solver data loading is transparent by construction (design note DLV-006 Sec. 2, requirement R1).

Coordinates: cylindrical (x, r, psi) aligned with the shaft axis, x positive downstream, origin at the disk center, lengths nondimensionalized by the tip radius. The Cartesian mapping is y = r sin(psi), z = r cos(psi): psi = 0 points along +z (up) and grows toward +y. A tier-1 test pins this convention (DLV-006 Sec. 3.1: fix it once, in code, with a test).

Azimuthal spacing is uniform by construction: the lattice stores only the azimuth count, so a nonuniform spacing is unrepresentable. Uniform periodic sampling is what makes the azimuthal rectangle rule spectrally accurate and the FFT direct (DLV-006 Sec. 2.2); this is a hard design constraint, not a default.

Advanced

pyflightstream.probes.lattice.ProbeLattice

Bases: ProbeModel

Serializable cylindrical probe lattice of a far-field survey.

The lattice is a set of transverse annular planes (constant x) plus, optionally, rings on a lateral cylinder that closes the control volume on the side (DLV-006 Sec. 2.1). Ring edges are stored explicitly so the annular area weights of the quadrature are exact (DLV-006 Sec. 2.2); ring centers are the sampling radii.

Attributes:

Name Type Description
tip_radius float

Reference radius R in simulation length units; every stored coordinate is nondimensionalized by it. The far-field ledgers integrate over areas of tip_radius squared, so they are in the field's units times this unit squared: SI only for R in metres (see :class:pyflightstream.farfield.fields.LatticeFields).

stations tuple of float

Axial positions x/R of the annular planes, strictly increasing, x positive downstream of the disk center.

ring_edges tuple of float

Radial ring edges r/R, strictly increasing, at least two. The first edge must be positive: the axis r = 0 is a coordinate singularity of the cylindrical quadrature, so rings start off-axis (DLV-006 Sec. 2.2 starts them at 0.05 R).

n_psi int

Number of uniformly spaced azimuths per ring. At least 8, so the FFT resolves the low-order harmonic content the ledgers need (order 0 forces, order 1 in-plane moments).

lateral_radius (float, optional)

Radius r/R of the lateral closure cylinder; None when the lattice carries no lateral rings.

lateral_stations tuple of float

Axial positions x/R of the lateral rings; empty exactly when lateral_radius is None.

n_r property

n_r: int

Number of radial rings per annular plane.

ring_centers property

ring_centers: ndarray

Sampling radii r/R, the midpoints of the stored ring edges.

psi property

psi: ndarray

Uniform azimuths in radians, 2 pi k / n_psi for k = 0..n_psi-1.

delta_psi property

delta_psi: float

Uniform azimuthal step in radians.

point_count property

point_count: int

Total probe count: annular planes plus lateral rings.

area_weights

area_weights() -> np.ndarray

Per-sample annular quadrature weights, in units of R squared.

Returns:

Type Description
ndarray

Shape (n_r,); the weight of the sample at ring j and any azimuth k is 0.5 (r_{j+1/2}^2 - r_{j-1/2}^2) dpsi (DLV-006 Sec. 3.1). Summed over rings and azimuths the weights give the exact annular plane area.

plane_points

plane_points() -> np.ndarray

Nondimensional Cartesian probe positions of the annular planes.

Returns:

Type Description
ndarray

Shape (n_stations, n_r, n_psi, 3) with components (x, y, z)/R; y = r sin(psi), z = r cos(psi).

lateral_points

lateral_points() -> np.ndarray

Nondimensional Cartesian positions of the lateral-cylinder rings.

Returns:

Type Description
ndarray

Shape (n_lateral_stations, n_psi, 3); empty when the lattice has no lateral cylinder.

dimensional_points

dimensional_points() -> np.ndarray

All probe positions in simulation length units, flat and ordered.

The order is the loading contract of the whole extraction chain: annular planes first (station-major, then ring, then azimuth), lateral rings last (station-major, then azimuth).

Returns:

Type Description
ndarray

Shape (point_count, 3), Cartesian (x, y, z) scaled by tip_radius.

to_json

to_json() -> str

Serialize the defining data; arrays are derived, never stored.

from_json classmethod

from_json(text: str) -> ProbeLattice

Rebuild a lattice from :meth:to_json output.

The CFD extraction consumes the same serialized object to place its sampling points, which is what makes cross-solver loading transparent (DLV-006 requirement R1).

pyflightstream.probes.lattice.build_lattice

build_lattice(
    *,
    tip_radius: float,
    stations: tuple[float, ...] = (
        -2.0,
        -0.2,
        0.2,
        0.5,
        1.0,
        1.5,
        2.0,
    ),
    n_r: int = 40,
    r_inner: float = 0.05,
    r_outer: float = 2.5,
    n_psi: int = 72,
    lateral_radius: float | None = 2.5,
    lateral_stations: tuple[float, ...] | None = None,
    hub_width: float = 0.15,
    tip_width: float = 0.1,
) -> ProbeLattice

Build the dense reference lattice of the far-field survey.

Defaults follow DLV-006 Sec. 2: inlet plane at -2 R, disk-adjacent planes at +-0.2 R, wake planes to 2 R, 40 rings from 0.05 R clustered near hub and tip, 72 uniform azimuths (5 degree step, harmonics to order 35 without aliasing; order 36 is the Nyquist order and is refused), lateral cylinder at 2.5 R. If solver cost forces a reduction, cut n_r before n_psi and record the change (DLV-006 Sec. 2.2).

Parameters:

Name Type Description Default
tip_radius float

Reference radius R in simulation length units.

required
stations tuple of float

Annular plane positions x/R, strictly increasing.

(-2.0, -0.2, 0.2, 0.5, 1.0, 1.5, 2.0)
n_r (int, float, float)

Ring count and radial extent r/R of every annular plane.

40
r_inner (int, float, float)

Ring count and radial extent r/R of every annular plane.

40
r_outer (int, float, float)

Ring count and radial extent r/R of every annular plane.

40
n_psi int

Uniform azimuth count, at least 14 for the six stored harmonics (DLV-006 Sec. 3.2); uniformity is structural.

72
lateral_radius float

Lateral closure cylinder radius r/R, not smaller than r_outer so the cylinder encloses the annular planes; None disables it.

2.5
lateral_stations tuple of float

Lateral ring positions x/R; defaults to stations when the cylinder is enabled.

None
hub_width float

Gaussian widths (in r/R) of the hub and tip clustering bands.

0.15
tip_width float

Gaussian widths (in r/R) of the hub and tip clustering bands.

0.15

Returns:

Type Description
ProbeLattice

Validated, serializable lattice.

Raises:

Type Description
ProbeGeometryError

If the survey has fewer than 14 azimuths for its six stored harmonics, the lateral cylinder is smaller than the outer ring edge, or lateral_stations are given with lateral_radius=None.