[Dune] Exporting displacement field to VTK

Christian Engwer christian.engwer at uni-muenster.de
Tue Apr 14 11:02:20 CEST 2020


Hi Thomas,

> AFAIK the default implementation expects a flat vector, i.e. the entries can’t be blocked into a FieldVector<double,3>.
> 
> You can pass a custom VTKFunction instead that knows how to handle the nested type.
> For example there is a possible implementation in Dumux (https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/io/vtkfunction.hh <https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/io/vtkfunction.hh>)
> I don’t know if that’s too complicated for your needs.
> 
> There might be a solution with dune-functions. I’m not sure...

what you need to write yourself or what yuo can use depends on how yuo
implemented your discretization. All higherlevel discretization
modules offer functionality to interpret a coefficient vector as a
discrete function, which can then be visualized using VTK.

If you use `dune-functions` you can simply create `DiscreteGlobalBasisFunction` and pass this function to  the VTKWriter (e.g. see dune/functions/functionspacebases/test/lagrangebasistest.cc).

If you are using `dune-pdelab` you can create a `driscreteGridViewFunction`, which follows the same interface as in `dune-functions`, so passing it to VTKWriter looks the same...

Best
Christian




More information about the Dune mailing list