CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] Using python script for automatic post processing of openFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Joshua14

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 14, 2017, 11:54
Default Using python script for automatic post processing of openFoam
  #1
New Member
 
Join Date: Apr 2017
Posts: 6
Rep Power: 9
vPaquet is on a distinguished road
Hi,

I'm having some problems with the automation of the post processing of my openFoam case..


1) can't run python script with parafoam but can open my openFoam case

2) can run python script with paraview but can't open my openFoam case

3) I dont know how to fully automate my script i just know how to use: tool-->python shell
is there a way to only use a script that: open paraview -> do stuff with python shell -> close paraview

Thanx!
vPaquet is offline   Reply With Quote

Old   June 14, 2017, 13:42
Default
  #2
Member
 
Joshua
Join Date: Dec 2016
Location: St. Louis, Missouri
Posts: 91
Rep Power: 10
Joshua14 is on a distinguished road
Have you tried running the script using pvpython?

You should be able to copy and paste your script into the python shell.

Joshua
Joshua14 is offline   Reply With Quote

Old   June 14, 2017, 13:50
Default
  #3
New Member
 
Join Date: Apr 2017
Posts: 6
Rep Power: 9
vPaquet is on a distinguished road
tool -> python shell is greyed in parafoam so i can't use it..
vPaquet is offline   Reply With Quote

Old   June 14, 2017, 13:52
Default
  #4
Member
 
Joshua
Join Date: Dec 2016
Location: St. Louis, Missouri
Posts: 91
Rep Power: 10
Joshua14 is on a distinguished road
Quote:
Originally Posted by vPaquet View Post
tool -> python shell is greyed in parafoam so i can't use it..
What version of Paraview are you using?

Joshua
Joshua14 is offline   Reply With Quote

Old   June 14, 2017, 14:03
Default
  #5
New Member
 
Join Date: Apr 2017
Posts: 6
Rep Power: 9
vPaquet is on a distinguished road
paraFoam 4.4.0 64bits Linux
vPaquet is offline   Reply With Quote

Old   June 14, 2017, 14:32
Default
  #6
Member
 
Joshua
Join Date: Dec 2016
Location: St. Louis, Missouri
Posts: 91
Rep Power: 10
Joshua14 is on a distinguished road
Quote:
Originally Posted by Joshua14 View Post
Have you tried running the script using pvpython?
What about this?

Joshua
Joshua14 is offline   Reply With Quote

Old   June 15, 2017, 06:22
Default
  #7
New Member
 
Join Date: Apr 2017
Posts: 6
Rep Power: 9
vPaquet is on a distinguished road
What's the difference between pvpython and python script?

I have use Cmake to put PARAVIEW_ENABLE_PYTHON = ON but python script is still greyed

When i launch my script from the bash: paraFoam --script=parapy04.py I get an error message : Python support not enabled. Cannot run python scripts.

Last edited by vPaquet; June 15, 2017 at 09:58.
vPaquet is offline   Reply With Quote

Old   June 15, 2017, 10:09
Default
  #8
Member
 
Joshua
Join Date: Dec 2016
Location: St. Louis, Missouri
Posts: 91
Rep Power: 10
Joshua14 is on a distinguished road
Quote:
Originally Posted by vPaquet View Post
What's the difference between pvpython and python script?
Say you have script.py

If you run "python script.py" then python is used to run the script.

If you do "pvpython script.py" then you use the paraview version of python that already has certain modules loaded into it.

On the other hand, pvbatch is the parallel version of pvpython.

Joshua
vPaquet likes this.
Joshua14 is offline   Reply With Quote

Old   June 15, 2017, 10:21
Default
  #9
Member
 
Joshua
Join Date: Dec 2016
Location: St. Louis, Missouri
Posts: 91
Rep Power: 10
Joshua14 is on a distinguished road
You might want to try looking at this CFD Online post:

Python Shell button is diabled

Joshua
Joshua14 is offline   Reply With Quote

Old   June 15, 2017, 10:52
Default
  #10
New Member
 
Join Date: Apr 2017
Posts: 6
Rep Power: 9
vPaquet is on a distinguished road
Yea I have seen this post but the problem is that I have is that paraview can't open my openFoam case correctly (only take 1/4 of the time steps and mix them up), but paraview have no problems running scripts.

So I use the paraview that was installed with openFoam (it can open my case without problems) but paraFoam cant run python scripts.. I have follow these steps to try to solve the situation but i didnt work: https://www.paraview.org/Wiki/ParaVi...iew_With_CMake
Reistalling paraFoam seems like a pretty intricate task, it's all mixed up in OF files!
vPaquet is offline   Reply With Quote

Old   June 15, 2017, 10:59
Default
  #11
Member
 
Joshua
Join Date: Dec 2016
Location: St. Louis, Missouri
Posts: 91
Rep Power: 10
Joshua14 is on a distinguished road
Try installing the newest version of paraview 5.3, 5.2 also works well. Either way they have more filters and options then version 4.4.

Joshua
Joshua14 is offline   Reply With Quote

Old   June 20, 2017, 08:32
Default
  #12
New Member
 
Join Date: Apr 2017
Posts: 6
Rep Power: 9
vPaquet is on a distinguished road
Now i have the version 5.4 of paraview installed but still got the same problem.
vPaquet is offline   Reply With Quote

Old   December 16, 2021, 04:30
Arrow
  #13
Senior Member
 
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10
foamiste is on a distinguished road
Please check this video, the automation in paraview is well explained:
https://youtu.be/h6Y7HZR_SAI
foamiste is offline   Reply With Quote

Reply

Tags
openfoam, parafoam, paraview, python


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PyFoam with Python Post Processing godfatherBond OpenFOAM Post-Processing 0 October 18, 2018 16:18
python script to create geometry for salome, and then mesh 6863523 Mesh Generation & Pre-Processing 4 March 18, 2017 10:00
Post processing in CFD Post or Fluent. Blobs OpenFOAM Post-Processing 2 June 26, 2016 08:23
Post processing from OpenFoam to Tecplot danielec87 Tecplot 2 August 14, 2012 15:19
CentFOAM Python Script Installation: Error socon009 OpenFOAM Installation 2 May 26, 2012 10:36


All times are GMT -4. The time now is 10:51.