Hello everyone!
I am setting up a code and at a certain point I need to have something similar to:
import dolfin
p = 1
# Generate the mesh
mesh = dolfin.BoxMesh(dolfin.Point(0.0, 0.0, 0.0),
dolfin.Point(1.0, 1.0, 1.0),
2, 2, 2)
# The function space used for the discretization of the stream function
S_element = dolfin.FiniteElement("N1curl", mesh.ufl_cell(), p)
S = dolfin.FunctionSpace(mesh, S_element)
C_element = dolfin.FiniteElement("CG", mesh.ufl_cell(), p)
C = dolfin.FunctionSpace(mesh, C_element)
# generate the mixed space with S and R
M_element = dolfin.MixedElement(S_element, C_element)
M = dolfin.FunctionSpace(mesh, M_element)
S_of_M, C_of_M = M.split()
# Trial functions
sTrial = dolfin.TrialFunction(S_of_M)
cTrial = dolfin.TrialFunction(C_of_M)
# Test functions
sTest = dolfin.TestFunction(S_of_M)
cTest = dolfin.TestFunction(C_of_M)
Lap_psi = (dolfin.inner(dolfin.curl(sTrial),dolfin.curl(sTest))*dolfin.dx -
dolfin.inner(dolfin.grad(cTrial), sTest)*dolfin.dx)
Lap_psi_mat = dolfin.assemble(Lap_psi)
Lap_psi_1 = (dolfin.inner(dolfin.curl(sTrial),dolfin.curl(sTest))*dolfin.dx)
Lap_psi_2 = (dolfin.inner(dolfin.grad(cTrial), sTest)*dolfin.dx)
Lap_psi_1_mat = dolfin.assemble(Lap_psi_1)
Lap_psi_2_mat = dolfin.assemble(Lap_psi_2)
This code does not work because the line
Lap_psi_mat = dolfin.assemble(Lap_psi)
generates the error
UFLException: Found different Arguments with same number and part.
Did you combine test or trial functions from different spaces?
The Arguments found are:
v_0
v_1
v_1
The last four lines
Lap_psi_1 = (dolfin.inner(dolfin.curl(sTrial),dolfin.curl(sTest))*dolfin.dx)
Lap_psi_2 = (dolfin.inner(dolfin.grad(cTrial), sTest)*dolfin.dx)
Lap_psi_1_mat = dolfin.assemble(Lap_psi_1)
Lap_psi_2_mat = dolfin.assemble(Lap_psi_2)
Are an alternative that does not generate any errors and I can even add the two matrices. Anyone knows what I am doing wrong?
Thank you for your time.