Reading mesh and functions from XDMF Timeseries


590
views
1
13 months ago by
Hello,
Can I use the XDMFFile Class to get the mesh and functions of an earlier written time series?
Minimum not working example with dolfin 2017.2.0.dev0 on debian:

#creating and saving mesh
from fenics import *

XDMFFile = XDMFFile("temp.xdmf")
mesh = BoxMesh(Point(0, 0, 0), Point(1, 1, 1),5,5,5)
XDMFFile.write(mesh)

V=FunctionSpace(mesh, 'P', 1)
u = Function(V)

#write function with timestamp.
XDMFFile.write(u, float(0))
​

and after resetting / new console:

from fenics import *
mesh = Mesh()
XDMFFILE = XDMFFile("temp.xdmf")
XDMFFILE.read(mesh)


Thanks for your help

Baltasar

The Error message:
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-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to recognise cell type.
*** Reason:  Unknown value "".
*** Where:   This error was encountered inside XDMFFile.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2017.2.0.dev0
*** Git changeset:  8a9b150311981abdcb72e808bd5b1657f2384aa4
*** -------------------------------------------------------------------------
​
Community: FEniCS Project

1 Answer


3
13 months ago by
The version of XDMF in the current interface is not suitable for restoring function values. You should look at the "HDF5File" interface instead.
So I have to save it twice, once for visualization and once for later acces? (I'll use the TimeSeries class and the XDMF File now)
written 13 months ago by Baltasar  
Unfortunately, that is the case - you must save as HDF5 and XDMF. The XDMF format is really only for visualisation, at present. We have a project currently to improve the situation.
written 13 months ago by Chris Richardson  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »