2.ubuntu下安装openfoam8

2.搭建openfoam
直接安装
sudo addaptrepository http://dl.openfoam.org/ubuntu
sudo sh -c “wget -O – http://dl.openfoam.org/gpg.key | apt-key add -“
sudo apt-get update
sudo apt-get -y install openfoam5
gedit $HOME/.bashrc
source /opt/openfoam5/etc/bashrc
blockMesh
编译安装
sudo aptget install buildessential flex bison cmake zlib1gdev libopenmpidev openmpibin qt4devtools libqt4dev libqt4opengldev freeglut3dev libqtwebkitdev gnuplot libreadlinedev libncursesdev libxtdev libscotchdev libptscotchdev libcgaldev
sudo sh -c “wget -O – https://dl.openfoam.org/gpg.key | apt-key add -”
sudo add-apt-repository
http://dl.openfoam.org/ubuntu
sudo apt-get update
sudo apt-get -y install openfoam8
(4). 配置环境变量:在终端输入
gedit $HOME/.bashrc
会打开一个文件,我们在文件的最底部重新取一行添加下述文字:
source $HOME/OpenFOAM/OpenFOAM-5.x/etc/bashrc
保存并关闭。关闭终端并打开新的终端的时候,环境变量自动生效。
(5). 编译OpenFOAM:打开终端,输入(即切换到OpenFOAM-5.x目录下):
cd $HOME/OpenFOAM/OpenFOAM-5.x/
然后输入:
./Allwmake
这时候会输出大量的信息,编译开始。编译之后请尝试运行:
blockMesh

参考:

https://openfoam.org/download/8-ubuntu/