Difference between revisions of "Installation/Linux/OpenFOAM-2.3.1/Ubuntu"

From OpenFOAMWiki
(Added indication for Ubuntu 15.04 that the instructions for 14.10 work just fine.)
(Ubuntu 18.04: Revised how the alias is being defined)
 
(17 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
Here you have at least two choices:
 
Here you have at least two choices:
 
* You can install from source, by either:
 
* You can install from source, by either:
** Following the official instructions from here: [http://www.openfoam.org/download/source.php Source Pack Installation]
+
** Following the official instructions from here: [http://openfoam.org/download/2-3-1-source/ Download v2.3.1 | Source Pack]
 
** Or by following the detailed step-by-step instructions below...
 
** Or by following the detailed step-by-step instructions below...
  
Line 28: Line 28:
 
<ol>
 
<ol>
 
{{Installation/Linux/SwitchToRoot}}
 
{{Installation/Linux/SwitchToRoot}}
 
+
{{Installation/Linux/AptGetUpdate}}
 
<li>Install the necessary packages:
 
<li>Install the necessary packages:
 
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev gnuplot libreadline-dev \
 
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev gnuplot libreadline-dev \
Line 60: Line 60:
 
<bash>uname -m</bash>
 
<bash>uname -m</bash>
 
Now, accordingly:
 
Now, accordingly:
<ul>
+
<ul {{NoIndentStyle}}>
 
<li>For i686:
 
<li>For i686:
 
<bash>#here you can change 4 to the number of cores you've got
 
<bash>#here you can change 4 to the number of cores you've got
Line 74: Line 74:
 
</li>
 
</li>
  
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file:
+
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file, simply by running the following command:
 
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
</bash>
 
</bash>
Line 84: Line 84:
  
 
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
 
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
  
 
#update the shell environment
 
#update the shell environment
Line 116: Line 116:
  
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
  
 
#Run it a second time for getting a summary of the installation
 
#Run it a second time for getting a summary of the installation
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
 
</bash></li>
 
</bash></li>
  
 
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
 
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
  
<li>Now you can go read the User Guide: [http://www.openfoam.org/docs/user/ official OpenFOAM User Guide]</li>
+
<li>{{Installation/ReadUserGuideEtAl_OpenFOAMFoundation}}</li>
 
</ol>
 
</ol>
  
Line 137: Line 137:
 
Here you have at least two choices:
 
Here you have at least two choices:
 
* You can install from source, by either:
 
* You can install from source, by either:
** Following the official instructions from here: [http://www.openfoam.org/download/source.php Source Pack Installation]
+
** Following the official instructions from here: [http://openfoam.org/download/2-3-1-source/ Download v2.3.1 | Source Pack]
 
** Or by following the detailed step-by-step instructions below...
 
** Or by following the detailed step-by-step instructions below...
  
  
'''Discussion thread where you can ask questions about these steps''': ''none so far.''
+
'''Discussion thread where you can ask questions about these steps''': {{Installation/NoThreadAskForum}}
  
 
Steps:
 
Steps:
 
<ol>
 
<ol>
 
{{Installation/Linux/SwitchToRoot}}
 
{{Installation/Linux/SwitchToRoot}}
 
+
{{Installation/Linux/AptGetUpdate}}
 
<li>Install the necessary packages:
 
<li>Install the necessary packages:
 
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev gnuplot libreadline-dev \
 
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev gnuplot libreadline-dev \
Line 178: Line 178:
 
<bash>uname -m</bash>
 
<bash>uname -m</bash>
 
Now, accordingly:
 
Now, accordingly:
<ul>
+
<ul {{NoIndentStyle}}>
 
<li>For i686:
 
<li>For i686:
 
<bash>#here you can change 4 to the number of cores you've got
 
<bash>#here you can change 4 to the number of cores you've got
Line 192: Line 192:
 
</li>
 
</li>
  
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file:
+
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file, simply by running the following command:
 
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
</bash>
 
</bash>
Line 202: Line 202:
  
 
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
 
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
  
 
#update the shell environment
 
#update the shell environment
Line 224: Line 224:
  
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
  
 
#Run it a second time for getting a summary of the installation
 
#Run it a second time for getting a summary of the installation
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
 
</bash></li>
 
</bash></li>
  
 
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
 
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
  
<li>Now you can go read the User Guide: [http://www.openfoam.org/docs/user/ official OpenFOAM User Guide]</li>
+
<li>{{Installation/ReadUserGuideEtAl_OpenFOAMFoundation}}</li>
 
</ol>
 
</ol>
  
Line 239: Line 239:
  
  
'''Discussion thread where you can ask questions about these steps''': ''none so far.''
+
'''Discussion thread where you can ask questions about these steps''': {{Installation/NoThreadAskForum}}
  
  
Line 245: Line 245:
  
 
Here you have the following choices:
 
Here you have the following choices:
* You can install the Deb packages, which provide a quick and easy way for having a working installation of OpenFOAM 2.3.1. This is the quickest solution for beginners and instructions are provided here: [http://www.openfoam.org/download/ubuntu.php Ubuntu Deb Pack Installation]
+
* You can install the Deb packages, which provide a quick and easy way for having a working installation of OpenFOAM 2.3.1. This is the quickest solution for beginners and instructions are provided here: [http://openfoam.org/download/2-3-1-ubuntu/ Download v2.3.1 | Ubuntu]
 
** Note: If are getting an error when trying to install the packages for Ubuntu, then check this FAQ: [[FAQ/Installation and Running#Why am I not able to install the official OpenFOAM Deb packages on Ubuntu ?|Why am I not able to install the official OpenFOAM Deb packages on Ubuntu ?]]
 
** Note: If are getting an error when trying to install the packages for Ubuntu, then check this FAQ: [[FAQ/Installation and Running#Why am I not able to install the official OpenFOAM Deb packages on Ubuntu ?|Why am I not able to install the official OpenFOAM Deb packages on Ubuntu ?]]
 
* You can install from source, by either:
 
* You can install from source, by either:
** Following the official instructions from here: [http://www.openfoam.org/download/source.php Source Pack Installation]
+
** Following the official instructions from here: [http://openfoam.org/download/2-3-1-source/ Download v2.3.1 | Source Pack]
 
** Or by following the detailed step-by-step instructions below...
 
** Or by following the detailed step-by-step instructions below...
  
Line 256: Line 256:
 
<ol>
 
<ol>
 
{{Installation/Linux/SwitchToRoot}}
 
{{Installation/Linux/SwitchToRoot}}
 
+
{{Installation/Linux/AptGetUpdate}}
 
<li>Install the necessary packages:
 
<li>Install the necessary packages:
 
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
 
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
Line 289: Line 289:
 
<bash>uname -m</bash>
 
<bash>uname -m</bash>
 
Now, accordingly:
 
Now, accordingly:
<ul>
+
<ul {{NoIndentStyle}}>
 
<li>For i686:
 
<li>For i686:
 
<bash>#here you can change 4 to the number of cores you've got
 
<bash>#here you can change 4 to the number of cores you've got
Line 303: Line 303:
 
</li>
 
</li>
  
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file:
+
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file, simply by running the following command:
 
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
</bash>
 
</bash>
Line 316: Line 316:
  
 
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
 
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
  
 
#update the shell environment
 
#update the shell environment
Line 344: Line 344:
  
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
  
 
#Run it a second time for getting a summary of the installation
 
#Run it a second time for getting a summary of the installation
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
 
</bash></li>
 
</bash></li>
  
 
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
 
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
  
<li>Now you can go read the User Guide: [http://www.openfoam.org/docs/user/ official OpenFOAM User Guide]</li>
+
<li>{{Installation/ReadUserGuideEtAl_OpenFOAMFoundation}}</li>
 
</ol>
 
</ol>
  
Line 365: Line 365:
  
 
Here you have the following choices:
 
Here you have the following choices:
* You can install the Deb packages, which provide a quick and easy way for having a working installation of OpenFOAM 2.3.1. This is the quickest solution for beginners and instructions are provided here: [http://www.openfoam.org/download/ubuntu.php Ubuntu Deb Pack Installation]
+
* You can install the Deb packages, which provide a quick and easy way for having a working installation of OpenFOAM 2.3.1. This is the quickest solution for beginners and instructions are provided here: [http://openfoam.org/download/2-3-1-ubuntu/ Download v2.3.1 | Ubuntu]
 
** Note: If are getting an error when trying to install the packages for Ubuntu, then check this FAQ: [[FAQ/Installation and Running#Why am I not able to install the official OpenFOAM Deb packages on Ubuntu ?|Why am I not able to install the official OpenFOAM Deb packages on Ubuntu ?]]
 
** Note: If are getting an error when trying to install the packages for Ubuntu, then check this FAQ: [[FAQ/Installation and Running#Why am I not able to install the official OpenFOAM Deb packages on Ubuntu ?|Why am I not able to install the official OpenFOAM Deb packages on Ubuntu ?]]
 
* You can install from source, by either:
 
* You can install from source, by either:
** Following the official instructions from here: [http://www.openfoam.org/download/source.php Source Pack Installation]
+
** Following the official instructions from here: [http://openfoam.org/download/2-3-1-source/ Download v2.3.1 | Source Pack]
 
** Or by following the detailed step-by-step instructions below...
 
** Or by following the detailed step-by-step instructions below...
  
Line 377: Line 377:
 
<ol>
 
<ol>
 
{{Installation/Linux/SwitchToRoot}}
 
{{Installation/Linux/SwitchToRoot}}
 
+
{{Installation/Linux/AptGetUpdate}}
 
<li>Install the necessary packages:
 
<li>Install the necessary packages:
 
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
 
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
Line 410: Line 410:
 
<bash>uname -m</bash>
 
<bash>uname -m</bash>
 
Now, accordingly:
 
Now, accordingly:
<ul>
+
<ul {{NoIndentStyle}}>
 
<li>For i686:
 
<li>For i686:
 
<bash>#here you can change 4 to the number of cores you've got
 
<bash>#here you can change 4 to the number of cores you've got
Line 424: Line 424:
 
</li>
 
</li>
  
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file:
+
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file, simply by running the following command:
 
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
</bash>
 
</bash>
Line 437: Line 437:
  
 
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
 
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
  
 
#update the shell environment
 
#update the shell environment
Line 470: Line 470:
 
<bash>uname -m</bash>
 
<bash>uname -m</bash>
 
Now, accordingly:
 
Now, accordingly:
<ul>
+
<ul {{NoIndentStyle}}>
 
<li>For i686:
 
<li>For i686:
 
<bash>#this will take a while... somewhere between 30 minutes to 2 hours or more
 
<bash>#this will take a while... somewhere between 30 minutes to 2 hours or more
Line 499: Line 499:
  
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
  
 
#Run it a second time for getting a summary of the installation
 
#Run it a second time for getting a summary of the installation
./Allwmake > make.log 2>&1
+
./Allwmake > log.make 2>&1
 
</bash></li>
 
</bash></li>
  
 
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
 
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
  
<li>Now you can go read the User Guide: [http://www.openfoam.org/docs/user/ official OpenFOAM User Guide]</li>
+
<li>{{Installation/ReadUserGuideEtAl_OpenFOAMFoundation}}</li>
 
</ol>
 
</ol>
  
Line 516: Line 516:
 
'''Discussion thread where you can ask questions about these steps''': [http://www.cfd-online.com/Forums/openfoam-installation/144878-installing-openfoam-2-3-0-ubuntu-14-10-a.html Installing OpenFOAM 2.3.1 on Ubuntu 14.10]
 
'''Discussion thread where you can ask questions about these steps''': [http://www.cfd-online.com/Forums/openfoam-installation/144878-installing-openfoam-2-3-0-ubuntu-14-10-a.html Installing OpenFOAM 2.3.1 on Ubuntu 14.10]
  
 +
<br>
  
 
== Ubuntu 15.04 ==
 
== Ubuntu 15.04 ==
Line 521: Line 522:
 
Here you have the following choices:
 
Here you have the following choices:
 
* You can install from source, by either:
 
* You can install from source, by either:
** Following the official instructions from here: [http://www.openfoam.org/download/source.php Source Pack Installation]
+
** Following the official instructions from here: [http://openfoam.org/download/2-3-1-source/ Download v2.3.1 | Source Pack]
 
** Or by following the detailed step-by-step instructions given above for [[#Ubuntu 14.10|Ubuntu 14.10]], because those instructions work just fine for Ubuntu 15.04.
 
** Or by following the detailed step-by-step instructions given above for [[#Ubuntu 14.10|Ubuntu 14.10]], because those instructions work just fine for Ubuntu 15.04.
 +
 +
<br>
 +
 +
== Ubuntu 16.04 ==
 +
 +
Here you have the following choices:
 +
* You can install from source, by either:
 +
** Following the official instructions from here: [http://openfoam.org/download/2-3-1-source/ Download v2.3.1 | Source Pack]
 +
** Or by following the detailed step-by-step instructions below...
 +
 +
 +
'''Discussion thread where you can ask questions about these steps''': {{Installation/NoThreadAskForum}}
 +
 +
Steps:
 +
<ol>
 +
{{Installation/Linux/SwitchToRoot}}
 +
{{Installation/Linux/AptGetUpdate}}
 +
<li>Install the necessary packages:
 +
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
 +
libreadline-dev libncurses5-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev \
 +
libmpfr-dev python python-dev libcgal-dev
 +
</bash>
 +
'''Note''': It has been reported that the following should also be executed in some cases, so that ParaView and CGAL will build properly:
 +
<bash>apt-get install libglu1-mesa-dev libqt4-opengl-dev</bash>
 +
</li>
 +
 +
{{Installation/Linux/ExitRoot}}
 +
 +
<li>Download and unpack (here you can copy-paste all in single go):
 +
<bash>#OpenFOAM downloading and installation
 +
cd ~
 +
mkdir OpenFOAM
 +
cd OpenFOAM
 +
wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.1.tgz?use_mirror=mesh" -O OpenFOAM-2.3.1.tgz
 +
wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.1.tgz?use_mirror=mesh" -O ThirdParty-2.3.1.tgz
 +
 +
tar -xzf OpenFOAM-2.3.1.tgz
 +
tar -xzf ThirdParty-2.3.1.tgz
 +
</bash></li>
 +
 +
<li>'''Optional''': Let's make a few symbolic links that should ensure that the correct global MPI installation is used by this OpenFOAM installation:
 +
<bash>ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.3.1/bin/mpicc
 +
ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.1/bin/mpirun</bash>
 +
This way we avoid having problems in case there is more than one MPI toolbox installed in your Ubuntu system, for example if MPICH2 is installed and is the default MPI toolbox.
 +
</li>
 +
 +
<li>A few details need to be fixed, before proceeding, which will change the default Boost and CGAL versions, to then use the ones provided by Ubuntu:
 +
<bash>sed -i -e 's/\(cgal_version=\)CGAL-4.3/\1cgal-system/' OpenFOAM-2.3.1/etc/config/CGAL.sh
 +
</bash>
 +
</li>
 +
 +
<li>For building OpenFOAM itself, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
 +
<bash>uname -m</bash>
 +
Now, accordingly:
 +
<ul {{NoIndentStyle}}>
 +
<li>For i686:
 +
<bash>#here you can change 4 to the number of cores you've got
 +
source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32
 +
</bash></li>
 +
 +
<li>For x86_64:
 +
<bash>#here you can change 4 to the number of cores you've got
 +
source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
 +
</bash>
 +
</li>
 +
</ul>
 +
</li>
 +
 +
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file, simply by running the following command:
 +
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 +
</bash>
 +
{{Installation/Linux/AliasNote|OpenFOAM 2.3.1|of231}}
 +
</li>
 +
 +
<li>Now let's build the {{tt|ThirdParty}} folder, because we need the shell environment to be updated afterwards, for CGAL to be properly picked up for building OpenFOAM:
 +
<bash>cd $WM_THIRD_PARTY_DIR
 +
 +
#make very certain that the correct Qt version is being used, by running this command:
 +
export QT_SELECT=qt4
 +
 +
# Fix issue regarding not wanting to build CGAL
 +
sed -i -e 's|\(^if.*CGAL_ARCH_PATH.*\)]|\1 -a "${CGAL_ARCH_PATH##*/}" != "cgal-system" ]|' Allwmake
 +
 +
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
 +
./Allwmake > log.make 2>&1
 +
 +
#update the shell environment
 +
wmSET $FOAM_SETTINGS
 +
</bash>
 +
</li>
 +
 +
<li>Now, in order to build ParaView 4.1.0 that comes with OpenFOAM, including with the ability to use Python and MPI, several steps are needed:
 +
<ol>
 +
<li>First make very certain that the correct Qt version is being used, by running this command:
 +
<bash>export QT_SELECT=qt4</bash>
 +
</li>
 +
<li>Need to do several fixes:
 +
<bash>cd $WM_THIRD_PARTY_DIR
 +
 +
sed -i -e 's=MPI_ARCH_PATH/include=MPI_ARCH_PATH/include;$MPI_INCLUDE=' etc/tools/ParaView4Functions
 +
 +
sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \
 +
  ParaView-4.1.0/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx
 +
 +
cd $WM_THIRD_PARTY_DIR/ParaView-4.1.0
 +
 +
wget http://www.paraview.org/pipermail/paraview/attachments/20140210/464496cc/attachment.bin -O Fix.patch
 +
patch -p1 < Fix.patch
 +
 +
cd VTK
 +
wget https://github.com/gladk/VTK/commit/ef22d3d69421581b33bc0cd94b647da73b61ba96.patch -O Fix2.patch
 +
patch -p1 < Fix2.patch
 +
 +
cd ../..
 +
</bash>
 +
</li>
 +
<li>For building ParaView with Python and MPI, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
 +
<bash>uname -m</bash>
 +
Now, accordingly:
 +
<ul {{NoIndentStyle}}>
 +
<li>For i686:
 +
<bash>#this will take a while... somewhere between 30 minutes to 2 hours or more
 +
./makeParaView4 -python -mpi -python-lib /usr/lib/i386-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1</bash>
 +
</li>
 +
 +
<li>For x86_64:
 +
<bash>#this will take a while... somewhere between 30 minutes to 2 hours or more
 +
./makeParaView4 -python -mpi -python-lib /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1</bash>
 +
</li>
 +
</ul>
 +
</li>
 +
<li>Once the {{tt|makeParaView4}} script is finished running, make sure to check the contents of the file {{tt|log.makePV}} and check if there are any errors.
 +
</li>
 +
<li>Finally, update the shell environment:
 +
<bash>wmSET $FOAM_SETTINGS</bash>
 +
</li>
 +
</ol>
 +
</li>
 +
 +
<li>Now, before we can build OpenFOAM, we need to do a few fixes:
 +
<bash>#Go into OpenFOAM's main source folder
 +
cd $WM_PROJECT_DIR
 +
 +
#Change how the flex version is checked
 +
find src applications -name "*.L" -type f | xargs sed -i -e 's=\(YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\& \1='
 +
</bash>
 +
</li>
 +
 +
<li>Now let's build OpenFOAM:<br>
 +
('''Warning''': this may take somewhere from 30 minutes to 6 hours, depending on your machine.)<br>
 +
<bash>#Go into OpenFOAM's main source folder
 +
cd $WM_PROJECT_DIR
 +
 +
#Still better be certain that the correct Qt version is being used
 +
export QT_SELECT=qt4
 +
 +
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
 +
./Allwmake > log.make 2>&1
 +
 +
#Run it a second time for getting a summary of the installation
 +
./Allwmake > log.make 2>&1
 +
</bash></li>
 +
 +
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
 +
 +
<li>{{Installation/ReadUserGuideEtAl_OpenFOAMFoundation}}</li>
 +
</ol>
 +
 +
 +
{{Installation/Linux/AliasReminder|OpenFOAM 2.3.1|of231}}
 +
 +
 +
'''Discussion thread where you can ask questions about these steps''': {{Installation/NoThreadAskForum}}
 +
 +
<br>
 +
 +
== Ubuntu 18.04 ==
 +
 +
Here you have the following choices:
 +
* You can install from source, by either:
 +
** Following the official instructions from here: [http://openfoam.org/download/2-3-1-source/ Download v2.3.1 | Source Pack]
 +
** Or by following the detailed step-by-step instructions below...
 +
 +
 +
'''Discussion thread where you can ask questions about these steps''': [https://www.cfd-online.com/Forums/openfoam-installation/202905-installing-openfoam-2-3-ubuntu-18-04-a.html Installing OpenFOAM 2.3 on Ubuntu 18.04]
 +
 +
Steps:
 +
<ol>
 +
{{Installation/Linux/SwitchToRoot}}
 +
{{Installation/Linux/AptGetUpdate}}
 +
<li>Install the necessary packages:
 +
<bash>apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
 +
libreadline-dev libncurses5-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev \
 +
libmpfr-dev python python-dev libcgal-dev gcc-5 g++-5
 +
</bash>
 +
'''Note''': It has been reported that the following should also be executed in some cases, so that ParaView and CGAL will build properly:
 +
<bash>apt-get install libglu1-mesa-dev libqt4-opengl-dev</bash>
 +
</li>
 +
 +
{{Installation/Linux/ExitRoot}}
 +
 +
<li>Download and unpack (here you can copy-paste all in single go):
 +
<bash>#OpenFOAM downloading and installation
 +
cd ~
 +
mkdir OpenFOAM
 +
cd OpenFOAM
 +
wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.1.tgz?use_mirror=mesh" -O OpenFOAM-2.3.1.tgz
 +
wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.1.tgz?use_mirror=mesh" -O ThirdParty-2.3.1.tgz
 +
 +
tar -xzf OpenFOAM-2.3.1.tgz
 +
tar -xzf ThirdParty-2.3.1.tgz
 +
</bash></li>
 +
 +
<li>'''Optional''': Let's make a few symbolic links that should ensure that the correct global MPI installation is used by this OpenFOAM installation:
 +
<bash>ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.3.1/bin/mpicc
 +
ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.1/bin/mpirun</bash>
 +
This way we avoid having problems in case there is more than one MPI toolbox installed in your Ubuntu system, for example if MPICH2 is installed and is the default MPI toolbox.
 +
</li>
 +
 +
<li>A few details need to be fixed, before proceeding, which will change the default Boost and CGAL versions, to then use the ones provided by Ubuntu, along with a few GCC version changes:
 +
<bash>sed -i -e 's/\(cgal_version=\)CGAL-4.3/\1cgal-system/' OpenFOAM-2.3.1/etc/config/CGAL.sh
 +
sed -i -e 's=\-lmpfr=-lmpfr -lboost_thread=' OpenFOAM-2.3.1/wmake/rules/General/CGAL
 +
 +
sed -i -e 's/gcc/\$(WM_CC)/' OpenFOAM-2.3.1/wmake/rules/linux*Gcc/c
 +
sed -i -e 's/g++/\$(WM_CXX)/' OpenFOAM-2.3.1/wmake/rules/linux*Gcc/c++
 +
</bash>
 +
</li>
 +
 +
<li>For building OpenFOAM itself, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
 +
<bash>uname -m</bash>
 +
Now, accordingly:
 +
<ul {{NoIndentStyle}}>
 +
<li>For i686:
 +
<bash>#here you can change 4 to the number of cores you've got
 +
source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32
 +
export WM_CC='gcc-5'
 +
export WM_CXX='g++-5'
 +
</bash></li>
 +
 +
<li>For x86_64:
 +
<bash>#here you can change 4 to the number of cores you've got
 +
source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
 +
export WM_CC='gcc-5'
 +
export WM_CXX='g++-5'
 +
</bash>
 +
</li>
 +
</ul>
 +
</li>
 +
 +
<li>Save an ''alias'' in the personal {{tt|.bashrc}} file, simply by running the following command:
 +
<bash>echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS; export WM_CC=gcc-5; export WM_CXX=g++-5'" >> $HOME/.bashrc
 +
</bash>
 +
{{Installation/Linux/AliasNote|OpenFOAM 2.3.1|of231}}
 +
<ul  {{NoIndentStyle}}><li>Just in case, also ''source'' that file, so that you can use {{tt|of231}} in this terminal if necessary, by running:
 +
<bash>source $HOME/.bashrc</bash>
 +
</li></ul>
 +
</li>
 +
 +
<li>Now let's build the {{tt|ThirdParty}} folder, because we need the shell environment to be updated afterwards, for CGAL to be properly picked up for building OpenFOAM:
 +
<bash>cd $WM_THIRD_PARTY_DIR
 +
 +
#make very certain that the correct Qt version is being used, by running this command:
 +
export QT_SELECT=qt4
 +
 +
# Fix issue regarding not wanting to build CGAL
 +
sed -i -e 's|\(^if.*CGAL_ARCH_PATH.*\)]|\1 -a "${CGAL_ARCH_PATH##*/}" != "cgal-system" ]|' Allwmake
 +
 +
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
 +
./Allwmake > log.make 2>&1
 +
 +
#update the shell environment
 +
of231
 +
</bash>
 +
</li>
 +
 +
<li>Now, in order to build ParaView 4.1.0 that comes with OpenFOAM, including with the ability to use Python and MPI, several steps are needed:
 +
<ol>
 +
<li>First make very certain that the correct Qt version is being used, by running this command:
 +
<bash>export QT_SELECT=qt4</bash>
 +
</li>
 +
<li>Need to do several fixes:
 +
<bash>cd $WM_THIRD_PARTY_DIR
 +
 +
sed -i -e 's=MPI_ARCH_PATH/include=MPI_ARCH_PATH/include;$MPI_INCLUDE=' etc/tools/ParaView4Functions
 +
 +
sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \
 +
  ParaView-4.1.0/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx
 +
 +
cd $WM_THIRD_PARTY_DIR/ParaView-4.1.0
 +
 +
wget http://www.paraview.org/pipermail/paraview/attachments/20140210/464496cc/attachment.bin -O Fix.patch
 +
patch -p1 < Fix.patch
 +
 +
cd VTK
 +
wget https://github.com/gladk/VTK/commit/ef22d3d69421581b33bc0cd94b647da73b61ba96.patch -O Fix2.patch
 +
patch -p1 < Fix2.patch
 +
 +
cd ../..
 +
</bash>
 +
</li>
 +
<li>For building ParaView with Python and MPI, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
 +
<bash>uname -m</bash>
 +
Now, accordingly:
 +
<ul {{NoIndentStyle}}>
 +
<li>For i686:
 +
<bash>#this will take a while... somewhere between 30 minutes to 2 hours or more
 +
./makeParaView4 -python -mpi -python-lib /usr/lib/i386-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1</bash>
 +
</li>
 +
 +
<li>For x86_64:
 +
<bash>#this will take a while... somewhere between 30 minutes to 2 hours or more
 +
./makeParaView4 -python -mpi -python-lib /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1</bash>
 +
</li>
 +
</ul>
 +
</li>
 +
<li>Once the {{tt|makeParaView4}} script is finished running, make sure to check the contents of the file {{tt|log.makePV}} and check if there are any errors.
 +
</li>
 +
<li>Finally, update the shell environment:
 +
<bash>of231</bash>
 +
</li>
 +
</ol>
 +
</li>
 +
 +
<li>Now, before we can build OpenFOAM, we need to do a few fixes:
 +
<bash>#Go into OpenFOAM's main source folder
 +
cd $WM_PROJECT_DIR
 +
 +
#Change how the flex version is checked
 +
find src applications -name "*.L" -type f | xargs sed -i -e 's=\(YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\& \1='
 +
</bash>
 +
</li>
 +
 +
<li>Now let's build OpenFOAM:<br>
 +
('''Warning''': this may take somewhere from 30 minutes to 6 hours, depending on your machine.)<br>
 +
<bash>#Go into OpenFOAM's main source folder
 +
cd $WM_PROJECT_DIR
 +
 +
#Still better be certain that the correct Qt version is being used
 +
export QT_SELECT=qt4
 +
 +
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
 +
./Allwmake > log.make 2>&1
 +
 +
#Run it a second time for getting a summary of the installation
 +
./Allwmake > log.make 2>&1
 +
</bash></li>
 +
 +
<li>{{Installation/Linux/CheckIfAllWentWell}}</li>
 +
 +
<li>{{Installation/ReadUserGuideEtAl_OpenFOAMFoundation}}</li>
 +
</ol>
 +
 +
 +
{{Installation/Linux/AliasReminder|OpenFOAM 2.3.1|of231}}
 +
 +
 +
'''Discussion thread where you can ask questions about these steps''': [https://www.cfd-online.com/Forums/openfoam-installation/202905-installing-openfoam-2-3-ubuntu-18-04-a.html Installing OpenFOAM 2.3 on Ubuntu 18.04]
 +
 +
<br>
  
 
[[Category:Installing OpenFOAM on Linux]] [[Category:Installing OpenFOAM on Ubuntu]]
 
[[Category:Installing OpenFOAM on Linux]] [[Category:Installing OpenFOAM on Ubuntu]]

Latest revision as of 16:59, 18 May 2019

1 Introduction

This page is dedicated to explaining how to install OpenFOAM OF Version 231.png in Ubuntu.

If you do not yet feel comfortable using Linux, then perhaps you better first read the page Working with the Shell and train a bit with the shell/terminal environments, so you can have a better perception of the steps shown below.


2 Copy-Paste steps

A few notes before you start copy-pasting:

  1. Lines that start with # don't have to be copy-pasted. They are just comments to let you know what's going on.
  2. One wrong character is enough for breaking this guide, so make sure you can read the characters properly or that the installed language system does not break the copied characters!


2.1 Ubuntu 12.04

Here you have at least two choices:

  • You can install from source, by either:


Discussion thread where you can ask questions about these steps: Problems installing OpenFOAM 2.3.1 in Ubuntu 12.04

Steps:

  1. Switch to root mode (administrator), to install the necessary packages:
    sudo -s
    • If the 'sudo' command tells you're not in the sudoers list, then run:
      su -
  2. Update the apt-get cache by running:
    apt-get update
  3. Install the necessary packages:
    apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev gnuplot libreadline-dev \
    libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev

    Note: It has been reported that the following should also be executed in some cases, so that ParaView and CGAL will build properly:

    apt-get install libglu1-mesa-dev libqt4-opengl-dev
  4. Now exit from the root mode:
    exit
  5. Download and unpack (here you can copy-paste all in single go):
    #OpenFOAM downloading and installation
    cd ~
    mkdir OpenFOAM
    cd OpenFOAM
    wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.1.tgz?use_mirror=mesh" -O OpenFOAM-2.3.1.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.1.tgz?use_mirror=mesh" -O ThirdParty-2.3.1.tgz
     
    tar -xzf OpenFOAM-2.3.1.tgz 
    tar -xzf ThirdParty-2.3.1.tgz
  6. Optional: Let's make a few symbolic links that should ensure that the correct global MPI installation is used by this OpenFOAM installation:
    ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.3.1/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.1/bin/mpirun

    This way we avoid having problems in case there is more than one MPI toolbox installed in your Ubuntu system, for example if MPICH2 is installed and is the default MPI toolbox.

  7. For building OpenFOAM itself, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
    uname -m

    Now, accordingly:

    • For i686:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32
    • For x86_64:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
  8. Save an alias in the personal .bashrc file, simply by running the following command:
    echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
    Note: This last line means that whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, whenever you start a new terminal, you should run:
    of231
    
    For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.
  9. Now let's build the ThirdParty folder, because we need the shell environment to be updated afterwards, for CGAL to be properly picked up for building OpenFOAM:
    cd $WM_THIRD_PARTY_DIR
     
    # This next command will take a while... somewhere between 5 minutes to 30 minutes.
    ./Allwmake > log.make 2>&1
     
    #update the shell environment
    wmSET $FOAM_SETTINGS
  10. Ubuntu 12.04 comes with CMake 2.8.7, but ParaView 4.1.0 needs CMake 2.8.8 or newer series. Therefore, we'll need to do a custom build:
    cd $WM_THIRD_PARTY_DIR
    wget "https://raw.github.com/wyldckat/scripts4OpenFOAM3rdParty/master/getCmake"
    sed -i -e 's=version}\.3=version}.12.1=' getCmake
    chmod +x getCmake
    ./getCmake
    ./makeCmake
    wmSET $FOAM_SETTINGS
  11. Now, in order to build ParaView 4.1.0 that comes with OpenFOAM:
    #this will take a while... somewhere between 30 minutes to 2 hours or more
    ./makeParaView4 -qmake $(which qmake-qt4) > log.makePV 2>&1
     
    #update the shell environment
    wmSET $FOAM_SETTINGS
    Once the makeParaView4 scripts is finished running, make sure to check the contents of the file log.makePV and check if there are any errors.
  12. Now let's build OpenFOAM:
    (Warning: this may take somewhere from 30 minutes to 6 hours, depending on your machine.)
    #Go into OpenFOAM's main source folder
    cd $WM_PROJECT_DIR
     
    # This next command will take a while... somewhere between 30 minutes to 3-6 hours.
    ./Allwmake > log.make 2>&1
     
    #Run it a second time for getting a summary of the installation
    ./Allwmake > log.make 2>&1
  13. To check if everything went well:
    1. Check if icoFoam is working, by running this command:
      icoFoam -help

      which should tell you something like this:

      Usage: icoFoam [OPTIONS]
      options:
        -case <dir>       specify alternate case directory, default is the cwd
        -noFunctionObjects
                          do not execute functionObjects
        -parallel         run in parallel
        -roots <(dir1 .. dirN)>
                          slave root directories for distributed running
        -srcDoc           display source code in browser
        -doc              display application documentation in browser
        -help             print the usage

      Note: And keep in mind that you need to be careful with the letter case of the command. It's icoFoam, not icoFOAM.

    2. If the previous command failed to work properly, then edit the file log.make and check if there are any error messages. A few examples on how you can edit this file:
      • By using kwrite:
        kwrite log.make
      • By using gedit:
        gedit log.make
      • By using nano:
        nano log.make

        You can then exit by using the key combination Ctrl+X and following any instructions it gives you.

      Note: It's the first error message that matters.

    3. If you don't understand the output, then please compress the log-file log.make and attach the compressed file to a post in the designated thread.
      If you do not know how to create a compressed file, then try one of the following examples:
      • You can compress the file with gzip by running this command:
        gzip < log.make > log.make.gz

        Then attach the resulting package file named log.make.gz to a post in the designated thread.

      • Or you can compress one or more log-files into a tarball package file, by running this command:
        tar -czf logs.tar.gz log.*

        Then attach the resulting package file named logs.tar.gz to a post in the designated thread.

    4. Instructions on how to further diagnose the issue yourself, have a look at the section Common errors when building OpenFOAM from source code in the page FAQ/Installation and Running.
  14. Now you can go read the User Guide, where you may have more than one choice:
    1. Which you can find a local copy of the User Guide by running the following command:
      ls -A1 $WM_PROJECT_DIR/doc/Guides*/*UserGuide*.pdf
      • You should see two available formats: A4 and US-Letter.
      • But if it instead tells you that there is No such file or directory, then the OpenFOAM environment is possibly not properly activated.
    2. You can also find the more recent OpenFOAM Foundation User Guides online at the following page: official OpenFOAM User Guide - but be careful if you use the version that is too much ahead of the version you are currently using, given that some features have changed overtime.


Reminder: Whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, run the following command whenever you start a new terminal:
of231
For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.


Discussion thread where you can ask questions about these steps: Problems installing OpenFOAM 2.3.1 in Ubuntu 12.04

2.2 Ubuntu 13.10

Here you have at least two choices:

  • You can install from source, by either:


Discussion thread where you can ask questions about these steps: No thread available. Please a create a new thread in the forum.

Steps:

  1. Switch to root mode (administrator), to install the necessary packages:
    sudo -s
    • If the 'sudo' command tells you're not in the sudoers list, then run:
      su -
  2. Update the apt-get cache by running:
    apt-get update
  3. Install the necessary packages:
    apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev gnuplot libreadline-dev \
    libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev

    Note: It has been reported that the following should also be executed in some cases, so that ParaView and CGAL will build properly:

    apt-get install libglu1-mesa-dev libqt4-opengl-dev
  4. Now exit from the root mode:
    exit
  5. Download and unpack (here you can copy-paste all in single go):
    #OpenFOAM downloading and installation
    cd ~
    mkdir OpenFOAM
    cd OpenFOAM
    wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.1.tgz?use_mirror=mesh" -O OpenFOAM-2.3.1.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.1.tgz?use_mirror=mesh" -O ThirdParty-2.3.1.tgz
     
    tar -xzf OpenFOAM-2.3.1.tgz 
    tar -xzf ThirdParty-2.3.1.tgz
  6. Optional: Let's make a few symbolic links that should ensure that the correct global MPI installation is used by this OpenFOAM installation:
    ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.3.1/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.1/bin/mpirun

    This way we avoid having problems in case there is more than one MPI toolbox installed in your Ubuntu system, for example if MPICH2 is installed and is the default MPI toolbox.

  7. For building OpenFOAM itself, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
    uname -m

    Now, accordingly:

    • For i686:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32
    • For x86_64:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
  8. Save an alias in the personal .bashrc file, simply by running the following command:
    echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
    Note: This last line means that whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, whenever you start a new terminal, you should run:
    of231
    
    For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.
  9. Now let's build the ThirdParty folder, because we need the shell environment to be updated afterwards, for CGAL to be properly picked up for building OpenFOAM:
    cd $WM_THIRD_PARTY_DIR
     
    # This next command will take a while... somewhere between 5 minutes to 30 minutes.
    ./Allwmake > log.make 2>&1
     
    #update the shell environment
    wmSET $FOAM_SETTINGS
  10. Now, in order to build ParaView 4.1.0 that comes with OpenFOAM:
    #this will take a while... somewhere between 30 minutes to 2 hours or more
    ./makeParaView4 -qmake $(which qmake-qt4) > log.makePV 2>&1
     
    #update the shell environment
    wmSET $FOAM_SETTINGS
    Once the makeParaView4 scripts is finished running, make sure to check the contents of the file log.makePV and check if there are any errors.
  11. Now let's build OpenFOAM:
    (Warning: this may take somewhere from 30 minutes to 6 hours, depending on your machine.)
    #Go into OpenFOAM's main source folder
    cd $WM_PROJECT_DIR
     
    # This next command will take a while... somewhere between 30 minutes to 3-6 hours.
    ./Allwmake > log.make 2>&1
     
    #Run it a second time for getting a summary of the installation
    ./Allwmake > log.make 2>&1
  12. To check if everything went well:
    1. Check if icoFoam is working, by running this command:
      icoFoam -help

      which should tell you something like this:

      Usage: icoFoam [OPTIONS]
      options:
        -case <dir>       specify alternate case directory, default is the cwd
        -noFunctionObjects
                          do not execute functionObjects
        -parallel         run in parallel
        -roots <(dir1 .. dirN)>
                          slave root directories for distributed running
        -srcDoc           display source code in browser
        -doc              display application documentation in browser
        -help             print the usage

      Note: And keep in mind that you need to be careful with the letter case of the command. It's icoFoam, not icoFOAM.

    2. If the previous command failed to work properly, then edit the file log.make and check if there are any error messages. A few examples on how you can edit this file:
      • By using kwrite:
        kwrite log.make
      • By using gedit:
        gedit log.make
      • By using nano:
        nano log.make

        You can then exit by using the key combination Ctrl+X and following any instructions it gives you.

      Note: It's the first error message that matters.

    3. If you don't understand the output, then please compress the log-file log.make and attach the compressed file to a post in the designated thread.
      If you do not know how to create a compressed file, then try one of the following examples:
      • You can compress the file with gzip by running this command:
        gzip < log.make > log.make.gz

        Then attach the resulting package file named log.make.gz to a post in the designated thread.

      • Or you can compress one or more log-files into a tarball package file, by running this command:
        tar -czf logs.tar.gz log.*

        Then attach the resulting package file named logs.tar.gz to a post in the designated thread.

    4. Instructions on how to further diagnose the issue yourself, have a look at the section Common errors when building OpenFOAM from source code in the page FAQ/Installation and Running.
  13. Now you can go read the User Guide, where you may have more than one choice:
    1. Which you can find a local copy of the User Guide by running the following command:
      ls -A1 $WM_PROJECT_DIR/doc/Guides*/*UserGuide*.pdf
      • You should see two available formats: A4 and US-Letter.
      • But if it instead tells you that there is No such file or directory, then the OpenFOAM environment is possibly not properly activated.
    2. You can also find the more recent OpenFOAM Foundation User Guides online at the following page: official OpenFOAM User Guide - but be careful if you use the version that is too much ahead of the version you are currently using, given that some features have changed overtime.


Reminder: Whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, run the following command whenever you start a new terminal:
of231
For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.


Discussion thread where you can ask questions about these steps: No thread available. Please a create a new thread in the forum.


2.3 Ubuntu 14.04

Here you have the following choices:

Discussion thread where you can ask questions about these steps: Paraview not found when installing OpenFoam to Ubuntu 14.04

Steps:

  1. Switch to root mode (administrator), to install the necessary packages:
    sudo -s
    • If the 'sudo' command tells you're not in the sudoers list, then run:
      su -
  2. Update the apt-get cache by running:
    apt-get update
  3. Install the necessary packages:
    apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
    libreadline-dev libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev \
    libmpfr-dev

    Note: It has been reported that the following should also be executed in some cases, so that ParaView and CGAL will build properly:

    apt-get install libglu1-mesa-dev libqt4-opengl-dev
  4. Now exit from the root mode:
    exit
  5. Download and unpack (here you can copy-paste all in single go):
    #OpenFOAM downloading and installation
    cd ~
    mkdir OpenFOAM
    cd OpenFOAM
    wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.1.tgz?use_mirror=mesh" -O OpenFOAM-2.3.1.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.1.tgz?use_mirror=mesh" -O ThirdParty-2.3.1.tgz
     
    tar -xzf OpenFOAM-2.3.1.tgz 
    tar -xzf ThirdParty-2.3.1.tgz
  6. Optional: Let's make a few symbolic links that should ensure that the correct global MPI installation is used by this OpenFOAM installation:
    ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.3.1/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.1/bin/mpirun

    This way we avoid having problems in case there is more than one MPI toolbox installed in your Ubuntu system, for example if MPICH2 is installed and is the default MPI toolbox.

  7. For building OpenFOAM itself, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
    uname -m

    Now, accordingly:

    • For i686:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32
    • For x86_64:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
  8. Save an alias in the personal .bashrc file, simply by running the following command:
    echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
    Note: This last line means that whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, whenever you start a new terminal, you should run:
    of231
    
    For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.
  9. Now let's build the ThirdParty folder, because we need the shell environment to be updated afterwards, for CGAL to be properly picked up for building OpenFOAM:
    cd $WM_THIRD_PARTY_DIR
     
    #make very certain that the correct Qt version is being used, by running this command:
    export QT_SELECT=qt4
     
    # This next command will take a while... somewhere between 5 minutes to 30 minutes.
    ./Allwmake > log.make 2>&1
     
    #update the shell environment
    wmSET $FOAM_SETTINGS
  10. Now, in order to build ParaView 4.1.0 that comes with OpenFOAM:
    #First make very certain that the correct Qt version is being used, by running this command:
    export QT_SELECT=qt4
     
    #this will take a while... somewhere between 30 minutes to 2 hours or more
    ./makeParaView4 > log.makePV 2>&1
     
    #update the shell environment
    wmSET $FOAM_SETTINGS
    Once the makeParaView4 scripts is finished running, make sure to check the contents of the file log.makePV and check if there are any errors.
  11. Now let's build OpenFOAM:
    (Warning: this may take somewhere from 30 minutes to 6 hours, depending on your machine.)
    #Go into OpenFOAM's main source folder
    cd $WM_PROJECT_DIR
     
    #Still better be certain that the correct Qt version is being used
    export QT_SELECT=qt4
     
    # This next command will take a while... somewhere between 30 minutes to 3-6 hours.
    ./Allwmake > log.make 2>&1
     
    #Run it a second time for getting a summary of the installation
    ./Allwmake > log.make 2>&1
  12. To check if everything went well:
    1. Check if icoFoam is working, by running this command:
      icoFoam -help

      which should tell you something like this:

      Usage: icoFoam [OPTIONS]
      options:
        -case <dir>       specify alternate case directory, default is the cwd
        -noFunctionObjects
                          do not execute functionObjects
        -parallel         run in parallel
        -roots <(dir1 .. dirN)>
                          slave root directories for distributed running
        -srcDoc           display source code in browser
        -doc              display application documentation in browser
        -help             print the usage

      Note: And keep in mind that you need to be careful with the letter case of the command. It's icoFoam, not icoFOAM.

    2. If the previous command failed to work properly, then edit the file log.make and check if there are any error messages. A few examples on how you can edit this file:
      • By using kwrite:
        kwrite log.make
      • By using gedit:
        gedit log.make
      • By using nano:
        nano log.make

        You can then exit by using the key combination Ctrl+X and following any instructions it gives you.

      Note: It's the first error message that matters.

    3. If you don't understand the output, then please compress the log-file log.make and attach the compressed file to a post in the designated thread.
      If you do not know how to create a compressed file, then try one of the following examples:
      • You can compress the file with gzip by running this command:
        gzip < log.make > log.make.gz

        Then attach the resulting package file named log.make.gz to a post in the designated thread.

      • Or you can compress one or more log-files into a tarball package file, by running this command:
        tar -czf logs.tar.gz log.*

        Then attach the resulting package file named logs.tar.gz to a post in the designated thread.

    4. Instructions on how to further diagnose the issue yourself, have a look at the section Common errors when building OpenFOAM from source code in the page FAQ/Installation and Running.
  13. Now you can go read the User Guide, where you may have more than one choice:
    1. Which you can find a local copy of the User Guide by running the following command:
      ls -A1 $WM_PROJECT_DIR/doc/Guides*/*UserGuide*.pdf
      • You should see two available formats: A4 and US-Letter.
      • But if it instead tells you that there is No such file or directory, then the OpenFOAM environment is possibly not properly activated.
    2. You can also find the more recent OpenFOAM Foundation User Guides online at the following page: official OpenFOAM User Guide - but be careful if you use the version that is too much ahead of the version you are currently using, given that some features have changed overtime.


Reminder: Whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, run the following command whenever you start a new terminal:
of231
For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.


Discussion thread where you can ask questions about these steps: Paraview not found when installing OpenFoam to Ubuntu 14.04


2.4 Ubuntu 14.10

Here you have the following choices:


Discussion thread where you can ask questions about these steps: Installing OpenFOAM 2.3.1 on Ubuntu 14.10

Steps:

  1. Switch to root mode (administrator), to install the necessary packages:
    sudo -s
    • If the 'sudo' command tells you're not in the sudoers list, then run:
      su -
  2. Update the apt-get cache by running:
    apt-get update
  3. Install the necessary packages:
    apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
    libreadline-dev libncurses5-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev \
    libmpfr-dev python python-dev

    Note: It has been reported that the following should also be executed in some cases, so that ParaView and CGAL will build properly:

    apt-get install libglu1-mesa-dev libqt4-opengl-dev
  4. Now exit from the root mode:
    exit
  5. Download and unpack (here you can copy-paste all in single go):
    #OpenFOAM downloading and installation
    cd ~
    mkdir OpenFOAM
    cd OpenFOAM
    wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.1.tgz?use_mirror=mesh" -O OpenFOAM-2.3.1.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.1.tgz?use_mirror=mesh" -O ThirdParty-2.3.1.tgz
     
    tar -xzf OpenFOAM-2.3.1.tgz 
    tar -xzf ThirdParty-2.3.1.tgz
  6. Optional: Let's make a few symbolic links that should ensure that the correct global MPI installation is used by this OpenFOAM installation:
    ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.3.1/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.1/bin/mpirun

    This way we avoid having problems in case there is more than one MPI toolbox installed in your Ubuntu system, for example if MPICH2 is installed and is the default MPI toolbox.

  7. For building OpenFOAM itself, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
    uname -m

    Now, accordingly:

    • For i686:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32
    • For x86_64:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
  8. Save an alias in the personal .bashrc file, simply by running the following command:
    echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
    Note: This last line means that whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, whenever you start a new terminal, you should run:
    of231
    
    For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.
  9. Now let's build the ThirdParty folder, because we need the shell environment to be updated afterwards, for CGAL to be properly picked up for building OpenFOAM:
    cd $WM_THIRD_PARTY_DIR
     
    #make very certain that the correct Qt version is being used, by running this command:
    export QT_SELECT=qt4
     
    # This next command will take a while... somewhere between 5 minutes to 30 minutes.
    ./Allwmake > log.make 2>&1
     
    #update the shell environment
    wmSET $FOAM_SETTINGS
  10. Now, in order to build ParaView 4.1.0 that comes with OpenFOAM, including with the ability to use Python and MPI, several steps are needed:
    1. First make very certain that the correct Qt version is being used, by running this command:
      export QT_SELECT=qt4
    2. Need to do several fixes:
      sed -i -e 's=MPI_ARCH_PATH/include=MPI_ARCH_PATH/include;$MPI_INCLUDE=' etc/tools/ParaView4Functions
       
      sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \
        ParaView-4.1.0/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx
       
      cd $WM_THIRD_PARTY_DIR/ParaView-4.1.0
       
      wget http://www.paraview.org/pipermail/paraview/attachments/20140210/464496cc/attachment.bin -O Fix.patch
      patch -p1 < Fix.patch
       
      cd VTK
      wget https://github.com/gladk/VTK/commit/ef22d3d69421581b33bc0cd94b647da73b61ba96.patch -O Fix2.patch
      patch -p1 < Fix2.patch
       
      cd ../..
    3. For building ParaView with Python and MPI, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
      uname -m

      Now, accordingly:

      • For i686:
        #this will take a while... somewhere between 30 minutes to 2 hours or more
        ./makeParaView4 -python -mpi -python-lib /usr/lib/i386-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1
      • For x86_64:
        #this will take a while... somewhere between 30 minutes to 2 hours or more
        ./makeParaView4 -python -mpi -python-lib /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1
    4. Once the makeParaView4 script is finished running, make sure to check the contents of the file log.makePV and check if there are any errors.
    5. Finally, update the shell environment:
      wmSET $FOAM_SETTINGS
  11. Now let's build OpenFOAM:
    (Warning: this may take somewhere from 30 minutes to 6 hours, depending on your machine.)
    #Go into OpenFOAM's main source folder
    cd $WM_PROJECT_DIR
     
    #Still better be certain that the correct Qt version is being used
    export QT_SELECT=qt4
     
    # This next command will take a while... somewhere between 30 minutes to 3-6 hours.
    ./Allwmake > log.make 2>&1
     
    #Run it a second time for getting a summary of the installation
    ./Allwmake > log.make 2>&1
  12. To check if everything went well:
    1. Check if icoFoam is working, by running this command:
      icoFoam -help

      which should tell you something like this:

      Usage: icoFoam [OPTIONS]
      options:
        -case <dir>       specify alternate case directory, default is the cwd
        -noFunctionObjects
                          do not execute functionObjects
        -parallel         run in parallel
        -roots <(dir1 .. dirN)>
                          slave root directories for distributed running
        -srcDoc           display source code in browser
        -doc              display application documentation in browser
        -help             print the usage

      Note: And keep in mind that you need to be careful with the letter case of the command. It's icoFoam, not icoFOAM.

    2. If the previous command failed to work properly, then edit the file log.make and check if there are any error messages. A few examples on how you can edit this file:
      • By using kwrite:
        kwrite log.make
      • By using gedit:
        gedit log.make
      • By using nano:
        nano log.make

        You can then exit by using the key combination Ctrl+X and following any instructions it gives you.

      Note: It's the first error message that matters.

    3. If you don't understand the output, then please compress the log-file log.make and attach the compressed file to a post in the designated thread.
      If you do not know how to create a compressed file, then try one of the following examples:
      • You can compress the file with gzip by running this command:
        gzip < log.make > log.make.gz

        Then attach the resulting package file named log.make.gz to a post in the designated thread.

      • Or you can compress one or more log-files into a tarball package file, by running this command:
        tar -czf logs.tar.gz log.*

        Then attach the resulting package file named logs.tar.gz to a post in the designated thread.

    4. Instructions on how to further diagnose the issue yourself, have a look at the section Common errors when building OpenFOAM from source code in the page FAQ/Installation and Running.
  13. Now you can go read the User Guide, where you may have more than one choice:
    1. Which you can find a local copy of the User Guide by running the following command:
      ls -A1 $WM_PROJECT_DIR/doc/Guides*/*UserGuide*.pdf
      • You should see two available formats: A4 and US-Letter.
      • But if it instead tells you that there is No such file or directory, then the OpenFOAM environment is possibly not properly activated.
    2. You can also find the more recent OpenFOAM Foundation User Guides online at the following page: official OpenFOAM User Guide - but be careful if you use the version that is too much ahead of the version you are currently using, given that some features have changed overtime.


Reminder: Whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, run the following command whenever you start a new terminal:
of231
For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.


Discussion thread where you can ask questions about these steps: Installing OpenFOAM 2.3.1 on Ubuntu 14.10


2.5 Ubuntu 15.04

Here you have the following choices:

  • You can install from source, by either:
    • Following the official instructions from here: Download v2.3.1 | Source Pack
    • Or by following the detailed step-by-step instructions given above for Ubuntu 14.10, because those instructions work just fine for Ubuntu 15.04.


2.6 Ubuntu 16.04

Here you have the following choices:

  • You can install from source, by either:


Discussion thread where you can ask questions about these steps: No thread available. Please a create a new thread in the forum.

Steps:

  1. Switch to root mode (administrator), to install the necessary packages:
    sudo -s
    • If the 'sudo' command tells you're not in the sudoers list, then run:
      su -
  2. Update the apt-get cache by running:
    apt-get update
  3. Install the necessary packages:
    apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
    libreadline-dev libncurses5-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev \
    libmpfr-dev python python-dev libcgal-dev

    Note: It has been reported that the following should also be executed in some cases, so that ParaView and CGAL will build properly:

    apt-get install libglu1-mesa-dev libqt4-opengl-dev
  4. Now exit from the root mode:
    exit
  5. Download and unpack (here you can copy-paste all in single go):
    #OpenFOAM downloading and installation
    cd ~
    mkdir OpenFOAM
    cd OpenFOAM
    wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.1.tgz?use_mirror=mesh" -O OpenFOAM-2.3.1.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.1.tgz?use_mirror=mesh" -O ThirdParty-2.3.1.tgz
     
    tar -xzf OpenFOAM-2.3.1.tgz 
    tar -xzf ThirdParty-2.3.1.tgz
  6. Optional: Let's make a few symbolic links that should ensure that the correct global MPI installation is used by this OpenFOAM installation:
    ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.3.1/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.1/bin/mpirun

    This way we avoid having problems in case there is more than one MPI toolbox installed in your Ubuntu system, for example if MPICH2 is installed and is the default MPI toolbox.

  7. A few details need to be fixed, before proceeding, which will change the default Boost and CGAL versions, to then use the ones provided by Ubuntu:
    sed -i -e 's/\(cgal_version=\)CGAL-4.3/\1cgal-system/' OpenFOAM-2.3.1/etc/config/CGAL.sh
  8. For building OpenFOAM itself, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
    uname -m

    Now, accordingly:

    • For i686:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32
    • For x86_64:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
  9. Save an alias in the personal .bashrc file, simply by running the following command:
    echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
    Note: This last line means that whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, whenever you start a new terminal, you should run:
    of231
    
    For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.
  10. Now let's build the ThirdParty folder, because we need the shell environment to be updated afterwards, for CGAL to be properly picked up for building OpenFOAM:
    cd $WM_THIRD_PARTY_DIR
     
    #make very certain that the correct Qt version is being used, by running this command:
    export QT_SELECT=qt4
     
    # Fix issue regarding not wanting to build CGAL
    sed -i -e 's|\(^if.*CGAL_ARCH_PATH.*\)]|\1 -a "${CGAL_ARCH_PATH##*/}" != "cgal-system" ]|' Allwmake
     
    # This next command will take a while... somewhere between 5 minutes to 30 minutes.
    ./Allwmake > log.make 2>&1
     
    #update the shell environment
    wmSET $FOAM_SETTINGS
  11. Now, in order to build ParaView 4.1.0 that comes with OpenFOAM, including with the ability to use Python and MPI, several steps are needed:
    1. First make very certain that the correct Qt version is being used, by running this command:
      export QT_SELECT=qt4
    2. Need to do several fixes:
      cd $WM_THIRD_PARTY_DIR
       
      sed -i -e 's=MPI_ARCH_PATH/include=MPI_ARCH_PATH/include;$MPI_INCLUDE=' etc/tools/ParaView4Functions
       
      sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \
        ParaView-4.1.0/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx
       
      cd $WM_THIRD_PARTY_DIR/ParaView-4.1.0
       
      wget http://www.paraview.org/pipermail/paraview/attachments/20140210/464496cc/attachment.bin -O Fix.patch
      patch -p1 < Fix.patch
       
      cd VTK
      wget https://github.com/gladk/VTK/commit/ef22d3d69421581b33bc0cd94b647da73b61ba96.patch -O Fix2.patch
      patch -p1 < Fix2.patch
       
      cd ../..
    3. For building ParaView with Python and MPI, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
      uname -m

      Now, accordingly:

      • For i686:
        #this will take a while... somewhere between 30 minutes to 2 hours or more
        ./makeParaView4 -python -mpi -python-lib /usr/lib/i386-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1
      • For x86_64:
        #this will take a while... somewhere between 30 minutes to 2 hours or more
        ./makeParaView4 -python -mpi -python-lib /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1
    4. Once the makeParaView4 script is finished running, make sure to check the contents of the file log.makePV and check if there are any errors.
    5. Finally, update the shell environment:
      wmSET $FOAM_SETTINGS
  12. Now, before we can build OpenFOAM, we need to do a few fixes:
    #Go into OpenFOAM's main source folder
    cd $WM_PROJECT_DIR
     
    #Change how the flex version is checked
    find src applications -name "*.L" -type f | xargs sed -i -e 's=\(YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\& \1='
  13. Now let's build OpenFOAM:
    (Warning: this may take somewhere from 30 minutes to 6 hours, depending on your machine.)
    #Go into OpenFOAM's main source folder
    cd $WM_PROJECT_DIR
     
    #Still better be certain that the correct Qt version is being used
    export QT_SELECT=qt4
     
    # This next command will take a while... somewhere between 30 minutes to 3-6 hours.
    ./Allwmake > log.make 2>&1
     
    #Run it a second time for getting a summary of the installation
    ./Allwmake > log.make 2>&1
  14. To check if everything went well:
    1. Check if icoFoam is working, by running this command:
      icoFoam -help

      which should tell you something like this:

      Usage: icoFoam [OPTIONS]
      options:
        -case <dir>       specify alternate case directory, default is the cwd
        -noFunctionObjects
                          do not execute functionObjects
        -parallel         run in parallel
        -roots <(dir1 .. dirN)>
                          slave root directories for distributed running
        -srcDoc           display source code in browser
        -doc              display application documentation in browser
        -help             print the usage

      Note: And keep in mind that you need to be careful with the letter case of the command. It's icoFoam, not icoFOAM.

    2. If the previous command failed to work properly, then edit the file log.make and check if there are any error messages. A few examples on how you can edit this file:
      • By using kwrite:
        kwrite log.make
      • By using gedit:
        gedit log.make
      • By using nano:
        nano log.make

        You can then exit by using the key combination Ctrl+X and following any instructions it gives you.

      Note: It's the first error message that matters.

    3. If you don't understand the output, then please compress the log-file log.make and attach the compressed file to a post in the designated thread.
      If you do not know how to create a compressed file, then try one of the following examples:
      • You can compress the file with gzip by running this command:
        gzip < log.make > log.make.gz

        Then attach the resulting package file named log.make.gz to a post in the designated thread.

      • Or you can compress one or more log-files into a tarball package file, by running this command:
        tar -czf logs.tar.gz log.*

        Then attach the resulting package file named logs.tar.gz to a post in the designated thread.

    4. Instructions on how to further diagnose the issue yourself, have a look at the section Common errors when building OpenFOAM from source code in the page FAQ/Installation and Running.
  15. Now you can go read the User Guide, where you may have more than one choice:
    1. Which you can find a local copy of the User Guide by running the following command:
      ls -A1 $WM_PROJECT_DIR/doc/Guides*/*UserGuide*.pdf
      • You should see two available formats: A4 and US-Letter.
      • But if it instead tells you that there is No such file or directory, then the OpenFOAM environment is possibly not properly activated.
    2. You can also find the more recent OpenFOAM Foundation User Guides online at the following page: official OpenFOAM User Guide - but be careful if you use the version that is too much ahead of the version you are currently using, given that some features have changed overtime.


Reminder: Whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, run the following command whenever you start a new terminal:
of231
For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.


Discussion thread where you can ask questions about these steps: No thread available. Please a create a new thread in the forum.


2.7 Ubuntu 18.04

Here you have the following choices:

  • You can install from source, by either:


Discussion thread where you can ask questions about these steps: Installing OpenFOAM 2.3 on Ubuntu 18.04

Steps:

  1. Switch to root mode (administrator), to install the necessary packages:
    sudo -s
    • If the 'sudo' command tells you're not in the sudoers list, then run:
      su -
  2. Update the apt-get cache by running:
    apt-get update
  3. Install the necessary packages:
    apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
    libreadline-dev libncurses5-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev \
    libmpfr-dev python python-dev libcgal-dev gcc-5 g++-5

    Note: It has been reported that the following should also be executed in some cases, so that ParaView and CGAL will build properly:

    apt-get install libglu1-mesa-dev libqt4-opengl-dev
  4. Now exit from the root mode:
    exit
  5. Download and unpack (here you can copy-paste all in single go):
    #OpenFOAM downloading and installation
    cd ~
    mkdir OpenFOAM
    cd OpenFOAM
    wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.1.tgz?use_mirror=mesh" -O OpenFOAM-2.3.1.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.1.tgz?use_mirror=mesh" -O ThirdParty-2.3.1.tgz
     
    tar -xzf OpenFOAM-2.3.1.tgz 
    tar -xzf ThirdParty-2.3.1.tgz
  6. Optional: Let's make a few symbolic links that should ensure that the correct global MPI installation is used by this OpenFOAM installation:
    ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.3.1/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.1/bin/mpirun

    This way we avoid having problems in case there is more than one MPI toolbox installed in your Ubuntu system, for example if MPICH2 is installed and is the default MPI toolbox.

  7. A few details need to be fixed, before proceeding, which will change the default Boost and CGAL versions, to then use the ones provided by Ubuntu, along with a few GCC version changes:
    sed -i -e 's/\(cgal_version=\)CGAL-4.3/\1cgal-system/' OpenFOAM-2.3.1/etc/config/CGAL.sh
    sed -i -e 's=\-lmpfr=-lmpfr -lboost_thread=' OpenFOAM-2.3.1/wmake/rules/General/CGAL
     
    sed -i -e 's/gcc/\$(WM_CC)/' OpenFOAM-2.3.1/wmake/rules/linux*Gcc/c
    sed -i -e 's/g++/\$(WM_CXX)/' OpenFOAM-2.3.1/wmake/rules/linux*Gcc/c++
  8. For building OpenFOAM itself, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
    uname -m

    Now, accordingly:

    • For i686:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32
      export WM_CC='gcc-5'
      export WM_CXX='g++-5'
    • For x86_64:
      #here you can change 4 to the number of cores you've got
      source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
      export WM_CC='gcc-5'
      export WM_CXX='g++-5'
  9. Save an alias in the personal .bashrc file, simply by running the following command:
    echo "alias of231='source \$HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc $FOAM_SETTINGS; export WM_CC=gcc-5; export WM_CXX=g++-5'" >> $HOME/.bashrc
    Note: This last line means that whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, whenever you start a new terminal, you should run:
    of231
    
    For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.
    • Just in case, also source that file, so that you can use of231 in this terminal if necessary, by running:
      source $HOME/.bashrc
  10. Now let's build the ThirdParty folder, because we need the shell environment to be updated afterwards, for CGAL to be properly picked up for building OpenFOAM:
    cd $WM_THIRD_PARTY_DIR
     
    #make very certain that the correct Qt version is being used, by running this command:
    export QT_SELECT=qt4
     
    # Fix issue regarding not wanting to build CGAL
    sed -i -e 's|\(^if.*CGAL_ARCH_PATH.*\)]|\1 -a "${CGAL_ARCH_PATH##*/}" != "cgal-system" ]|' Allwmake
     
    # This next command will take a while... somewhere between 5 minutes to 30 minutes.
    ./Allwmake > log.make 2>&1
     
    #update the shell environment
    of231
  11. Now, in order to build ParaView 4.1.0 that comes with OpenFOAM, including with the ability to use Python and MPI, several steps are needed:
    1. First make very certain that the correct Qt version is being used, by running this command:
      export QT_SELECT=qt4
    2. Need to do several fixes:
      cd $WM_THIRD_PARTY_DIR
       
      sed -i -e 's=MPI_ARCH_PATH/include=MPI_ARCH_PATH/include;$MPI_INCLUDE=' etc/tools/ParaView4Functions
       
      sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \
        ParaView-4.1.0/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx
       
      cd $WM_THIRD_PARTY_DIR/ParaView-4.1.0
       
      wget http://www.paraview.org/pipermail/paraview/attachments/20140210/464496cc/attachment.bin -O Fix.patch
      patch -p1 < Fix.patch
       
      cd VTK
      wget https://github.com/gladk/VTK/commit/ef22d3d69421581b33bc0cd94b647da73b61ba96.patch -O Fix2.patch
      patch -p1 < Fix2.patch
       
      cd ../..
    3. For building ParaView with Python and MPI, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:
      uname -m

      Now, accordingly:

      • For i686:
        #this will take a while... somewhere between 30 minutes to 2 hours or more
        ./makeParaView4 -python -mpi -python-lib /usr/lib/i386-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1
      • For x86_64:
        #this will take a while... somewhere between 30 minutes to 2 hours or more
        ./makeParaView4 -python -mpi -python-lib /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1
    4. Once the makeParaView4 script is finished running, make sure to check the contents of the file log.makePV and check if there are any errors.
    5. Finally, update the shell environment:
      of231
  12. Now, before we can build OpenFOAM, we need to do a few fixes:
    #Go into OpenFOAM's main source folder
    cd $WM_PROJECT_DIR
     
    #Change how the flex version is checked
    find src applications -name "*.L" -type f | xargs sed -i -e 's=\(YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\& \1='
  13. Now let's build OpenFOAM:
    (Warning: this may take somewhere from 30 minutes to 6 hours, depending on your machine.)
    #Go into OpenFOAM's main source folder
    cd $WM_PROJECT_DIR
     
    #Still better be certain that the correct Qt version is being used
    export QT_SELECT=qt4
     
    # This next command will take a while... somewhere between 30 minutes to 3-6 hours.
    ./Allwmake > log.make 2>&1
     
    #Run it a second time for getting a summary of the installation
    ./Allwmake > log.make 2>&1
  14. To check if everything went well:
    1. Check if icoFoam is working, by running this command:
      icoFoam -help

      which should tell you something like this:

      Usage: icoFoam [OPTIONS]
      options:
        -case <dir>       specify alternate case directory, default is the cwd
        -noFunctionObjects
                          do not execute functionObjects
        -parallel         run in parallel
        -roots <(dir1 .. dirN)>
                          slave root directories for distributed running
        -srcDoc           display source code in browser
        -doc              display application documentation in browser
        -help             print the usage

      Note: And keep in mind that you need to be careful with the letter case of the command. It's icoFoam, not icoFOAM.

    2. If the previous command failed to work properly, then edit the file log.make and check if there are any error messages. A few examples on how you can edit this file:
      • By using kwrite:
        kwrite log.make
      • By using gedit:
        gedit log.make
      • By using nano:
        nano log.make

        You can then exit by using the key combination Ctrl+X and following any instructions it gives you.

      Note: It's the first error message that matters.

    3. If you don't understand the output, then please compress the log-file log.make and attach the compressed file to a post in the designated thread.
      If you do not know how to create a compressed file, then try one of the following examples:
      • You can compress the file with gzip by running this command:
        gzip < log.make > log.make.gz

        Then attach the resulting package file named log.make.gz to a post in the designated thread.

      • Or you can compress one or more log-files into a tarball package file, by running this command:
        tar -czf logs.tar.gz log.*

        Then attach the resulting package file named logs.tar.gz to a post in the designated thread.

    4. Instructions on how to further diagnose the issue yourself, have a look at the section Common errors when building OpenFOAM from source code in the page FAQ/Installation and Running.
  15. Now you can go read the User Guide, where you may have more than one choice:
    1. Which you can find a local copy of the User Guide by running the following command:
      ls -A1 $WM_PROJECT_DIR/doc/Guides*/*UserGuide*.pdf
      • You should see two available formats: A4 and US-Letter.
      • But if it instead tells you that there is No such file or directory, then the OpenFOAM environment is possibly not properly activated.
    2. You can also find the more recent OpenFOAM Foundation User Guides online at the following page: official OpenFOAM User Guide - but be careful if you use the version that is too much ahead of the version you are currently using, given that some features have changed overtime.


Reminder: Whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.3.1 shell environment. In other words, run the following command whenever you start a new terminal:
of231
For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.


Discussion thread where you can ask questions about these steps: Installing OpenFOAM 2.3 on Ubuntu 18.04