Picard Iteration Not Updating Properly

I believe the issue here is the use of Wn.split() instead of split(Wn). See the following simple example:

from dolfin import *

# Create function `u` in mixed space:
mesh = UnitSquareMesh(10,10)
VE = FiniteElement('CG', mesh.ufl_cell(), 1)
W = FunctionSpace(mesh,MixedElement(2*[VE,]))
u = Function(W)

# Two different ways to `split` the function:
u1, u2 = split(u)
u1s, u2s = u.split()

# Modify the original mixed function `u`:
u.assign(project(Constant((1,1)),W))

# Using `split(u)` reflects changes in `u`:
print(assemble(u1*dx))

# Using `u.split()` does not reflect changes:
print(assemble(u1s*dx))

This has been a known source of confusion for a while:

P.S. You can format code nicely by surrounding it with triple backticks and (optionally) specifying a language, as follows:

```python
line1
line2
etc.
```

Look up “Markdown” for more formatting tricks.

5 Likes