How to devote series of data to corresponding timesteps in ParaView using programmable filter

I have about 10000 timesteps in my OpenFOAM case folder. I tried to add some grains to each time step to see them in the postprocessing animations. The grain specs are in .txt formats for each timestep. I have imported one of my data to ParaView by using related code in the docs, correctly.


I don’t know how to import and devote all data files to each corresponding timesteps. The number of data files are equal to the number OpenFOAM timesteps. I think this can be achieved using the docs’ another code, but I coud not find out how it works and how each data is read and devoted to each specified timestep (in my case, each data → each timestep). I would like to use programmable filter to do so programmatically with python. I am new to ParaView coding and would be appreciated if any one would show me how to doing so.

I would just read all the .csv file as a time series using the strandard CSV reader of ParaView.

Thank you for you response. I have tried to do so by CSV time series. When I open timesteps in ParaView, each of them place in integer time; e.g. if the OF case folder have result folders for each 0.1 seconds as 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 then the imported data as txt or csv will be placed in time as integers as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. So, only in time = 1, in this case, the imported data will match to the original case results and the time will be as 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9. it is shown in the following picture:

For the case with results in 1 seconds where results folder is as 1, 2, 3, 4, 5, 6, 7, 8, 9, if we import the timesteps’ data as above, the results will be matched for each time, except 0. So the time will be as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
How could I solve this problem for when timesteps’ data are for each OF case corresponding result folders where steps are each 0.001 s like.
The small sample code with steps is:
test.rar (3.4 MB)

If you would suggest to use .vtk, .vtu, .vtt or .pvd extensions, how could I do so?
My particles’ coordinates and their radii are exported as .txt from another software using NumPy. Which steps must I do to prepare ParaView readable such formats from that software. Could I export such readable formats directly from that software using python libraries or it needs additional works to convert and … the.txt files?

Now, I am trying to import .txt data files and export data as .pvd from ParaView, and then changing their timesteps in .pvd created file by using python. But, it seems not a good way.

Use a .series file :
https://blog.kitware.com/paraview-5-5-0-release-notes/

1 Like