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

[OpenFOAM] using the python shell in paraFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By wyldckat
  • 1 Post By wyldckat
  • 1 Post By louisgag

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 4, 2013, 07:28
Default using the python shell in paraFoam
  #1
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19
colinB is on a distinguished road
Dear Foamers,

I encountered a problem which puzzles me now for already some days
and I couldn't get a satisfying solution.

Before I start with a description of my problem I give you some details
about my system:

  • OS: Ubuntu 12.04 LTS
  • OpenFoam: 2.1.1 and the latest: 2.2.1 with aliases (the 2.1.1 I use for some older cases which I still have)
  • paravieopenfoam: 3.12.0 along with the same version of paraview
  • the output of python --version is: Python 2.7.3

The goal:My goal is it to use the python shell of paraview and/or the trace
function of paraview to generate unified output of openfoam results.

The problem: with paraview the trace function works good and gives me a
nice script. The python terminal starts up fine however prints an error
message saying:

Code:
Import Error: /usr/lib/paraview/libvtkPVVTKExtensionsPythonD.so: undefined symbol [some weird string]
hitting Enter the regular shell starts up and can be used.

with paraFoam however the trace function returns me an empty editor
and apparently hasn't done anything. And the python shell returns me the
same error message.

I read a lot in the forum the last days and my conclusion is
that when paraview is installed with openfoam it doesn't have all features
which are available, such as the python shell.
Then I came across the blog posts of Bruno which describe in detail
what to do and so on.
However at some point I always got lost, whether the command

Code:
rm -rf $ParaView_DIR
says I have no permission to delete the folders
or the command

Code:
ls $ParaView_DIR
points to the current directory where I'm in and I dare not to delete
that one.
Or I do not find the directories where the bashrc files are stored nor
the line which has to be replaced or whatever.

I'm actually sure that I already stumbled over the solution at some point
but couldn't identify it or didn't know how to apply it to my case.
So my actual request is if somebody could point me to the right
direction.
If I'm wrong and this problem is new I'm glad if someone can point out
the way to the solution.

If you're missing some information let me know I will post it right away.

so far thx for your trouble
regards
Colin
colinB is offline   Reply With Quote

Old   September 7, 2013, 12:52
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Colin,

I only read a bit of your post, but I think I'm familiar with this problem. See the following links:
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   September 10, 2013, 06:11
Default
  #3
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19
colinB is on a distinguished road
Dear Bruno

thanks for your reply, after applying your "hack"
the python shell starts up smoothly when using
paraFoam.

Still when using the trace tool with paraFoam I have troubles:

