I am coupling a Laplace equation for the velocity potential with a Navier-Stokes equation for the velocity. Up to now I have assembled the equations separately on two different meshes and then extracted them as SciPy sparse matrices and set up a sparse block system where the coupling conditions on the interface between the subdomains, which goes into the off-diagonal blocks, is hand coded. This approach works, but coding the quadrature on the shared facets is tedious.
A naive attempt at solving the problem by setting up a large mixed space fails with "Unable to create function space -> Nonmatching meshes for function space":
from dolfin import *
mesh = UnitSquareMesh(1, 1)
cell_marker = CellFunction('size_t', mesh)
cell_marker[0] = 1
cell_marker[1] = 2
mesh1 = SubMesh(mesh, cell_marker, 1)
mesh2 = SubMesh(mesh, cell_marker, 1)
V_phi = FunctionSpace(mesh1, 'CG', 2)
V_u = VectorFunctionSpace(mesh2, 'CG', 1)
W = MixedFunctionSpace([V_phi, V_u])
Question
Can this be set up elegantly in UFL by the existing FEniCS machinery, or must I continue assembling the coupling terms myself? I have noticed the work on overlapping meshes, which this is some kind of special case of, but I would really appreciate some pointers if this is a way to go forward.
Side question
For helping hand coding the quadrature on shared facets, is there an easy way to evaluate a single test function (1 dof) and its derivative from the Python layer? I know this functionality is in the UFC element class. EDIT: MiroK just told me that this element functionality can be found under FunctionSpace.element() (instead of FunctionSpace.ulf_element(). Thanks!