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

Loading L-shape mesh in FEniCS 1.3

0 votes

Hello,

The command which was used in earlier releases is
mesh = Mesh("../lshape.xml.gz")

It doesn't work in FEniCS 1.3. How to make it work?

Thanks,

asked Jan 17, 2014 by John1977 FEniCS Novice (250 points)

I had no problems so far. What kind of error do you get?

The error message is the following:

Traceback (most recent call last):
File "lshap.py", line 34, in
mesh = Mesh("../lshape.xml.gz")
File "/usr/lib/python2.7/dist-packages/dolfin/mesh/meshes.py", line 68, in init
cpp.Mesh.cppinit(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/mesh.py", line 1572, in __init__
_mesh.Mesh_swiginit(self,_mesh.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


*** fenics@fenicsproject.org


*** 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 "../lshape.xml.gz".
*** Where: This error was encountered inside XMLFile.cpp.
*** Process: 0


*** DOLFIN version: 1.3.0
*** Git changeset: unknown

1 Answer

+1 vote
 
Best answer

I just tried the same with the 'lshape.xml.gz' which you can download on the FEniCS-website and everything worked fine with DOLFIN 1.3 and Python 2.7. Check that the file is actually there, that you have read privileges and that it is not corrupt in any way.

Using "../lshape.xml.gz" for the path it has to be one directory up from the directory where you run your script from. In any case, try to give the full path as an argument. If that works, then everything is fine with your distribution of FEniCS 1.3 and you just have to read about absolute vs. relative paths. If not, then there may be another problem, but I consider this highly unlikely, given the number of users without problems. If you cannot get this to run, then it might help to have more specific information about your environment, i.e., your OS; whether you are using a packaged version or a self-installed version of DOLFIN; the path from which you run your script (which may be another one than where FEniCS is installed) vs. the path where your mesh is located, etc.

edit: slightly extended answer

answered Jan 17, 2014 by Christian Waluga FEniCS Expert (12,310 points)
selected Jan 20, 2014 by Jan Blechta

Where should the /lshape.xml.gz file be located in my computer?
I have downloaded it to the same folder where FEniCS code is, but still I get the following error message:
Traceback (most recent call last):
File "lshap.py", line 34, in
mesh = Mesh("../lshape.xml.gz")
File "/usr/lib/python2.7/dist-packages/dolfin/mesh/meshes.py", line 68, in init
cpp.Mesh.cppinit(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/mesh.py", line 1572, in __init__
_mesh.Mesh_swiginit(self,_mesh.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


*** fenics@fenicsproject.org


*** 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 "../lshape.xml.gz".
*** Where: This error was encountered inside XMLFile.cpp.
*** Process: 0


*** DOLFIN version: 1.3.0
*** Git changeset: unknown
*** -------------------------------------------------------------------------

Thanks

Using "../lshape.xml.gz" for the path it has to be one directory up from the directory where you run your script from. In any case, try to give the full path as an argument. If that works, then everything is fine with your distribution of FEniCS 1.3 and you just have to read about absolut vs. relative paths.

Thank you so much. It works fine. I really appreciate your time

...