Bug in LocalAssembler when reorder_dofs_serial is turned off
Issue #578
resolved
I get different results out of the local assembler depending on whether reorder_dofs_serial is on or off. It seems like the behavior with reordering is correct, but when turning of reordering it is buggy.
I turn of reordering to be able to easier inspect and control global matrices for debugging. This bug is not major, but something to be aware of at least
The code below shows the bug. The code requires pull request #245 to run. The lines for method 1 and 2 are equal if dof reordering is on and different if dof reordering is off.
from dolfin import *
dolfin.parameters['reorder_dofs_serial'] = False
mesh = UnitSquareMesh(1, 1, 'right')
cell = Cell(mesh, 1)
n = FacetNormal(mesh)
V = FunctionSpace(mesh, 'DGT', 1)
v = TestFunction(V)
# Checkerboard initialization of known function w
w = Function(V)
for i in range(len(w.vector())):
w.vector()[i] = 1 + i%2
####################################################
# Method 1: Flux in UFL
u_hat_ds = w
u_hat_dS = avg(w)*w('+')
# Calculate linear form
L = u_hat_ds*v*ds
for R in '+-':
L += u_hat_dS*v(R)*dS
b = assemble_local(L, cell)
print 'Method 1, cell %d: %r' % (cell.index(), list(b))
####################################################
# Method 2: Flux in DGT
def project_to_dgt(u_hat_ds, u_hat_dS, V):
u = TrialFunction(V)
v = TestFunction(V)
a = u*v*ds
L = u_hat_ds*v*ds
for R in '+-':
a += u(R)*v(R)*dS
L += u_hat_dS*v(R)*dS
A, b = assemble_system(a, L)
u_hat = Function(V)
solve(A, u_hat.vector(), b)
return u_hat
u_hat = project_to_dgt(u_hat_ds, u_hat_dS, V)
# Calculate linear form
L = u_hat*v*ds
for R in '+-':
L += u_hat(R)*v(R)*dS
b = assemble_local(L, cell)
print 'Method 2, cell %d: %r' % (cell.index(), list(b))
Comments (4)
-
reporter -
reporter This is solved in pull request #244
-
reporter - changed status to resolved
The pull request has been merged into master
-
- removed milestone
Removing milestone: 1.7 (automated comment)
- Log in to comment
This is a combination of multiple problems
I am working on all of these now