Two coupled components in one dimension

The coupled solver on a line.

Field at $z$ = 1.00e-03 m, $|\psi_1|^2$, $\mathrm{arg}(\psi_1)$, $|\psi_2|^2$, $\mathrm{arg}(\psi_2)$
/home/runner/work/NLSE/NLSE/NLSE/solvers/nlse.py:182: UserWarning: The CUPY backend is not installed here, so CPU will be used instead — the fastest one available. Install cupy to use CUPY, or pass backend='CPU' to silence this.
  self._backend: Backend = get_backend(backend, grid_size=(NX, NY))
/home/runner/work/NLSE/NLSE/NLSE/solvers/nlse.py:380: UserWarning: delta_z=1.00e-04 exceeds split-step accuracy limit (3.04e-05). Reducing to 2.73e-05.
  delta_z = self._capped_delta_z(delta_z, A, method)





Propagation:   0%|          | 0.00/100 [00:00<?, ?%/s]




Propagation: 100%|██████████| 100/100 [00:01<00:00, 66.0%/s]





Time spent to solve : 1.516017543000089 s (CPU)

import numpy as np
from NLSE import CNLSE_1d

PRECISION_COMPLEX = np.complex64
PRECISION_REAL = np.float32

N = 2048
n2 = -1.6e-9
n12 = -1e-10
waist = 2.23e-3
waist2 = 70e-6
window = 4 * waist
puiss = 1.05
Isat = 10e4  # saturation intensity in W/m^2
L = 1e-3
alpha = 20


def main() -> None:
    simu_c = CNLSE_1d(
        alpha,
        puiss,
        window,
        n2,
        n12,
        None,
        L,
        NX=N,
        Isat=Isat,
        omega=1,
        backend="CUPY",
    )
    simu_c.puiss2 = 10e-3
    simu_c.n22 = 1e-10
    simu_c.k2 = 2 * np.pi / 795e-9
    E_0 = np.exp(-(simu_c.X**2) / waist**2).astype(PRECISION_COMPLEX)
    V = np.exp(-(simu_c.X**2) / waist2**2).astype(PRECISION_COMPLEX)
    simu_c.out_field(
        np.array([E_0, V]),
        L,
        verbose=True,
        plot=True,
        splitting="lie",
    )


if __name__ == "__main__":
    main()

Total running time of the script: (0 minutes 1.876 seconds)

Gallery generated by Sphinx-Gallery