Vector curl in 2D

Hello!
I’m trying to implement a simple custom linear operator in 2D (which ressemble a curl):
\nabla\times u=(\partial_y u ; -\partial_x u)
So it should take a scalar and return a 2D vector, i know that i can access the derivative of a function with .dx(i) but how do i package everything in a vector ?

def vector_curl(u):
      ux = u.dx(0)
      uy = u.dx(1)
      return [uy, -ux] #???

Thanks

1 Like

as_vector((uy, -ux)), which is a component of ufl.

1 Like