CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   paraView in shell mode (python script running) (

Prosiaczek March 17, 2012 12:08

paraView in shell mode (python script running)
Dear all,

I'm looking for a method that helps me to run my *.py file under paraView without starting its GUI. Maybe you know how to solve it?

Roughly speaking, I try to automatize a process of meshing (in snappyHexMesh). Instead of running paraFoam after each process, I would like to produce some predefined screenshots, so I could compare it later by myself.

Until now, I've made a small script thanks to the macro tracking option (in paraView's GUI) and saved it into file and I know how to run it using Python shell when GUI is available, but since I will work remotely on a server which is equipped with extremely low bandwith I need another way to produce those pictures. Just to stress the problem is the fact that I need about 15 min only to run GUI via Xterm (Cygwin), not mentioning that I need to load the mesh and probably rotate it or cut it... which takes another 15 (or more) minutes.

I would appreciate any help. Thanks in advance.

MartinB March 17, 2012 15:19

Hi Andrzej,

you can start Python scripts for Paraview with the "pvbatch" command via ssh.

Depending on the Paraview installation on the server side it might be necessary to compile Paraview there with OSMesa (CPU based offscreen rendering) and Python enabled. The Paraview directory to the location of "pvbatch" must be known by the servers system, of course.

An easy way to to create the scripts is to use your macro as a starting point. Especially the camera settings are useful. Then add more Python code as necessary, a good source of knowledge can be found here:


elvis March 19, 2012 08:54


as all visualisation is based on "VTK" you might also take a look at mayavi2 as well =>scripting
foamToVTK can convert you shm to vtk-files that can be viewed by mayavi or visit

All times are GMT -4. The time now is 21:32.