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

From OpenFOAMWiki
(Ubuntu 14.10: Added missing patch fix for VTK 6.x to build with GCC 4.9)
(Now using the template for accessing the user guide)
 
(16 intermediate revisions by the same user not shown)
Line 18: Line 18:
  
 
Here you have at least two choices:
 
Here you have at least two choices:
* You can install the Deb packages, which provide a quick and easy way for having a working installation of OpenFOAM 2.3.0. 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.0. This is the quickest solution for beginners and instructions are provided here: [http://openfoam.org/download/2-3-0-ubuntu/ Download v2.3.0 | 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-0-source/ Download v2.3.0 | 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 \
 
libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev
 
libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev
 
</bash>
 
</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>
 
</li>
  
Line 60: Line 62:
 
<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 76:
 
</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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
<bash>echo "alias of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
</bash>
 
</bash>
Line 84: Line 86:
  
 
# 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 118:
  
 
# 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 131: Line 133:
  
  
'''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 137: Line 139:
  
 
Here you have at least two choices:
 
Here you have at least two choices:
* You can install the Deb packages, which provide a quick and easy way for having a working installation of OpenFOAM 2.3.0. 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.0. This is the quickest solution for beginners and instructions are provided here: [http://openfoam.org/download/2-3-0-ubuntu/ Download v2.3.0 | 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-0-source/ Download v2.3.0 | 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 \
 
libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev
 
libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev
 
</bash>
 
</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>
 
</li>
  
Line 179: Line 183:
 
<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 193: Line 197:
 
</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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
<bash>echo "alias of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
</bash>
 
</bash>
Line 203: Line 207:
  
 
# 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 225: Line 229:
  
 
# 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 240: Line 244:
  
  
'''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 247: Line 251:
 
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-0-source/ Download v2.3.0 | Source Pack]
 
** Or by following the detailed step-by-step instructions below...
 
** Or by following the detailed step-by-step instructions below...
  
Line 255: Line 259:
 
<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 261: Line 265:
 
libmpfr-dev
 
libmpfr-dev
 
</bash>
 
</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>
 
</li>
  
Line 286: Line 292:
 
<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 300: Line 306:
 
</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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
<bash>echo "alias of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
</bash>
 
</bash>
Line 308: Line 314:
 
<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:
 
<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
 
<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
  
 
# 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 338: Line 347:
  
 
# 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 360: Line 369:
 
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-0-source/ Download v2.3.0 | Source Pack]
 
** Or by following the detailed step-by-step instructions below...
 
** Or by following the detailed step-by-step instructions below...
  
Line 369: Line 378:
 
<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 375: Line 384:
 
libmpfr-dev python python-dev
 
libmpfr-dev python python-dev
 
</bash>
 
</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>
 
</li>
  
Line 400: Line 411:
 
<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 414: Line 425:
 
</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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
<bash>echo "alias of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 
</bash>
 
</bash>
Line 422: Line 433:
 
<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:
 
<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
 
<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
  
 
# 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 457: Line 471:
 
<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 486: Line 500:
  
 
# 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 502: 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.0 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.0 on Ubuntu 14.10]
 +
 +
 +
== 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-0-source/ Download v2.3.0 | 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/194600-openfoam-2-3-x-install-ubuntu-16-04-windows-10-a.html openFoam 2.3.x install on Ubuntu 16.04 in windows 10]
 +
 +
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.0.tgz?use_mirror=mesh" -O OpenFOAM-2.3.0.tgz
 +
wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.0.tgz?use_mirror=mesh" -O ThirdParty-2.3.0.tgz
 +
 +
tar -xzf OpenFOAM-2.3.0.tgz
 +
tar -xzf ThirdParty-2.3.0.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.0/bin/mpicc
 +
ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.0/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.0/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.0/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.0/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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
 +
</bash>
 +
{{Installation/Linux/AliasNote|OpenFOAM 2.3.0|of230}}
 +
</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.0|of230}}
 +
 +
 +
