Note
Go to the end to download the full example code.
A Bose-Einstein condensate¶
GPE solves the Gross-Pitaevskii equation in atomic units rather than optical ones.

/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))
Propagation: 0%| | 0.00/100 [00:00<?, ?%/s]
Propagation: 100%|██████████| 100/100 [00:00<00:00, 195%/s]
Time spent to solve : 0.5129523990001417 s (CPU)
import numpy as np
from NLSE import GPE
from scipy.constants import atomic_mass
PRECISION_COMPLEX = np.complex64
PRECISION_REAL = np.float32
N = 2048
N_at = 1e6
g = 1e3 / (N_at / 1e-3**2)
waist = 1e-3
window = 1e-3
m = 87 * atomic_mass
def main():
simu_gpe = GPE(
gamma=0,
N=N_at,
window=window,
g=g,
V=None,
m=m,
NX=N,
NY=N,
backend="CUPY",
)
psi_0 = np.exp(-(simu_gpe.XX**2 + simu_gpe.YY**2) / waist**2).astype(
PRECISION_COMPLEX
)
simu_gpe.out_field(psi_0, 1e-6, verbose=True, plot=True, splitting="lie")
if __name__ == "__main__":
main()
Total running time of the script: (0 minutes 2.384 seconds)