OpenFoam在Centos7.5下编译全过程(Openmpi)
2021/6/19 7:34:57
本文主要是介绍OpenFoam在Centos7.5下编译全过程(Openmpi),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
- 安装必要的依赖包
$sudo yum groupinstall -y 'Development Tools'
$sudo yum install zlib-devel libXext-devel libGLU-devel libXt-devel libXrender-devel libXinerama-devel libpng-devel libXrandr-devel libXi-devel libXft-devel libjpeg-turbo-devel libXcursor-devel readline-devel ncurses-devel python python-devel cmake qt-devel qt-assistant mpfr-devel gmp gmp-devel
- 下载OpenFOAM安装包
$cd ~
$mkdir OpenFOAM
$cd OpenFOAM
$git clone https://github.com/OpenFOAM/OpenFOAM-5.x.git
$git clone https://github.com/OpenFOAM/ThirdParty-5.x.git
- 编译安装OpenFOAM第三方包
$cd ThirdParty-5.x
- 下载第三方包必要的源代码包
$mkdir download
$wget -P download https://www.cmake.org/files/v3.9/cmake-3.9.0.tar.gz
$wget -P download \
https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.10/CGAL-4.10.tar.xz
$wget -P download https://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.bz2
$wget -P download https://www.open-mpi.org/software/ompi/v2.1/downloads/openmpi-2.1.1.tar.bz2
$wget -P download http://www.paraview.org/files/v5.4/ParaView-v5.4.0.tar.gz
- 解压下载的源码包
$tar -xzf download/cmake-3.9.0.tar.gz
$tar -xJf download/CGAL-4.10.tar.xz
$tar -xjf download/boost_1_55_0.tar.bz2
$tar -xjf download/openmpi-2.1.1.tar.bz2
$tar -xzf download/ParaView-v5.4.0.tar.gz --transform='s/ParaView-v5.4.0/ParaView-5.4.0/'
- 更改默认的Boost和CGAL版本
$cd ..
$sed -i -e 's/\(boost_version=\)boost-system/\1boost_1_55_0/' OpenFOAM-5.x/etc/config.sh/CGAL
$sed -i -e 's/\(cgal_version=\)cgal-system/\1CGAL-4.10/' OpenFOAM-5.x/etc/config.sh/CGAL
- 配置临时环境变量
$source $HOME/OpenFOAM/OpenFOAM-5.x/etc/bashrc WM_LABEL_SIZE=64 WM_MPLIB=OPENMPI FOAMY_HEX_MESH=yes
- 构建CMake
CentOS 7.5附带CMake 2.8.,但ParaView 5.4.0需要最近的CMake 3.x系列中的一个版本,而CGAL也需要CMake。因此,我们需要自定义构建Cmake
$cd $WM_THIRD_PARTY_DIR
$./makeCmake > log.makeCmake 2>&1
$wmRefresh
- 编译ThirdParty包
$cd $WM_THIRD_PARTY_DIR
$./Allwmake > log.make 2>&1
$wmRefresh
- 编译ParaView
$cd $WM_THIRD_PARTY_DIR
$./makeParaView -mpi -python -qmake $(which qmake-qt4) > log.makePV 2>&1
$wmRefresh
- 编译OpenFOAM
$cd $WM_PROJECT_DIR
$./Allwmake -j > log.make 2>&1
$icoFoam -help
- 配置环境变量
$vim ~/.bashrc
#### OPENMPI #####
export PATH=$PATH:~/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/openmpi-2.1.1/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/OpenFOAM/ThirdParty-5.x/platforms/ linux64Gcc /openmpi-2.1.1/lib
#### PARAVIEW #####
export PATH=$PATH:~/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/ParaView-5.4.0/bin
#### OpenFOAM #####
source ~/OpenFOAM/OpenFOAM-5.x/etc/bashrc
$source ~/.bashrc
这篇关于OpenFoam在Centos7.5下编译全过程(Openmpi)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23增量更新怎么做?-icode9专业技术文章分享
- 2024-11-23压缩包加密方案有哪些?-icode9专业技术文章分享
- 2024-11-23用shell怎么写一个开机时自动同步远程仓库的代码?-icode9专业技术文章分享
- 2024-11-23webman可以同步自己的仓库吗?-icode9专业技术文章分享
- 2024-11-23在 Webman 中怎么判断是否有某命令进程正在运行?-icode9专业技术文章分享
- 2024-11-23如何重置new Swiper?-icode9专业技术文章分享
- 2024-11-23oss直传有什么好处?-icode9专业技术文章分享
- 2024-11-23如何将oss直传封装成一个组件在其他页面调用时都可以使用?-icode9专业技术文章分享
- 2024-11-23怎么使用laravel 11在代码里获取路由列表?-icode9专业技术文章分享
- 2024-11-22怎么实现ansible playbook 备份代码中命名包含时间戳功能?-icode9专业技术文章分享