Skip to content

Incorrect assembly of surface integrals when diagonal=True #2300

@pbrubeck

Description

@pbrubeck

Consider a form that only depends on the jump of CG(1) test and trial functions.
Calling assemble(a, diagonal=False) gives a matrix of zeros, which is the expected output.
On the other hand, assemble(a, diagonal=True) gives non-zeros. For DG(1), the diagonal is also incorrectly computed.

Here is the minimal failing example:

from firedrake import *

mesh = UnitIntervalMesh(2)
V = FunctionSpace(mesh, "CG", 1)

u = TrialFunction(V)
v = TestFunction(V)
n = FacetNormal(mesh)
outer_jump = lambda w, n: outer(w('+'), n('+')) + outer(w('-'), n('-'))
a = inner(outer_jump(v, n), outer_jump(u, n)) * dS
A = assemble(a)
print(A.petscmat.view())

diag = assemble(a, diagonal=True)
with diag.dat.vec as x:
    print(x.view())

Giving the output:

Mat Object: 1 MPI processes
  type: seqaij
row 0: (0, 0.)  (1, 0.)  (2, 0.) 
row 1: (0, 0.)  (1, 0.)  (2, 0.) 
row 2: (0, 0.)  (1, 0.)  (2, 0.) 
None
Vec Object: 1 MPI processes
  type: seq
0.
2.
0.
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions