Error: Expected a Function or linear combinations of Functions in the same FunctionSpace

I am working on time dependent problem with mixed space H = (RT1, CG1)
w = Function(H), w = function(t)
(q, u) = split(w)
w is obtained from the system AW = B.
I have to update (q,u) with each time step, but while assignment it gives me error as

``Expected a Function or linear combinations of Functions in the same FunctionSpace’’

The end part of my code in while loop reads
Thanks !!



solve(A == B, W)
q = W.split(0)
u = W.split(1)
u0.assign(u)
q0.assign(q)

You need supply a minimal working code example.
Note that you should check the forum for similar posts before creating a new post, see for instance:

I think I tried it but was not working. But I shall check again.

As you have not supplied a minimal working code example, this is the only guidance I can Give you.
Please provide an example that can reproduce the error. Note that you do not Need to define a PDE in the minimal example, as it is only related to assign. So please define your mesh, FunctionSpace and relevant functions, and try to assign one to the other.

Thank you so much.
I shall first try to work out the through the post which you just shared.
Because of short time I generally skip writing the code.
Is there any documentation where these codes exist. I am a beginner in fenics and making first code …have been following
Lecture notes: Automated Solutions … Anders Logg . et al.
But I find things are quite different.

As this book was published in 2012, the software has changed quite a lot since then. If you base your work around the 2016.2.0 version, you can use:

Thanks you very much Dokken !!