Comment 1 for bug 927539

Revision history for this message
Anders Logg (logg) wrote : Re: [Bug 927539] [NEW] Missing diagonals after subdomain assembly

I'm not sure this is a bug. There's no way we can prevent users from
assembling matrices with missing diagonal entries. Consider the
following example:

c = Expression("0.0")
A = assemble(Constant(c*dot(grad(u), grad(v))*dx)

That will give A = 0 which has all diagonal entries zero.

--
Anders

On Mon, Feb 06, 2012 at 10:47:33AM -0000, Joachim Haga wrote:
> Public bug reported:
>
> The matrix produced by subdomain assembly seems to not (always) include
> diagonal entries. PETSc says:
>
> [0]PETSC ERROR: --------------------- Error Message ------------------------------------
> [0]PETSC ERROR: Object is in wrong state!
> [0]PETSC ERROR: Matrix is missing diagonal entry in row 124!
> [0]PETSC ERROR: ------------------------------------------------------------------------
>
> I don't use this functionality, maybe this is fine ("user error"). But
> since PETSc apparently consider a matrix with missing diagonals an
> error, dolfin should probably not produce them.
>
> Reproduction: Put this at the end of the method
> test_subdomain_assembly_meshdomains() in
> test/unit/fem/python/SystemAssembler.py. Notice that there is no
> boundary active, so the problem isn't just that we're missing a diagonal
> we actually need for the DirichletBC.
>
> A = assemble(a0)
> def boundary(x): return False
> bc = DirichletBC(V, Constant(0.0), boundary)
> bc.apply(A)
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New
>