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

Saving Parallel Mesh

0 votes

When running in parallel, I can't seem to save the mesh (I have no problem saving the solution to my PDE). Based on another post, I tried:

File('mesh.xdmf') << mesh

But I get the error:

Traceback (most recent call last):
  File "./var1.py", line 39, in <module>
    File('mesh.xdmf') << mesh
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dolfin/cpp/io.py", line 652, in __init__
    _io.File_swiginit(self,_io.new_File(*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 open file.
*** Reason:  Unknown file type (".xdmf") for file "mesh.xdmf".
*** Where:   This error was encountered inside File.cpp.
*** Process: unknown
*** 
*** DOLFIN version: 1.5.0
*** Git changeset:  
*** -------------------------------------------------------------------------
asked May 21, 2015 by gideonsimpson FEniCS Novice (510 points)

1 Answer

0 votes

It would seem like you have installed FEniCS without HDF5. The xdmf-files used in FEniCS is purely a description of the data stored in an associated HDF5-file (like pvd and vtu-files).

Clipped from File.cpp:

[snip]

#ifdef HAS_HDF5
    else if (extension == ".xdmf")
        file.reset(new XDMFFile(comm, filename));
#endif

[snip]

else
{
  dolfin_error("File.cpp",
                     "open file",
                     "Unknown file type (\"%s\") for file \"%s\"",
                     extension.c_str(), filename.c_str());
}

If you reinstall FEniCS with HDF5, everything should work as expected.

answered May 21, 2015 by Øyvind Evju FEniCS Expert (17,700 points)
...