twpasolver.cmes module#

Coupled Mode Equations models and solvers optimized for Numba.

twpasolver.cmes.CMEode_complete(t: float, y: ndarray[Any, dtype[complex128]], kp: float, ks: float, ki: float, xi: float, epsi: float) ndarray[Any, dtype[complex128]][source]#

Complete coupled mode equation model for current amplitudes.

y[0] = Ip # pump current y[1] = Is # signal current y[2] = Ii # idler current t = x #

Equations A5a, A5b and A5c from PRX Quantum 2, 010302 (2021)

Parameters:
  • t (float) – Time variable.

  • y (ComplexArray) – Array of current amplitudes [Ip, Is, Ii].

  • kp (float) – Pump wave number.

  • ks (float) – Signal wave number.

  • ki (float) – Idler wave number.

  • xi (float) – Nonlinear coefficient.

  • epsi (float) – Small perturbation parameter.

Returns:

Derivatives of current amplitudes [dIp/dt, dIs/dt, dIi/dt].

Return type:

ComplexArray

twpasolver.cmes.general_cme_ideal(x, currents, kappas, relations_3wm, relations_4wm, coeffs_3wm, coeffs_4wm)[source]#

Return derivatives of Coupled Mode Equations system including arbitrary 3WM and 4WM relations.

twpasolver.cmes.general_cme_loss_only(x, currents, kappas, alphas, relations_3wm, relations_4wm, coeffs_3wm, coeffs_4wm)[source]#

Return derivatives of Coupled Mode Equations system including arbitrary 3WM and 4WM relations.

twpasolver.cmes.general_cme(x, currents, kappas, alphas, ts_reflection, ts_reflection_neg, relations_3wm, relations_4wm, coeffs_3wm, coeffs_4wm)[source]#

Return derivatives of Coupled Mode Equations system including reflection and arbitrary 3WM and 4WM relations.

twpasolver.cmes.cme_general_solve_freq_array_ideal(x_array: ndarray[Any, dtype[float64]], y0_array: ndarray[Any, dtype[complex128]], kappas_array: ndarray[Any, dtype[float64]], relations_3wm, relations_4wm, coeffs_3wm, coeffs_4wm, thin: int = 200) ndarray[Any, dtype[complex128]][source]#

Solve ideal general CMEs for multiple frequency points using numba prange.

twpasolver.cmes.cme_general_solve_freq_array_loss(x_array: ndarray[Any, dtype[float64]], y0_array: ndarray[Any, dtype[complex128]], kappas_array: ndarray[Any, dtype[float64]], alphas_array: ndarray[Any, dtype[float64]], relations_3wm, relations_4wm, coeffs_3wm, coeffs_4wm, thin: int = 200) ndarray[Any, dtype[complex128]][source]#

Solve loss-only general CMEs for multiple frequency points using numba prange.

twpasolver.cmes.cme_general_solve_freq_array_full(x_array: ndarray[Any, dtype[float64]], y0_array: ndarray[Any, dtype[complex128]], kappas_array: ndarray[Any, dtype[float64]], alphas_array: ndarray[Any, dtype[float64]], ts_reflection_array: ndarray[Any, dtype[complex128]], ts_reflection_neg_array: ndarray[Any, dtype[complex128]], relations_3wm, relations_4wm, coeffs_3wm, coeffs_4wm, thin: int = 200) ndarray[Any, dtype[complex128]][source]#

Solve full general CMEs (with reflections) for multiple frequency points using numba prange.

twpasolver.cmes.cme_general_solve_freq_array(x_array: ndarray[Any, dtype[float64]], y0_array: ndarray[Any, dtype[complex128]], data_kappas_gammas_array, relations_coefficients, thin: int = 200, reflections: bool = True, with_loss: bool = False) ndarray[Any, dtype[complex128]][source]#

Solve coupled mode equations for multiple frequency points using numba prange.

Parameters:
  • x_array (FloatArray) – Array of position values for evaluation.

  • y0_array (ComplexArray) – Initial currents for each mode and frequency (2D array: [n_freq, n_modes] or 1D array for single condition).

  • data_kappas_gammas_array – List of parameter arrays for each frequency point.

  • relations_coefficients – tables with indexes representing mixing relations between modes and relative coefficients.

  • thin (int) – Thinning factor for plotting.

  • reflections (bool) – Whether to include reflections.

  • with_loss (bool) – Whether to use the loss-only model.

Returns:

Solution of the coupled mode equations for all frequencies (3D array: [n_freq, n_modes, n_positions]).

Return type:

ComplexArray

twpasolver.cmes.cme_solve(k_signal: ndarray[Any, dtype[float64]], k_idler: ndarray[Any, dtype[float64]], x_array: ndarray[Any, dtype[float64]], y0: ndarray[Any, dtype[complex128]], k_pump: float, xi: float, epsi: float) ndarray[Any, dtype[complex128]][source]#

Solve coupled mode equations for multiple frequencies using the standard 3WM model.

Parameters:
  • k_signal (FloatArray) – Array of signal wave numbers.

  • k_idler (FloatArray) – Array of idler wave numbers.

  • x_array (FloatArray) – Array of position values for evaluation.

  • y0 (ComplexArray) – Initial conditions for the coupled mode equations (1D array for single condition or 2D array for multiple).

  • k_pump (float) – Pump wave number.

  • xi (float) – Nonlinear coefficient.

  • epsi (float) – Small perturbation parameter.

Returns:

Solution of the coupled mode equations for the given frequencies.

Return type:

ComplexArray