[Dune] save FoamGrid mesh

Timo Koch timo.koch at iws.uni-stuttgart.de
Tue Apr 3 10:11:27 CEST 2018

Dear Ilya,

can you please ask such questions on the mailing list? This way others 
can profit from the answers too (and you'll probably get an answer 
faster, too).

For saving grids with associated data, we usually use the VTK format. 
You can use the VTKWriter / VTKSequenceWriter classes and their 
addCellData / addVertexData / write member functions for that. You can 
easily view them with paraview.

If you want to write out a grid with data and read it in again later the 
Dune Grid Format (DGF) is also an option. Use the class DGFWriter to 
write out your grid and create a Dune::GridPtr for reading the file 
again. There is also a Dune::GmshWriter now, so you can write to the 
Gmsh file format (*.msh). However, data attached to cells has to have 
integer format. So you attach a tag and store the data in a separate 
data file where the data is associated with this tag. I haven't tried 
but I would guess that these approaches preserve the ID set of 
non-adaptive / static grids.

The VTK, DGF, Gmsh formats don't preserve the hierarchical grid 
structure AFAIK (in case you use adaptive grids and you want to reload 
the exact hierarchical structure e.g. to pause and resume a simulation). 
For saving and reloading _adaptive_ grids you need to use the 
Dune::BackupRestoreFacility as you tried. Unfortunately, this feature 
is, at the moment, not implemented for FoamGrid.

Best regards,

On 31.03.2018 10:41, Ponomarev, Ilya wrote:
> Dear Timo,
> I have FoamGrid mesh 1d in 3d world and I need to save it to disk with 
> additional datafields associated with vertices and cells.
> As I understand I could use Dune::BackupRestoreFacility for mesh and 
> simple .txt for data, associated with id sets, but when I run program 
> I get the mistake:
> Dune reported error: NotImplemented 
> [backup:/home/ilya/program/DUNE_installed_on_this_computer/dune-grid/dune/grid/common/backuprestore.hh:51]: 
> backup / restore not implemented.
> How can I save my grid, when I would like to preserve id set?
> Best regards,
> Ilya


Timo Koch                              phone: +49 711 685 64676
IWS, Universit├Ąt Stuttgart             fax:   +49 711 685 60430
Pfaffenwaldring 61        email: timo.koch at iws.uni-stuttgart.de
D-70569 Stuttgart            url: www.hydrosys.uni-stuttgart.de

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20180403/5ada0fee/attachment.html>

More information about the Dune mailing list