I have a function from a mixed function space à la
W_element = VectorElement('Lagrange', mesh.ufl_cell(), 2)
P_element = FiniteElement('Lagrange', mesh.ufl_cell(), 1)
WP = FunctionSpace(mesh, W_element * P_element)
up = Function(WP)
and I'd like to dissect it into two fully qualified functions u
and p
. Splitting like
u, p = up.split()
gives my something, but I can't copy/assign the function to another, i.e.,
W = u.function_space().collapse()
u2 = Function(W)
u2.assign(u0) # fail
u2 = u.copy() # fail
The error is
*** Error: Unable to access vector of degrees of freedom.
*** Reason: Cannot access a non-const vector from a subfunction.
How can I split up
into u
and p
such that they can be copy()
d?