pyflightstream.farfield.trefftz (provisional)¶
Generated from the docstrings at build time: every one of the 17 names in the __all__ of pyflightstream.farfield.trefftz has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The Trefftz-plane integrals: the discrete trace (A, B) and the probe plane (C).
Pipeline role: the far-field lift, side force and induced drag of a configuration, from a discrete trailing-vortex sheet in the Trefftz plane (variants A and B, FR-451 and FR-452) or from the velocities sampled on a plane of probes (variant C, FR-453), and the far-field loss channels of a rotor. The equations are those of the definitions page, The far-field family; every component here is already in the axes the docstring names, turned by the caller (FR-1005), and nothing here reads or writes a file (FR-1004).
Advanced¶
pyflightstream.farfield.trefftz.PlaneDrag
dataclass
¶
PlaneDrag(
induced_drag: float,
coarse_drag: float,
quadrature_error: float,
coverage: float,
)
The crossflow-energy induced drag of a probe plane (Trefftz C).
Attributes:
| Name | Type | Description |
|---|---|---|
induced_drag |
float
|
|
coarse_drag |
float
|
The same samples integrated on every other grid point, N; NaN where the grid's point counts do not allow it to span the same extent. |
quadrature_error |
float
|
|
coverage |
float
|
The fraction of the plane's AREA whose crossflow samples are finite, each sample weighted by the area its trapezoid weight integrates. |
pyflightstream.farfield.trefftz.RotorChannels
dataclass
¶
RotorChannels(
station: float,
p_axial: float,
p_swirl: float,
p_crossflow: float,
p_total: float,
thrust: float,
eta_ff: float,
coverage: float,
)
The far-field loss channels of a rotor at one lattice station (W).
thrust is the axial force of the balance between the inlet and the
station (N); eta_ff is NaN at V = 0.
pyflightstream.farfield.trefftz.TraceResult
dataclass
¶
TraceResult(
lift: float,
side_force: float,
induced_drag: float,
sheets: tuple[int, ...],
sheet_lift: ndarray,
sheet_side_force: ndarray,
sheet_drag_share: ndarray,
sheet_drag_isolated: ndarray,
y: ndarray,
z: ndarray,
dy: ndarray,
dz: ndarray,
ds: ndarray,
gamma: ndarray,
normalwash: ndarray,
sheet: ndarray,
original: ndarray,
)
The forces of a discrete trailing-vortex trace and its strips.
Forces are those of the traced (mirrored, where asked) configuration, in N; the per-strip arrays run over every strip of the trace.
Attributes:
| Name | Type | Description |
|---|---|---|
lift, side_force, induced_drag |
float
|
|
sheets |
tuple of int
|
The sheet labels, in order of first appearance. |
sheet_lift, sheet_side_force |
ndarray
|
Per sheet, N. |
sheet_drag_share |
ndarray
|
Per sheet, the drag of its strips under the normalwash of every
sheet's filaments; the shares add up to |
sheet_drag_isolated |
ndarray
|
Per sheet, the drag of its strips under its own filaments only. |
y, z, dy, dz, ds, gamma |
ndarray
|
Per strip: the point, the strip's projections and length (m), and the circulation (m^2/s). |
normalwash |
ndarray
|
Per strip, the Trefftz-plane velocity along the strip's upward normal, induced by every sheet (m/s). |
sheet |
ndarray
|
Per strip, its sheet label. |
original |
ndarray
|
Per strip, True where the strip is a station of the input (False on a mirror image). |
pyflightstream.farfield.trefftz.WakeLoads
dataclass
¶
WakeLoads(
thrust: float, torque: float, blades: int, lines: int
)
Rotor thrust and torque from the circulation its blades shed (option 3).
Attributes:
| Name | Type | Description |
|---|---|---|
thrust |
float
|
|
torque |
float
|
|
blades |
int
|
Blades whose lines were traced, periodic copies included. |
lines |
int
|
Wake lines read, before periodic copies. |
pyflightstream.farfield.trefftz.WakeTrace
dataclass
¶
WakeTrace(
y: ndarray,
z: ndarray,
values: ndarray,
short: int,
problem: str | None,
)
Where the solver's wake lines cross a Trefftz plane (variant B).
Attributes:
| Name | Type | Description |
|---|---|---|
y, z |
ndarray
|
The crossings in span order, m. |
values |
ndarray
|
The circulation shed by each crossing's line, with the exported sign. |
short |
int
|
How many lines end before the plane. |
problem |
str or None
|
Why the crossings are no trace (lines falling short, a start run that is not one sheet), or None. |
forces
¶
forces(
*, rho: float, v_inf: float, mirror: bool = False
) -> TraceResult
Integrate the circulation shed by the lines between their crossings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rho
|
float
|
Density in kg/m3 and free-stream speed in m/s. |
required |
v_inf
|
float
|
Density in kg/m3 and free-stream speed in m/s. |
required |
mirror
|
bool
|
The crossings are one half of a mirror model. Sum the negative exported strengths from the tip inwards, then reflect the strips. For a full sheet, sum signed strengths from its first edge. |
False
|
Returns:
| Type | Description |
|---|---|
TraceResult
|
Forces and strip data. Each strip lies between two wake lines, with circulation accumulated from the exterior zero value. |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If the crossings do not form an integrable sheet. |
pyflightstream.farfield.trefftz.bernoulli_residual
¶
bernoulli_residual(
plane: PlaneFields, *, rho: float, v_inf: float
) -> float
Return the Betz-Maskell term of a plane, in N (FR-1031).
With the total-pressure deficit
p0_inf - p0 = -p' - (rho / 2) (u^2 + v^2 + w^2 - V^2) and the
artificial axial velocity u* = sqrt(u^2 + 2 (p0_inf - p0) / rho),
integral over p0 < p0_inf of [(p0_inf - p0) + (rho / 2) (u* - u)
(u* + u - 2 V)] dS. Zero by construction in a field that holds
Bernoulli's relation; written as a diagnostic, never as a drag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
PlaneFields
|
Rectangular probe-plane samples in free-stream axes. |
required |
rho
|
float
|
Density in kg/m3. |
required |
v_inf
|
float
|
Free-stream speed in m/s. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Integrated Betz-Maskell diagnostic in N over the total-pressure deficit region. |
pyflightstream.farfield.trefftz.calibration_scale
¶
calibration_scale(
raw_lift: float,
*,
cl_near: float,
q: float,
s_ref: float,
) -> float
Return the scale k that makes a trace's lift the solver's own (FR-1024).
The wake export's value is proportional to the circulation with a scale the
solver does not document; Gamma = k Gamma_raw with
k = CL_near q SREF / L_raw, L_raw the lift the raw values give, so
CL_T of variant B equals the solver's CL by construction. NaN where
the near-field CL is missing or zero, or the raw lift is zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw_lift
|
float
|
The lift of the trace traced with the raw values, N, already counted as the polar counts it (the meshed half of a half model whose loads are not doubled). |
required |
cl_near
|
float
|
The solver's |
required |
q
|
float
|
Dynamic pressure (Pa) and reference area (m2). |
required |
s_ref
|
float
|
Dynamic pressure (Pa) and reference area (m2). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Circulation scale, or NaN when lift cannot define it. |
pyflightstream.farfield.trefftz.plane_induced_drag
¶
plane_induced_drag(
plane: PlaneFields, *, rho: float, v_inf: float
) -> PlaneDrag
Induced drag from the crossflow kinetic energy on a plane (FR-1030).
D_i = (rho / 2) integral (v^2 + w^2) dS: the crossflow-energy
integrand of the balances advected by V and divided by it, so the
balance and Trefftz C share one integrand (FR-1003). NaN at V = 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
PlaneFields
|
Rectangular probe-plane samples in free-stream axes. |
required |
rho
|
float
|
Density in kg/m3. |
required |
v_inf
|
float
|
Free-stream speed in m/s. |
required |
Returns:
| Type | Description |
|---|---|
PlaneDrag
|
Fine and coarse induced drag in N, their difference and sample coverage. |
pyflightstream.farfield.trefftz.plane_lift
¶
plane_lift(
plane: PlaneFields, *, rho: float, v_inf: float
) -> float
Lift from the first moment of the streamwise vorticity on a plane (FR-1038).
L = rho V sum_P y_P xi_P dS_P with xi = dw/dy - dv/dz by central
differences on the grid: the Kutta-Joukowski lift of the trailing vorticity
the plane holds, which for a flat sheet of strip circulation Gamma is
rho V integral Gamma dy and which roll-up does not change. It does not
depend on where y is measured from once the plane holds the whole wake
(its vorticity then sums to zero). NaN where any sample is missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
PlaneFields
|
Rectangular probe-plane samples in free-stream axes. |
required |
rho
|
float
|
Density in kg/m3. |
required |
v_inf
|
float
|
Free-stream speed in m/s. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Lift in N, positive along the plane's |
pyflightstream.farfield.trefftz.plane_vorticity_drag
¶
plane_vorticity_drag(
plane: PlaneFields, *, rho: float, chunk: int = 512
) -> float
Induced drag from the streamwise vorticity on a plane (Maskell, FR-1030).
xi = dw/dy - dv/dz by central differences on the grid, its stream
function psi(P) = -(1 / (2 pi)) sum_Q xi_Q ln|P - Q| dS_Q (the cell's
own logarithm integrated exactly), and D = (rho / 2) sum_P psi_P xi_P
dS_P. NaN where any sample is missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
PlaneFields
|
Rectangular probe-plane samples in free-stream axes. |
required |
rho
|
float
|
Density in kg/m3. |
required |
chunk
|
int
|
Number of source cells processed together to bound temporary memory; a positive integer. |
512
|
Returns:
| Type | Description |
|---|---|
float
|
Induced drag in N from the plane vorticity. |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If the density is not finite and positive, or |
pyflightstream.farfield.trefftz.rotor_channels
¶
rotor_channels(
fields: LatticeFields,
*,
rho: float,
v_inf: float,
station: float,
) -> RotorChannels
Axial, swirl and crossflow loss powers of a rotor at a station (FR-1032).
P_AXIAL = (rho / 2) I[u'^2 u], P_SWIRL and P_CROSSFLOW the swirl
and induced channels of the crossflow kinetic energy (one integrand),
P_TOTAL = I[(p0 - p0_inf) u] and
ETA_FF = T V / (T V + P_AXIAL + P_SWIRL + P_CROSSFLOW) with T the
axial force between the first station and this one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields
|
LatticeFields
|
Survey samples in the shaft-aligned axes of
:mod: |
required |
rho
|
float
|
Density in kg/m3. |
required |
v_inf
|
float
|
Free-stream speed in m/s. |
required |
station
|
float
|
Outlet station coordinate x/R. |
required |
Returns:
| Type | Description |
|---|---|
RotorChannels
|
Rotor loss powers in W, axial force in N, efficiency and coverage. |
pyflightstream.farfield.trefftz.rotor_wake_lines
¶
rotor_wake_lines(
lines: Sequence[ndarray],
*,
hub: Sequence[float],
axis: Sequence[float],
radius: float,
reach: float,
) -> np.ndarray
Return which wake lines leave the rotor, by where each one starts.
A line leaves the rotor when its first node lies within radius of the
rotor axis and within reach of the hub plane along it; every other
line leaves another family (a wing). Each line is assigned exactly once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines
|
sequence of numpy.ndarray
|
One |
required |
hub
|
sequence of float
|
The hub origin, in the lines' unit and frame. |
required |
axis
|
sequence of float
|
The rotor axis direction. |
required |
radius
|
float
|
The rotor tip radius, in the lines' unit. |
required |
reach
|
float
|
The largest axial distance of a blade trailing edge from the hub plane. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
One bool per line, True for a rotor line. |
pyflightstream.farfield.trefftz.trace_coefficients
¶
trace_coefficients(
lift: float,
*,
side_force: float,
induced_drag: float,
q: float,
s_ref: float,
b_ref: float,
) -> dict[str, float]
Return the coefficients CL_T, CY_T, CDI_T, E_T and AR of a result.
CL_T = L / (q SREF) and likewise, AR = BREF^2 / SREF and
E_T = CL_T^2 / (pi AR CDI_T), NaN where CDI_T is zero or not finite
or a reference value is missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lift
|
float
|
Lift force in N. |
required |
side_force
|
float
|
Side force in N. |
required |
induced_drag
|
float
|
Induced drag force in N. |
required |
q
|
float
|
Free-stream dynamic pressure in Pa. |
required |
s_ref
|
float
|
Reference area in m2 used by the load coefficients. |
required |
b_ref
|
float
|
Reference span in m. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Trefftz coefficients and aspect ratio, with NaN for undefined values. |
pyflightstream.farfield.trefftz.trace_forces
¶
trace_forces(
y: ndarray,
*,
z: ndarray,
gamma: ndarray,
rho: float,
v_inf: float,
sheets: Sequence[int] | ndarray | None = None,
ends: Literal["extended", "station"] = "extended",
mirror: bool = False,
) -> TraceResult
Lift, side force and induced drag of a discrete trace (Trefftz A and B).
The trace is a list of points (y, z) in the Trefftz plane, in wind
axes (m), each carrying the circulation of the strip around it, grouped in
sheets and ordered along each sheet. Strip edges follow
:func:~pyflightstream.farfield.quadrature.strip_edges; a filament leaves
every edge with the circulation shed there; the normalwash at each point is
induced by every sheet's filaments; and
L = rho V sum Gamma dy, Y = -rho V sum Gamma dz,
D_i = -(rho / 2) sum Gamma v_n ds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
ndarray
|
The trace points, m, shape |
required |
z
|
ndarray
|
The trace points, m, shape |
required |
gamma
|
ndarray
|
Circulation of each strip, m^2/s (positive for positive lift on a sheet running toward +y). |
required |
rho
|
float
|
Density (kg/m3) and free-stream speed (m/s). |
required |
v_inf
|
float
|
Density (kg/m3) and free-stream speed (m/s). |
required |
sheets
|
sequence of int
|
Sheet label per point; one sheet when omitted. Each sheet is traced in the order its points are given. |
None
|
ends
|
('extended', 'station')
|
The strip-edge rule beyond the end points; the far field uses
|
"extended"
|
mirror
|
bool
|
Mirror each sheet about the plane |
False
|
Returns:
| Type | Description |
|---|---|
TraceResult
|
The forces of the traced configuration and the per-strip arrays. |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If trace samples, density, symmetry or integration settings are invalid. |
pyflightstream.farfield.trefftz.wake_crossings
¶
wake_crossings(
lines: Sequence[ndarray], *, values: ndarray, x_t: float
) -> WakeTrace
Cut each wake line at its first crossing of the plane x = x_t (FR-452).
Each line is an ordered chain of nodes (n_k, 3) in wind axes (m), from
the trailing edge downstream. A line is cut at its first crossing by linear
interpolation on the straddling segment; the crossings are ordered by the
span position (y) of their lines' starting nodes, not by where they
cross, so a rolled-up sheet keeps its topology.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines
|
sequence of numpy.ndarray
|
The wake lines. |
required |
values
|
ndarray
|
One value per line. |
required |
x_t
|
float
|
The plane's position along the free stream, m. |
required |
Returns:
| Type | Description |
|---|---|
WakeTrace
|
The crossings, or a |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If a wake polyline or its values have an invalid shape. |
pyflightstream.farfield.trefftz.wake_rotor_loads
¶
wake_rotor_loads(
lines: Sequence[ndarray],
*,
values: ndarray,
hub: Sequence[float],
axis: Sequence[float],
omega: float,
v_axial: float,
rho: float,
blades: int,
) -> WakeLoads
Thrust and torque of a rotor from its shed wake lines (Kutta-Joukowski).
The lines are split per blade at the azimuth gaps of their first nodes and
ordered root to tip. The bound circulation of the strip between lines j
and j + 1 is the accumulated shed circulation from the root,
Gamma_j = sum_{k <= j} value_k. It equals the tip sum of Trefftz B,
-sum_{k > j} value_k, when a blade's values close (sum zero); the
solver's rotor lattice does not close at the tip, whose filament carries
part of the circulation, so the root anchor keeps every strip. Line
k is a chain of straight vortex segments of strength -value_k along
the line. At the strip's lifting-line point (the midpoint of the two first
nodes) the induced velocity w of every line (Biot-Savart) gives
dT = rho Gamma (Omega r - w_t) dr and dQ = rho Gamma (V_a + w_a) r dr,
with e_t = e_a x e_r. No scale is applied: the values are read as the
circulation itself.
Where fewer blades carry lines than blades (a periodic sector), the lines
are copied about the axis by the sector angle, so the induced field and the
sums are those of the whole rotor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines
|
sequence of numpy.ndarray
|
The rotor's wake lines, |
required |
values
|
ndarray
|
The shed circulation of each line, m^2/s. |
required |
hub
|
sequence of float
|
Hub origin (m) and rotor axis direction. |
required |
axis
|
sequence of float
|
Hub origin (m) and rotor axis direction. |
required |
omega
|
float
|
Rotor speed about |
required |
v_axial
|
float
|
Free-stream component along |
required |
rho
|
float
|
Density, kg/m^3. |
required |
blades
|
int
|
The rotor's blade count, periodic copies included. |
required |
Returns:
| Type | Description |
|---|---|
WakeLoads
|
Thrust, torque, the blades traced and the lines read. |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If the density is invalid, the rotor sheds no wake line, the shed values do not match the lines, or no blade sheds two lines or more. |