dump_modify command

Submitted by PRASHANT KUMAR JHA on Thu, 08/24/2023 - 14:03

dump dmp all custom/vtk 1000 post2/particle_*.vtk id type x y z vx vy vz
dump_modify dmp every 1000 format "%d %d %.16g %.16g %.16g %.16g %.16g %.16g"
This modify command not working. I want to modify my dump file precision value.

Daniel Queteschiner | Thu, 08/24/2023 - 15:56

The dump_modify format option is not supported for dump custom/vtk (that should probably be clarified in the manual). The reason is the usage of VTK library functions for writing the output and (if I remember correctly - it's been some time since I implemented it) it would be rather tedious to customize the formatting/precision (as there is no functionality for that in the VTK library), e.g. instead of a simple call to
vtkPolyDataWriter::Write()
it would require smth like
fp = vtkPolyDataWriter::OpenVTKFile(...)
fp.precision(...);
vtkPolyDataWriter::WritePoints(...)
fp.precision(...);
vtkPolyDataWriter::WriteCells(...)
fp.precision(...);
vtkPolyDataWriter::WriteCellData(...)
fp.precision(...);
vtkPolyDataWriter::WritePointData(...)
...

PRASHANT KUMAR JHA | Fri, 08/25/2023 - 13:27

Thank you so much for your valuable reply. I found the file: vtkPolyDataWriter.cxx in the VTK library , but i am not getting what to do exactly. It is very crucial for my Phd work.

Thanking you in advance.

Daniel Queteschiner | Sun, 08/27/2023 - 10:27

You don't really want to modify the VTK library. Instead you want to modify the LIGGGHTS implementation. In case of simple text vtk files (as opposed to xml based files), the function in question is here
https://github.com/CFDEMproject/LIGGGHTS-PUBLIC/blob/master/src/dump_vtk...
Instead of
writer->SetFileName(filename);
writer->Write();
You would implement the procedure I mentioned above ...
However, I suppose it might be easier for you to just use the native LIGGGHTS/LAMMPS output format, i.e. the dump custom command where the dump_modify format command should work as desired ...