Dear All.
I have different FEM results (continuous and discontinuous) that I save together in a VTU file.
For each selected time instant I generate a new VTU file.
Is there a way in GetFEM to save multiple time frames in a single VTU file?
I think this question is mostly about ParaView than GetFEM. Sure you can store several time step in a single VTU file, but you will have to name them differently:
that allows to put all the time steps together and open them in Paraview at once.
Originally, I was not thinking at Paraview but at PyVista instead.
In PyVista I just discovered that there’s the chance to make a single MultiBlock file .pvd with all the .vtk/.vtu time steps together
I was wondering what is the good practice with GetFem to do the same and if I need to use the above mentioned methods or maybe if there’s another better way to proceed.
E.g. at the end of your simulation you can create the pvd file like this:
with open(f"{resultspath}/postproc.pvd", "w") as f:
f.write('<?xml version="1.0"?>')
f.write('<VTKFile type="Collection" version="0.1"')
f.write(' byte_order="LittleEndian">')
f.write(' <Collection>')
for step in range(len(progress)):
f.write(f' <DataSet timestep="{stored_times[step]}" group="" part="0"')
f.write(f' file="simulation_results_{step}.vtu"/>')
f.write(' </Collection>')
f.write('</VTKFile>')
Regarding pyvista, be a bit careful with it. Last time I checked, its support for second order elements was not that great. In general when you visualize second order finite element results with ParaView you should always be using some larger value for Nonlinear Subdivision Level than the default of 1.