How to periodically output vtk files without overwriting previous results?

Asked by weijie on 2020-10-05

Dear all,

In the process of exporting the force chain, I found that the output result cannot be saved in a certain time step, and the previous result will be overwritten. What should be done so that the results of different time steps can be saved periodically?

Thanks in advance.
Jie

Here's MWE:
############
def vtkExport():
    export.VTKExporter('vtk/forcechain').exportInteractions(ids=intrs,what=dict(forceN='i.phys.normalForce.norm()'))
O.engines=O.engines+[PyRunner(iterPeriod=500, command='vtkExport()',firstIterRun=60000)]

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2020-10-05
Last query:
2020-10-05
Last reply:
2020-10-05
Best Jan Stránský (honzik) said : #1

Hi,

create one instance of VTKExporter (not every time a new one), it increase internal "counter" and therefore does not overwrite the existing files.
############ [1]
vtk = export.VTKExporter('vtk/forcechain')
def vtkExport():
    vtk.exportInteractions(ids=intrs,what=dict(forceN='i.phys.normalForce.norm()'))
O.engines ...
###

cheers
Jan

[1] https://yade-dem.org/doc/yade.export.html#yade.export.VTKExporter

weijie (amandajoe) said : #2

Thanks Jan Stránský, that solved my question.