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

Is CSG not working in 2D?

+1 vote

Hi,

I'm constructing a mesh using the CSG. I use this mesh when I try to solve a variational problem (i.e. "solve (a == L, u)")

In 3D, everything is fine, and I can solve my problem.

In 2D, however, the code crashes when I call the solve method.

I receive the following error message:

"Solving linear system of size 855 x 855 using Epetra LU solver (Amesos_Umfpack).
python: /home/oleel/Work/FEniCS/src/trilinos-11.4.1-Source/packages/amesos/src/Amesos_Umfpack.cpp:332: int Amesos_Umfpack::PerformNumericFactorization(): Assertion `status == 0' failed."

Does anyone know what is wrong? If I use the LU solver instead, I doesn't crash, but the "answer" is useless.

As said, in 3D, it works fine, and I am pretty sure that the problem is with the CSG constructer for 2D.

I run dolfin 1.3.0 (built with dorsal) on Ubuntu 12.04

asked Jan 30, 2014 by oleel FEniCS Novice (130 points)

Please, provide short and complete code demonstrating your problem.

Here is a running example. Please don't be put of by the import of the block-module. It is only because I use this in a different part of the code. If one doesn't import the block module (so that solve is called with the default solver), it will "solve" something, but the output only provides the values "nan".

from block import *
from block.iterative import *
from block.algebraic.trilinos import *
from dolfin import *

dim = 2
if dim == 2:
  c1 = Circle(0,0,.3)
  c2 = Circle(0,0, 1)
if dim == 3:
  c1 = Sphere(Point(0, 0, 0), .3)
  c2 = Sphere(Point(0, 0, 0),  1)

c = c2 - c1
mesh = Mesh(c, 10)
mesh = refine(mesh)

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

(u, c) = TrialFunction(W)
(v, d) = TestFunction(W)

f = Expression('10*sin(x[0])')

a = (inner(grad(u),grad(v)) + v*c + u*d)*dx
L = f*v*ds

U = Function(W)

solve(a == L, U)
(u,c) = U.split(True)

plot(u)
interactive()
...