OpenFOAM 普通用户安装
以 2.4.0
版本为例,其它版本类似
安装准备
创建目录
mkdir ~/project/OpenFOAM
下载源代码并解压缩
cd ~/project/OpenFOAM
wget http://downloads.sourceforge.net/foam/ThirdParty-2.4.0.tgz
wget http://downloads.sourceforge.net/foam/OpenFOAM-2.4.0.tgz
tar -xf ThirdParty-2.4.0.tgz
tar -xf OpenFOAM-2.4.0.tgz
建立符号链接
cd ~/
ln -s ~/project/OpenFOAM OpenFOAM
设置编译环境
加载编译器
module load openmpi/2.1.5
设置环境变量
source ~/OpenFOAM/OpenFOAM-2.4.0/etc/bashrc
编译 ThirdParty
cd ~/OpenFOAM/ThirdParty-2.4.0
./Allwmake
编译 OpenFOAM
cd ~/OpenFOAM/OpenFOAM-2.4.0
./Allwmake
编译安装完成。
OpenFOAM
并行的 sbatch
脚本示例
#!/bin/bash
#SBATCH --partition=hpxg
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=16
#SBATCH --time=6:00:00
module load openmpi/2.1.5
source ~/OpenFOAM/OpenFOAM-2.4.0/etc/bashrc
cd $SLURM_SUBMIT_DIR
srun -n $SLURM_NTASKS icoFoam -parallel