I am interesting in solving the following nonlinear, time-dependent pde in 2 spatial dimensions (complex Gross-Pitaevskii eq):

$$i \frac{\partial \psi}{\partial t} = \left[ -\nabla^2 + (1-i \sigma)(|\psi|^2-1) \right] \psi$$

The goal is to find steady state solutions for the function $\psi(x,y,t)$, for different parameters $\sigma$. Here $\sigma$ is a positive real-valued parameter. The boundary conditions can initially be of the Dirichlet type, setting the function $\psi$ to zero on the contour of a square, but later on I plan to implement some absorbing BC (perhaps using the perfectly matched layer method?). I am also considering solving the equation in a different geometry later on, on a disk using polar coordinates.

For the time-dependence, I plan to use the Gryphon module of Erik Skare (https://launchpad.net/gryphonproject), which is basically a Runge-Kutta solver and for the spatial part Fenics.

So the question is, do you think this is feasible to do with Fenics, and if so, how would one proceed?


1 Answer 1


I would try pushing this form

V = VectorFucntioSpace(mesh, 'CG', 1, dim=2)
u = Function(V)
v = TestFunction(V)
sigma = Constant(0.1)
F = inner(grad(u), grad(v))*dx \
  + (inner(u, u)-1.0)*((u[0]+sigma*u[1])*v[0] + (u[1]-sigma*u[0])*v[1])*dx

into nonlinear-poisson demo. But note that this would yield trivial solution if you start from zero field with zero Dirichlet.

  • $\begingroup$ Actually, as initial condition I would like to take a vortex in the center, $\psi(r,0)=r e^{-\frac{r^2}{2 c^2}}e^{i \phi(r)}$, where the azimuthal angle $\phi(r)$ varies from 0 to 2$\pi$ around the vortex core. The natural way to do this would be to use polar coordinates, but I have no idea how to do that in Fenics.. $\endgroup$
    – Andrei
    Jun 28, 2013 at 8:29
  • $\begingroup$ This initial condition can be easily achieved also in Cartesian coordinates. But I see no problem with polar coordinates in FEniCS. You just need to replace Laplace term with appropriate term valid in polar coordinates and add Jacobian of volume integral. $\endgroup$ Jun 28, 2013 at 12:51
  • $\begingroup$ so is there any worked out example of using polar coordinates in Fenics, for solving an eq. on a disk? $\endgroup$
    – Andrei
    Jun 28, 2013 at 13:18
  • $\begingroup$ besides, the equation is in the complex domain, and as far as i know fenics does not support complex numbers! $\endgroup$
    – Andrei
    Jun 28, 2013 at 15:42
  • 1
    $\begingroup$ No. It is especially worth for 2D problems involving rotational symmetry which would yield 1D problem so it is ODR instead of PDR. I don't think it is much useful to use polar coordinates for your problem unless boundary conditions implies rotationally-symmetric solution in which case you should reduce your problem to ODR. DOLFIN is able to create spherical meshes in Cartesian coordinates. $\endgroup$ Jun 28, 2013 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.