Hello,
I am trying to solve a 1d shallow water problem with mixed function spaces defined as
v_ele = FiniteElement("DG", mesh.ufl_cell(), 1)
h_ele = FiniteElement("DG", mesh.ufl_cell(), 1)
W = FunctionSpace(mesh, MixedElement([v_ele, h_ele]))
I start defining the functions
solution_old = Function(W, name="SolutionOld")
functions_old = split(solution_old)
u_old = functions_old[0]
h_old = functions_old[1]
and then the conditions
h_initial = Expression(....)
u_initial = Constant(...)
Now I would like to assign these conditions to u_old and h_old, but I'm not able to do it.
If I try with u_old.assign(Function(W.sub(0)).interpolate(u_initial))
I receive the error
File "sw_DG.py", line 73, in
u_old.assign(Function(W.sub(0)).interpolate(u_initial))
AttributeError: 'Indexed' object has no attribute 'assign'
and another error if I try with u_old = interpolate(u_initial, W.sub(0))
I think it's a problem with the split of the space W, but I don't know how to solve it.
Thanks in advance