Updating a mixed element solutions separately

Hey!
I am solving a MixedElement problem, where after every time step the solution is updated for the next step:

      u_1, u_2, u_2 = split(u)      #function values at step n+1
      u_n1, u_n2, u_n3 = split(u_n)     #functions at step n
           u_n.assign(u)           # Update previous solution

as u can see all the function values are updated together using the assign function, But I wanted to know if there is a way to update these values separately. I tried using:

         assign(u_n1, u_1)
         assign(u_n2, u_2)
         assign(u_n3, u_3)

If I do this, I get the error
AttributeError: ‘Indexed’ object has no attribute ‘_cpp_object’
I need to update these solutions sepately because I want to put a condition on of the functions (do not update solution for u_3 when my condition is met) , while the other update normally. So is there a way to update them separately, any help would be appreciated, Thanks.

You should use the FunctionAssigner, see: Usage of FunctionAssigner - #2 by dokken

2 Likes

thanks it worked out nicely!

Hi Dokken,

Can you please explain a bit more. Suppose I only want to update u_n1 with u_1.

See for instance: Bitbucket