Save both CG and DG functions to the same file for Paraview

Hello everyone,

In legacy FEniCS, using XDMFFile it was possible to save both CG and DG functions in a single XDMF file for visualization in Paraview. This was handy for instance in mechanics to view the stress (DG) in the deformed configuration (CG displacement).
As far as I understand now, it seems that the preferred writer has switched to ADIOS2 with dolfinx, using VTXWriter. It can save multiple functions but only if they have the same element type, if I am correct?
Is there a way to replicate what could be done with XDMFFilein legacy dolfin, i.e. save both DG and CG functions to a unique file for visualization?

Thanks in advance,
Maxime

3 Likes

VTKFile and XDMFFile can save both DG and CG functions. VTXWriter can save CG functions. In the main branch, VTXWriter can also save DG functions but not together with CG functions yet.

You can find some examples here in this post:

When visualizing with Paraview, you should use Xdmf3_Reader_T for XDMF

1 Like

Thanks for your reply.

Still, even with the Xdmf3_Reader_T, when I warp the mesh using one function, it seems that I cannot add coloring with respect to another function. In the warped configuration only the function used to warp is available.

In any case, as XDMF is no longer supported I think it is time to switch to VTX, I can circumvent the lack of simultaneous support for CG and CG functions for now by projecting everything on a CG space. Hopefully writing functions with different interpolations will be possible in the future.

1 Like

There are two filters in paraview “Append Datasets” and “Merge datasets” that may be useful.

1 Like