This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Empty matrix when I assemble on shared edges of partition

0 votes

Hello,

The following code (run with mpirun -np 4) reproduces the problem I have. I want to assemble a global matrix that has non-zero contributions on the DOFs corresponding to vertices that lie in the shared edges of partitioned mesh. Why do I get an empty matrix upon assembly?

** Edited from original question to incorporate MiroK's suggestion. However problem persists - see reply **

from dolfin import *

comm = mpi_comm_world()
mpirank = MPI.rank(comm)
mpisize = MPI.size(comm)

ny = 5
mesh = UnitSquareMesh(ny-1, ny-1)
meshtopo = mesh.topology()
V = FunctionSpace(mesh, 'Lagrange', 1)

interfaces = FacetFunction('size_t', mesh)
interfaces.set_all(0)

shared_edges = meshtopo.shared_entities(1)
for edge in shared_edges.keys():
    interfaces[edge] = 1

dS = Measure('dS', domain=mesh, subdomain_data=interfaces) 

u = TrialFunction(V)
v = TestFunction(V)

mrobin =  inner(u('-'),v('-'))*dS(1)
Mrobin = assemble(mrobin)
print Mrobin.array()
asked Jun 1, 2016 by brk888 FEniCS Novice (990 points)
edited Jun 3, 2016 by brk888

Hi, I haven't made this work yet but the first problem is that you want to integrate over interior facets (w.r.t to global mesh) while ds is for exterior facets. So Measure('dS', ...) is the measure that should be used.

Thank you for your suggestion, I have incorporated the changes you suggest and updated the code pasted above to reflect these. I still get an empty matrix, even when assembing with dS measure type.

Note that when I use dS, I can assemble on interior facets within the middle of a partition. It is only the shared edges between partitions that fail to assemble.

Hi, sorry but I made no progress on your issue.

...