Skip to content

pyflightstream.farfield.balances (stable)

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

The conservation balances of a survey lattice (FR-38).

Pipeline role: the mass, momentum, swirl and crossflow-kinetic-energy balances of the far-field extraction (design note DLV-006 Sec. 3), on the samples of a :class:~pyflightstream.farfield.fields.LatticeFields. Every integral goes through :func:~pyflightstream.farfield.quadrature.plane_integral; the crossflow kinetic energy has one integrand, :func:crossflow_integrand, which Trefftz C calls too (FR-1003).

Solver asymmetry, by design (design note DLV-006 Sec. 2.3, not a dated report): the FlightStream side is taken to run the purely kinematic, reversible balances with the constant free-stream density; any cross-solver delta in a reversible channel is then attributed to numerics, an assumption no comparison report measures.

Units: the ledgers are in the units of the field samples times tip_radius squared (forces and moments gain one further factor), with no unit conversion in the balances. They are SI only when tip_radius is given in metres and the fields are in SI; a radius held in the simulation's length unit must be converted by the caller first, which is the same unit discipline as the length unit stated when probe points are imported (:func:~pyflightstream.probes.layouts.emit_probe_import).

Advanced

pyflightstream.farfield.balances.CrossflowEnergy dataclass

CrossflowEnergy(
    total: ndarray, swirl: ndarray, induced: ndarray
)

The crossflow kinetic-energy flux per station, split by channel (W).

pyflightstream.farfield.balances.InPlaneMoment dataclass

InPlaneMoment(
    loading_term: float,
    moment_arm_term: float,
    total: float,
)

An in-plane moment split into its loading and moment-arm terms (N m).

pyflightstream.farfield.balances.MassClosure dataclass

MassClosure(
    mdot: ndarray,
    relative_spread: float,
    absolute_spread: float = float("nan"),
    status: str = "ok",
)

Gate G1: the mass flow per station and its relative spread.

Attributes:

Name Type Description
mdot ndarray

Mass flow through each annular plane, kg/s.

relative_spread float

max |mdot - mean| / |mean| over the stations; NaN where any station is incomplete or where the mean is zero (see status).

absolute_spread float

max |mdot - mean| in kg/s; NaN where any station is incomplete.

status str

"ok" when relative_spread is defined; "incomplete" where a station has a missing sample; "zero-mean-zero-spread" for a zero mean with every station equal (nothing flows anywhere); and "zero-mean-nonzero-spread" for a zero mean with unequal stations, where only absolute_spread carries the answer.

pyflightstream.farfield.balances.TransverseForce dataclass

TransverseForce(
    plane_term: float, lateral_term: float, total: float
)

A transverse force with its lateral term reported separately (N).

pyflightstream.farfield.balances.axial_flux

axial_flux(
    fields: LatticeFields, rho: float, v_inf: float
) -> np.ndarray

Axial momentum-plus-pressure flux per station (N).

integral(rho u (u - v_inf) + p_prime) dA with the axial perturbation u' = u - v_inf (DLV-006 Sec. 3.3).

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples in the shaft-aligned axes of :mod:pyflightstream.probes.lattice, with the units of :class:~pyflightstream.farfield.fields.LatticeFields.

required
rho float

Density in kg/m3.

required
v_inf float

Free-stream speed in m/s.

required

Returns:

Type Description
ndarray

Axial momentum-plus-pressure flux in N for each station.

pyflightstream.farfield.balances.axial_force

axial_force(
    fields: LatticeFields,
    rho: float,
    v_inf: float,
    *,
    inlet: float,
    outlet: float,
) -> float

Axial force from the control volume between two stations (N).

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples.

required
rho float

Density (kg/m3); the free-stream value on the FlightStream side.

required
v_inf float

Free-stream axial velocity (m/s).

required
inlet float

Station coordinates x/R of the inlet and outlet planes, matched exactly; the lateral cylinder is assumed at free stream, which the lateral ring probes must verify (DLV-006 Sec. 2.1).

required
outlet float

Station coordinates x/R of the inlet and outlet planes, matched exactly; the lateral cylinder is assumed at free stream, which the lateral ring probes must verify (DLV-006 Sec. 2.1).

required

Returns:

Type Description
float

F_X = outlet flux minus inlet flux, +x downstream, so a propulsive disk yields positive axial force.

pyflightstream.farfield.balances.crossflow_integrand

crossflow_integrand(
    rho: float,
    *,
    first: ndarray,
    second: ndarray,
    advecting: ndarray | float,
) -> np.ndarray

Return the one crossflow kinetic-energy integrand, (rho / 2) (a^2 + b^2) u_adv.

The balance passes the cylindrical components v_r, v_theta and the sampled axial velocity u; Trefftz C passes the Cartesian crossflow v, w and the free-stream speed V (FR-1003, FR-1030). The integrand is transverse components only: it contains no axial-deficit term by construction, a hard rule of the design note.

Parameters:

Name Type Description Default
rho float

Density in kg/m3.

required
first ndarray

First transverse velocity component, in m/s.

required
second ndarray

