Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into...

22
Source pack installa0on of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Transcript of Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into...

Page 1: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Sourcepackinstalla0onofOpenFOAM.4.0intoRHL

OpenCAELocalStudyMee0ngY.Takagi

July2,2016

Page 2: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Downloadthepackagesfromtheofficialwebsite

Page 3: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Whereshouldweinstall?

•  IfyouhaveamachineonlyforOpenFOAM,youcanupgradethelibrariesofthesystem.“DependentpackagesrequiredforRHEL6.5needupda:ngtonewerversions,e.g.Gccneedsupgradingfromv4.4tov4.5+.TheseupgradesmaybeavailableunderaRHELsupportsubscrip:on.Ifnot,thenupgradescanbeobtainedfromunofficialrepositoriesusingthefollowinginstruc:ons:”

•  Ifyoudonotwanttoupgradethesystemcasually,thecompa0blesoSwares/librariessuchasGCCandMPIarebuiltinthelocalThirdPartydirectory.

Page 4: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Ourmachineenvironment

•  OS:CentOS6.5(64bit)•  Systemlibraries:

–  GCC4.4.7–  cmake2.6-patch4–  Qt4.6.2

•  Targetconfigura0onofOpenFOAM–  Version4.0–  Mainsolvers,parallelprocessing,paraFoam(ParaViewreader)–  Requiredlaterversionlibrariesarebuiltintheprojectdirectory

(ThirdPartydirectory).

Page 5: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Procedureofinstalla0on

1.  Installthenecessaryrpmpackages.2.  Downloadthesourcepackagesandextractthem.3.  Edittheconfigura0on/sedngfiles.4.  Compilethetools/libraries.5.  Allwmake6.  Test(foamInstallationTest)7.  CompileParaViewanditsreader.

Page 6: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Installtherpmpackageswithyum

•  Necessarypackages:–  git,gcc-c++,bison,flex,m4,glibc-devel,glibc-devel.i686,zlib-devel

•  Asaroot,typetheyumcommand:$ yuminstallgccgcc-c++bisonflexm4glibc-devel\glibc-devel.i686zlib-devel

Page 7: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Directoryconfigura0on

•  UnderOpenFOAM-4.0

•  UnderThirdParty-4.0

Allwmakeapplica0ons/doc/plalorms/tutorials/COPYINGREADME.orgbin/etc/src/wmake/

Allclean cmake-3.2.1/ makeParaView3Allwmake etc/ makeQtAllwmakeLibccmio gcc-4.8.5/ mpc-1.0.1/CGAL-4.8/ gmp-5.1.2/ mpfr-3.1.2/COPYING makeCGAL openmpi-1.10.2/ParaView-5.0.1/ makeCmake plalorms/README.html makeGcc qt-everywhere-opensource-src-4.8.6/README.org makeGperSools scotch_6.0.3/boost_1_58_0/ makeLLVM build/ makeParaView

Red: make by yourself Blue: generated later

Page 8: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Downloadthesourcepackagesandextractthem

•  OpenFOAMmainsourcecode:

•  OpenFOAMThirdParty:

•  Compiler(GCC):

$ gitclonegit://github.com/OpenFOAM/OpenFOAM-4.x.git$ mvOpenFOAM-4.xOpenFOAM-4.0

$ gitclonegit://github.com/OpenFOAM/ThirdParty-4.x.git$ mvThirdParty-4.xThirdParty-4.0

$ cdThirdParty-4.0.x$ wgethttps://ftp.gnu.org/gnu/gcc/gcc-4.8.5/\gcc-4.8.5.tar.gz$ tarzxvfgcc-4.8.5.tar.gz

Page 9: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Downloadthesourcepackagesandextractthem

•  Libraries(gmp,mpfr,mpc)$ wgethttp://ftp.gnu.org/gnu/gmp/gmp-5.1.2.tar.bz2$ tarjxvfgmp-5.1.2.tar.bz2$ wgethttp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.gz$ tarzxvfmpfr-3.1.2.tar.gz$ wgethttp://ftp.gnu.org/gnu/mpc/mpc-1.0.1.tar.gz$ tarzxvfmpc-1.0.1.tar.gz

