Friday, 29 January 2010

Installation of OpenFOAM 1.6 on Ubuntu 9.10

OpenFOAM is another open source CFD software. In order to install OpenFOAM onto Ubuntu 9.10, the following packages are necessary.

cmake g++ flex++ bison python qt4-designer binutils-dev zlib1g-dev

Use apt-get to install them before trying to install and use OpenFOAM.

:/$ sudo apt-get install cmake g++ flex++ bison python qt4-designer binutils-dev zlib1g-dev

A very brief introduction on the compilation

1. Download the related packages, including the source pack and the binary pack. Double precision is recommended.

2. Create a directory OpenFOAM under $HOME (or at other locations if you prefer), move the downloaded packages into it, and then execute

# ship into $HOME/OpenFOAM/
:/$ tar xzvf OpenFOAM-1.6.General.gtgz
:/$ tar xzvf ThirdParty-1.6.General.gtgz
:/$ tar xzvf OpenFOAM-1.6.linuxGccDPOpt.gtgz
:/$ tar xzvf ThirdParty-1.6.linuxGcc.gtgz

3. After the files extracted, source the file OpenFOAM-1.6/etc/bashrc.

# at $HOME/OpenFOAM/
:/$ source OpenFOAM-1.6/etc/bashrc

For convenience, a sentence could be incorporated into the user config file ~/.bashrc to avoid executing the command above manually in the future.

source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc

4. Compile ParaView. Ship into OpenFOAM/ThirdParty-1.6 and execute

sh makeParaView

5. Link OpenFOAM ParaView reader and ParaView.

:/$ cd $FOAM_UTILITIES/postProcessing/graphics/PV3FoamReader
:/$ ./Allwclean
:/$ ./Allwmake

The Windows version

"openfoam-mswin" is a project to provide an OpenFOAM binary release for MS windows. The project is hosted on SourceForge, and a self-install file for Windows can then be downloaded from its SourceForge site. With its help, it is easier to install and use OpenFOAM if Linux experience is absent.

