Hi, I’d like to visualize multiple functions using a single xdmf file. I tried
with XDMFFile(MPI.comm_world, 'filename.xdmf') as file:
file.write(u, 0.)
file.write(rho, 0.)
where u is a vector field and rho is a scalar field.
I want to check coloring contour on a deformed shape with the vector field u, but there are two issues:
First, I cannot find a scalar field
Second, there is another vtk composite blocking the fields I want to see.
And if I want to save the save two variables in different time-step and to memorize all of them? If I insert this expression in a while loop it overwrites the solutions each time.
Thank you in advance
I am looking to reproduce this multi-function saving in dolfinx. If I understand correctly, I need to run both write_mesh and write_function? What if some functions are defined on refined versions of the meshes used for other functions? Can they still be saved in the same file?
I would not save multiple meshes to the same file (I do not think it is supported).
You should save functions for the unrefined mesh to one file, and functions on the refined mesh in another file.
Without a minimal code example it is hard to give you any pointers. In general the XDMFFile code is completely rewritten, so that to save a function it has to be associated with a mesh, see dolfinx/XDMFFile.h at main · FEniCS/dolfinx · GitHub