# time-dependent nonlinear pde in fenics

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

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+sigma*u)*v + (u-sigma*u)*v)*dx


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

• 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.. – Andrei Jun 28 '13 at 8:29
• 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. – Jan Blechta Jun 28 '13 at 12:51
• so is there any worked out example of using polar coordinates in Fenics, for solving an eq. on a disk? – Andrei Jun 28 '13 at 13:18
• besides, the equation is in the complex domain, and as far as i know fenics does not support complex numbers! – Andrei Jun 28 '13 at 15:42
• 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. – Jan Blechta Jun 28 '13 at 15:43