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

[OpenFOAM.org] Installing OpenFOAM 2.3 on Ubuntu 18.04

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 2 Post By wyldckat
  • 1 Post By Daniel_Khazaei
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 11, 2018, 15:34
Default Installing OpenFOAM 2.3 on Ubuntu 18.04
  #1
New Member
 
Youssef Bestavros
Join Date: Jun 2018
Posts: 1
Rep Power: 0
Joe1best is on a distinguished road
Hi guys,



I am fairly new to OpenFOAM and I just started a research project with my university. I took on a project that uses OpenFOAM to simulate some fluid dynamics. The previous student who worked on this used OpenFOAM 2.3 along with some python wrapper to generate the necessary 0, constant, system files,etc. I am just wondering if there is a way to install OpenFOAM 2.3 on my Ubuntu 18.04 ? All the tutorial that I found work for older versions of Ubuntu like 16.04 and older. I even tried those and as expected, they did not work...



Thanks !
Joe1best is offline   Reply With Quote

Old   June 26, 2018, 12:49
Default
  #2
Member
 
James Wright
Join Date: Oct 2015
Posts: 40
Rep Power: 10
u2berggeist is on a distinguished road
I've been able to get the OpenFOAM working on Ubuntu 18.04 via the Docker fine. That's with 1712 (I'm not sure what the conversion from the X.X version system to the XXXX versioning system is), though you can probably find a Docker with the version you're looking for?


I'm as much of a newbie (probably more) as you are, so I might be steering you in the wrong direction, but I figured I'd let you know that I've gotten OF to work on 18.04.
u2berggeist is offline   Reply With Quote

Old   August 13, 2018, 11:46
Default
  #3
New Member
 
Jiaui Zhang
Join Date: Aug 2018
Location: Changsha, China
Posts: 17
Rep Power: 7
charryzzz is on a distinguished road
I am working on it, but it does not work yet. :-(
charryzzz is offline   Reply With Quote

Old   August 17, 2018, 13:30
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

Sorry for the late reply, but I simply was not able to look into the forum questions until now.

Please find the requested installation instructions here: https://openfoamwiki.net/index.php/I...u#Ubuntu_18.04

Best regards,
Bruno
cicatrix and Aeroman98 like this.
__________________
wyldckat is offline   Reply With Quote

Old   August 18, 2018, 11:18
Default
  #5
New Member
 
Jiaui Zhang
Join Date: Aug 2018
Location: Changsha, China
Posts: 17
Rep Power: 7
charryzzz is on a distinguished road
Thank you for your time.
I have tried this method, but failed to compile the of 2.3.1 on Ubuntu 18.04. The log is attached ( since the file size is too big, only the beginning is uploadded)

Quote:
Originally Posted by wyldckat View Post
Greetings to all!

Sorry for the late reply, but I simply was not able to look into the forum questions until now.

Please find the requested installation instructions here: https://openfoamwiki.net/index.php/I...u#Ubuntu_18.04

Best regards,
Bruno
Thank you for your time.
I have tried this method, but failed to compile the of 2.3.1 on Ubuntu 18.04. The log is attached ( since the file size is too big, only the beginning is uploadded)
Attached Files
File Type: txt errorlog.txt (48.9 KB, 32 views)
charryzzz is offline   Reply With Quote

Old   August 18, 2018, 18:58
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick post:
  • This is very strange... are you certain you installed the packages listed in step #3?
  • Are you using Ubuntu 18.04 via Windows 10 WSL? Namely the one installed through the Microsoft Store?
  • Either way, please install the package "libc6-dev" as well, by running the following command:
    Code:
    sudo apt-get install libc6-dev
    It should solve the very first error, which affects everything else.
wyldckat is offline   Reply With Quote

Old   August 19, 2018, 00:06
Default
  #7
New Member
 
Jiaui Zhang
Join Date: Aug 2018
Location: Changsha, China
Posts: 17
Rep Power: 7
charryzzz is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick post:
  • This is very strange... are you certain you installed the packages listed in step #3?
  • Are you using Ubuntu 18.04 via Windows 10 WSL? Namely the one installed through the Microsoft Store?
  • Either way, please install the package "libc6-dev" as well, by running the following command:
    Code:
    sudo apt-get install libc6-dev
    It should solve the very first error, which affects everything else.
  • I am sure that I have installed all the packages by running
    Code:
    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
  • NO, I am using Ubuntu 18.04 Desktop (Ubuntu 18.04.1 LTS)
  • I have already installed the newest verison of libc6-dev (2.27-3ubuntu1) and it still shows the same error, please see the attachment.
Attached Files
File Type: txt ThirdParty-log.txt (123.5 KB, 9 views)
File Type: txt Openfoam-log_1.txt (190.0 KB, 6 views)
File Type: txt Openfoam-log_2.txt (190.0 KB, 3 views)
File Type: txt Openfoam-log_3.txt (190.0 KB, 1 views)
File Type: txt Openfoam-log_4.txt (190.0 KB, 3 views)
charryzzz is offline   Reply With Quote

Old   August 19, 2018, 02:32
Default
  #8
New Member
 
Jiaui Zhang
Join Date: Aug 2018
Location: Changsha, China
Posts: 17
Rep Power: 7
charryzzz is on a distinguished road
Quote:
Originally Posted by charryzzz View Post
  • I am sure that I have installed all the packages by running
    Code:
    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
  • NO, I am using Ubuntu 18.04 Desktop (Ubuntu 18.04.1 LTS)
  • I have already installed the newest verison of libc6-dev (2.27-3ubuntu1) and it still shows the same error, please see the attachment.
It seems to be an "isnan error" and I have found a solution.

To modify src/conversion/ensight/part/ensightPart.H

After line 63
Code:
// Static data memebers 
static const List<word> elemTypes_;
add the following content

Code:
// wrapper for isnan, namely C99 or C++11
inline bool isnan(const scalar value) const 
{ 
#ifndef isnan 
return std::isnan(value); 
#else 
return ::isnan(value); 
#endif 
}
charryzzz is offline   Reply With Quote

Old   August 20, 2018, 13:51
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings charryzzz,

The fix you proposed for "isnan" would not solve this issue as indicated in the log files:
Code:
gcc -m32  -Wall -O3   -fPIC dirToString.c -o /home/charry/OpenFOAM/OpenFOAM-2.3.1/wmake/platforms/linuxGcc/dirToString
In file included from dirToString.c:43:0:
/usr/include/stdio.h:27:36: fatal error: bits/libc-header-start.h: No such file or directory
 #include <bits/libc-header-start.h>
But from this line and others, it's possible to see that I had made a mistake in the order of export commands for "WM_CC" and "WM_CXX" in step #8, because the line in the output above starts with gcc instead of gcc-5.

The problem was that since I had written this:
Code:
export WM_CC='gcc-5'
export WM_CXX='g++-5'
source $HOME/OpenFOAM/OpenFOAM-2.3.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
Meant that "WM_CC" and "WM_CXX" were redefined when sourcing "etc/bashrc" back to the default:
Code:
export WM_CC='gcc'
export WM_CXX='g++'
I've now corrected to this in that step #8:
Code:
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'

As for the fix you proposed, my guess is that you had started a new terminal and ran of231. This means that the following command was called when you started a new terminal:
Code:
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
hence now using GCC version 5 instead of version 7.


However, I'm not certain why you needed the fix for "isnan", because the library inside which you made that change, did not require that fix in the test build that I did while writing the instructions. That fix would only have been necessary if g++ 7 (part of GCC) was being used, which in the second build attempt that you did, I believe you were already using g++ 5.

For example, in the log file of my build, I got this:
Code:
SOURCE=ensight/part/ensightPart.C ;  g++-5 -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/ofuser/OpenFOAM/OpenFOAM-2.3.1/src/fileFormats/lnInclude -I/home/ofuser/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude -I/home/ofuser/OpenFOAM/OpenFOAM-2.3.1/src/meshTools/lnInclude -IlnInclude -I. -I/home/ofuser/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude -I/home/ofuser/OpenFOAM/OpenFOAM-2.3.1/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/ensightPart.o
notice that it starts with:
Code:
SOURCE=ensight/part/ensightPart.C ;  g++-5
which gave me no errors.
Only when I replace g++-5 with g++, do I get this error:
Code:
ensight/part/ensightPart.C: In member function ‘bool Foam::ensightPart::isFieldDefined(const Foam::List<double>&) const’:
ensight/part/ensightPart.C:54:39: error: ‘isnan’ was not declared in this scope
             if (id >= field.size() || isnan(field[id]))
                                       ^~~~~
Therefore, there shouldn't be a need to add the "isnan" fix to the instructions at https://openfoamwiki.net/index.php/I...u#Ubuntu_18.04 - given that GCC 5 is the version being used to build it.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   August 21, 2018, 23:23
Default
  #10
New Member
 
Jiaui Zhang
Join Date: Aug 2018
Location: Changsha, China
Posts: 17
Rep Power: 7
charryzzz is on a distinguished road
Greetings Bruno
You are right! I have installed openfoam 2.3.1 on ubuntu 18.04 successfully according to your newest instructions.
Thank you :-)
charryzzz is offline   Reply With Quote

Old   August 23, 2018, 15:42
Default
  #11
Senior Member
 
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21
Daniel_Khazaei will become famous soon enough
I have compiled OpenFOAM 2.3.0 including paraview 4.1.0 successfully on the Ubuntu 18.04 based on the instruction provided for the 16.04! just needed to install gcc 5.5 accroding to this guide: (side by side with gcc 7.3 and selecting gcc5 before compiling)

https://gist.github.com/application2...cf9f56315a2d91

also needed to add these two lines in Make/options to get foamyQuadMesh and foamyHexyMesh compiled:

Code:
EXE_LIBS = \
    $(CGAL_LIBS) \
    -lextrude2DMesh \
    -lextrudeModel \
    -lcv2DMesh \
    -lconformalVoronoiMesh \
    -lmeshTools \
    -lsurfMesh \
    -ledgeMesh \
    -ltriSurface \
    -ldynamicMesh \
    -ldecompositionMethods \
    -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
    -lsampling \
    -lpthread \
    -lboost_thread \
    -lfileFormats

Last edited by Daniel_Khazaei; August 23, 2018 at 17:37.
Daniel_Khazaei is offline   Reply With Quote

Old   August 23, 2018, 16:20
Default
  #12
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Daniel,

Many thanks for sharing!

Although now I am a bit confused... when did you start to try to build OpenFOAM 2.3.0 on Ubuntu 18.04? I ask this because I had added a section for it here https://openfoamwiki.net/index.php/I...u#Ubuntu_18.04 - on the 17th of August 2018... so perhaps you had started your build before that?

Which leads me to the following question: Would it be preferable that I copy the complete instructions from the page for 2.3.1 to 2.3.0, instead of providing the wiki link?

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   August 23, 2018, 17:17
Default
  #13
Senior Member
 
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21
Daniel_Khazaei will become famous soon enough
Quote:
Originally Posted by wyldckat View Post
Greetings Daniel,

Many thanks for sharing!

Although now I am a bit confused... when did you start to try to build OpenFOAM 2.3.0 on Ubuntu 18.04? I ask this because I had added a section for it here https://openfoamwiki.net/index.php/I...u#Ubuntu_18.04 - on the 17th of August 2018... so perhaps you had started your build before that?

Which leads me to the following question: Would it be preferable that I copy the complete instructions from the page for 2.3.1 to 2.3.0, instead of providing the wiki link?

Best regards,
Bruno
Dear Bruno,
I have compiled it a month ago when I decided to upgrade to ubuntu 18.04 from 16.04! The first reasonable thing to do was to follow 16.04 instruction step by step and it didn't failed me...

after the step involving the installation of the necessary packages, I did as follow:

Code:
sudo apt-get update
sudo apt-get install gcc-snapshot -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
then selecting gcc5:
Code:
sudo update-alternatives --config gcc
also qt4 is needed:
Code:
sudo apt-get install qt4-default
actually I made aliases in bashrc to choose between different gcc and qt:
Code:
alias selectGCC='sudo update-alternatives --config gcc'
alias selectQt4='sudo apt-get install qt4-default'
alias selectQt5='sudo apt-get install qt5-default'
default cmake from ubuntu installation is used (3.10.2).

Quote:
Originally Posted by wyldckat View Post
Which leads me to the following question: Would it be preferable that I copy the complete instructions from the page for 2.3.1 to 2.3.0, instead of providing the wiki link?
Sorry but I haven't tried the instruction for OpenFOAM 2.3.1 with 2.3.0, so can comment here!

I can only confirm that the instruction for 16.04 in this page:

https://openfoamwiki.net/index.php/I...M-2.3.0/Ubuntu

is completely applicable to 18.04 with the above mentioned modifications!

Furthermore, the instruction for swak4Foam is also working on ubuntu 18.04:

https://openfoamwiki.net/index.php/I...2.2.0_to_3.0.x


Regards,
wyldckat likes this.

Last edited by Daniel_Khazaei; August 23, 2018 at 21:23.
Daniel_Khazaei is offline   Reply With Quote

Old   August 24, 2018, 13:46
Default
  #14
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Daniel,

Many thanks for writing down the steps you've used! And I'm very glad that swak4Foam builds without problems with those instructions.

I have a few improvement suggestions to the steps that you have:
  • You can switch between Qt versions by using the environment flag "QT_SELECT", for example:
    Code:
    export QT_SELECT=qt4
    export QT_SELECT=qt5
  • In steps #7 and #8 on the recent instructions for building OpenFOAM 2.3.1 on Ubuntu 18.04, you can tell OpenFOAM to use GCC 5 by using two tricks:
    1. Change the compiler names on the rules file:
      Code:
      sed -i -e 's/gcc/\$(WM_CC)/' OpenFOAM-2.3.1/wmake/rules/linux64Gcc/c
      sed -i -e 's/g++/\$(WM_CXX)/' OpenFOAM-2.3.1/wmake/rules/linux64Gcc/c++
      So that it uses environment variables instead of hard-coded names.
    2. Then after sourcing OpenFOAM's shell environment, you can redefine said environment variables, namely:
      Code:
      export WM_CC='gcc-5'
      export WM_CXX='g++-5'
    This way you don't need to change the default compiler for the whole Ubuntu installation
Best regards,
Bruno
Daniel_Khazaei likes this.
wyldckat is offline   Reply With Quote

Old   December 27, 2020, 08:22
Default
  #15
Member
 
Yan
Join Date: Dec 2013
Location: Milano
Posts: 42
Rep Power: 12
aparangement is on a distinguished road
Send a message via Skype™ to aparangement
I followed the guide of

https://openfoamwiki.net/index.php/I...u#Ubuntu_18.04

and successfully installed of230 and paraview on ubuntu18.04.5, without any issue, thanks a lot!!
aparangement is offline   Reply With Quote

Old   August 5, 2021, 22:21
Default
  #16
Member
 
chengan.wang
Join Date: Jan 2016
Location: china
Posts: 47
Rep Power: 10
wangchengan2003 is on a distinguished road
Send a message via Skype™ to wangchengan2003
Dear Bruno,
Have you tried to install openfoam 2.3 on ubuntu 20.04? I follow wiki https://openfoamwiki.net/index.php/I...u#Ubuntu_18.04
But it does not work. Could you give me some ideas?



Best regards,


Chengan
wangchengan2003 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] Looking for instructions/suggestions on installing Ubuntu as 2nd OS for OpenFOAM Alan Thomason OpenFOAM Installation 5 September 9, 2015 16:52
[OpenFOAM.org] Problems installing OpenFOAM 2.3.0 on Ubuntu 12.04 arieljeds OpenFOAM Installation 6 August 19, 2015 07:39
Prolem installing OpenFOAM Ver 2.3.0 source in Ubuntu 13.1.0 on VMware zandi OpenFOAM Installation 5 March 31, 2014 03:57
Trouble installing OpenFoam 2.10 on Ubuntu 11.10 LucasCG OpenFOAM Installation 17 January 27, 2013 14:58
Trouble with installing OpenFOAM on Ubuntu Milos OpenFOAM Installation 16 November 16, 2009 02:44


All times are GMT -4. The time now is 07:50.