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

Segfault in LocalSolver - user error or bug?

0 votes

Hi,

I am trying to use the local solver to perform a projection similar to BDM on a velocity field. The equation system is not square globally, but it is square locally on each element. For the reduced test case below the equation system is 6x6 locally.

The documentation of LocalSolver is rather sparse and on my real code I get NaN answers, while for the simplified code below I get segfaults (with FEniCS 1.6). I may be using the LocalSolver in a wrong manner (I do not quite understand the difference between solve_local_rhs and solve_global_rhs, but with the code below both gives segfaults).

I know the matrix of the real problem is well defined locally. I have my own local solver and assembler in Python which work, but are very slow even with pypy. Have I misunderstood how to use the LocalSolver or is there a bug that should be reported?

from dolfin import *

mesh = UnitTriangleMesh()
#mesh = UnitSquareMesh(1, 1)

Vu = VectorFunctionSpace(mesh, 'DG', 1)
Vv = FunctionSpace(mesh, 'DGT', 1) 
u = TrialFunction(Vu)
v = TestFunction(Vv)

n = FacetNormal(mesh)
w = Constant([1, 1])

a = dot(u, n)*v*ds
L = dot(w, n)*v*ds
for R in '+-':
    a += dot(u(R), n(R))*v(R)*dS
    L += dot(w(R), n(R))*v(R)*dS

A = assemble(a)
b = assemble(L)
U = Function(Vu)

if True:
    ls = LocalSolver(a, L)
    ls.solve_local_rhs(U)
else:
    solve(A, U.vector(), b)

print U.vector().array()
asked Sep 14, 2015 by Tormod Landet FEniCS User (5,130 points)

1 Answer

0 votes
 
Best answer

After compiling FEniCS from source I found the error. (Great work on fenics-install-all.sh by the way, worked perfectly!)

LocalSolver does not currently support facet integrals and contains the lines

integral_a = ufc_a.default_cell_integral;
dolfin_assert(integral_a);

The second line will fail since there is no facet integral in the form. Some work to be done here I guess ...

UPDATE: started working on this, see bug report

answered Sep 16, 2015 by Tormod Landet FEniCS User (5,130 points)
selected Sep 17, 2015 by Tormod Landet
...