CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Paraview & paraFoam (http://www.cfd-online.com/Forums/openfoam-paraview/)
-   -   using the python shell in paraFoam (http://www.cfd-online.com/Forums/openfoam-paraview/123094-using-python-shell-parafoam.html)

colinB September 4, 2013 06:28

using the python shell in paraFoam
 
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

wyldckat September 7, 2013 11:52

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

colinB September 10, 2013 05:11

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

wyldckat September 10, 2013 16:56

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

colinB September 12, 2013 09:07

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

wyldckat September 14, 2013 10:54

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 September 15, 2013 03:47

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.:eek: :D
how can replace it to 3.12.0 and delete that so that there be more space on disc? thanks.

wyldckat September 15, 2013 04:53

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 September 15, 2013 05:38

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


immortality September 15, 2013 05:54

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?!:)

wyldckat September 15, 2013 06:12

Quote:

Originally Posted by immortality (Post 451781)
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.

immortality September 15, 2013 06:40

OK,then I better to open paraview with paraFoam4 and open the case.foam and choose Decomposed Case,right?

colinB October 4, 2013 05:36

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

wyldckat October 5, 2013 01:40

Hi Colin,

Quote:

Originally Posted by colinB (Post 455005)
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 (Post 455005)
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


All times are GMT -4. The time now is 13:20.