ubuntu 16.04
openfoam 4.0

源码安装 foam-extend 4.0
http://openfoamwiki.net/index.php/Installation/Linux/foam-extend-4.0/Ubuntu

【System preparations】

sudo apt-get update

sudo apt-get install git-core build-essential binutils-dev cmake flex \
zlib1g-dev qt4-dev-tools libqt4-dev libncurses5-dev libiberty-dev \
libxt-dev rpm mercurial graphviz python python-dev

【Get the source code】

cd ~
mkdir foam
cd foam
git clone git://git.code.sf.net/p/foam-extend/foam-extend-4.0 foam-extend-4.0

   // cd /opt
   // git clone git://git.code.sf.net/p/foam-extend/foam-extend-4.0 foam-extend-4.0

【compile】

cd ~/foam/foam-extend-4.0

echo export WM_THIRD_PARTY_USE_BISON_27=1  >> etc/prefs.sh  //这个命令不要忘了
source etc/bashrc

//当运行source etc/bashrc后,会显示好几条 bash:/opt/foam-extend-4.0/bin/...:没有那个文件或目录。
//开始检查:gedit etc/bashrc,看到 FOAM_INST_DIR=$HOME/$MM_PROJECT,运行 $HOME 后,显示路径为 /root,然而运行 $FOAM_INST_DIR 后,显示路径为 /opt;二者矛盾。此时,到shell手动运行 FOAM_INST_DIR=$HOME/$MM_PROJECT,再查看 $FOAM_INST_DIR,显示/root,执行source etc/bashrc 可顺利通过。
// 由于作者之前都将openfoam4和paraview安装到了/opt下面,为了统一,这里也将foam-extend4.0安装到/opt下。则

cp -r foam /opt
cd /opt/foam/foam-extend-4.0
gedit etc/bashrc

//修改为 FOAM_INST_DIR=/opt/$MM_PROJECT,此时执行source etc/bashrc还是有相同的问题,于是到shell单独执行FOAM_INST_DIR=/opt/$MM_PROJECT。在此后安装过程中,每遇到$HOME,都要换成/opt。

echo export WM_THIRD_PARTY_USE_BISON_27=1  >> etc/prefs.sh  //这个命令不要忘了
source etc/bashrc  //顺利通过了

echo "alias fe40='source \/opt/foam/foam-extend-4.0/etc/bashrc'" >> /opt/.bashrc

//Note: This line means that whenever you start a new terminal window or tab, you should run the alias command associated to the foam-extend 4.0 shell environment. In other words, whenever you start a new terminal, you should run: fe40

   【optionally】
    export QT_BIN_DIR=/path/to/qmake_directory
    echo "export QT_BIN_DIR=$QT_BIN_DIR" >> etc/prefs.sh

    export CUDA_ARCH=sm_30
    echo "export CUDA_ARCH=sm_30" >> etc/prefs.sh

./Allwmake.firstInstall  //漫长的编译过程,数个小时,要下载安装一些三方。

//安装过程中无fatal,有warning。
//大部分警告是 warning: use of old-style cast [-Wold-style-cast]
//ThirdParty Allmake stage 5 时,无法打开很多 .H for source file .C。
//以后应用中不知道会不会有问题,再更。
 

其他分享 https://blog.csdn.net/aleigus/article/details/72991105?utm_medium=distribute.pc_relevant.none-task-blog-OPENSEARCH-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-1.nonecase

 

Logo

更多推荐