|
[Sponsors] |
[OpenFOAM] Python script to export animation images |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 3, 2013, 10:33 |
Python script to export animation images
|
#1 |
New Member
Mahyar
Join Date: Jun 2013
Posts: 3
Rep Power: 13 |
Hey everyone,
I am new to CFD and having a bit of trouble. My goal is to export the animation from ParaView as a video file or a series of images using some kind of script. The only way that I know how to export images is to manually go and click to export the images. I want to have a script that automatically does this so it would be more efficient. My current version of ParaView is 3.12.0 32-bit. I tried using this link http://paraview.org/Wiki/ParaView/Python_Scripting to setup the python to work with the ParaVeiw, but no success. I could not find the path(s) that were mentioned on the tutorial. Any help is appreciate. Thanks, Mahyar |
|
June 3, 2013, 13:33 |
|
#2 |
New Member
Mahyar
Join Date: Jun 2013
Posts: 3
Rep Power: 13 |
So I tried using the Trace option in ParaView but I get the following error:
from paraview.simple import * Traceback (most recent call last): File "<console>", line 1, in <module> File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module> import servermanager File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module> import paraview, re, os, os.path, new, sys, vtk File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module> from vtkCommonPython import * ImportError: No module named vtkCommonPython I cannot find vtkCommonPython anywhere on my system. |
|
June 3, 2013, 20:36 |
|
#3 |
Senior Member
Jose Rey
Join Date: Oct 2012
Posts: 134
Rep Power: 18 |
|
|
June 4, 2013, 07:56 |
|
#4 |
Member
Join Date: Nov 2012
Posts: 58
Rep Power: 14 |
Hello! Even though the easiest manner is to use JR22's method, it is sometimes not possible. When I leave work, I only have remote access to a windows machine and through that to the cluster server (yeap, those lovely security restrictions lead to inefficient situations). Therefore, the best way to see the results when I am away is to develop a paraview script to post-process.
So, I find the OP's question for a script meaningful and did not have the time to work on it myself. Does someone have something ready to share or some guidelines? |
|
June 4, 2013, 10:13 |
|
#5 |
Senior Member
|
Hi
what about "Advanced Paraview Tutorial", by Dave DeMarle, Kitware, Inc. given on the 6th Openfoam workshop? http://openfoam-extend.sourceforge.n...m/training.htm |
|
June 4, 2013, 10:32 |
|
#6 |
New Member
Mahyar
Join Date: Jun 2013
Posts: 3
Rep Power: 13 |
I was able to solve the vtkCommonPython error by uninstalling ParaView 3.12 and installing a newer version. Now, I have used the Trace option to get a script from ParaView.
My main goal is to have a script run automatically once it detects the output files from OpenFOAM. It should basically create the vtk files, open them with ParaView, and output a video of the simulation to a specified directory. Currently, I am somewhat stuck on calling Terminal commands in Ubuntu via a python script. First, I have changed my directory using os.chdir(/path/to/files) Then, I used os.system("paraFoam") in order to open ParaView from a directory but it says "sh: 1: paraFoam: not found" |
|
May 21, 2014, 20:53 |
|
#7 | |
Member
CFDUser
Join Date: Mar 2014
Posts: 59
Rep Power: 13 |
Quote:
Did you get any success? I am also trying to do the same. If you found the path will you guide me? Regards, CFDUser_ |
||
May 25, 2014, 08:01 |
|
#8 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
For future reference, the issue with the missing vtkCommonPython was reported here: http://www.openfoam.org/mantisbt/view.php?id=969 - a fix is also provided there. As for CFDUser's question and Mahyar's issue: if a more detailed script had been provided, it would possibly had been easier to help. Anyway, as far as I can see:
Bruno
__________________
|
|
May 25, 2014, 21:19 |
|
#9 | |
Member
CFDUser
Join Date: Mar 2014
Posts: 59
Rep Power: 13 |
Quote:
Regards, CFDUser_ |
||
July 10, 2014, 13:54 |
|
#10 | |
Senior Member
Join Date: Jan 2013
Posts: 372
Rep Power: 14 |
Dear Bruno,
I am wondering if I can post-processing my data using Paraview script. For example, I need to the following action for each time step: Code:
output the velocity components on one slice to CSV file I read the following link: http://www.paraview.org/Wiki/ParaView/Python_Scripting But it is very difficult to understand for me now. Do you have any suggestions? Thank you. OFFO Quote:
|
||
August 16, 2014, 12:11 |
|
#11 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi OFFO,
Quote:
If not, perhaps it's easier if you explain what you've already learned so far in using ParaView Python, so that I can figure out what needs to be explained. Best regards, Bruno
__________________
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] Close Paraview after python script execution | taalf | ParaView | 4 | August 29, 2019 22:29 |
[General] Generating isosurface from vtk file with python script | Leios | ParaView | 1 | March 26, 2018 13:33 |
A CFX-POST error (ver 14.5.7) | wangyflp88 | CFX | 2 | July 22, 2017 01:17 |
[General] Python script: Auto-scale color scale | julien.decharentenay | ParaView | 2 | December 9, 2013 06:39 |
Animation - error - fieldview export | Prasad Dudhgaonkar | FLUENT | 0 | May 26, 2007 07:07 |