Sum of two functions in the same function space

Hi everyone, I currently am using dolfinx 0.6.0.
As in the title, I have two function f, g on a space V and want to obtain their sum f+g not as a ufl.algebra.Sum but as a function in V.
I think this should be a pretty simple thing, but I’m struggling to find any information about it.
Thanks in advance,
Paolo

h = dolfinx.fem.Function(V)
u = dolfinx.fem.Function(V)
v = dolfinx.fem.Function(V)
# add some data to u and v
# …

h.x.array[:] = u.x.array + v.x.array
1 Like

thank you very much! I had tried to do this but without the ‘.array’ so it failed. Have a nice day!