Skip to content

Multimode (few-mode) coupled GNLSE

Split-step Fourier solver for N coupled modal channels: per-mode dispersion and group delay, LP/isotropic SPM-XPM coefficients, opt-in pump-driven inter-modal FWM with angular-momentum gating. Docstrings are the source of truth, rendered with mkdocstrings (numpydoc style). See multimode GNLSE for the physics and references.

photonics_helper.multimode_gnlse

Multimode (few-mode fiber) coupled GNLSE.

Split-step Fourier solver for N simultaneously-guided spatial modes: structured.py gives static LG/OAM portraits; this module propagates their modal envelopes nonlinearly.

Model (all channels coupled through one shared scalar γ):

  • linear: per-mode Taylor dispersion β_k^(m), shared scalar loss e^{−α dz/2}, and modal group delay (walk-off in the retarded frame of channel 0);
  • nonlinear SPM/XPM with a selectable coefficient set: "co_polarized" — co-polarized scalar spatial modes: SPM 1, XPM 2 (Mumtaz Eq. 6 scalar limit; Agrawal co-polarized Kerr limit); "lp_degenerate" — the two-polarization degenerate LP pair (the vector-GNLSE strip-down): SPM 1, XPM 2/3; or "isotropic" — all-ones (Manakov-like, for randomly-coupled bases). The two-polarization model is not the XPM of two co-polarized spatial modes; coef_model="co_polarized" is the spatial-mode default when no overlap tensor is supplied;
  • opt-in inter-modal four-wave mixing iγ·f·A_n A_p A_q* (RK4IP frequency-domain substep, Strang-split around the diagonal phase), restricted by angular momentum conservation ℓ_m = ℓ_n + ℓ_p − ℓ_q when OAM indices are supplied;
  • per-channel (intramodal) Raman iγ·A_m·[(1−f_R)|A_m|² + f_R·(h_R ⊗ |A_m|²)] with the scalar-engine convolution (step8), plus an opt-in intermodal delayed-coupling tensor raman_tensors (T_R^(m,n,p,q), Raman-weighted) evaluated as an FFT memory kernel on the RK4 path — Wright JSTQE Eq. (1) Raman term with S^R = S^K (ph_pdfs/pages_wright/page-03.png, image-read); step7 S⁽²⁾ tensors are admissible as T_R (hand-supplied fallback documented);
  • optional pump depletion: the full Manley–Rowe-consistent exchange (creation arms +iγ f A_n²A_q* / +iγ f A_n²A_m* and the back-conversion pump arm +2iγ f* A_m A_q A_n*), which conserves Σ|A|² to RK4 round-off (Mumtaz Eq. 6 three-recoupling structure);
  • optional mode-specific nonlinear overlap weights (Mumtaz Eq. 8 / Poletti & Horak Eq. 7): xpm_weights (N×N, SPM/XPM slot) and fwm_weights (N×N×N×N, FWM slot) override the uniform coef_model factors mode-pair-wise.
  • per-mode full-β(ω) spectral dispersion (full_beta — scalar TaperedGNLSESolver precedent; decision 1.1: full operator, not a Taylor-order bump) and full-S⁽²⁾ FWM contraction (fwm_full_tensor=True; Wright Eq. 1 tensor term, Poletti Eq. 18/19 + oam_l selection preserved; diagonal arms excluded — no double count).

The degenerate two-channel strip-down of this engine is the variety implemented in :mod:photonics_helper.vector_gnlse (the two polarization axes of one mode); the multimode engine generalizes the same machinery to arbitrary mode counts.

References

G. P. Agrawal, Nonlinear Fiber Optics, 5th ed. §6.4 (scalar XPM 2/3, FWM); M. Poletti & P. Horak, "Description of ultrashort pulse propagation in multimode optical fibers," J. Opt. Soc. Am. B 25, 1645 (2008), doi:10.1364/JOSAB.25.001645 (vector modal equations, overlap tensors, photon-number conservation Eq. 15); S. Mumtaz, R.-J. Essiambre & G. P. Agrawal, "Nonlinear propagation in multimode and multicore fibers: generalization of the Manakov equations," J. Lightwave Technol. 31, 398 (2013), doi:10.1109/JLT.2012.2235414 (Eq. 6/8: f_lmnp overlap tensor, γ/3 coherent mixing + 2γ/3 SPM/XPM structure; arXiv:1207.6645); L. G. Wright et al., Nat. Commun. 6, 6682 (2015) (resonant inter-modal FWM).