Second transverse velocity component, in m/s.

required
advecting ndarray | float

Advecting velocity in m/s, scalar or sampled with the components.

required

Returns:

Type Description
ndarray

Crossflow kinetic-energy flux density at each sample.

pyflightstream.farfield.balances.crossflow_kinetic_energy

crossflow_kinetic_energy(
    fields: LatticeFields, rho: float
) -> CrossflowEnergy

Crossflow kinetic-energy flux split into swirl and induced content (W).

E = 0.5 integral(rho (v_r^2 + v_theta^2) u dA) per station, with the axisymmetric (order-0) v_theta part reported as the stator-recoverable swirl channel and the remainder as the non-axisymmetric induced channel (DLV-006 Sec. 3.5).

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples in the shaft-aligned axes of :mod:pyflightstream.probes.lattice, with the units of :class:~pyflightstream.farfield.fields.LatticeFields.

required
rho float

Density in kg/m3.

required

Returns:

Type Description
CrossflowEnergy

Total, swirl and induced energy flux in W for each station.

pyflightstream.farfield.balances.in_plane_moment

in_plane_moment(
    fields: LatticeFields,
    rho: float,
    v_inf: float,
    *,
    inlet: float,
    outlet: float,
    axis: str = "y",
    method: str = "quadrature",
) -> InPlaneMoment

In-plane moment about an axis through the disk center (N m).

For axis="y" (DLV-006 Sec. 3.4): M_Y = integral(z g dA) - x_p integral(rho u w dA) evaluated at the outlet minus the same terms at the inlet, with g = rho u u' + p_prime and z = r cos(psi). The two contributions stay separate: the loading term is the order-1 cosine harmonic of the axial flux (the 1P loading asymmetry) and the moment-arm term carries the transverse flux. Both axes follow the right-handed cross product: axis="z" gives M_Z = x_p integral(rho u v dA) - integral(y g dA), with y = r sin(psi).

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples.

required
rho float

Density (kg/m3) and free-stream axial velocity (m/s).

required
v_inf float

Density (kg/m3) and free-stream axial velocity (m/s).

required
inlet float

Station coordinates x/R of the bounding planes; the moment arm of each plane is its own station position.

required
outlet float

Station coordinates x/R of the bounding planes; the moment arm of each plane is its own station position.

required
axis str

"y" or "z", the moment axis through the disk center.

'y'
method str

"quadrature" weights the axial flux by the sampled lever arm directly; "harmonic" rebuilds the loading term from the order-1 azimuthal coefficient. Two independent code paths.

'quadrature'

Returns:

Type Description
InPlaneMoment

Loading, moment-arm and total moment terms in N m. The total is plane-only: unlike :func:transverse_force it has no lateral-cylinder term, so it is valid where the lateral flux vanishes (zero incidence, or a lateral cylinder at free stream).

Raises:

Type Description
FarfieldInputError

If axis or integration method is unsupported.

pyflightstream.farfield.balances.lateral_flux

lateral_flux(
    fields: LatticeFields,
    *,
    rho: float,
    inlet: float,
    outlet: float,
    component: str = "w",
) -> float

Momentum-plus-pressure flux through the lateral cylinder between two stations (N).

