Openfoam学习记录(2017.06.10)(foam-extend-3.2在ubuntu16.04上的安装与编译)

       因为动网格要用到径向基函数方法,但是在很多openfoam的版本里都没找到这个文件,所以决定安装一个foam-extend-3.2,但是国内的教程基本都只有普通版本openfoam的安装教程,cfd-online上openfoam板块也不算是非常活跃,关于extend-3.2的安装编译的很多问题也不能得到及时良好的解决,我对linux系统一点也不熟,只能完完全全按照网上最基本的教程安装了。
      首先是一些准备工作,全部按照这个网站http://openfoamwiki.net/index.php/Installation/Linux/foam-extend-3.2/Ubuntu,我的系统是Ubuntu16.04
      step1: 进行一些升级
      code: sudo apt-get update
      step2:安装一些我也不知道有什么用的包
      code: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
      step3:建立foam文件夹,然后在网上下载extend-3.2的安装包
      code: cd ~
               mkdir foam
               cd foam
               git clone git://git.code.sf.net/p/foam-extend/foam-extend-3.2 foam-extend-3.2
     还有一些网站能下到这个包:http://git.code.sf.net/p/foam-extend/foam-extend- 3. 2 foam-extend- 3. 2
                                                    git://repo.or.cz/foam-extend- 3. 2.git foam-extend- 3. 2
                                                    http://repo.or.cz/foam-extend- 3. 2.git foam-extend- 3. 2
                                                    https://github.com/Unofficial-Extend-Project-Mirror/foam-extend-foam-extend- 3. 2.git foam-extend-3.2
       step4:环境变量的设置
       code: cd ~/foam/foam-extend- 3. 2
                echo export WM_THIRD_PARTY_USE_BISON_27= 1  >> etc/prefs.sh
                source etc/bashrc
                echo "alias fe32='source \$HOME/foam/foam-extend-3.2/etc/bashrc'" >> $HOME/.bashrc    //每次运行算例都要先输入fe32,也可以直接把地址加到bashrc文件末尾去
       step5:这个网站上说是要fix an issue with the Flex version,这一命令需要在Allwamke之前
       code: find src applications -name "*.L" -type f | xargs sed -i -e 's=\(YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\&\1='
       step 5: QT和CUDA solver的环境编译
      code:export QT_BIN_DIR=/path/to/qmake_directory   (其中/path/to/qmake_directory是which qmake和which qmake-qt4得到的路径,比如输入which qmake之后会显示/urs/bin/qmake,即export QT_BIN_DIR=/urs/bin/)
                 echo "export QT_BIN_DIR=$QT_BIN_DIR" >> etc/prefs.sh
                 export CUDA_ARCH=sm_30    (我也不知道我的计算机的sm数是多少,所以直接按照教程的30,最后也没有影响)                 
                 echo "export CUDA_ARCH=sm_30" >> etc/prefs.sh
       step6:openfoam编译
       code: ./Allwmake.firstInstall

下面是几个我遇到的问题:
      1.如果已经有安装包,先放进Ubuntu再解压,而不要先解压再放进去,因为这样可能会损坏一些软链接;
      2.bash: /opt/OpenFOAM-3.0.1/bin/foamCleanPath: No such file or directory出现这样的问题,很可能是因为你以前安装的openfoam导致了环境的冲突,可以用这个命令export FOAM_INST_DIR=/opt            source  /opt/OpenFOAM-3.0.1/etc/bashrc   直接安装到opt/文件夹里去 详见https://www.cfd-online.com/Forums/openfoam-installation/172157-openfoam-3-0-1-installation-problem-ubuntu-14-04-3-a.html
    
     
      

你可能感兴趣的:(Openfoam)