CoeffModel module-attribute

CoeffModel = Literal['lp_degenerate', 'isotropic', 'co_polarized']

CavityResult

CavityResult(fields: list[NDArray], iterations: int, converged: bool, history: list[float], beat_period_hz: float)

Result of a cavity iteration.

Attributes:

Name Type Description
fields

Converged complex fields, one per channel.

iterations

Number of cavity iterations performed.

converged

Whether the iteration converged.

history

Relative change per iteration.

beat_period_hz

Longitudinal mode beat period of the cavity in Hz.

fields instance-attribute

fields = fields

iterations instance-attribute

iterations = iterations

converged instance-attribute

converged = converged

history instance-attribute

history = history

beat_period_hz instance-attribute

beat_period_hz = beat_period_hz

MultimodeSplitStepEngine

MultimodeSplitStepEngine(waves, fiber: FiberProfile, betas, *, betas_unit: BetasUnit = 'ps^k/m', gamma_reference: float | None = None, group_delays: list[float] | None = None, phase_offsets: list[float] | None = None, coef_model: CoeffModel = 'lp_degenerate', include_fwm: bool = False, oam_l: list[int] | None = None, xpm_weights=None, fwm_weights=None, coupling_tensor=None, fwm_coupling_tensor=None, channel_alpha=None, fwm_pump_depletion: bool = False, include_raman: bool = False, raman_response=None, raman_tensors=None, include_shock: bool = False, tau_shock: float | None = None, conserving_shock: bool = False, include_tpa: bool = False, include_free_carriers: bool = False, beta_tpa=None, sigma_fca=None, sigma_tpa=None, full_beta=None, fwm_full_tensor: bool = False, step_size: Length | None = None, cavity_reflectivity_input: list[float] | None = None, cavity_reflectivity_output: list[float] | None = None, cavity_round_trip_length: float | None = None, cavity_group_index: float = 1.466, rayleigh_backscatter: float | None = None)

Split-step engine for N coupled modal channels (few-mode GNLSE).

Parameters:

Name Type Description Default
waves sequence of Wave

