I am implementing the time-integration of some wave equation with the constraint \int_\Omega u\ dx = 0 by means of a Lagrange multiplier. My product space therefore is
mesh = UnitSquareMesh(50, 50) V = FunctionSpace(mesh, FiniteElement('CG', mesh.ufl_cell(), 1) * FiniteElement('Real', mesh.ufl_cell(), 0))
However, due to time-integration I need to invoke (and update at each time step) a function u_ from the first factor of the product space which I believe to obtain by
V_ = V.sub(0).collapse()
- Is this correct?
Now, solving my equation at each time step I obtain a function w from V and I do
(u, alpha) = w.split()
However, trying to update
yields an error. It seems that u is NOT an element of V_. Indeed, u.vector()[:] has one entry more than u_.vector()[:].
- Why is that and how do I obtain an element of V_ instead?