CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

Using the official pre-built ParaView 3.10.1 version with OpenFOAM

Register Blogs Members List Search Today's Posts Mark Forums Read

Rating: 2 votes, 5.00 average.

Using the official pre-built ParaView 3.10.1 version with OpenFOAM

Posted April 30, 2011 at 08:16 by wyldckat
Updated May 4, 2013 at 07:46 by wyldckat (Updated to reflect changes in OpenFOAM 2.0)

<-- Related issues to ParaView with OpenFOAM - Fixes and solutions


NOTE: For building your own ParaView see Building ParaView 3.10.1 with custom Qt 4.6.4
_________________________________________________

After limited success with the old instructions "Using the official pre-built ParaView 3.8.0 version with OpenFOAM...", I've decided to write a new blog post, instead of editing the old one. Hopefully these instructions no longer will have the issues that occurred with those instructions.

NOTE: these instructions should also work with past and future versions of ParaView. You'll need to adapt version numbers for ParaView, such as 3.10.1 -> 3.10.2 or 3.8.1.

Keep in mind that versions before 3.8.0 are not acceptable with these instructions, since the internal reader can't read meshes from OpenFOAM versions above 1.2, if I'm not mistaken.

The instructions are as follows:
  1. Start a new terminal and activate the OpenFOAM environment if not already active. For more information, see Setting Environment Variables
    • For example, if you have installed OpenFOAM 1.7.1 using the Deb packages for Ubuntu, then this means that you need to switch to root mode and activate the respective environment. A quick way to do this is by running:
      Code:
      sudo su -c "source /opt/openfoam171/etc/bashrc; bash"
      Don't forget to run the following command before step #10:
      Code:
      exit
  2. Check if you already have something installed in paraview's binary folder:
    Code:
    ls $ParaView_DIR
    If it doesn't say something like "ls: cannot access /home/..../paraview-3.8.0: No such file or directory", then remove the folder:
    Code:
    rm -rf $ParaView_DIR
  3. Now run:
    Code:
    cd $HOME/OpenFOAM
    mkdir -p $ParaView_DIR
  4. Now, depending on the architecture you are running on your Linux box (i?86 or x86_64), run one of these commands:
    1. For i?86:
      Code:
      wget http://www.paraview.org/files/v3.10/ParaView-3.10.1-Linux-i686.tar.gz
    2. For x86_64:
      Code:
      wget http://www.paraview.org/files/v3.10/ParaView-3.10.1-Linux-x86_64.tar.gz
  5. Now do:
    Code:
    cd $ParaView_DIR
  6. Again, depending on what architecture you are using, do:
    1. For i?86:
      Code:
      tar -xzf $HOME/OpenFOAM/ParaView-3.10.1-Linux-i686.tar.gz
      mv ParaView-3.10.1-Linux-i686/* .
      rmdir ParaView-3.10.1-Linux-i686
    2. For x86_64:
      Code:
      tar -xzf $HOME/OpenFOAM/ParaView-3.10.1-Linux-x86_64.tar.gz
      mv ParaView-3.10.1-Linux-x86_64/* .
      rmdir ParaView-3.10.1-Linux-x86_64
  7. Now open the file "$WM_PROJECT_DIR/bin/paraFoam" in your favorite simple text editor and replace every entry ".OpenFOAM" with ".foam". Now save and close the file.
    NOTE: if you're feeling too lazy to open a text editor, try this:
    Code:
    sed -i -e 's=\.OpenFOAM=\.foam=' $WM_PROJECT_DIR/bin/paraFoam
    NOTE about OpenFOAM 2.0: If you want to keep this file unedited, you can use the new argument "builtin":
    Code:
    paraFoam -builtin
  8. Edit the file "$WM_PROJECT_DIR/etc/bashrc" and find the line that says:
    • In OpenFOAM 1.7:
      Code:
      paraview3=`$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/bashrc` \
          && _foamSource $paraview3
      unset paraview3
      Now comment it, like this:
      Code:
      #paraview3=`$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/bashrc` \
      #    && _foamSource $paraview3
      #unset paraview3
      Save and close the file.
    • In OpenFOAM 2.0:
      Code:
      # Source user setup files for optional packages
      # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh`
      _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.sh`
      Now comment it, like this:
      Code:
      # Source user setup files for optional packages
      # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      #_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh`
      _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.sh`
  9. Next, edit again the script "$WM_PROJECT_DIR/bin/paraFoam". Go to the line right after the first block of comments and add the lines that were commented in "$WM_PROJECT_DIR/etc/bashrc", although with a little tweak. With the tweak, it should look something like this (bold is the new addition):
    • OpenFOAM 1.7:
      Code:
      # Description
      #     start paraview with the OpenFOAM libraries
      #
      #------------------------------------------------------------------------------
      paraview3=`$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/bashrc` \
          && source $paraview3
      unset paraview3
      
      usage() {
      Save and close. I'm sorry, but I don't know yet how to create the lazy edit version
    • OpenFOAM 2.0:
      Code:
      # Description
      #     Run an OpenFOAM job in background.
      #     Redirects the output to 'log' in the case directory.
      #
      #------------------------------------------------------------------------------
      paraview3=`$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh` \
          && source $paraview3
      unset paraview3
        
      usage() {
  10. Start a new terminal once again and activate the OpenFOAM environment if not already active.
And voilą, you now should have a fully working paraFoam script at your disposal! Along with ParaView 3.10.1, with no further building required

By the way, some additional tips:
  1. If you are having problems with rescaling data (the colour labels) in ParaView, you might have tripped on a now known bug in ParaView 3.8.0, which I haven't checked yet if it was fixed in 3.10. To get past this, read this post (and its thread): paraview 3.8 auto rescale doesn't work #6
  2. Usual problems with ParaView and some hints on how to fix them: Segmentation fault when visualizing in ParaView
  3. ParaFoam error could not find a decent visual - solution in post #4

Good luck! Best regards,
Bruno
« Prev     Main     Next »
Total Comments 22

Comments

  1. Old Comment
    This worked for me except that after the "paraFoam" command the program is still confused about the data format - so I have to choose OpenFOAM manually.
    But worse it totally get's confused with the multiRegionFoam tutorial. Instead of reading constant/polyMesh/boundary it tries for constant/heater/polyMesh/boundary and then causes an error..
    Any ideas?
    permalink
    Posted July 1, 2011 at 11:28 by jofry jofry is offline
  2. Old Comment
    Greetings Jofry,

    You could have said which OpenFOAM version you are using The only idea I get is what has already been reported here: http://www.cfd-online.com/Forums/ope...tml#post313489

    In other words, things have changed a bit with OpenFOAM 2.0.0, so expect things not to work as expected with the internal reader

    By the way, which Linux distribution and version are you using? It's possible that it'll be easier to build ParaView now than it was a year ago!

    Best regards,
    Bruno
    permalink
    Posted July 2, 2011 at 06:05 by wyldckat wyldckat is offline
  3. Old Comment
    Hi jofry,
    That is the same issue to the one to which wyldckat provided the link, and has been filed as a bug with a proposed fix in the ParaView bug tracker.
    http://paraview.org/Bug/view.php?id=12318

    Takuya
    permalink
    Posted July 4, 2011 at 23:19 by 7islands 7islands is offline
  4. Old Comment
    Hi Bruno, hi Takuya,

    thanks for your support!!
    for the record: I tried openfoam 2.0 with paraview 3.10.1 on ubuntu 10.10 and 11.04

    Looking at the links and it struck me:
    I have no thirdparty software installed.. With openfoam 1.7.x i didn't need to - I just executed apt-get install openfoam 1.7.1 - (I'm not certain if I tried the multRegionFoam though).
    Now I downloaded it from the Git Repository but I'm not exactly sure how to make it work..

    Thanks again!!
    permalink
    Posted July 12, 2011 at 09:43 by jofry jofry is offline
  5. Old Comment
    Hi Jofry,

    If you are installing from the git repo, simply follow the whole and completely official instructions to the letter: http://www.openfoam.com/download/git.php
    Hopefully all will work well if you follow those instructions properly

    Failing that, here are at least a few threads you read and can check for more information:

    Best regards and good luck!
    Bruno
    permalink
    Posted July 12, 2011 at 19:24 by wyldckat wyldckat is offline
  6. Old Comment
    Hi Takuya!

    Many thanks for the cross-reference to that bug report! That will come in handy soon enough

    Best regards,
    Bruno
    permalink
    Posted July 12, 2011 at 19:25 by wyldckat wyldckat is offline
  7. Old Comment
    Thanks!!!!
    permalink
    Posted July 20, 2011 at 12:58 by ulisses ulisses is offline
  8. Old Comment
    Hi Bruno,

    Greetings!!

    Thanks for the method you gave to make paraview work for OF2.0. Although when I followed these steps for OpenFoam 2.0.x (centFoam) the paraview works fine, but now my 'gedit' command stopped working. On execution it says "Segmentation fault (core dumped). When I undid the step no. 8 (i.e. unhashed the '_foamsource..... paraview.sh' line) gedit again started working. Can you tell me any reason for this. FYI I installed centFOAM 2.0.x on RHEL 6.0 x64_86 and followed your above steps to build paraview.

    Thanks in advance!!

    Manoj
    permalink
    Posted July 21, 2011 at 07:31 by run_cfd run_cfd is offline
  9. Old Comment
    Greetings Manoj,

    Mmm interesting... two possibilities come to mind:
    1. You might have forgotten to start a new terminal after commenting that line in bashrc.
    2. Or config/paraview.sh might do something beneficial.
      The only beneficial detail I can think of is that the libraries that come with the pre-built ParaView version are more compatible with your system's gedit than some other library that is available with CentFOAM, most likely one of the libraries that come with CentFOAM's gcc version. This would be because of this line of code in config/paraview.sh:
      Code:
      export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-$ParaView_MAJOR:$LD_LIBRARY_PATH
      This puts ParaView's libraries in front of every other library in the search list. To confirm this, edit that file and change it to this:
      Code:
      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ParaView_DIR/lib/paraview-$ParaView_MAJOR
      Start a new terminal and try to run gedit. It will probably crash just the same as before.
    Well, in the end I suggest that you choose the solution that works for you!

    Best regards,
    Bruno
    permalink
    Posted July 22, 2011 at 18:50 by wyldckat wyldckat is offline
  10. Old Comment
    Hi
    Seeing that everyone is talking about Paraview 3.10.1, has anyone experienced a segmentation fault when making a screenshot in Paraview, as explained in the following bug report:

    https://bugzilla.redhat.com/show_bug.cgi?id=542391

    I'm running OpenFoam 2.0.1 on Ubuntu 10.10, and used the standard ubuntu repository install. I had Paraview 3.8.0 working perfectly before. Tried going the foamToVTK route but no luck either. Any suggestions/solutions?
    Thanks
    Case
    permalink
    Posted August 17, 2011 at 10:22 by case case is offline
  11. Old Comment

    Which build exactly?

    Greetings Case,

    It would help if you also let us know which ParaView build are you actually using now, which leads to the segmentation fault. Is it:
    1. The one from here: http://www.openfoam.com/download/ubuntu.php
    2. The one from www.paraview.org, as explained in this blog post.
    3. Or did you build it from source?
    Last but not least, did you see the last part of this blog post:
    Quote:
    Usual problems with ParaView and some hints on how to fix them: Segmentation fault when visualizing in ParaView
    That thread has a lot of information about how to fix, or at least isolate and determine, the cause of the problem.

    Best regards,
    Bruno
    permalink
    Posted August 17, 2011 at 14:25 by wyldckat wyldckat is offline
  12. Old Comment
    Sorry about the delay.
    I'm using the ParaView build as mentioned in a) http://www.openfoam.com/download/ubuntu.php

    Let me read through your blog post and try everything mentioned there, and see if I can get it to work. Have gone back to OF 1.7.1 and ParaView 3.8.0 in the meantime.
    Thanks for your time!

    Regards
    Case
    permalink
    Posted August 25, 2011 at 09:00 by case case is offline
  13. Old Comment
    thanks for help.
    permalink
    Posted November 29, 2011 at 20:18 by aminakis
  14. Old Comment
    Hi Bruno,
    thank you for the good tutorial 'Using the official pre-built ParaView 3.10.1 version with OpenFOAM ' for installing paraView

    I running OpenFOAM 2.0.0 with paraView 3.10.1
    with cmake version 2.8.7 cmake 2.8.7-0ubuntu4


    My problem is that paraFoam command does not work. When I write paraFoam within a OpenFOAM run case this is the error message:

    /home/tobias/OpenFOAM/OpenFOAM-2.0.0/bin/paraFoam:
    42: /home/tobias/OpenFOAM/OpenFOAM-2.0.0/bin/paraFoam: source: not found

    created temporary 'aachenBomb.OpenFOAM'

    /home/tobias/OpenFOAM/OpenFOAM-2.0.0/bin/paraFoam:
    244: /home/tobias/OpenFOAM/OpenFOAM-2.0.0/bin/paraFoam: paraview: not found



    Thanks!

    Best Regards,
    Tobias
    permalink
    Posted July 20, 2012 at 02:53 by tobias.joelsson tobias.joelsson is offline
  15. Old Comment
    Hi Tobias,

    Did you do the step #9, the one specific to OpenFOAM 2.0?

    What happens if you run this command:
    Code:
    $WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh
    And this command:
    Code:
    echo $WM_PROJECT_DIR
    Best regards,
    Bruno
    permalink
    Posted July 20, 2012 at 09:40 by wyldckat wyldckat is offline
  16. Old Comment
    Hi Bruno,

    First, thanks for you replying my question.

    Yes, I did step 9, there I in my home dir:
    Code:
     /home/tobias/OpenFOAM/OpenFOAM-2.0.0/bin/paraFoam
    inserted directly after the first comment box (at line 53) what you wrote:

    Code:
    paraview3=`$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh` \
        && source $paraview3
    unset paraview3
    on the command:
    Code:
    $WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh
    the reply:
    Code:
    /home/tobias/OpenFOAM/OpenFOAM-2.0.0/etc/config/paraview.sh
    on the command:
    Code:
    echo $WM_PROJECT_DIR
    the reply:
    Code:
    /home/tobias/OpenFOAM/OpenFOAM-2.0.0
    Best Regards,
    Tobias
    permalink
    Posted July 22, 2012 at 21:14 by tobias.joelsson tobias.joelsson is offline
  17. Old Comment
    Hi Tobias,

    I forgot to ask before, but what do these commands do for you:
    Code:
    ls -l /home/tobias/OpenFOAM/OpenFOAM-2.0.0/etc/config/paraview.sh
    which source
    source /home/tobias/OpenFOAM/OpenFOAM-2.0.0/etc/config/paraview.sh
    1. Check if the file does exist or not.
    2. Checks if source doesn't have a double meaning, i.e. it might also be an application, which it shouldn't be.
    3. Tests if what paraFoam first complain about does or not occur directly in the command line.
    Best regards,
    Bruno
    permalink
    Posted July 23, 2012 at 18:32 by wyldckat wyldckat is offline
  18. Old Comment
    Hi Bruno,

    First when I write in line
    ls -l /home/tobias/OpenFOAM/OpenFOAM-2.0.0/etc/config/paraview.sh
    is my reply:
    Code:
    -rw-rw-r-- 1 tobias tobias 4153 Jul 20 15:51 /home/tobias/OpenFOAM/OpenFOAM-2.0.0/etc/config/paraview.sh
    which source and
    source /home/tobias/OpenFOAM/OpenFOAM-2.0.0/etc/config
    does not reply anything in Terminal

    1. Check if the file does exist or not.
    Yes paraview.sh exist in
    Code:
    /home/tobias/OpenFOAM/OpenFOAM-2.0.0/etc/config/paraview.sh

    2. Checks if source doesn't have a double meaning, i.e. it might also be an application, which it shouldn't be.

    I do not really get where I should look for source? In which file?

    3. Tests if what paraFoam first complain about does or not occur directly in the command line.

    tested in lib
    Code:
     /home/tobias/OpenFOAM/tobias-2.0.0/run/tutorials/incompressible/icoFoam/1-cavity
    when typing paraFoam this is the reply
    Code:
     /home/tobias/OpenFOAM/OpenFOAM-2.0.0/bin/paraFoam: 54: /home/tobias/OpenFOAM/OpenFOAM-2.0.0/bin/paraFoam: source: not found
    created temporary '1-cavity.OpenFOAM'
    /home/tobias/OpenFOAM/OpenFOAM-2.0.0/bin/paraFoam: 257: /home/tobias/OpenFOAM/OpenFOAM-2.0.0/bin/paraFoam: paraview: not found
    Best Regards,
    Tobias
    permalink
    Posted July 25, 2012 at 02:34 by tobias.joelsson tobias.joelsson is offline
  19. Old Comment
    Hi Tobias,

    OK, I think I managed to figure it out: your sh shell is a non-conventional one. That is why the source command won't work the way it's meant to. The source command is an internal command in the shell, which in your case either doesn't work this way or doesn't exist.

    The quickest fix is to edit the paraFoam script again and change in the first line:
    Code:
    #!/bin/sh
    To this:
    Code:
    #!/bin/bash
    Save and try the paraFoam script once again!

    Best regards,
    Bruno
    permalink
    Posted July 25, 2012 at 15:33 by wyldckat wyldckat is offline
  20. Old Comment
    Thank you Bruno!
    Great it solve the problem...

    But when I run paraFoam it act strange, I got a bug that generate a temporary .OpenFOAM file when it (after your guide point 7.) should generate a .foam file
    It cause me some minor problem, to I have to manually reload the .foam file in to paraView.
    Is there somewhere else in paraFoam that I have forgot to change from .OpenFOAM to .foam?

    Best Regards, and Thanks again for finding the problem with made paraFoam run.

    Tobias
    permalink
    Posted July 26, 2012 at 06:02 by tobias.joelsson tobias.joelsson is offline
 

All times are GMT -4. The time now is 05:34.