'''Discussion thread where you can ask questions about these steps''': [https://www.cfd-online.com/Forums/openfoam-installation/194600-openfoam-2-3-x-install-ubuntu-16-04-windows-10-a.html openFoam 2.3.x install on Ubuntu 16.04 in windows 10]
 +
 +
<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-0-source/ Download v2.3.0 | Source Pack]
 +
** Or try following instead the instructions for installing [[Installation/Linux/OpenFOAM-2.3.1/Ubuntu#Ubuntu_18.04|OpenFOAM 2.3.1 on Ubuntu 18.04 on that wiki page]], but replace any mentions to 2.3.1 and with 2.3.0. If you are successful, please tell us about it on the discussion thread associated to those instructions.
 +
  
 
[[Category:Installing OpenFOAM on Linux]] [[Category:Installing OpenFOAM on Ubuntu]]
 
[[Category:Installing OpenFOAM on Linux]] [[Category:Installing OpenFOAM on Ubuntu]]

Latest revision as of 15:21, 27 October 2018

1 Introduction

This page is dedicated to explaining how to install OpenFOAM OF Version 230.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:


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.0.tgz?use_mirror=mesh" -O OpenFOAM-2.3.0.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.0.tgz?use_mirror=mesh" -O ThirdParty-2.3.0.tgz
     
    tar -xzf OpenFOAM-2.3.0.tgz 
    tar -xzf ThirdParty-2.3.0.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.0/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.0/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.0/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.0/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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/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.0 shell environment. In other words, whenever you start a new terminal, you should run:
    of230
    
    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.0 shell environment. In other words, run the following command whenever you start a new terminal:
of230
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.2 Ubuntu 13.10

Here you have at least two choices:


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.0.tgz?use_mirror=mesh" -O OpenFOAM-2.3.0.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.0.tgz?use_mirror=mesh" -O ThirdParty-2.3.0.tgz
     
    tar -xzf OpenFOAM-2.3.0.tgz 
    tar -xzf ThirdParty-2.3.0.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.0/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.0/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.0/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.0/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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/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.0 shell environment. In other words, whenever you start a new terminal, you should run:
    of230
    
    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.0 shell environment. In other words, run the following command whenever you start a new terminal:
of230
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:

  • You can install from source, by either:

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.0.tgz?use_mirror=mesh" -O OpenFOAM-2.3.0.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.0.tgz?use_mirror=mesh" -O ThirdParty-2.3.0.tgz
     
    tar -xzf OpenFOAM-2.3.0.tgz 
    tar -xzf ThirdParty-2.3.0.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.0/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.0/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.0/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.0/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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/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.0 shell environment. In other words, whenever you start a new terminal, you should run:
    of230
    
    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.0 shell environment. In other words, run the following command whenever you start a new terminal:
of230
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:

  • You can install from source, by either:


Discussion thread where you can ask questions about these steps: Installing OpenFOAM 2.3.0 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.0.tgz?use_mirror=mesh" -O OpenFOAM-2.3.0.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.0.tgz?use_mirror=mesh" -O ThirdParty-2.3.0.tgz
     
    tar -xzf OpenFOAM-2.3.0.tgz 
    tar -xzf ThirdParty-2.3.0.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.0/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.0/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.0/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.0/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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/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.0 shell environment. In other words, whenever you start a new terminal, you should run:
    of230
    
    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.0 shell environment. In other words, run the following command whenever you start a new terminal:
of230
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.0 on Ubuntu 14.10


2.5 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: openFoam 2.3.x install on Ubuntu 16.04 in windows 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 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.0.tgz?use_mirror=mesh" -O OpenFOAM-2.3.0.tgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.0.tgz?use_mirror=mesh" -O ThirdParty-2.3.0.tgz
     
    tar -xzf OpenFOAM-2.3.0.tgz 
    tar -xzf ThirdParty-2.3.0.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.0/bin/mpicc
    ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.3.0/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.0/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.0/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.0/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 of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/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.0 shell environment. In other words, whenever you start a new terminal, you should run:
    of230
    
    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.0 shell environment. In other words, run the following command whenever you start a new terminal:
of230
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: openFoam 2.3.x install on Ubuntu 16.04 in windows 10


2.6 Ubuntu 18.04

Here you have the following choices: