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-14Fetch / Axios学习:入门教程与实战指南
- 2024-11-14Typescript 类型课程入门教程
- 2024-11-14Fetch / Axios课程:初学者必看的网络请求教程
- 2024-11-14Styled-components课程:初学者指南
- 2024-11-13pre-commit 自动化测试课程:入门教程与实践指南
- 2024-11-13什么是AIGC?如何使用AIGC技术辅助办公?
- 2024-11-13Slicm 框架怎么进行用户认证?-icode9专业技术文章分享
- 2024-11-13在查询时将 map_coord 列的值转换为字符串有哪些方法?-icode9专业技术文章分享
- 2024-11-13如何将微信地区改成自定义文案?-icode9专业技术文章分享
- 2024-11-13DNS 缓存存在问题有哪些症状和解决方法?-icode9专业技术文章分享