CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [General] How can I use python script to generate animation from 2000 frames of vtk datasets (https://www.cfd-online.com/Forums/paraview/167738-how-can-i-use-python-script-generate-animation-2000-frames-vtk-datasets.html)

LieyuShi March 7, 2016 17:40

How can I use python script to generate animation from 2000 frames of vtk datasets
 
1 Attachment(s)
Hi,
I'm a beginner in Paraview. I just generated 2000 frames of vtk data for fluid simulation. I have separately uploaded files in Paraview and was able to see the image. I have two concerns
1. How can I use shell script to automatically generate animation from these datasets? Can Paraview achieve that with some piece of python code?
2. If the answer for above is no, can I write a script to automatically upload and save screenshots of each dataset respectively? I could only manually save screenshots from GUI.

Can somebody kindly help me with that? I was still learning Python script and searched materials online for that. Attached is one of my manually generated figure for fluid.

https://drive.google.com/drive/my-drive

Flowkersma March 10, 2016 09:02

Hi,

I think the easiest way is to rename the files such that they are foo0001.vtk, foo0002.vtk, foo0003.vtk, ..., foo2000.vtk and move all files to same directory. Then from ParaView GUI press Open and browse to the directory and you should see a filename called foo..vtk which loads all the timesteps. Now, you should be able to create an animation by pressing "Save Animation".

Regards,
Mikko

Quote:

Originally Posted by LieyuShi (Post 588552)
Hi,
I'm a beginner in Paraview. I just generated 2000 frames of vtk data for fluid simulation. I have separately uploaded files in Paraview and was able to see the image. I have two concerns
1. How can I use shell script to automatically generate animation from these datasets? Can Paraview achieve that with some piece of python code?
2. If the answer for above is no, can I write a script to automatically upload and save screenshots of each dataset respectively? I could only manually save screenshots from GUI.

Can somebody kindly help me with that? I was still learning Python script and searched materials online for that. Attached is one of my manually generated figure for fluid.

https://drive.google.com/drive/my-drive


LieyuShi March 10, 2016 13:28

Hi,
Thanks for your kind reply. It really works!!! I never image it can that easy to create an animation... Actually I spent a long time writing script and trying to make it work... Thanks greatly

LieyuShi March 10, 2016 13:37

Hi,
Thanks greatly. I never imagine it to be this easy. Actually I spent days in writing the script file to manage load, transformation and save.. Thanks man

Best

Lieyu
Quote:

Originally Posted by Flowkersma (Post 589015)
Hi,

I think the easiest way is to rename the files such that they are foo0001.vtk, foo0002.vtk, foo0003.vtk, ..., foo2000.vtk and move all files to same directory. Then from ParaView GUI press Open and browse to the directory and you should see a filename called foo..vtk which loads all the timesteps. Now, you should be able to create an animation by pressing "Save Animation".

Regards,
Mikko



All times are GMT -4. The time now is 08:17.