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:
infile.read(mesh)
······
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?