implementations.problem_classes.NonlinearSchroedinger_MPIFFT module

class nonlinearschroedinger_fully_implicit(lintol=1e-09, liniter=99, **kwargs)[source]

Bases: nonlinearschroedinger_imex

Example implementing the \(N\)-dimensional nonlinear Schrödinger equation with periodic boundary conditions

\[\frac{\partial u}{\partial t} = -i \Delta u + 2 c i |u|^2 u\]

for fixed parameter \(c\) and \(N=2, 3\). The linear parts of the problem will be discretized using mpi4py-fft [1]_. For time-stepping, the problem will be solved fully-implicitly, i.e., the nonlinear system containing the full right-hand side is solved by GMRES method.

References

dtype_f

alias of mesh

dtype_u

alias of mesh

eval_f(u, t)[source]

Routine to evaluate the right-hand side of the problem.

Parameters:
  • u (dtype_u) – Current values of the numerical solution.

  • t (float) – Current time at which the numerical solution is computed.

Returns:

f – The right-hand side of the problem.

Return type:

dtype_f

solve_system(rhs, factor, u0, t)[source]

Solve the nonlinear system \((1 - factor \cdot f)(\vec{u}) = \vec{rhs}\) using a SciPy Newton-Krylov solver. See page [1]_ for details on the solver.

Parameters:
  • rhs (dtype_f) – Right-hand side for the linear system.

  • factor (float) – Abbrev. for the node-to-node stepsize (or any other factor required).

  • u0 (dtype_u) – Initial guess for the iterative solver (not used here so far).

  • t (float) – Current time (e.g. for time-dependent BCs).

Returns:

me – The solution as mesh.

Return type:

dtype_u

class nonlinearschroedinger_imex(c=1.0, **kwargs)[source]

Bases: IMEX_Laplacian_MPIFFT

Example implementing the \(N\)-dimensional nonlinear Schrödinger equation with periodic boundary conditions

\[\frac{\partial u}{\partial t} = -i \Delta u + 2 c i |u|^2 u\]

for fixed parameter \(c\) and \(N=2, 3\). The linear parts of the problem will be solved using mpi4py-fft [1]_. Semi-explicit time-stepping is used here to solve the problem in the temporal dimension, i.e., the Laplacian will be handled implicitly.

Parameters:
  • nvars (tuple, optional) – Spatial resolution

  • spectral (bool, optional) – If True, the solution is computed in spectral space.

  • L (float, optional) – Denotes the period of the function to be approximated for the Fourier transform.

  • c (float, optional) – Nonlinearity parameter.

  • comm (MPI.COMM_World) – Communicator for parallelisation.

fft

Object for parallel FFT transforms.

Type:

PFFT

X

Grid coordinates in real space.

Type:

mesh-grid

K2

Laplace operator in spectral space.

Type:

matrix

References

u_exact(t, **kwargs)[source]

Routine to compute the exact solution at time \(t\), see (1.3) https://arxiv.org/pdf/nlin/0702010.pdf for details

Parameters:

t (float) – Time of the exact solution.

Returns:

u – The exact solution.

Return type:

dtype_u