ufl.conditional is a computational symbolic expression of the condition provided. It will not apply a numerical operator to a vector of degrees of freedom as your call to u_n.assign is attempting.
There are two approaches I would investigate:
- Your problem is already set up as if it were nonlinear: try solving it with
u_1throughu_6replaced by your conditional symbolic representations. This will probably be difficult (maybe impossible) for the Newton solver to resolve without an appropriate initial guess though. - Get the local values of the underlying vector of
u, and manipulate them as you wish between time steps. E.g.do_something_with(as_backend_type(u.vector()).get_local()).