waves2Foam系列:1.安装

waves2Foam 的安装

waves2Foam的编译不算很难,其中可能会遇见一些错误。但如果仔细观察输出的log的话,是比较容易发现错误的。
本文使用Ubuntu 18.04 OpenFOAM 版本为3.0.1以及1912
其中3.0.1的安装采用的是源代码本地编译,而1912是通过预编译deb包直接安装的。本文不讲述OpenFOAM安装的细节。

安装waves2Foam

  1. 首先是下载依赖:
$ sudo apt install libgsl-dev gfortran subversion git

ubuntu版本为14.4 则将上面的 libgsl-dev 替换为libgsl0-dev

  1. 通过svn版本管理器下载源代码

必须先进入OpenFOAM的环境

$ mkdir -p $FOAM_RUN/../applications/utilities
$ cd $FOAM_RUN/../applications/utilities
$ svn co http://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.6/other/waves2Foam

若需要下载特定版本,则需要在svn co后加入选项-c 版本号

由于(大陆)网络波动,下载时有一定的可能性会出现下载失败或者校验失败等等
这个时候需要先解除svn对文件夹的锁定,然后再次执行svn下载

$ svn clean up waves2Foam
$ svn co http://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.6/other/waves2Foam
  1. 编译
$ cd waves2Foam
$ ./Allwmake

Allwmake里面有个很容易出的问题,就是ThirdParrty里面,关于OceanWave3D-Fortran90的下载,与安装时采用的git clone. git clone https://github.com/boTerpPaulsen/OceanWave3D-Fortran90.git ,详细见ThirdParty/Allwmake中关于OceanWave3D-Fortran90的内容,如下:

...
echo " COMPILE OCEANWAVE3D"
echo "====================================="

# Path for the git-repository
ocw="OceanWave3D-Fortran90"

# Create output directory for OceanWave3D
if [ ! -d "bin" ]
then mkdir bin
fi

# Check-out the git-repository
if [ ! -d "$ocw" ]
then echo ""
    echo "Cloning the OceanWave3D git repository ..."
    git clone https://github.com/boTerpPaulsen/OceanWave3D-Fortran90.git  

    # Copy the compilation settings for OCW3D
    cp $settings/oceanWave3DSettings/common.mk $ocw/.
    cp $settings/oceanWave3DSettings/makefile $ocw/.
else echo ""
    echo "Pull changes from the OceanWave3D git repository ..."
    cd $ocw
...

由于已知的(大陆)网络问题,会导致无法下载OceanWave3D,从而引发后续一系列问题,导致编译失败。此部分通过阅读make文件的操作,进行手动解决OceanWave3D的编译,主要进行了以下操作:

  • 下载OceanWave3D 到ThirdParty/目录下,可手动从github上下载。此处也有时间为20201026的存档,提取码为 v588,在ThirdParty目录下解压,请确认解压后的文件夹名称为OceanWave3D-Fortran90
  • cp $settings/oceanWave3DSettings/common.mk $ocw/. 注意此处中的环境变量$setting的具体路径是waves2Foam/ThirdParty/setting$ocw具体路径即为上一步解压后的文件夹OceanWave3D-Fortran90.
  • cp $settings/oceanWave3DSettings/makefile $ocw/. 此处同上一步。

完成这三步,就相当于手动解决了OceanWave3D的下载问题,然后可以运行Allmake进行编译。或者自行阅读后续过程手动编译OceanWave3D.

测试是否安装完成

编译完成后测试下,最简单的测试方法是在终端输入

waveFoam -help

如果编译成功,会提示

Usage: waveFoam [OPTIONS]
Options:
  -case <dir>       Specify case directory to use (instead of cwd)
  -decomposeParDict <file>
                    Use specified file for decomposePar dictionary
  -dry-run          Check case set-up only using a single time step
  -dry-run-write    Check case set-up and write only using a single time step
  -parallel         Run in parallel
  -doc              Display documentation in browser
  -help             Display short help and exit
  -help-full        Display full help and exit

Solver for two incompressible, isothermal immiscible fluids using VOF
phase-fraction based interface capturing.
With optional mesh motion and mesh topology changes including adaptive
re-meshing.

Using: OpenFOAM-2106 (2106) - visit www.openfoam.com
Build: _f815a12b-20210902
Arch:  LSB;label=32;scalar=64

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值