"""
Two coupled components
======================

``CNLSE`` propagates a two-component field with cross-phase modulation between them.
"""

import numpy as np
from NLSE import CNLSE

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
Isat2 = waist / waist2 * Isat
L = 10e-2
alpha = 20


def main():
    simu_c = CNLSE(
        alpha,
        puiss,
        window,
        n2,
        n12,
        None,
        L,
        NX=N,
        NY=N,
        Isat=Isat,
        omega=None,
        backend="CL",
    )
    simu_c.puiss2 = 10e-3
    simu_c.n22 = 1e-10
    simu_c.I_sat2 = Isat2
    simu_c.k2 = 2 * np.pi / 795e-9
    E_0 = np.exp(-(simu_c.XX**2 + simu_c.YY**2) / waist**2).astype(PRECISION_COMPLEX)
    V = np.exp(-(simu_c.XX**2 + simu_c.YY**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()
