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 07:16 by wyldckat
Updated May 4, 2013 at 06: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
    Hi Tobias,

    You're welcome!
    Quote:
    Originally Posted by tobias.joelsson View Comment
    Is there somewhere else in paraFoam that I have forgot to change from .OpenFOAM to .foam?
    Well, when in doubt, open the "paraFoam" script with your favourite text editor, then search and replace every occurrence of "OpenFOAM" for "foam"! That ought to fix it

    Although I advise you to not close the editor until you've tested the script, so you can undo if necessary

    Best regards,
    Bruno
    permalink
    Posted July 26, 2012 at 15:35 by wyldckat wyldckat is offline
  2. Old Comment
    Hi Bruno,
    I searched through "paraFoam" and found additional places whereas I had to change OpenFOAM to foam. So now the "paraFoam" script works very well.
    Thanks Bruno for solving the problem.

    Best Regards,
    Tobias
    permalink
    Posted July 26, 2012 at 21:50 by tobias.joelsson tobias.joelsson is offline
 

All times are GMT -4. The time now is 06:21.