Page 10: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Downloadthesourcepackagesandextractthem

•  OpenMPI:

•  Scotch:•  Boost:

•  CGAL:

$ wget--no-check-certificatehttps://www.open-mpi.org/\software/ompi/v1.10/downloads/openmpi-1.10.2.tar.gz$ tarzxvfopenmpi-1.10.2.tar.gz

$ wgethttps://gforge.inria.fr/frs/download.php/\file/34099/scotch_6.0.3.tar.gz$ tarzxvfscotch_6.0.3.tar.gz

$ wgethttp://sourceforge.net/projects/boost/files/\boost/1.58.0/boost_1_58_0.tar.gz$ tarzxvfboost_1_58_0.tar.gz

$ wgethttps://github.com/CGAL/cgal/releases/download/\releases/CGAL-4.8/CGAL-4.8.tar.xz$ tarJxvfCGAL-4.8.tar.xz

Page 11: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Downloadthesourcepackagesandextractthem

•  Cmake:

•  Qt(qmake)

IfyoudonotneedParaView,thispackageisunnecessary.

$ wget--no-check-certificatehttps://download.qt.io/\archive/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz$ tarzxvfqt-everywhere-opensource-src-4.8.6.tar.gz

$ wget--no-check-certificatehttps://cmake.org/files/\v3.2/cmake-3.2.1.tar.gz$ tarzxvfcmake-3.2.1.tar.gz

Page 12: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Edittheconfigura0on/sedngfiles

•  EditOpenFOAM-4.0environmentfile

$ vi../OpenFOAM-4.0/etc/bashrc

exportWM_PROJECT=OpenFOAMexportWM_PROJECT_VERSION=4.0#Pleasesettotheappropriatepathifthedefaultisnotcorrect.#[$BASH_SOURCE]&&\exportFOAM_INST_DIR=${BASH_SOURCE%/*/*/*}||\#exportFOAM_INST_DIR=$HOME/$WM_PROJECT#exportFOAM_INST_DIR=~$WM_PROJECTexportFOAM_INST_DIR=/opt/$WM_PROJECT#exportFOAM_INST_DIR=/usr/local/$WM_PROJECT

Page 13: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Edittheconfigura0on/sedngfiles

$ vi../OpenFOAM-4.0/etc/bashrc

#-Compilerlocation:#WM_COMPILER_TYPE=system|ThirdParty(OpenFOAM)exportWM_COMPILER_TYPE=ThirdParty#-Labelsize:#WM_LABEL_SIZE=32|64exportWM_LABEL_SIZE=64#-MPIimplementation:#WM_MPLIB=SYSTEMOPENMPI|OPENMPI|SYSTEMMPI|\MPICH|MPICH-GM|HPMPI#|MPI|QSMPI|SGIMPIexportWM_MPLIB=OPENMPI

Page 14: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Edittheconfigura0on/sedngfiles

•  EditOpenFOAM-4.0compiler/librariessedngfile

$ vi../OpenFOAM-4.0/etc/config.sh/compiler

case"$WM_COMPILER_TYPE"inOpenFOAM|ThirdParty)#DefaultversionsofGMP,MPFRandMPC,overrideasnecessarygmp_version=gmp-5.1.2mpfr_version=mpfr-3.1.2mpc_version=mpc-1.0.1case"$WM_COMPILER"inGcc|Gcc48)gcc_version=gcc-4.8.5

Page 15: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Edittheconfigura0on/sedngfiles

•  EditThirdParty-4.0/makeCGAL

$ vimakeCGAL

