I am solving a very simple problem, at least what I thought. Take a vector field and extract its curl component using Lagrange vectorfunctionspace as finite element space. It seems that the solution failed to converge in 0 iterations using Krylov solver. I tried with all possible solver (Mumps, superLu, Gmres,…) but none of them work. Possibly something is wrong with my formulation. This is the code

```
mesh = Mesh(mesh_file)
R_3 = VectorFunctionSpace(mesh, 'DG', 0)
x = Function(R_3,vec_file)
L_3 = VectorFunctionSpace(mesh, 'CG', 1)
u = TrialFunction(L_3)
v = TestFunction(L_3)
a = inner(curl(u), curl(v))*dx
L = inner(x, curl(v))*dx
v = Function(L_3)
c = Constant((0.0,)*3)
bc = DirichletBC(L_3, c, DomainBoundary())
solve(a == L, v, bc,solver_parameters={'linear_solver': 'mumps'})
```

Thank you.

Could you provide your `mesh`

and your `vec_file`

or a MWE how to create them?

Have you tried Nédélec elements instead of Lagrange elements? In e.g. the Helmholtz equation you have a curl-curl too and you use

```
L_3 = FunctionSpace(mesh, "N1curl", 1) # Yes, it's FunctionSpace!
```

in that case.

Attached to the link are the two files needed for the example.

https://we.tl/t-D2WHcMcGQ6

I used Nédélec elements before and it works nicely. The problem is that the potential function is defined over the edges so that modifying the values (e.g: smoothing, …) becomes unstable and tricky. I tried to convert them to Lagrange basis but I got a rank problem error. Something like

```
Lagrange = FunctionSpace(mesh, 'CG', 1)
# Potential on Lagrange element
L = FunctionSpace(mesh, 'CG', 1)
v_lagrange_pot = Function(L)
LagrangeInterpolator.interpolate(v_lagrange_pot, v)
# Vector from Lagrange element
v_lagrange_vec= project(grad(v_lagrange_pot), x.function_space())
```

Thanks!