本文对OpenFOAM+LIGGGHTS+CFDEM耦合在北京超算云上编译安装过程进行记录。
总体安装步骤按CFDEM官方文档进行CFDEM®coupling Documentation — CFDEMcoupling v3.X documentation,在此基础上略有改动。
首先在默认目录下新建soft文件夹,在soft文件夹中新建env.sh文件用于配置环境。
从GitHub上下载OpenFOAM和ThirdParty源代码到本地并将压缩文件上传至超算云平台soft文件夹中,OpenFOAM版本要求为5.x及以下,本文以5.x为例。
OpenFOAM-5.x下载链接:GitHub - OpenFOAM/OpenFOAM-5.x: OpenFOAM Foundation patch version of OpenFOAM-5
ThirdParty-5.x下载链接:GitHub - OpenFOAM/ThirdParty-5.x: Third-party library compilation scripts for OpenFOAM-5
unzip OpenFOAM-5.x-master.zip
unzip ThirdParty-5.x-master.zip
mv OpenFOAM-5.x-master OpenFOAM-5.x
mv ThirdParty-5.x-master ThirdParty-5.x
在~/soft/OpenFOAM-5.x/etc文件夹下新建rebashrc文件,修改文件内容为:
#!/bin/bash
source /public1/soft/modules/module.sh
module load cmake/3.17.0-gcc mpi/intel/17.0.7-thc
export FOAM_INST_DIR=/public1/home/替换为您的超算账号/soft
foamDotFile=$FOAM_INST_DIR/OpenFOAM-5.x/etc/bashrc
[ -f $foamDotFile ] && . $foamDotFile
在~/soft/env.sh末尾添加一行:
source /public1/home/替换为您的超算账号/soft/OpenFOAM-5.x/etc/rebashrc
source ~/soft/env.sh
cd $WM_PROJECT_DIR
./Allwmake
编译时间很长,可能需要几个小时~
CFDEM下载链接:https://github.com/CFDEMproject/CFDEMcoupling-PUBLIC.git
LIGGGHTS下载链接:https://github.com/CFDEMproject/LIGGGHTS-PUBLIC.git
LPP下载链接:https://github.com/CFDEMproject/LPP.git
mkdir CFDEM
cd CFDEM
mv CFDEMcoupling-PUBLIC-master CFDEMcoupling-PUBLIC
cd ~/soft
mkdir LIGGGHTS
cd LIGGGHTS
mv LIGGGHTS-PUBLIC-master LIGGGHTS-PUBLIC
mv LPP-master lpp
修改CFDEMcoupling-PUBLIC文件名后缀与OpenFOAM版本号对应。
cd ~/soft/CFDEM
mv CFDEMcoupling-PUBLIC CFDEMcoupling-PUBLIC-$WM_PROJECT_VERSION
修改~/soft/env.sh内容为:
#!/bin/bash
source /public1/soft/modules/module.sh
module load mpi/intel/17.0.7-thc cmake/3.17.0-gcc vtk/6.2.0-thc python/2.7.17 mpi/openmpi/2.0.4-gcc-4.9.0
source /public1/home/替换为您的超算账号/soft/OpenFOAM-5.x/etc/rebashrc
export workdir=/public1/home/替换为您的超算账号/soft
export CFDEM_VERSION=PUBLIC
export WM_PROJECT_VERSION=5.x
export CFDEM_PROJECT_DIR=$workdir/CFDEMcoupling-$CFDEM_VERSION-$WM_PROJECT_VERSION
export CFDEM_SRC_DIR=$CFDEM_PROJECT_DIR/src
export CFDEM_SOLVER_DIR=$CFDEM_PROJECT_DIR/applications/solvers
export CFDEM_DOC_DIR=$CFDEM_PROJECT_DIR/doc
export CFDEM_UT_DIR=$CFDEM_PROJECT_DIR/applications/utilities
export CFDEM_TUT_DIR=$CFDEM_PROJECT_DIR/tutorials
export CFDEM_PROJECT_USER_DIR=$workdir/CFDEM/$LOGNAME-$CFDEM_VERSION-$WM_PROJECT_VERSION
export CFDEM_bashrc=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/bashrc
export CFDEM_LIGGGHTS_SRC_DIR=$workdir/LIGGGHTS/LIGGGHTS-PUBLIC/src
export CFDEM_LIGGGHTS_LIB_PATH=$workdir/LIGGGHTS/LIGGGHTS-PUBLIC/src
export CFDEM_LIGGGHTS_MAKEFILE_NAME=mpi
export CFDEM_LPP_DIR=$workdir/LIGGGHTS/lpp/src
. $CFDEM_bashrc
加载并检查环境是否配置成功:
source ~/.bashrc
cfdemSysTest
修改~/soft/LIGGGHTS/LIGGGHTS-PUBLIC/src/MAKE/Makefile.mpi文件77~79行VTK路径为:
VTK_INC = -I/public1/soft/vtk/6.2.0/include/vtk-6.2
VTK_PATH = #-L/usr/lib/x86_64-linux-gnu
VTK_LIB = -lvtkCommonCore-6.2 -lvtkIOCore-6.2 -lvtkIOXML-6.2 -lvtkIOLegacy-6.2 -lvtkCommonDataModel-6.2 -lvtkIOParallel-6.2 -lvtkParallelCore-6.2 -lvtkParallelMPI-6.2 -lvtkIOImage-6.2 -lvtkCommonExecutionModel-6.2 -lvtkFiltersCore-6.2 -lvtkIOParallelXML-6.2
建议分步编译特定部分,使用以下命令:
cfdemCompLIG
cfdemCompCFDEMsrc
cfdemCompCFDEMsol
cfdemCompCFDEMuti
如果没有报错则安装完成,现在可以cd ~/soft/CFDEMcoupling-PUBLIC-5.x/tutorials运行官方案例进行测试。