Module channels

Module channels 

Source
Expand description

Plane-wave channels of periodic arrays: how the multipoles of a 2D array of spheres or a 1D array of cylinders couple to the diffracted plane waves on either side.

Upstream: treams.sw.periodic_to_pw, treams.cw.periodic_to_pw, and the plane-wave expansions inside treams.SMatrices.from_array.

ItemContentsUpstream
sw_periodic_to_pwone plane-wave amplitude radiated by a spherical multipole of a 2D arraysw.periodic_to_pw
cw_periodic_to_pwone plane-wave amplitude radiated by a cylindrical mode of a 1D arraycw.periodic_to_pw
spherical_channelsthe incident and radiated coefficients of a whole spherical basis, with a pullbackSMatrices.from_array on a TMatrix
cylindrical_channelsthe same for a cylindrical basisSMatrices.from_array on a TMatrixC

Each channel matrix has one column per plane mode and 4 d rows for d multipoles: row side * d + i holds the regular expansion of the incident plane wave (the pw.to_sw or pw.to_cw coefficient, with the phase of the multipole position), and row (2 + side) * d + i the amplitude of the plane wave that multipole i radiates. On side 0 the plane wave travels up, toward +z for spheres and +y for cylinders; on side 1 it travels down.

Both families share ChannelGradient, input checks and matrix assembly. Each evaluates its own channel type and jet size; pullbacks share an ordered traversal while keeping the family-specific transverse-wavevector rules explicit.

The inline tests module checks the error paths; the reciprocity, scaling and adjoint identities of the channels are in properties/plane.rs.

Structsยง

ChannelGradient
Cotangents of positions, medium wavenumbers, transverse plane vectors and the unit-cell measure.
CylindricalChannel ๐Ÿ”’
One diffraction channel of a 1D array of cylinders along x in one direction: the plane wave (kx, ยฑky, kz), as jets in the slots above. The axial kz is a fixed label.
CylindricalChannelsResidual
What cylindrical_channels saves for its pullback: its inputs alone.
SphericalChannel ๐Ÿ”’
One diffraction channel of a 2D array of spheres in one direction: the plane wave (qx, qy, ยฑkz) and the angles at which the multipole coefficients are evaluated, as jets in the slots above.
SphericalChannelsResidual
What spherical_channels saves for its pullback: its inputs alone.

Constantsยง

CYLINDRICAL_MEASURE ๐Ÿ”’
Slot of the period of a 1D array.
CYLINDRICAL_SLOTS ๐Ÿ”’
Jet size of a cylindrical channel.
K ๐Ÿ”’
Slot of the medium wavenumber k.
POSITION ๐Ÿ”’
First of the three slots of the multipole position.
Q ๐Ÿ”’
First transverse-wavevector slot: (qx, qy) for spheres, kx alone for cylinders.
SPHERICAL_MEASURE ๐Ÿ”’
Slot of the unit-cell area of a 2D array.
SPHERICAL_SLOTS ๐Ÿ”’
Jet size of a spherical channel.

Functionsยง

channel_direction ๐Ÿ”’
Both families use the same input shapes and slot layout, except that cylinders have only the kx transverse slot. Contract each small local jet directly; no global Jacobian or output-sized cotangent seeds are needed.
channel_matrix ๐Ÿ”’
Assemble incident/radiated pairs, constructing each channel once per side. Each worker owns complete plane-mode columns without buffering intermediate values.
channel_pullback ๐Ÿ”’
Reverse the shared matrix assembly in fixed column, side and multipole order. Each column writes its own transverse gradient; only the shared gradients enter the ordered reduction. Construct channels before skipping zero-weight entries, preserving validation and avoiding evaluation of unused, possibly overflowing jets.
channel_state_size ๐Ÿ”’
The shared numerical channel inputs, with one byte for the familyโ€™s flags.
cw_periodic_to_pw
Amplitude of the plane wave vector = (kx, ky, kz) that the cylindrical mode mode of a 1D array along x with lattice period radiates.
cylindrical_channels
Incident and radiated channels of a cylindrical basis in a 1D array along x with lattice period.
read_channel_state ๐Ÿ”’
spherical_channels
Incident and radiated channels of a spherical basis in a 2D array with unit-cell area.
sw_periodic_to_pw
Amplitude of the plane wave vector that the spherical multipole mode of a 2D array with unit-cell area radiates. The sign of kz (of its imaginary part for a complex kz) picks the side.
validate_channel_tangent ๐Ÿ”’
validate_channels ๐Ÿ”’
Check the inputs both channel families share; measure is the area or the period.
write_channel_state ๐Ÿ”’

Type Aliasesยง

ChannelState ๐Ÿ”’