Issue with importing the mesh of navier-stokes Demo

Hi,
I am trying to run the navier-stokes demo but I face the following error:
I have put the “…/lshape.xml.gz” file and its extract inside a folder that contains the demo_navier-stokes.py .( beside the demo_navier-stokes.py )

I would be thankful if you could help me where should i put the mesh file so the fenics can read the mesh?

mhd@mhd-N552VW:~/Desktop/navier-stokesa$ python demo_navier-stokes.py
Traceback (most recent call last):
File “demo_navier-stokes.py”, line 36, in
mesh = Mesh(“…/lshape.xml.gz”)
RuntimeError:

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

First, it may be a typo that there are three dots instead of two at the beginning of the file path for the mesh. (In the current stable version, the path is "../lshape.xml.gz".) Second, the file lshape.xml.gz should be in the directory containing your current working directory when you run the script (i.e., if you typed cd .., you would be in the directory containing the mesh).

Thank you for your reply,

  1. It has 2 dots and also by changing it into 3 dots the error is simmilar.
  2. The file lshape.xml.gz is in the directory that i run the script.

The file lshape.xml.gz should be in the directory “above” the one in which you run the script, e.g., if the script is in foo/bar/, the mesh should be in foo/ (which is also foo/bar/../).

2 Likes

Thanks alot Mr. kamensky,
The problem solved.