OpenFoam8安装swak4Foam
一个结合了groovyBC和funkySetFields功能的库:它为用户提供了指定涉及字段的表达式并计算它们的可能性。这个库提供了许多实用程序(例如funkySetFields使用表达式设置字段)、边界条件(groovyBC根据表达式指定任意边界条件)和函数对象,这些工具允许做许多需要编程的事情。
提示:以下是本篇文章正文内容,下面案例可供参考
一、准备工作
代码如下(示例):
sudo apt update
sudo apt install snapd
sudo snap install hello-world
sudo snap install mercurial
sudo apt-get install python-is-python3
链接:https://snapcraft.io/docs/installing-snap-on-ubuntu
二、安装swak4Foam
链接:https://openfoamwiki.net/index.php/Installation/swak4Foam
代码如下(示例):
//Installation/swak4Foam/Downloading
mkdir -p $FOAM_RUN
cd "$HOME/OpenFOAM/$USER-$WM_PROJECT_VERSION"
hg clone http://hg.code.sf.net/p/openfoam-extend/swak4Foam swak4Foam
cd swak4Foam && hg update develop
//Installation/swak4Foam/Building dependencies
cd swak4Foam
wget http://ftpmirror.gnu.org/m4/m4-1.4.17.tar.gz
tar -xf m4-1.4.17.tar.gz
cd m4-1.4.17
./configure --prefix $PWD/../m4
make
make install
cd ..
export PATH=$PWD/m4/bin:$PATH
bison --version
//Installation/swak4Foam/Installing On/Ubuntu
#Go into swak4Foam's main source foldercd swak4Foam
# This next command will take a while...
./Allwmake > log.make 2>&1
#Run it a second time for getting a summary of the installation
./Allwmake > log.make 2>&1
export WM_NCOMPPROCS=4
三、测试是否安装成功swak4Foam
代码如下(示例):
//测试是否安装成功
funkySetFields
//安装成功会报错然后显示版本号 安装在了of8下面
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
Build : 8-3d62498be310
Exec : funkySetFields
Date : Jul 17 2021
Time : 15:53:00
Host : "dyfluid-virtual-machine"
PID : 39922
I/O : uncollated
Case : /home/dyfluid/OpenFOAM/dyfluid-6/swak4Foam
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
swakVersion: 202x.yy (Release date: Next release)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
--> FOAM FATAL ERROR:
funkySetFields: time/latestTime option is required
From function main()
in file funkySetFields.C at line 713.
FOAM exiting
四、安装过程中报错
代码如下(示例):
log.make:
Some scripts require a binary 'python' to be installed
It doesn't matter if this is Python 2 or 3
This problem is caused by Linux distros that install 'python2' and/or 'python3' but no python
On such distros usually a packages exists that links 'python' to one of those
解决1:
https://www.cfd-online.com/Forums/openfoam-community-contributions/113239-error-installing-swak4foam-8.html
其中里面很多带python的文件,可以通过file查看其链接情况:
cd /usr/bin
find python*
file python
产生新的链接文件:
sudo ln -s /usr/bin/python3.8 /usr/bin/python
在swak4Foam文件夹下面./Allwmake
cd "$HOME/OpenFOAM/$USER-$WM_PROJECT_VERSION"
./Allwmake
检查是否安装成功
funkySetFields