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

DOLFIN encountered an error when I am using with Ubuntu

0 votes

When I am running an example on the terminal using python,

from dolfin import *
mesh = Mesh("../aneurysm.xml.gz")
V = FunctionSpace(mesh, "CG", 1)
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(0.0)
a = dot(grad(u), grad(v))dx
L = f
v*dx
u0 = Constant(0.0)
u1 = Constant(1.0)
u2 = Constant(2.0)
u3 = Constant(3.0)
bc0 = DirichletBC(V, u0, 0)
bc1 = DirichletBC(V, u1, 1)
bc2 = DirichletBC(V, u2, 2)
bc3 = DirichletBC(V, u3, 3)
if has_petsc():
PETScOptions.set("mat_mumps_icntl_14", 40.0)

u = Function(V)
solve(a == L, u, [bc0, bc1, bc2, bc3])
File("u.pvd") << u
plot(u, interactive=True)

I faced the following error message.

Traceback(most recent call last):
File "pois2.py", line 6, in
mesh=Mesh("../aneurysm.xml.gz")
File "/usr/python2.7/dist-packages/dolfin/cpp.py", line 9367, ininit
_cpp.Mesh_swiginit(self,_cpp.new_Mesh(*args))
RuntimeError:

*** -----------------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue using the information listed below, you can ask for help at

http://answers.launchpad.net.dolfin

Remember to include the error message listed below and, if possible, include a minimal running example to reproduce the error.

***--------------------------------------------
Error: Unable to read data from XML file.
Reason: Unable to open file "../aneurysm.xml.gz".
Where: This error was encountered inside XMLFile.cpp.

asked Feb 23, 2015 by Mohammed FEniCS Novice (120 points)

I presume you're using a pretty old version of dolfin, cause the help link shown above is http://answers.launchpad.net.dolfin, rather than fenics@fenicsproject.org. I would suggest you updating your dolfin.
About the error, the error denotes that it can't read the mesh file at '../aneurysm.xml.gz'. Have you checked whether the mesh file is in the right place or not?

...