paraFoam gets incredibly slow.
I tried first to get the free surface
( I'm doing a ship hull analyses with LTSInterFoam)
with the internal mesh (3.8 M cells) and it took
ages both using the trace tool and not using it.
The computer used approx. 2.8 GB of RAM and one core
had 100% load.

Then suspecting that the amount of data is too much. I only
loaded the hull patch to get the phase fraction
and without using the trace tool it worked fine, but still taking
quite some time, however when using the trace tool again
it takes ages (same symptoms as afore mentioned.)

Hence my question is:
is this slow down a logic consequence of using the new libraries
or is this another feature of paraFoam.

Again thanks for your trouble
regards
Colin
colinB is offline   Reply With Quote

Old   September 10, 2013, 17:56
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Colin,

It's a bit complicated to figure this one out, without having a test case.

Are you able to reproduce the same issue with one of OpenFOAM's tutorials?
Perhaps after some minor modifications to one of the tutorials?

Because if you are and if you can describe the steps at which the slow part occurs, I can better check this for myself and confirm if there is any solution for this.


Beyond that, my guesses are:
  1. Usually tracing/debugging can lead to having a slower execution, given that it has to log and interpret each step we take. So this is one hypothesis.
  2. I remember that the resulting script usually has got a lot more information than the actual steps I've taken, such as registering which camera position is was in and what colours were being used. So perhaps there is a lot of information being collected.
  3. It might be spending more iterations in refreshing the screen (and/or rendering), because the tracing might be forcing it to refresh more times than actually needed.
  4. If you are using the ".OpenFOAM" file extension, then you might be hitting one of the limitations of the official OpenFOAM reader for ParaView. You can try using the ".foam" file extension, in order to use the internal reader, which should be more efficient. You can quickly use it by simply running:
    Code:
    paraFoam -builtin
  5. You can try turning on the multi-core feature that ParaView has got, if it was built with MPI capabilities, which is accessible at the Settings dialogue, namely the check box "Use Multi-Core": http://www.paraview.org/Wiki/ParaVie...Guide/Settings
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   September 12, 2013, 10:07
Default
  #5
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19
colinB is on a distinguished road
Hi Bruno,

thanks again for your help. I'm still investigating and it will also
take some more time for my vacation are upcoming,
however I have some intermediate results which I want to share:

  • paraFoam -builtin doesn't solve the problem
  • I was not capable of reproducing the problem with a tutorial case
  • the mpirun button is blanked out for paraFoam but not for paraview
I tried to use the weirOverflow tutorial to reproduce the problem by
increasing the number of cells up to over 5M. Moreover I made it a 3D case
with two symmetry planes instead of the empty patches, however
paraFoam worked smoothly (and the trace function of paraFoam)

The only difference between my mesh and the one from the tutorial is
that I used sHM and the tutorial only blockMesh. So maybe the slow
down is due to the unstructured mesh that I use.

In my particular case the slow down occured after choosing to display
the alpha1 values on the surface. To see whether I works or aborts
I let it load over night and I could figure out it really loads, but as
said before it takes ages.

The script I could make with this long tracing process, is working fine
and doing the process much faster (like the normal time you would
expect).

I hope I could clarify my problem a little bit
again thanks for your efforts

kind regards
Colin
colinB is offline   Reply With Quote

Old   September 14, 2013, 11:54
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Colin,

Well, without a test case I can't test this myself.
The only suggestion left is to try with one of the latest ParaView versions from www.paraview.org and to use it instead of the default ParaView version that OpenFOAM uses.

To use it:
  1. Simply unpack the binary package for Linux version wherever you want.
  2. Start a new terminal and do not activate any OpenFOAM environment.
  3. Go into the folder that has got this independent ParaView version, namely into the "bin" folder it has got.
  4. Run:
    Code:
    ./paraview
  5. On another terminal, go into your case folder, with an active OpenFOAM environment and run:
    Code:
    paraFoam -builtin -touch
  6. Then on the ParaView that is open, choose to open the file create by the previous command, e.g. "case.foam".
Now test things out, to see if the same error occurs. With any luck, it works without any problem.

Best regards,
Bruno
immortality likes this.
__________________

Last edited by wyldckat; September 14, 2013 at 14:01. Reason: typo
wyldckat is offline   Reply With Quote

Old   September 15, 2013, 04:47
Default
  #7
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
Hi Bruno
I installed 4.0.1 version.its really better and is saving animations now,
it makes a movie automatically if select .ogv concurrently with saving images in the folder.
how can replace it to 3.12.0 and delete that so that there be more space on disc? thanks.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   September 15, 2013, 05:53
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Ehsan,

This is an old blog post of mine, but it should still work just fine: Using the official pre-built ParaView 3.10.1 version with OpenFOAM - keep in mind that you can skip the "download" step (the one that uses wget).

But honestly, I strongly suggest to not erase the current ParaVew 3.12.0 version you've got. This is because ParaView 4.0.1 also has it's own bugs, which ParaView 3.12.0 doesn't have.

Instead, if you want an easy way to launch this new ParaView version, add and adapt the following file into your "~/.bashrc" file:
Code:
alias paraFoam4='(. $WM_PROJECT_DIR/etc/config/unset.sh; touch case.foam && /full/path/to/your/new/ParaView/bin/paraview --data=case.foam)'
Save and close the file and then start a new terminal. You can then choose to launch the new ParaView version by running:
Code:
paraFoam4
Best regards,
Bruno
immortality likes this.
__________________
wyldckat is offline   Reply With Quote

Old   September 15, 2013, 06:38
Default
  #9
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
Bruno I want to use -builtin
this is the error displayed in terminal:
Code:
ehsan@Ehsan-com:~$ paraFoam4 -builtin
bash: syntax error near unexpected token `-builtin'
ehsan@Ehsan-com:~$ paraFoam4
ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/IO/XMLParser/vtkXMLParser.cxx, line 483
vtkPVXMLParser (0x1785a50): Error parsing XML in stream at line 74, column 6, byte index 3360: unclosed token


ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/IO/Geometry/vtkOpenFOAMReader.cxx, line 8464
vtkPOpenFOAMReader (0x305ec80): /home/ehsan/case.foam contains no timestep data.


ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/Common/ExecutionModel/vtkExecutive.cxx, line 754
vtkPVCompositeDataPipeline (0x3066de0): Algorithm vtkPOpenFOAMReader(0x305ec80) returned failure for request: vtkInformation (0x306fbd0)
  Debug: Off
  Modified Time: 111082
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_INFORMATION
  FORWARD_DIRECTION: 0
  ALGORITHM_AFTER_FORWARD: 1
and its the error in paraview "Output Messages"
Code:
ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/IO/Geometry/vtkOpenFOAMReader.cxx, line 8464
vtkPOpenFOAMReader (0x305ec80): /home/ehsan/case.foam contains no timestep data.


ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/Common/ExecutionModel/vtkExecutive.cxx, line 754
vtkPVCompositeDataPipeline (0x3066de0): Algorithm vtkPOpenFOAMReader(0x305ec80) returned failure for request: vtkInformation (0x306fbd0)
  Debug: Off
  Modified Time: 111082
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_INFORMATION
  FORWARD_DIRECTION: 0
  ALGORITHM_AFTER_FORWARD: 1
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   September 15, 2013, 06:54
Default
  #10
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
Quote:
This is an old blog post of mine, but it should still work just fine: Using the official pre-built ParaView 3.10.1 version with OpenFOAM - keep in mind that you can skip the "download" step (the one that uses wget).

But honestly, I strongly suggest to not erase the current ParaVew 3.12.0 version you've got.
Bruno this means that if I follow the instructions,3.12.0 will be deleted from the disc?or it will be only disabled? or none of these?!
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   September 15, 2013, 07:12
Default
  #11
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by immortality View Post
Bruno this means that if I follow the instructions,3.12.0 will be deleted from the disc?or it will be only disabled? or none of these?!
Step #2 explicitly uses this command:
Code:
rm -rf $ParaView_DIR
So, yeah, it will be removed. And not in the correct way either, since yours was installed from a Deb package.
__________________
wyldckat is offline   Reply With Quote

Old   September 15, 2013, 07:40
Default
  #12
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
OK,then I better to open paraview with paraFoam4 and open the case.foam and choose Decomposed Case,right?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   October 4, 2013, 06:36
Default
  #13
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19
colinB is on a distinguished road
Hi Bruno,

thanks for your new suggestions and your efforts you put into my questions.

Quote:
Well, without a test case I can't test this myself.
I know, the problem is that the original case is too big to share as well as it is
confidential.

So far I haven't tried one of your new suggestions yet, however I think I forgot
to mention a crucial detail:
I'm calculating on a virtual-machine.
And I think that the troubles may come from the 3D acceleration which was not
activated. Now I have activated it, but have troubles to install the guest-additions,
but as soon as I have solved that, I will try again and see whether paraFoam works
and will also try your suggestions, if not.

thanks again for your efforts
regards
colinB is offline   Reply With Quote

Old   October 5, 2013, 02:40
Default
  #14
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Colin,

Quote:
Originally Posted by colinB View Post
I know, the problem is that the original case is too big to share as well as it is confidential.
Well, you can try using one of the LTSInterFoam tutorials in OpenFOAM to create a similar sized case.

Quote:
Originally Posted by colinB View Post
And I think that the troubles may come from the 3D acceleration which was not
activated. Now I have activated it, but have troubles to install the guest-additions,
but as soon as I have solved that, I will try again and see whether paraFoam works
and will also try your suggestions, if not.
My experience with 3D acceleration in VMs has been appalling. Best one I've used so far has been the one on VMPlayer, but even that one needs to be turned on only when I do need to test stuff with 3D acceleration. Once the test is complete, I shut-down the VM and turn the option off for it.

You can use ParaView's internal ".foam" reader to process the data on your real machine. Simply:
  1. Run while on the VM:
    Code:
    paraFoam -builtin -touch
  2. Copy the whole case from the VM to the real machine.
  3. Open the file that has the extension ".foam" in ParaView on the real machine and you should be good to go!
There are a few limitations with the internal reader, because it's not fully aware of all OpenFOAM features

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   September 14, 2015, 10:04
Default
  #15
Senior Member
 
louisgag's Avatar
 
Louis Gagnon
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 338
Rep Power: 18
louisgag is on a distinguished road
Send a message via ICQ to louisgag
Just pitching in :
Quote:
If you want to increase the speed of <i>data crunching</i>, then try switching on the "Multi-core" option: <a href="http://www" target="_blank">http://www</a>....
Unfortunately the link is no longer valid. To enable the multi-core option one need to go to the settings menu and enable advance options (click the gear). Then, it will be possible to check the "Enable Auto MPI" option and select a maximum number of processors.

For me, this did not work on either the default OpenFOAM-2.4.x paraview nor on the 4.3.1 downloaded compiled version. What worked was to rebuilt paraview from the makeParaview4 script with the -mpi option, for which I was also able to build even for the 4.3.1 sources downloaded from the paraview website.

Finally, different methods to run paraview in parallel are given on the following website: http://daac.hpc.mil/software/ParaVie...rocessors.html

Regards,


-Louis
wyldckat likes this.
louisgag is offline   Reply With Quote

Reply

Tags
parafoam, python, shell, trace


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
[OpenFOAM] Paraview from python shell : Glew initialization and VTKcommoncorepython error pradyumnsingh ParaView 0 September 18, 2018 14:40
[OpenFOAM] Integrate Variables using ParaView Python Shell cfdsolver1 ParaView 0 October 12, 2016 04:08
[General] Python Shell button is diabled JPW ParaView 4 November 8, 2015 15:51
How to get Python Shell into ParaView 3.8.1? blaise OpenFOAM Installation 3 July 24, 2012 05:58
python scripting in paraFoam chegdan OpenFOAM Post-Processing 0 March 31, 2010 20:06


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