pyflightstream.farfield.fields (stable)¶
Generated from the docstrings at build time: every one of the 7 names in the __all__ of pyflightstream.farfield.fields has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The containers the far-field core integrates: survey samples on a lattice or a plane.
Pipeline role: the frozen numpy containers that replaced the xarray dataset (FR-457).
:class:LatticeFields carries the samples of a cylindrical
survey lattice, shaped (station, ring, azimuth), in the shaft-aligned
coordinates defined by :mod:pyflightstream.probes.lattice; :class:PlaneFields
carries the samples of a rectangular far-field plane, shaped (y, z). Neither
reads or writes a file (FR-1004).
Field names: axial velocity u (m/s, +x downstream), transverse Cartesian
v (+y) and w (+z), cylindrical v_r and v_theta (derived, see
:func:cylindrical_components), pressure perturbation p_prime = p - p_inf
(Pa). Radii and stations are nondimensionalized by the lattice tip radius.
Advanced¶
pyflightstream.farfield.fields.FarfieldInputError
¶
Bases: PyflightstreamError, ValueError
A far-field reduction was given fields it cannot integrate.
Survey fields missing a sample array the ledger needs, a harmonic request the azimuthal sampling cannot resolve, a flux or moment call whose arrays do not agree on shape or frame, a station the lattice does not carry.
Also inherits from ValueError.
pyflightstream.farfield.fields.LatticeFields
dataclass
¶
LatticeFields(
stations: ndarray,
ring_centers: ndarray,
ring_edges: ndarray,
psi: ndarray,
tip_radius: float,
values: Mapping[str, ndarray],
lateral_radius: float | None = None,
lateral_stations: ndarray = (lambda: np.empty(0))(),
lateral_values: Mapping[str, ndarray] = _EMPTY,
)
Samples of a cylindrical survey lattice with its coordinates.
Attributes:
| Name | Type | Description |
|---|---|---|
stations |
ndarray
|
Axial positions x/R of the annular planes, shape |
ring_centers |
ndarray
|
Sampling radii r/R, shape |
ring_edges |
ndarray
|
Ring edges r/R, shape |
psi |
ndarray
|
Uniform azimuths in radians, shape |
tip_radius |
float
|
Reference radius R, in THE LENGTH UNIT OF THE SAMPLES' POSITIONS. No
unit conversion is performed by this container or by
:func: |
values |
mapping of str to numpy.ndarray
|
Sampled fields, each shaped |
lateral_radius |
float or None
|
Radius r/R of the lateral closure cylinder; None without one. |
lateral_stations |
ndarray
|
Axial positions x/R of the lateral rings, shape |
lateral_values |
mapping of str to numpy.ndarray
|
Lateral ring samples, each shaped |
with_values
¶
with_values(**arrays: ndarray) -> LatticeFields
Return a copy with fields added or replaced (shapes checked).
with_lateral_values
¶
with_lateral_values(**arrays: ndarray) -> LatticeFields
Return a copy with lateral-ring fields added or replaced.
station_index
¶
station_index(station: float) -> int
Return the index of a station x/R, allowing floating-point roundoff.
An exact match wins; otherwise the one station within 1e-12
(relative and absolute) is taken, so 0.1 * 3 finds the plane at
0.3. A nearby plane is never guessed.
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If no plane, or more than one, lies at |
points
¶
points() -> tuple[np.ndarray, dict[str, np.ndarray]]
Flatten the survey into the inputs of the point writers.
The replacement of the retired post.dataset_to_points: positions
rebuilt from the survey coordinates (x = station R,
y = r sin(psi) R, z = r cos(psi) R, the convention of
:mod:pyflightstream.probes) and every field flattened in the same
station, ring, azimuth order, so the result drops straight into
:func:pyflightstream.post.writers.write_vtk_points or
:func:pyflightstream.post.writers.write_tecplot_points.
Returns:
| Type | Description |
|---|---|
tuple
|
|
pyflightstream.farfield.fields.PlaneFields
dataclass
¶
PlaneFields(
y: ndarray, z: ndarray, values: Mapping[str, ndarray]
)
Samples of a uniform rectangular far-field plane (Trefftz C, wing).
Attributes:
| Name | Type | Description |
|---|---|---|
y, z |
ndarray
|
The grid axes in the plane, in m, uniform and strictly increasing,
shapes |
values |
mapping of str to numpy.ndarray
|
Sampled fields, each shaped |
pyflightstream.farfield.fields.cylindrical_components
¶
cylindrical_components(
fields: LatticeFields,
) -> LatticeFields
Add the cylindrical velocity components v_r and v_theta.
Convention (fixed here and pinned by a tier-1 test, DLV-006 Sec. 3.1):
y = r sin(psi), z = r cos(psi), so the radial unit vector is
(0, sin psi, cos psi) and the azimuthal unit vector, in the direction
of growing psi (+z toward +y), is (0, cos psi, -sin psi). A
right-handed rotation about +x therefore has negative v_theta in this
convention. The lateral rings gain the same two components where they
carry v and w.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields
|
LatticeFields
|
Survey samples carrying |
required |
Returns:
| Type | Description |
|---|---|
LatticeFields
|
A copy with |
pyflightstream.farfield.fields.hub_frame_velocities
¶
hub_frame_velocities(
points: ndarray,
*,
velocities: ndarray,
omega: float,
axis: ndarray,
origin: ndarray,
) -> np.ndarray
Convert velocities sampled in a frame turning with a rotor to its hub frame.
A quasi-steady rotor holds its blades still and carries the rotation in the
free stream, so a probe there is taken to read the velocity relative to a frame that
turns at omega about axis (FR-1037; not measured in a committed report).
The hub-frame velocity adds back the
frame velocity at the probe, v_hub = v + Omega x (x - x_hub) with
Omega = omega axis (FR-1037). The positions are not moved: the
balances of one solve read the field at one instant, where the two frames
coincide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
Probe positions, shape |
required |
velocities
|
ndarray
|
Sampled velocities in the turning frame, shape |
required |
omega
|
float
|
Signed rotational speed in rad/s about |
required |
axis
|
ndarray
|
The rotation axis, shape |
required |
origin
|
ndarray
|
A point of the rotation axis (the hub), shape |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Hub-frame velocities, shape |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If the axis is not a finite non-zero vector, or |
pyflightstream.farfield.fields.lattice_fields
¶
lattice_fields(
lattice: ProbeLattice,
*,
fields: Mapping[str, ndarray],
lateral: Mapping[str, ndarray] | None = None,
) -> LatticeFields
Assemble the survey samples of a lattice, the replacement of lattice_dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice
|
ProbeLattice
|
Lattice that placed the probes; supplies stations, ring centers, ring edges, azimuths, the tip radius and the lateral cylinder. Supply the tip radius in metres for SI balances; this function copies it without converting simulation length units. |
required |
fields
|
mapping of str to numpy.ndarray
|
Sampled fields of the annular planes, each shaped
|
required |
lateral
|
mapping of str to numpy.ndarray
|
Sampled fields of the lateral rings, each |
None
|
Returns:
| Type | Description |
|---|---|
LatticeFields
|
The frozen container every balance integrates. |
pyflightstream.farfield.fields.plane_fields
¶
plane_fields(
y: object, *, z: object, fields: Mapping[str, ndarray]
) -> PlaneFields
Assemble the samples of a far-field plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
array_like
|
Uniform grid axes in m, each with at least three points. |
required |
z
|
array_like
|
Uniform grid axes in m, each with at least three points. |
required |
fields
|
mapping of str to numpy.ndarray
|
Sampled fields shaped |
required |
Returns:
| Type | Description |
|---|---|
PlaneFields
|
The frozen container the Trefftz C integrals take. |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If coordinates or field arrays do not form the declared rectangular plane. |