#GetCGAL,boostandgmp/mpfrversions.$WM_PROJECT_DIR/etc/config.sh/functions_foamEvalSOURCE_CGAL_VERSIONS_ONLY=yes\$($WM_PROJECT_DIR/bin/foamEtcFileconfig.sh/CGAL)_foamSource$($WM_PROJECT_DIR/bin/foamEtcFileconfig.sh/compiler)set-xcgalPACKAGE=${cgal_version:-CGAL-4.8}boostPACKAGE=boost_1_58_0gmpPACKAGE=gmp-5.1.2mpfrPACKAGE=mpfr-3.1.2

Page 16: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Edittheconfigura0on/sedngfiles

•  EditCGAL

$ vi../OpenFOAM-4.0/etc/config.sh/CGAL

#Description#SetupfileforCGAL(&boost)include/libraries.#SourcedfromOpenFOAM-<VERSION>/etc/bashrc#---------------------------------------------------------boost_version=boost_1_58_0#cgal_version=cgal-systemcgal_version=CGAL-4.8

Page 17: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Compilethetools/libraries

•  ReloadtheOpenFOAMenvironmentfileandcompileGCC:

$ ./opt/OpenFOAM/OpenFOAM-4.0/etc/bashrc

Warningin/opt/OpenFOAM/OpenFOAM-4.0/etc/config.sh/settings:Cannotfind/opt/OpenFOAM/ThirdParty-4.0/platforms/linux64/gcc-4.8.5installation.Pleaseinstallthiscompilerversionorifyouwishtousethesystemcompiler,changethe'WM_COMPILER_TYPE'settingto'system'

$ ./makeGcc

Page 18: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Compilethetools/libraries

•  BuildCMakeandexecuteAllwmake:

•  BuildOpenFOAM:

•  ASerthecompiling,checkit:

$ ./makeCmake$ ./opt/OpenFOAM/OpenFOAM-4.0/etc/bashrc$ ./Allwmake

$ ./opt/OpenFOAM/OpenFOAM-4.0/etc/bashrc$ cd/opt/OpenFOAM/OpenFOAM-4.0/$ ./Allwmake–j4#-j4dependingonyourmachine

$ ./opt/OpenFOAM/OpenFOAM-4.0/etc/bashrc$ foamInstallationTest

Page 19: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

CompileParaViewanditsreader

•  BuildQt–  ShellscriptforQtcompilingisnotincludedinThirdParty4.0.

$ cd/opt/OpenFOAM/ThirdParty-4.0$ cp/opt/OpenFOAM/ThirdParty-3.0.x/makeQt./$ cp/opt/OpenFOAM/ThirdParty-3.0.x/etc/tools/QtFunctions\./etc/tools/$ vimakeQt

#Description#Buildscriptforqt-everywhere-opensource-src#---------------------------------------------------------qtVERSION=4.8.6qtTYPE=qt-everywhere-opensource-src

$ ./makeQt

Page 20: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

CompileParaViewanditsreader

•  CompileParaView5.0.1 $ vimakeParaView

#SetthepathtotheQt-4.5(orlater)qmakeifthe\systemQtisolderQMAKE_PATH="/opt/OpenFOAM/ThirdParty-4.0/\platforms/linux64Gcc/qt-4.8.6/bin"#SetthepathtocmakeCMAKE_PATH="/opt/OpenFOAM/ThirdParty-4.0/\platforms/linux64Gcc/cmake-3.2.1/bin"

$ ./makeParaView

Page 21: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

CompileParaViewanditsreader

•  CompileParaViewreader

•  ASerthecompiling,checkatutorialrun(cavity):

$ cd$FOAM_UTILITIES/postProcessing/graphics/PVReaders$ ./Allwclean$ ./Allwmake

$ ./opt/OpenFOAM/OpenFOAM-4.0/etc/bashrc$ mkdir–p$FOAM_RUN$ run$ cp–r$FOAM_TUTORIALS/incompressible/icoFoam/\ cavity/cavity./$ cdcavity$ blockMesh$ icoFoam$ paraFoam

Page 22: Source pack installaon of OpenFOAM. 4.0 into RHL · Source pack installaon of OpenFOAM. 4.0 into RHL Open CAE Local Study Mee0ng Y. Takagi July 2, 2016

Herewego!Enjoy!