One input envelope per guided mode. All channels must share one :class:TemporalGrid (each wave's grid is the same object) and equal-length fields; each may carry its own central wavelength but the engine treats them all as co-polarized modal envelopes.

required
fiber FiberProfile

Shared scalar parameters (n2, alpha, A_eff, confinement_factor, length). One scalar γ is applied in every channel; mode-specific area/overlap corrections are to be handled at the caller by scaling fiber.A_eff.

required
betas array_like or sequence of array_like

Taylor coefficients [β₂, β₃, …] per mode (ps^k/m with Ω in rad/ps), or one shared array for every channel.

required
betas_unit BetasUnit

Unit of the dispersion coefficients. Default "ps^k/m".

'ps^k/m'
group_delays list[float] | None

Modal group delay β₁⁽ᵐ⁾ − β₁⁽⁰⁾ (SI, s/m) in the retarded frame of channel 0. None (default) = co-riding modes; forced group_delays[0] == 0.

None
phase_offsets sequence of float

Modal propagation-constant offset Δβ₀⁽ᵐ⁾ = β₀⁽ᵐ⁾ − β₀⁽⁰⁾ (rad/m) in the retarded frame of channel 0. Frequency-independent phase accumulated as e^{i Δβ₀ z} in each channel's linear step; this is the absolute modal phase the retarded-frame Taylor expansion omits, and it is what provides discrete intermodal quasi-phase matching (e.g. the GRIN geometric-parametric- instability ladder, where Δβ₀⁽ᵖ⁾ = −2πp/ξ from self-imaging).

None
gamma_reference float

Absolute nonlinear scale γ₀ (W⁻¹m⁻¹) used by every tensor-normalised term, overriding _fiber_gamma(fiber, ω₀). Needed when fwm_weights / raman_tensors were divided by S_0000 (as :func:photonics_helper.mode_analysis .overlap_tensors_from_fields does): their absolute coefficient is γ₀·weight, independent of the A_eff placed on fiber. With coupling_tensor/xpm_weights from the same deck it also makes the default SPM/XPM path per-mode correct (γ₀·xpm_ii = γ_i). Omitted (default) keeps the fiber-derived scalar γ, byte-identically.

None
coef_model ('lp_degenerate', 'isotropic', 'co_polarized')

Nonlinear coefficients:

  • "lp_degenerate" (default) — the two-polarization degenerate LP pair (the vector-GNLSE strip-down): SPM 1, XPM 2/3 (the orthogonal-linear-polarization value), inter-modal FWM 2/3 (the equal mix of the co-polarized 1 and orthogonal 1/3 values). Not the co-polarized spatial-mode model — for two co-polarized spatial modes the Kerr XPM limit is 2, not 2/3.
  • "isotropic" — all-ones coefficients (Manakov-like spatially averaged modes; use for a non-degenerate basis).
  • "co_polarized" — co-polarized scalar spatial modes (Mumtaz Eq. 6 scalar limit / Agrawal co-polarized Kerr limit): SPM 1, XPM 2, inter-modal FWM 1. Use this for a few-mode LP basis that shares one linear polarization, or for a mode-analysis deck with xpm_model="co_polarized".
"lp_degenerate"
include_fwm bool

Opt-in inter-modal four-wave mixing. Default False — the standard averaged few-mode model keeps only SPM/XPM (the heterodyne FWM beats wash out over the group-delay walk-off in real fiber).

False
oam_l sequence of int

OAM azimuthal order ℓ of each channel. When supplied (and FWM is on) FWM triples are restricted to ℓ_m = ℓ_n + ℓ_p − ℓ_q (transverse-photon-momentum balance for the A_n A_p A_q* term feeding channel m); otherwise every triplet is allowed.

This gate is the Poletti & Horak Eq. (18) type-2 spatial selection rule, not merely an approximation of it: their Q^(2) term in Eq. (6) is Q^(2)_plmn A_l* A_m A_n feeding channel p with l the conjugated field, so their balance m_m + m_n = m_p + m_l is the printed rule −m_p − m_l + m_m + m_n = 0; under the index map (p, l, m, n) = (m, q, n, p) it becomes ℓ_m + ℓ_q = ℓ_n + ℓ_p, which is this gate (verified element-wise in reproductions/poletti_2008_multimode).

Two caveats:

  • The gate carries the spatial rule only. The polarisation rule Eq. (19) and the exact magnitudes are in the overlap tensor — pass them via fwm_weights / xpm_weights when a real fibre's mode functions are known.
  • Uniform entries make the gate inert: if all labels are equal (e.g. [0, 0, 0], the common "these channels have no distinguished azimuthal order" case) the condition holds for every triplet and the gate is exactly the isotropic fallback of oam_l=None. It is a selection filter, not a cost control — it never reduces the engine's work, only the number of permitted exchanges.
None
xpm_weights array_like

Mode-specific SPM/XPM overlap weights (Mumtaz Eq. 8 style), an N×N real array. w[i, j] multiplies |A_j|² entering channel i (including i == j, i.e. the SPM slot). When given, this overrides the uniform coef_model factors.

None
fwm_weights array_like

Mode-specific FWM overlap weights, an N×N×N×N array (real, or complex when the full-vectorial S⁽²⁾ overlap carries an imaginary part — never silently clipped); w[m, n, p, q] weights the → m transition pumped by (n, p) consuming q. When given, it multiplies every allowed triple (OAM gating, if any, still applies first).

None
coupling_tensor array_like

Absolute SPM/XPM coupling coefficients, an N×N complex array in W⁻¹ m⁻¹; C[i, j] is the coefficient multiplying |A_j|² in the rate of channel i. Supplied when given in preference to coef_model/xpm_weights, which carry dimensionless multipliers of a single scalar γ.

Two properties make this the right slot for a Raman cascade rather than a widened xpm_weights:

  • An imaginary antisymmetric off-diagonal pair, C[i, j] = −conj(C[j, i]), is a photon-number-conserving energy exchange — channel i gains what j loses — which is the structure a Raman Stokes cascade needs and which a real symmetric overlap weight cannot express.
  • The coefficients are absolute, so pump and Stokes orders carry their own nonlinear scales without the engine holding a per-order γ.

The instantaneous arm is integrated exactly while C is real (the closed-form phase rotation) and by RK4 substeps otherwise, so a real tensor reproduces the default path exactly.

None
fwm_coupling_tensor array_like

Absolute FWM coefficients, an N×N×N×N complex array in W⁻¹ m⁻¹; C[m, n, p, q] is the coefficient of the → m transition pumped by (n, p) consuming q. Supplied when given in preference to fwm_weights (OAM gating still applies first). Requires include_fwm=True.

None
channel_alpha array_like

Per-channel loss in 1/m, length N, overriding the shared fiber.alpha. Raman cascade orders sit at different wavelengths and have genuinely different losses (Mermelstein 2003 Table I: 0.279 / 0.220 / 0.179 dB/km at 1375 / 1465 / 1560 nm), so a single scalar cannot represent them.

This is deliberately a constructor argument and not part of coupling_tensor: the coupling tensor multiplies |A_j|**2, so folding loss into it would make the loss amplitude-dependent. Omitted (the default) leaves the shared fiber.alpha in charge, byte-identically.

None
fwm_pump_depletion bool

Include the Manley–Rowe-consistent back-conversion pump arm +2iγ f* A_m A_q A_n* in the FWM substep (requires include_fwm=True). With this on, Σ|A|² is conserved to RK4 round-off and strong pumps show the parametric back-conversion oscillation. Default False (pump-driven approximation: the pump evolves only through SPM/XPM).

False
step_size Length | None

Fixed step size (m); None uses length/num_steps.

None
cavity_reflectivity_input sequence of float

Per-channel power reflectivity at the input end (z=0) of a cavity, length N. None (default) = no cavity, amplifier mode. When supplied, :meth:cavity_iterate closes the propagation into a resonator.

None
cavity_reflectivity_output sequence of float

Per-channel power reflectivity at the output end (z=L) of a cavity, length N. Must be supplied together with cavity_reflectivity_input.

None
cavity_round_trip_length float

Round-trip length of the cavity in metres. Used for the beat-period calculation and the round-trip phase. Defaults to 2 * fiber.length (the physical cavity length).

None
cavity_group_index float

Group index n_g of the fiber, used both for the round-trip phase and for :meth:cavity_beat_period. Defaults to 1.466 (silica near 1.5 um), which is the Babin 2005 value. Must be positive.

1.466

betas instance-attribute

betas = _mm_betas_per_mode(betas, betas_unit, self._n)

waves instance-attribute

waves = waves

fiber instance-attribute

fiber = fiber

gamma_reference instance-attribute

gamma_reference = gamma_reference

group_delays instance-attribute

group_delays = None if group_delays is None else list(group_delays)

phase_offsets instance-attribute

phase_offsets = None if phase_offsets is None else list(phase_offsets)

coef_model instance-attribute

coef_model: CoeffModel = coef_model

include_fwm instance-attribute

include_fwm = include_fwm

oam_l instance-attribute

oam_l = None if oam_l is None else list(oam_l)

xpm_weights instance-attribute

xpm_weights = _xpm

fwm_weights instance-attribute

fwm_weights = _fwm_w

coupling_tensor instance-attribute

coupling_tensor = _ct

fwm_coupling_tensor instance-attribute

fwm_coupling_tensor = _fct

fwm_pump_depletion instance-attribute

fwm_pump_depletion = fwm_pump_depletion

include_raman instance-attribute

include_raman = bool(include_raman)

raman_response instance-attribute

raman_response = raman_response

raman_tensors instance-attribute

raman_tensors: NDArray | None

channel_alpha instance-attribute

channel_alpha = _mm_coerce_channel_alpha(channel_alpha, self._n)

step_size instance-attribute

step_size = step_size

cavity_reflectivity_input instance-attribute

cavity_reflectivity_input = r_in

cavity_reflectivity_output instance-attribute

cavity_reflectivity_output = r_out

cavity_round_trip_length instance-attribute

cavity_round_trip_length = cavity_round_trip_length if cavity_round_trip_length is not None else 2.0 * self.fiber.length.as_m

cavity_group_index instance-attribute

cavity_group_index = float(cavity_group_index)

rayleigh_backscatter instance-attribute

rayleigh_backscatter = rayleigh_backscatter

grid instance-attribute

grid: TemporalGrid = waves[0].grid

omega0 instance-attribute

omega0 = waves[0].central_frequency

fwm_full_tensor instance-attribute

fwm_full_tensor = bool(fwm_full_tensor)

full_beta instance-attribute

full_beta: list[NDArray] | None = None

include_shock instance-attribute

include_shock = bool(include_shock)

conserving_shock instance-attribute

conserving_shock = bool(conserving_shock)

include_tpa instance-attribute

include_tpa = bool(include_tpa)

include_free_carriers instance-attribute

include_free_carriers = bool(include_free_carriers)

beta_tpa instance-attribute

beta_tpa = self._broadcast_per_mode(beta_tpa, 'beta_tpa')

sigma_fca instance-attribute

sigma_fca = self._broadcast_per_mode(sigma_fca, 'sigma_fca')

sigma_tpa instance-attribute

sigma_tpa = self._broadcast_per_mode(sigma_tpa, 'sigma_tpa')

A instance-attribute

A: list[NDArray] = []

evolution instance-attribute

evolution: list[list[Wave]] = []

tau_shock property

tau_shock: float

Shock time: override or 1/ω₀ (Blow & Wood default).

has_cavity property

has_cavity: bool

Whether cavity reflectivity is configured.

z_array property

z_array: NDArray

Propagation distances (m) for each saved snapshot.

energy_vs_z property

energy_vs_z: NDArray

Total photon number Σᵢ∫|A_i|²dt at every snapshot.

spectra_vs_z property

spectra_vs_z: tuple[NDArray, NDArray]

(ω [rad/s], total summed spectrum over all channels) per snapshot.

propagate

propagate(num_steps: int, *, nsaves: int | None = None, show_progress: bool = False) -> None

Run the split-step propagation for num_steps steps.

Snapshot semantics match the scalar engine: nsaves evenly spaced snapshots (including z=0 and z=L), every step when nsaves=None; a total-photon-number monitor warns on >5% drift in lossless runs.

cavity_beat_period

cavity_beat_period(group_index: float | None = None) -> float

Longitudinal mode beat period of the cavity, in Hz.

The beat period is set by the cavity round-trip time: f_beat = c / (2 * n_g * L_rt) where L_rt is the round-trip length and n_g is the group index. For the Babin 2005 configuration (L = 16 m, n_g = 1.466) this gives approximately 6 MHz.

Parameters:

Name Type Description Default
group_index float | None

Group index of the fiber. None (default) uses the engine's cavity_group_index, itself defaulting to 1.466 (silica at 1.5 um).

None

Returns:

Type Description
float

Beat period in Hz.

cavity_iterate

cavity_iterate(num_steps: int, *, tolerance: float = 1e-06, max_iterations: int = 100, pump_field: NDArray | None = None, relaxation: float = 1.0, callback=None) -> 'CavityResult'

Iterate propagation and boundary application to convergence.

The cavity iteration propagates all channels through the fiber, applies the round-trip boundary conditions, re-injects the pump, and repeats until the circulating field converges.

Parameters:

Name Type Description Default
num_steps int

Number of split-step propagation steps per iteration.

required
tolerance float

Convergence tolerance on the relative change of the circulating intensity |A|**2 between successive round trips, i.e. || |F(A)|**2 - |A|**2 || / || |A|**2 ||. Intensity, not the complex field, because the round-trip map carries an arbitrary absolute phase; see the comment at the metric below.

1e-06
max_iterations int

Maximum number of cavity iterations. Raises on non-convergence.

100
relaxation float

Under-relaxation factor w in A <- (1 - w) A_old + w A_boundary, in (0, 1]. Default 1.0 is the plain round-trip map.

An above-threshold cavity needs w < 1. Its fixed point exists — pump depletion and output coupling balance it — but plain iteration diverges: the small-signal loop gain at the origin is much greater than one, and the gain saturation that would arrest the growth only sets in far from the origin, so every iterate runs away instead of climbing toward the fixed point. This was confirmed directly: a seeded first-Stokes cavity with mirror reflectivities of 0.99 raised RuntimeError at every launch power and seed tried. Damping moves each iterate inside the basin of attraction instead of over it. w = 1 remains the default so that a below-threshold cavity — the only case that converges unconditionally — is untouched.

1.0
pump_field NDArray | None

Pump field to inject at z=0 at each iteration. If None, the original pump field is used.

None
callback

Optional callback function called after each iteration with the iteration index and current relative change.

None

Returns:

Type Description
CavityResult

The converged field, iteration count, and convergence history.

Raises:

Type Description
RuntimeError

If the cavity does not converge within max_iterations. A cavity above its Stokes threshold genuinely has no fixed point under plain fixed-point iteration, and this is the one case where raising is the correct answer rather than a bug.

ValueError

If no cavity is configured.

fields_vs_z

fields_vs_z() -> list[NDArray]

Complex field histories: one (n_saves, N) array per channel.

nonlinear_phase_measure

nonlinear_phase_measure(m: int) -> float

Nonlinear phase of channel m measured against its own input CW.

Returns arg(A_m(t₀, z) / A_m(t₀, 0)) at the last snapshot for CW or constant-amplitude inputs.