Hello everybody!
I have been looking at the demo_elastodynamics.py that uses a function (minimal version shown below) to update fields after the linear solve:
def update(v):
    """Update fields at the end of each time step."""
    # Get vectors (references)
    v_vec  = v.vector()
    # Update  velocity
    v_vec = ...  # some formula
    # Update v
    v.vector()[:] = v_vec
In my case, however, I want to modify my solution which is in a MixedFunctionSpace (MixedFunctionSpace([DG]*L0) and I can't figure out how to update it properly. I tried:
def updateMixedFunction(w):
    """Update a function which is in a MixedFunctionSpace at the end of each time step."""
    # Get vectors (references)
    W = []
    for i in range(0,L0):
        w_i = project(w[i], FunctionSpace(mesh, "DG", 1))
        W.append(w_i.vector())
    # Update the mixed function
    for i in range(0,L0):
        W[i] = ... # some formula
    # Update w
    for i in range(0,L0):
        w[i].vector()[:] = Phi[i]
Getting the vectors references and updating the mixed function seem to work but I am having troubles changing w itself. The code above returns:
  AttributeError: 'Indexed' object has no attribute 'vector'
Does anyone have an idea to fix the problem? Any help would be greatly appreciated
Thanks!
Vincent