各版本 OpenFOAM 及 Paraview 安装
OpenFOAM
OpenFOAM 包含两个大版本 (https://www.topcfd.cn/18754/ )
此处选择最新org OpenFOAM-V12版本,其余版本安装过程类似;安装也包含两种方法,第一种是通过包管理器 (https://openfoam.org/download/12-ubuntu ) 安装,另一种是基于源码安装 (https://openfoam.org/download/source ),此处选择后者
安装依赖包 (https://openfoam.org/download/source/software-for-compilation/ )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 sudo apt updatesudo apt-get install build-essential cmake git ca-certificates flexsudo sh -c "wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc" sudo add-apt-repository http://dl.openfoam.org/ubuntusudo apt install openfoam-deps sudo apt install openfoam-nopv-deps
下载源码 (https://openfoam.org/download/source/downloading-source-code/ )
1 2 git clone https://github.com/OpenFOAM/OpenFOAM-12.git git clone https://github.com/OpenFOAM/ThirdParty-12.git
设置环境变量 (https://openfoam.org/download/source/setting-environment/ )
1 2 3 4 5 source $HOME /OpenFOAM/OpenFOAM-12/etc/bashrcecho $WM_PROJECT_DIR
编译第三方软件 (https://openfoam.org/download/source/third-party-software/ )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 sudo vim $HOME /OpenFOAM/OpenFOAM-12/Allwmakevim $HOME /OpenFOAM/OpenFOAM-12/etc/bashrc export WM_MPLIB=OPENMPIsource $HOME /OpenFOAM/OpenFOAM-12/etc/bashrcwget -P $HOME /OpenFOAM/ThirdParty-12 https://download.open-mpi.org/release/open-mpi/v2.1/openmpi-2.1.1.tar.gz tar -xvf $HOME /OpenFOAM/ThirdParty-12/openmpi-2.1.1.tar.gz rm -f $HOME /OpenFOAM/ThirdParty-12/openmpi-2.1.1.tar.gz
编译 OpenFOAM (https://openfoam.org/download/source/compiling-openfoam/ )
安装 PVReaders
1 2 3 4 cd $FOAM_UTILITIES /postProcessing/graphics/PVReaders./Allwclean && ./Allwmake which paraFoam
更新 (https://openfoam.org/download/source/compiling-openfoam/ )
1 2 3 4 5 6 git pull ./Allwmake -update -j <n> wcleanPlatform
OpenFOAM switch version
OpenFOAM-org 最近几个版本变化较大,特别是 V11 版本引入了基于类的模块化求解器,因此有多版本共存的需求
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 # %Module proc ModulesHelp {} { puts stderr "Program: OpenFoam-v$::version" puts stderr "Description: Open Source Field Operation and Manipulation (OpenFOAM) C++ libraries." puts stderr "Home Page: https://openfoam.org/" puts stderr "User Guide: https://doc.cfd.direct/openfoam/user-guide-v12/index" puts stderr "Github: https://github.com/OpenFOAM/OpenFOAM-12" puts stderr "Licence: https://openfoam.org/licence" puts stderr {} } set version 12 set prefix /home/user/OpenFOAM module-whatis "OpenFOAM-v$version" conflict OpenFOAM source-sh bash $prefix/OpenFOAM-$version/etc/bashrc
Paraview
ParaFOAM
OpenFOAM ParaView 安装 (https://openfoam.org/download/source/third-party-software/ )
1 2 3 4 5 6 7 8 9 10 11 12 13 env | grep Paravim $HOME /OpenFOAM/etc/bashrc export ParaView_TYPE=ThirdPartysource $HOME /OpenFOAM/OpenFOAM-12/etc/bashrc./makeParaView -version 5.11.2 wmRefresh
BiliBili-paraView环境变量变动,连续翻车,终于搞定OpenFOAM-12 | 法式滚筒YEBOSS
BiliBili-openFOAM小随笔6:如何实现任意版本的paraView安装 | 法式滚筒YEBOSS
Original
Paraview Documents (https://docs.paraview.org/en/latest/UsersGuide/index.html )
Paraview Wiki (https://www.paraview.org/Wiki/ParaView )
可通过以下方式安装
添加 Paraview
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # %Module proc ModulesHelp {} { puts stderr "Program: paraview $::version" puts stderr "Description: Open-source, multi-platform visualization application." puts stderr "Home Page: https://www.paraview.org/Wiki/ParaView" puts stderr {} } set version 5.13.1 set prefix /home/user/snap/paraview module-whatis "ParaView is an open-source, multi-platform application designed to visualize data sets of va rying sizes from small to very large. " setenv FPM_HOME $prefix/ParaView-$version prepend-path PATH $prefix/ParaView-$version/bin
由于 paraview 依赖于 xcb, x11, glu, xrender, xi, xkbcommon, xkbcommon-x11 , 初次使用可能报错
1 2 3 4 5 6 7 Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: xcb. error: exception occurred: Subprocess aborted
安装 QT
即可 (https://web.stanford.edu/dept/cs_edu/resources/qt/install-linux#2-download-and-run-the-qt-installer )
参考
东岳流体-OpenFOAM安装
OpenFOAM学习杂记-OpenFOAM v1912以及paraview安装问题
Paraview安装两种方法(ubuntu系统下)