# Multi-equation coupling has multi-function space

Hello, everyone, I now ask to solve the coupling of three equations, and save the sum of the solution of three equations to a file, the steps are as follows:

``````mesh = Mesh()
with XDMFFile("mesh/mesh.xdmf") as infile:
······
P1 = FiniteElement('P', triangle, 2)
P2 = FiniteElement('P', triangle, 1)
element = MixedElement([P1, P2, P2])
V = FunctionSpace(mesh, element)
C = Function(V)
C_n = Function(V)
c, ct1, ct2 = split(C)
v1, v2, v3 = TestFunctions(V)
······
t = 0
for n in range(num_steps):
t += dt
solver.solve()
C_n.assign(C)
c, ct1, ct2 = C.split(deepcopy=True)
c.vector()[:] += ct1.vector()[:] + ct2.vector()[:]
with XDMFFile("diffusion_two defect/nex cul.xdmf") as outfile:
outfile.write_checkpoint(c, "c", 0, append=True)
``````

What I want to do is use second-order units for solving c, and first-order units for ct1 and ct2, so I have two questions:
(1) Is my above definition of function space correct? How do I fix it if it’s not correct?
(2) If the above process can be implemented, how do I output c+ct1+ct2 to a file?

The variable names here are very confusing, as P1 is P2 and opposite.

If you want to make a linear combination of functions from different function spaces, you need to select a space (preferably the P2 space), and interpolate the sum into that space, i.e.

``````V2, _ V.sub(0).collapse()
sum_expr = dolfinx.fem.Expression(c + c1t + c2t, V2.element.integration_points())
out_func = dolfinx.fem.Function(V2)
out_func.interpolate(sum_expr)
``````

It looks very smooth, but I use fenics2019.1, I seem to be very unfamiliar with fenicsx,Prompt the following error：

‘function’ object has no attribute ‘integration_points’