D_lat = integral over the cylinder of (rho v_r c + p' n_c) dA with c the transverse component (w for F_Z, v for F_Y) and n_c its share of the outward normal (cos psi for w, sin psi for v): the azimuthal rectangle rule around each lateral ring and the trapezoid rule along x over the lateral stations from inlet to outlet. NaN where a ring sample is missing. Stations match within 1e-12 as the annular planes do. The far-field family definition states the balance from the inlet station downstream and no convention for a reversed pair, so an outlet upstream of inlet is refused rather than given a sign; equal stations bound no cylinder and give 0.0.

Raises:

Type Description
FarfieldInputError

If the lattice has no lateral cylinder, its samples carry no v_r, p_prime or component, inlet or outlet is not a lateral station, or outlet lies upstream of inlet.

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples in the shaft-aligned axes of :mod:pyflightstream.probes.lattice, with the units of :class:~pyflightstream.farfield.fields.LatticeFields.

required
rho float

Density in kg/m3.

required
inlet float

Inlet station coordinate x/R.

required
outlet float

Outlet station coordinate x/R.

required
component str

Transverse velocity field name: v for +y or w for +z.

'w'

Returns:

Type Description
float

Lateral-cylinder momentum-plus-pressure flux in N.

pyflightstream.farfield.balances.mass_closure

mass_closure(
    fields: LatticeFields, rho: float
) -> MassClosure

Gate G1: station-to-station mass-flow closure diagnostic.

Returns:

Type Description
MassClosure

mdot per station (kg/s) and the scalar relative_spread (max deviation from the station mean over the mean); reported per run, judged against the case tolerance elsewhere.

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples in the shaft-aligned axes of :mod:pyflightstream.probes.lattice, with the units of :class:~pyflightstream.farfield.fields.LatticeFields.

required
rho float

Density in kg/m3.

required

pyflightstream.farfield.balances.mass_flux

mass_flux(fields: LatticeFields, rho: float) -> np.ndarray

Mass flow through each annular plane, integral(rho u dA) in kg/s.

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples in the shaft-aligned axes of :mod:pyflightstream.probes.lattice, with the units of :class:~pyflightstream.farfield.fields.LatticeFields.

required
rho float

Density in kg/m3.

required

Returns:

Type Description
ndarray

Mass flow in kg/s for each station.

pyflightstream.farfield.balances.shaft_torque

shaft_torque(
    fields: LatticeFields, rho: float
) -> np.ndarray

Swirl flux integral(rho (r v_theta) u dA) per station (N m).

The order-0 v_theta content weighted by the dimensional moment arm r (DLV-006 Sec. 3.4); the sign follows the v_theta convention of :func:~pyflightstream.farfield.fields.cylindrical_components.

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples in the shaft-aligned axes of :mod:pyflightstream.probes.lattice, with the units of :class:~pyflightstream.farfield.fields.LatticeFields.

required
rho float

Density in kg/m3.

required

Returns:

Type Description
ndarray

Shaft torque flux in N m for each station.

pyflightstream.farfield.balances.spurious_diagnostic

spurious_diagnostic(
    near_field: float,
    far_field: float,
    *,
    rho_inf: float,
    v_inf: float,
    s_ref: float,
) -> float

Inviscid near-field minus far-field load, in counts (gate G4).

The residual between the integrated inviscid near-field load and the far-field balance is treated as numerical, not physical (design note DLV-006 Sec. 3.5; no dated report measures it); reported in counts so runs are comparable across cases and solvers.

Parameters:

Name Type Description Default
near_field float

Integrated inviscid near-field force in N (total minus viscous projection).

required
far_field float

Far-field force balance in N.

required
rho_inf float

Free-stream density in kg/m3.

required
v_inf float

Free-stream speed in m/s.

required
s_ref float

Reference area in m2 used by the load coefficients.

required

Raises:

Type Description
TypeError

If s_ref is omitted: the reference area in m2 has no safe default.

Returns:

Type Description
float

Near-field minus far-field force expressed in drag counts.

pyflightstream.farfield.balances.to_counts

to_counts(
    delta: float,
    *,
    rho_inf: float,
    v_inf: float,
    s_ref: float,
) -> float

Express a force delta in drag counts.

One count is 1e-4 of the dynamic-pressure force scale: counts = 2 delta / (rho_inf v_inf^2 s_ref) * 1e4.

Parameters:

Name Type Description Default
delta float

Force difference (N).

required
rho_inf float

Free-stream density (kg/m3) and speed (m/s).

required
v_inf float

Free-stream density (kg/m3) and speed (m/s).

required
s_ref float

Explicit reference area (m2), the same area used by the load coefficients.

required

Raises:

Type Description
TypeError

If s_ref is omitted: the reference area in m2 has no safe default.

FarfieldInputError

If density, speed or area is not finite and strictly positive. Dynamic-pressure counts are undefined in hover; retain dimensional loads there.

Returns:

Type Description
float

Force delta expressed in drag counts.

pyflightstream.farfield.balances.transverse_flux

transverse_flux(
    fields: LatticeFields,
    rho: float,
    *,
    component: str = "w",
    method: str = "quadrature",
) -> np.ndarray

Transverse momentum flux integral(rho u c dA) per station (N).

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples.

required
rho float

Density (kg/m3).

required
component str

Transverse velocity component: "w" (+z) for the F_Z / M_Y balance, "v" (+y) for F_Y / M_Z.

'w'
method str

"quadrature" is the direct product integral; "harmonic" evaluates the same number from the azimuthal spectra of u and the component (Parseval), the second, independent code path DLV-006 Sec. 3.3 demands.

'quadrature'

Returns:

Type Description
ndarray

Transverse momentum flux in N for each station.

Raises:

Type Description
FarfieldInputError

If the integration method is unsupported.

pyflightstream.farfield.balances.transverse_force

transverse_force(
    fields: LatticeFields,
    rho: float,
    *,
    inlet: float,
    outlet: float,
    component: str = "w",
    lateral_flux: float = 0.0,
) -> TransverseForce

Transverse force with the lateral term reported separately (N).

F_Z = integral_out(rho u w dA) - integral_in(rho u w dA) + Delta_lat (DLV-006 Sec. 3.3). The lateral-cylinder momentum and pressure flux is never folded silently into the plane term: it is a separate value of the result, zero only when zero incidence makes it so.

Parameters:

Name Type Description Default
fields LatticeFields

Survey samples.

required
rho float

Density (kg/m3).

required
inlet float

Station coordinates x/R of the bounding planes.

required
outlet float

Station coordinates x/R of the bounding planes.

required
component str

"w" for F_Z, "v" for F_Y.

'w'
lateral_flux float

Lateral-surface momentum-plus-pressure flux (N), from :func:lateral_flux; the default 0.0 is legitimate only at zero incidence, where symmetry nulls it.

0.0

Returns:

Type Description
TransverseForce

Plane, lateral and total force terms in N.