gpe.exact_solutions
===================

.. py:module:: gpe.exact_solutions

.. autoapi-nested-parse::

   This file contains a set of exact solutions useful for testing.



Classes
-------

.. autoapisummary::

   gpe.exact_solutions.HarmonicOscillator
   gpe.exact_solutions.HarmonicOscillators
   gpe.exact_solutions.BrightSoliton
   gpe.exact_solutions.TravellingWaves
   gpe.exact_solutions.DarkBrightSolitons


Functions
---------

.. autoapisummary::

   gpe.exact_solutions.sn
   gpe.exact_solutions.K


Module Contents
---------------

.. py:class:: HarmonicOscillator(Nx=46, Lx=17.0, sigma=1.0, g=1.0, n0=1.0, **kw)

   Bases: :py:obj:`gpe.bec.StateBase`


   Modified 1D harmonic oscillator potential with analytic solution.

   Here we add a piece to the harmonic oscillator potential to ensure that a
   Gaussian is an eigenstate, even in the presence of interactions.


   .. py:attribute:: w
      :value: 1.0



   .. py:attribute:: n0
      :value: 1.0



   .. py:attribute:: sigma
      :value: 1.0



   .. py:method:: get_psi_exact(r)


   .. py:method:: get_Vext_r(r)


   .. py:property:: psi_exact


   .. py:method:: get_Vext_GPU()

      Return the external potential.  This default version is zero.



.. py:class:: HarmonicOscillators(Nxyz=(46, 46), Lxyz=(17.0, 17.0), sigmas=(1.0, 1.0), g=1.0, n0=1.0, **kw)

   Bases: :py:obj:`gpe.bec.StateBase`


   Modified 2D harmonic oscillator potential with analytic solution.

   Here we add a piece to the harmonic oscillator potential to ensure that a
   Gaussian is an eigenstate, even in the presence of interactions.


   .. py:attribute:: ws


   .. py:attribute:: n0
      :value: 1.0



   .. py:attribute:: sigmas
      :value: (1.0, 1.0)



   .. py:method:: get_psi_exact(xyz=None)


   .. py:method:: get_Vext_GPU()

      Return the external potential.  This default version is zero.



   .. py:property:: psi_exact


.. py:class:: BrightSoliton(Nx=2**4 * 3**3, Lx=58.0, sigma=1.0, g=None, n0=1.0, v=0.0, **kw)

   Bases: :py:obj:`gpe.bec.StateTwist_x`


   Analytic moving bright soliton (for attractive interactions).


   .. py:attribute:: sigma
      :value: 1.0



   .. py:attribute:: n0
      :value: 1.0



   .. py:attribute:: v
      :value: 0.0



   .. py:property:: x

      Flat x abscissa as a numpy array.


   .. py:property:: psi0


.. py:function:: sn(u, m)

   Jacobi elliptic function sn.


.. py:function:: K(m)

   Jacobi elliptic integral


.. py:class:: TravellingWaves(Nx=64, Lx=10.0, n0=0.1, n1=1.0, m=1.0, g=1.0, hbar=1.0, v_p=0.0, v_x=None, twist=None, **kw)

   Bases: :py:obj:`gpe.bec.StateTwist_x`


   Analytic traveling wave solutions for the GPE without a
   potential.

   The solutions are characterized by the following parameters:

   n0, n1 : float
      Minimum and maximum density of the soliton.  The amplitude is
      a=n1-n0.
   Lx : float
      The period of the wave, and the length of our box.  This is
      specified in terms of Lx = 2lK(m_), where m_=al^2.
   v_p : float
      Phase velocity.
   v_x : float
      Velocity of the frame.  If None, this is set to be the phase
      velocity so that the solution should be stationary.
   twist : float
      Twisted boundary condition.  If None, this is computed by
      integrating the continuity equation.


   .. py:attribute:: v_unit
      :value: 1.0



   .. py:attribute:: v_p
      :value: 0.0



   .. py:attribute:: _n0
      :value: 0.1



   .. py:attribute:: _m


   .. py:attribute:: _C


   .. py:attribute:: mu
      :value: 1.05



   .. py:attribute:: _twist
      :value: None



   .. py:method:: n_exact(x=None)


   .. py:method:: psi_exact(x=None, Lx=None)

      Return the exact solution.

      :param x: Abscissa and box size - used by the constructor for getting
                the exact solution before the state has been properly initialized.
      :type x: array, float
      :param Lx: Abscissa and box size - used by the constructor for getting
                 the exact solution before the state has been properly initialized.
      :type Lx: array, float



   .. py:method:: get_m(_a, _L)
      :staticmethod:


      Return the solution to _L = 2*sqrt(m/_a)*K(m).



.. py:class:: DarkBrightSolitons(kappa=1.0, bs=[-1.0, -2.0, -3.0], lambdas=(0.0, 0.0), **kw)

   Bases: :py:obj:`gpe.bec2.State`


   State with HO potential for backward compatibility.


   .. py:attribute:: kappa
      :value: 1.0



   .. py:attribute:: bs


   .. py:attribute:: lambdas
      :value: (0.0, 0.0)



   .. py:attribute:: Cs


   .. py:method:: get_initial_state(x0=0.0, eta=1.0, v=1.0, t=0.0, mu=1.0)


