twpasolver.analysis.gain module#
Gain models: the forward-only simple CMEs and the forward-backward bloch CMEs.
- class twpasolver.analysis.gain.GainModel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
-
Available CME models for gain analysis.
- SIMPLE“simple”
Traditional coupled mode equations of a homogeneous line, forward waves only. The supercell enters only through the Bloch wavenumber; the couplings are those of a uniform medium (scaled by k), without the intracell current profiles, so they are not exact for loaded lines, especially near stopbands. Ignores reflections and the port/connector models. Fast; for quick sweeps and comparisons with the literature. Segmented devices are interpolated linearly between segment midpoints (a smooth taper).
- BLOCH“bloch”
Forward-backward model in the Bloch-mode basis: exact Bloch couplings with the intracell current profiles, counter-propagating waves and reflections, exact boundary conditions with the port/connector models, fixed edge basis for modes close to a stopband edge. Segmented devices (whole supercells per segment) are solved on per-segment Bloch modes joined by exact junction conditions. Configured by
BlochSolverConfig.
- SIMPLE = 'simple'#
- BLOCH = 'bloch'#
- twpasolver.analysis.gain.port_gains(a_in, a_out, b_in, b_out) dict[str, Any][source]#
S21, S12, S11 and S22 in dB from the external currents (
ain,bout).
- twpasolver.analysis.gain.solve_simple(problem: CMEProblem, y0: ndarray, x: ndarray, rk_config: RKSolverConfig, **meta) GainResult[source]#
Forward-only CMEs;
y0(n_freq, n_modes) are the currents injected at x=0.No ports:
b_outis the current at x=L, nothing comes back (b_inNaN).
- twpasolver.analysis.gain.solve_bloch(problem: CMEProblem, y0_fwd: ndarray, y0_bwd: ndarray, x: ndarray, ports: Ports, bloch_config: BlochSolverConfig, rk_config: RKSolverConfig, **meta) GainResult[source]#
Forward-backward CMEs in the Bloch basis;
y0_fwd/y0_bwd(n_freq, n_modes) are the currents incident from the external lines at x=0 and x=L. Amplitudes are +x-referenced boundary currents of the forward and backward Bloch modes; seetwpasolver.cmes.bloch_fb.