admin管理员组文章数量:1122871
OpenFOAM
OpenFOAM安装
最近装了OpenFOAM-v2112,记录一下,利人利己。
安装系统
虚拟机
-
ubuntu 20.04,VMware,很多安装教程
-
换源:阿里源
进入Ubuntu桌面,终端输入
sudo gedit /etc/apt/sources.list
将内容全部删除,并将下面的内容粘贴进去,并保存
deb / focal main restricted universe multiverse
deb-src / focal main restricted universe multiverse
deb / focal-security main restricted universe multiverse
deb-src / focal-security main restricted universe multiverse
deb / focal-updates main restricted universe multiverse
deb-src / focal-updates main restricted universe multiverse
deb / focal-proposed main restricted universe multiverse
deb-src / focal-proposed main restricted universe multiverse
deb / focal-backports main restricted universe multiverse
deb-src / focal-backports main restricted universe multiverse
安装OpenFOAM-v2112
安装依赖
- 可参考OpenFOAM官网给出的OpenFOAM系统要求
sudo apt-get update
sudo apt-get install build-essential autoconf autotools-dev cmake gawk gnuplot
sudo apt-get install flex libfl-dev libreadline-dev zlib1g-dev openmpi-bin libopenmpi-dev mpi-default-bin mpi-default-dev
sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev
- 安装openmpi,参考链接
-
进入openmpi官网,选择Download,鼠标右击openmpi-4.1.2.tar.gz上复制下载链接
-
终端输入
wget .1/openmpi-4.1.2.tar.gz
- 解压
tar -zxvf openmpi-4.1.2.tar.gz
- 打开openmpi-4.1.2
cd openmpi-4.1.2
- 配置(将其安装到 /usr/local/openmpi目录下)
./configure --prefix="/usr/local/openmpi"
- Build 并安装
make
sudo make install
- 设置环境变量
gedit ~/.bashrc
,打开后末尾输入
export PATH="$PATH:/usr/local/openmpi/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/openmpi/lib/"
- 保存后执行
sudo ldconfig
打开新的终端,使环境变量生效
- 测试是否安装成功
mpirun
设置环境变量
sudo gedit ~/.bashrc
alias of2112='source ~/OpenFOAM/OpenFOAM-v2112/etc/bashrc'
编译系统
of2112
foamSystemCheck
foam
./Allwmake -j -s -q -l
foamInstallationTest
测试
mkdir -p $WM_PROJECT_USER_DIR/{run,applications,src}
run
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily ./
cd pitzDaily
blockMesh
simpleFoam
Paraview安装
- 可以安装编译版paraFoam:
cd ThirdParty-v2112
./makeParaView
paraFoam
- 这里是从官网下载,手动安装了paraview-5.10.0
-
进入ParaView官网,下载
-
将ParaView压缩包拷贝到home目录下并解压
tar -zxvf ParaView-5.10.0-MPI-Linux-Python3.9-x86_64.tar.gz
- 重名为ParaView-5.10.0,并将其拷贝到/opt目录下
mv ParaView-5.10.0-MPI-Linux-Python3.9-x86_64 ParaView-5.10.0
cp -r ParaView-5.10.0 /opt/
- 设置环境变量
sudo gedit ~/.bashrc
,末尾添加
export PATH=$PATH:/opt/ParaView-5.10.0/bin
- 然后在运行完算例后
touch xxx.foam
,paraview xxx.foam
就可以了
参考
[1] =1001.2014.3001.5506 [2] [大官人学cfd](=333.999.0.0) [3] [东岳流体](.html) [4] .html本文标签: OpenFOAM
版权声明:本文标题:OpenFOAM 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1688019894a169549.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论