14 comments:

  1. Dear Sir
    I'm new with ubuntu (and any linux) and get lost on step 3. Please help! Thanks

    ReplyDelete
  2. Hi, I tried to modify the sentences again to make it clearer. Actually step 3 means the file 'OpenFOAM-1.6/etc/bashrc' is supposed to be 'source'ed.

    For a bash there can be environmental variables incorporated. By default, '~/.bashrc', ~ means your home directory, namely $HOME, will be 'source'ed whenever you launch a bash console.

    Therefore, source the file OpenFOAM-1.6/etc/bashrc means the variables etc will be loaded into the current bash environment. They are necessary for OpenFOAM. You can execute the 'source' action by manually typing the command at your console, or write the 'source' command line into your '~/.bashrc', which implies when ~/.bashrc is loaded, the file OpenFOAM-1.6/etc/bashrc will be loaded at the same time.

    I hope my explanation makes sense and it helps.

    Regards,

    ReplyDelete
  3. Hi!

    Everything works but the last step. ./Allwmake I get the following:

    + [ -d /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linux64Gcc -a -r /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linux64Gcc ]
    + wmake libso vtkPV3Foam
    wmakeLnInclude: linking include files to ./lnInclude
    Making dependency list for source file vtkPV3Foam.C
    could not open file vtkConfigure.h for source file vtkPV3Foam.C
    Making dependency list for source file vtkPV3FoamFields.C
    could not open file vtkConfigure.h for source file vtkPV3FoamFields.C
    Making dependency list for source file vtkPV3FoamMesh.C
    could not open file vtkConfigure.h for source file vtkPV3FoamMesh.C
    Making dependency list for source file vtkPV3FoamMeshLagrangian.C
    could not open file vtkConfigure.h for source file vtkPV3FoamMeshLagrangian.C
    Making dependency list for source file vtkPV3FoamMeshPatch.C
    could not open file vtkConfigure.h for source file vtkPV3FoamMeshPatch.C

    ...

    SOURCE=vtkPV3Foam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/marcoantonio/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -I/home/marcoantonio/OpenFOAM/OpenFOAM-1.6/src/lagrangian/basic/lnInclude -I/home/marcoantonio/OpenFOAM/OpenFOAM-1.6/src/meshTools/lnInclude -I/home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linux64Gcc/VTK -I/home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1 -I/home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK -I/home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common -I/home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Filtering -I/home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Rendering -I../PV3FoamReader -IlnInclude -I. -I/home/marcoantonio/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/marcoantonio/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/vtkPV3Foam.o
    In file included from /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common/vtkSystemIncludes.h:30,
    from /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common/vtkIndent.h:24,
    from /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common/vtkObjectBase.h:43,
    from /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common/vtkObject.h:41,
    from /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Filtering/vtkAlgorithm.h:32,

    ...

    /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common/vtkType.h:165:3: error: #error "No native data type can represent an 8-bit integer."
    /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common/vtkType.h:180:3: error: #error "No native data type can represent a 16-bit integer."
    /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common/vtkType.h:195:3: error: #error "No native data type can represent a 32-bit integer."
    /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-

    ...

    /home/marcoantonio/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common/vtkType.h:231:3: error: #error "No native data type can represent a 64-bit floating point value."
    make: *** [Make/linux64GccDPOpt/vtkPV3Foam.o] Error 1
    + cd PV3FoamReader
    + mkdir -p Make/linux64GccDPOpt
    + cd Make/linux64GccDPOpt
    + cmake ../..
    cmake: /home/marcoantonio/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux64/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by cmake)
    + make
    make: *** No targets specified and no makefile found. Stop.
    marcoantonio@ubuntu:~/OpenFOAM/OpenFOAM-1.6/applications/utilities/postProcessing/graphics/PV3FoamReader$

    I can also add that I'm new to Ubuntu :) So I wouldn't be surprised if I just missed something very trivial.

    Thanks!

    ReplyDelete
  4. Hi,

    I tried the process again and unfortunately I didn't get any problems. I saw you lack of a header file 'vtkConfigure.h', which should be

    salad@salad-desktop:~/OpenFOAM$ find . -name vtkConfigure.h
    ./ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc/VTK/vtkConfigure.h

    Can you check whether the file is there? If the directories are incomplete, perhaps you have to re-extract from the downloaded packages and try again. I am not sure if it is the problem; at lease we can try and see.

    Addtionally, I paste my corresponding output of ./Allwmake in case it helps. (I cannot paste long because the length is limited here)

    salad@salad-desktop:~/OpenFOAM/OpenFOAM-1.6/applications/utilities/postProcessing/graphics/PV3FoamReader$ ./Allwmake
    + [ -d /home/salad/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc -a -r /home/salad/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc ]
    + wmake libso vtkPV3Foam
    wmakeLnInclude: linking include files to ./lnInclude
    Making dependency list for source file vtkPV3Foam.C
    Making dependency list for source file vtkPV3FoamFields.C
    Making dependency list for source file vtkPV3FoamMesh.C
    Making dependency list for source file vtkPV3FoamMeshLagrangian.C
    Making dependency list for source file vtkPV3FoamMeshPatch.C
    Making dependency list for source file vtkPV3FoamMeshSet.C
    Making dependency list for source file vtkPV3FoamMeshVolume.C
    Making dependency list for source file vtkPV3FoamMeshZone.C
    Making dependency list for source file vtkPV3FoamUpdateInfo.C
    Making dependency list for source file vtkPV3FoamUtilities.C
    SOURCE=vtkPV3Foam.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/salad/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -I/home/salad/OpenFOAM/OpenFOAM-1.6/src/lagrangian/basic/lnInclude -I/home/salad/OpenFOAM/OpenFOAM-1.6/src/meshTools/lnInclude -I/home/salad/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc/VTK -I/home/salad/OpenFOAM/ThirdParty-1.6/paraview-3.6.1 -I/home/salad/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK -I/home/salad/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common -I/home/salad/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Filtering -I/home/salad/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Rendering -I../PV3FoamReader -IlnInclude -I. -I/home/salad/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/salad/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/vtkPV3Foam.o
    ...

    Good luck and leave comments if there are still errors :)

    ReplyDelete
  5. hi,

    I am new to Linux and open foam, I have tried to follow the above steps to install but I am getting the below errors:
    + [ -d /home/jish/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linux64Gcc -a -r /home/jish/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linux64Gcc ]
    + wmake libso vtkPV3Foam
    '/home/jish/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libvtkPV3Foam.so' is up to date.
    + cd PV3FoamReader
    + mkdir -p Make/linux64GccDPOpt
    + cd Make/linux64GccDPOpt
    + cmake ../..
    ./Allwmake: 1: cmake: not found
    + make
    make: *** No targets specified and no makefile found. Stop.

    Can you please suggest me what to do please.

    regards
    jish

    ReplyDelete
  6. Hi Jish,

    It seems that you didn't install cmake. Did you install the packages

    sudo apt-get install cmake g++ flex++ bison python qt4-designer binutils-dev zlib1g-dev

    Can you use command 'type cmake' to check whether there is a cmake present in the system?

    Regards,

    ReplyDelete
  7. To good software
    Full of all the features of CFD Installation...

    ReplyDelete
  8. Hi ,

    I have followed all the steps as shown above and managed to install without any problem. I still able to excute blockMesh command and paraFoam and etc. However, the moment I close the terminal, I re-run blockMesh and paraFoam command, it shows

    blockMesh: command not found

    I reckon should be the installation somehow not install properly. I rectified this can be overcome by re-execute the "bashrc" command everytime if I happen to close my terminal.

    ->(Ubuntu 9.10, OpenFOAM-1.6)
    Anyone knows this problem?

    Thanks
    Noobie

    ReplyDelete
  9. Hi Noobie,

    Whenever a new terminal is opened, .bashrc script will be automatically loaded. So I don't quite understand why you need to re-execute the bashrc.

    Can you check the PATH environment variable when you encounter the problem?

    Good luck :)

    Best regards,

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Hi, I'm new with Ubuntu and in the first step to install g++ and ... I've got this message:
    E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

    could you please tell me What it is and what I should do?
    Thank you very much

    ReplyDelete
  12. Hi Mehdy,

    There should be another apt-get or that sorts of process working behind to update/install some packages at the moment. You would check it, and after they are finished, apt-get command can be used.

    Good luck :)

    Best regards,

    ReplyDelete
  13. This is a great article it really made me think. Thanks

    ReplyDelete
  14. I am glad to know this helps!

    Best regards,

    ReplyDelete