assembling over subspace fails - create a better error message

Issue #199 new
Nico Schlömer created an issue

When assembling a form over a subspace, e.g., W.sub(0), the assembler will cowardly bail out.

MWE:

from dolfin import *

mesh = UnitSquareMesh(20, 20)

V = FunctionSpace(mesh, 'CG', 1)
W = V * V

print V
print W.sub(0)

u = TrialFunction(W.sub(0))
v = TestFunction(W.sub(0))
assemble(u * v * dx)

fails with

[0]PETSC ERROR: Arguments are incompatible!
[0]PETSC ERROR: Local column size 882 cannot be larger than global column size 441!

Comments (12)

  1. Prof Garth Wells

    W.sub(0) provides a view into the FunctionSpace W, which is the cause the problem. We'll need to dig into the code to find a resolution.

    We have had other issues with the distinction between FunctionSpaces and views into FunctionSpaces. Maybe we should make a FunctionSpace view a different type.

  2. Jan Blechta

    @nschloe What would you like to assemble? A matrix whose rows and columns are indexed by a subset of {0, 1, 2, ..., W.dim()-1}?

  3. Nico Schlömer reporter

    @blechta I would have expected to get the same matrix as for assembling over V since it appears to be really the same as W.sub(0).

  4. Prof Garth Wells

    It could be that this threw an error in the past, but that since Johan added the dof ownership range to sub-maps it allocates a vector of the wrong length. Needs some digging.

  5. Log in to comment