mantrasuser3
mantrasuser3

Reputation: 99

Is it possible to load OpenFOAM solution file using ParaView Python Shell without using GUI?

I have OpenFOAM solution file obtained on HPC (cluster computer system) in which I have no GUI access. I have Python code that works on Python Shell of ParaView without any problem but I need to open ParaView to use the code. I want to run this Python code on HPC and calculate some parameters using ParaView Python ability. Is it possible to do this without activating GUI of ParaView?

Upvotes: 1

Views: 910

Answers (1)

Jackpap
Jackpap

Reputation: 7974

Yes of course. You can generate a python trace in ParaView (Tools-> Start Trace). This will help you find out what code you are missing :

from paraview.simple import * 

casefoam = OpenFOAMReader(FileName='/path/to/case.foam')
casefoam.MeshRegions = ['internalMesh']
casefoam.CellArrays = ['U']
casefoam.CaseType = 'Decomposed Case'

etc....

Then you can use the pvbatch utility to run this. However, if you are going to run it on a cluster environment where the nodes don't have access to X then you need to make sure pvbatch was compiled with off-screen rendering capability using either EGL or OSMesa.

Upvotes: 1

Related Questions