I would like to combine trial functions related to distinct meshes (hierarchically related) to assembler a rectangular 5x8 global matrix. I tried the script below.
from dolfin import *
set_log_level(DEBUG)
mesh1 = UnitIntervalMesh(4)
mesh2 = UnitIntervalMesh(2)
V1 = FunctionSpace(mesh1, "CG", 1)
V2 = FunctionSpace(mesh2, "CG", 1)
V = V1 * V2
(u1, u2) = TrialFunctions(V)
v1 = TestFunctions(V1)
a = (inner(grad(u1), grad(v1)) * dx) + (inner(grad(u2), grad(v1)) * dx)
A = assemble(a)
print(A.array())
I can't interpret the error messages below
Traceback (most recent call last):
File "/home/andremachado/Desktop/basis_function_dictionary_example.py", line 23, in <module>
a = (inner(grad(u1), grad(v1)) * dx) + (inner(grad(u2), grad(v1)) * dx)
File "/usr/lib/python2.7/dist-packages/ufl/operators.py", line 319, in grad
f = as_ufl(f)
File "/usr/lib/python2.7/dist-packages/ufl/constantvalue.py", line 394, in as_ufl
"The representation of the object is:\n%r") % (type(expression), expression))
File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 154, in error
raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Invalid type conversion: <type 'tuple'> can not be converted to any UFL type.
The representation of the object is:
(Argument(FiniteElement('Lagrange', Domain(Cell('interval', 1), 'interval_multiverse', 1, 1), 1, None), -2),)