treams_core/pw/mod.rs
1//! Plane waves: polarization vectors, fields, translation phases, cyclic permutations of
2//! the Cartesian axes, and the expansion of plane waves in regular spherical and
3//! cylindrical waves.
4//!
5//! Upstream: `treams.pw`, `treams.misc.wave_vec_z`, and `treams.special.vpw_M`, `vpw_N`
6//! and `vpw_A`.
7//!
8//! | File | Contents | Upstream |
9//! |---|---|---|
10//! | `polarization.rs` | [`polarization()`], [`field_value`] and [`wave_vector_z`]; the private `Direction` jets of a wavevector | `special.vpw_*`, `misc.wave_vec_z` |
11//! | `field.rs` | [`translate`], [`phases`] and [`field()`] | `pw.translate`, `special.vpw_*` |
12//! | `permute.rs` | [`permute_xyz`] and [`permutation`] | `pw.permute_xyz` |
13//! | `expand.rs` | [`to_sw`], [`to_cw`] and [`expansion`] | `pw.to_sw`, `pw.to_cw`, the `Expand` operator from a plane-wave basis |
14//! | `saved.rs` | Fixed numerical layouts for derivative state | treams-rs extension |
15//!
16//! Conventions:
17//!
18//! - A plane wave is `p exp(i k·r)` with a complex wavevector `k = (kx, ky, kz)`, which
19//! may be evanescent. Its wavenumber is the algebraic norm `sqrt(kx^2 + ky^2 + kz^2)`,
20//! not the Hermitian length.
21//! - `pol` is the polarization index, 0 or 1: with `helicity` true, 1 is positive and 0
22//! negative helicity; with `helicity` false, 1 is the N and 0 the M polarization, as
23//! for [`crate::sw`].
24//! - Gradients with respect to a complex wavevector use the pairing
25//! `dL = Re Σ conj(g)·dk`, so a real input takes the real part of its gradient.
26//!
27//! The physical and adjoint identities of plane waves are tested in
28//! `properties/plane.rs`, which compares the expansions with the single-wave references
29//! of `expand.rs`.
30
31mod expand;
32mod field;
33mod permute;
34mod polarization;
35mod saved;
36
37pub(crate) use expand::cylindrical_mode_matches;
38pub use expand::{ExpansionGradient, ExpansionResidual, expansion, to_cw, to_sw};
39#[cfg(test)]
40pub(crate) use expand::{reference_cylindrical_expansion, reference_spherical_expansion};
41pub use field::{
42 FieldGradient, FieldResidual, PhasesGradient, PhasesResidual, field, phases, translate,
43};
44pub use permute::{PermutationResidual, permutation, permute_xyz};
45pub use polarization::{field_value, polarization, wave_vector_z};
46pub(crate) use polarization::{polarization_from_inputs, polarization_jet};