Module fields

Module fields 

Source
Expand description

Cartesian spherical and cylindrical vector waves, field sums and field operators.

field sums a mode expansion at sample points, and operator builds the matrix that maps mode coefficients to those fields; both have analytic gradients.

The waves use Cartesian components built from solid harmonics, so they stay finite on the z axis and at the expansion centre, where polar coordinates are singular.

Upstream: treams.efield and the vector waves treams.special.vsw_* and vcw_*.

Structsยง

Accumulator ๐Ÿ”’
Partial sums of a field pullback over a chunk of consecutive samples. Point gradients are written in place, one per sample.
FieldGradient
Input gradients of a field or operator pullback, under the convention dL = Re sum(conj(g) dx).
FieldResidual
What field saves for its pullback: the wave set, the points and the coefficients. Its size grows with the samples plus the modes, not their product.
GeometryTangent ๐Ÿ”’
A direction in field geometry, shared by field sums and operators. Local wave derivatives are contracted immediately, without constructing a global Jacobian.
OperatorResidual
What operator saves for its pullback: the wave set and the points, without the matrix.
SampleCache ๐Ÿ”’
Work shared by the waves of one sample point: scaled radial functions per (position, wavenumber, order), and the last spherical parts or cylindrical components, which the adjacent polarization of the same mode reuses. Every entry is keyed by all of its inputs, so any mode order is evaluated exactly as without the cache. N is the derivative level (VALUES, SPATIAL_AND_K or WITH_AXIAL).
VectorWave
A spherical or cylindrical electric vector wave with its analytic derivatives with respect to the evaluation point and the medium wavenumber k.
WaveSet ๐Ÿ”’
Evaluates the waves of a multipole basis at any point, for one pair of medium wavenumbers, polarization convention and radial kind.

Constantsยง

SPATIAL_AND_K ๐Ÿ”’
Derivative level: values, point derivatives (jet variables 0 to 2) and the wavenumber derivative (variable 3).
VALUES ๐Ÿ”’
Derivative level of a wave evaluation: values only. Each level is the jet size of the cylindrical path; the spherical path evaluates derivatives above this level.
WITH_AXIAL ๐Ÿ”’
Derivative level: SPATIAL_AND_K plus the axial-wavenumber derivative of cylindrical waves (variable 4).

Functionsยง

combine ๐Ÿ”’
The wave normalization (weight_n N + weight_m M) of the value and requested derivatives. The part m from spherical_parts is -M, so it enters with a minus sign.
cross ๐Ÿ”’
cylindrical_components ๐Ÿ”’
The M and N components of a cylindrical wave, which do not depend on its polarization. Jet variables are the position (0..3), k (3) and kz (4).
cylindrical_wave
Cartesian cylindrical vector wave and its point and wavenumber derivatives. Adjacent scalar harmonics remove all polar-coordinate divisions at the axis.
field
Evaluate weighted electric fields in parallel over samples: one Cartesian field vector per point.
normalization ๐Ÿ”’
Normalization i sqrt((2l + 1) / (4 pi l (l + 1))) sqrt((l - m)! / (l + m)!) of the spherical wave (l, m); it depends on neither point nor k.
operator
Matrix mapping multipole amplitudes to Cartesian samples. Rows pack (sample, component). The residual keeps the basis, wavenumbers and points, without the output or any derivative matrix.
pack_cylindrical ๐Ÿ”’
The value, point derivatives (jet variables 0 to 2) and wavenumber derivative (variable 3) of a cylindrical wave; jets without derivatives give zeros.
read_sampled_state ๐Ÿ”’
Check the complete byte size from the allocation-free header before decoding any arrays. Both residual layouts share the same sampled-wave prefix.
sampled_waves ๐Ÿ”’
The waves of basis and the sample points, checked in this order: basis, points, wavenumbers.
scaled_radial ๐Ÿ”’
spherical_arguments ๐Ÿ”’
A common length unit bounds solid-harmonic coordinates by one and bounds the wavenumber in the regular origin series. Hold this scale fixed when taking derivatives: the wave is unchanged by any common change of length units.
spherical_parts ๐Ÿ”’
The unnormalized parts [n, m] of a spherical wave of degree l, which every polarization combines with its own weights.
spherical_wave
Evaluate a vector spherical wave in treams normalization. Parity polarization 0 is M, 1 is N; helicity is (N + (2pol-1) M)/sqrt(2).
spherical_wave_impl ๐Ÿ”’
spherical_wave with the point and wavenumber derivatives only if DERIVATIVES.
validate_coefficients ๐Ÿ”’
validate_points ๐Ÿ”’
weights ๐Ÿ”’
Weights [weight_n, weight_m] of the N and M parts of polarization pol: parity polarization 1 is N and 0 is M; helicity polarization pol is (N + (2 pol - 1) M) / sqrt(2), as in treams.special.vsw_A.
write_sampled_state ๐Ÿ”’

Type Aliasesยง

ComponentsKey ๐Ÿ”’
Position index, wavenumber index, order and axial-wavenumber bits of cylindrical components.
PartsKey ๐Ÿ”’
Position index, wavenumber index, degree and order of spherical parts.