OpenFOAM中funkySetFields的安装与使用

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenFOAM中funkySetFields的安装与使用相关的知识,希望对你有一定的参考价值。

参考技术A

OpenFOAM中有个setFields函数能够设置简单的初始场,其实,OpenFOAM的插件swak4foam中funkySetFields能够设置更复杂的初始条件。

根据不同的OpenFOAM版本,在这个 网站 选择安装.

当然也可以试试网站中的另两种方法。

swak4foam包含下列文件或文件夹:

在swak4foam中输入以下命令:
./Allwmake
显示如下

应当指出,上述关键字可以直接在控制台上输,也可以写在名字为funkySetFieldsDict(类似于setFieldsDict)中。

or:

注意比较长的式子用单引号或者双引号隔开。 上述关键字没有次序要求。
类似于setFields:

高级命令行用法

方法二 使用 funkySetFieldsDict 字典

命令: funkySetFields -time 0

openFoam:报告湍流场的问题

【中文标题】openFoam:报告湍流场的问题【英文标题】:openFoam: Trouble reporting turbulence fields 【发布时间】:2017-05-22 05:04:13 【问题描述】:

我运行 openFoam 4.1,在我的 k-eps 模拟中提取湍流应力张量 R 时遇到问题。我 4 天前在 cfd-online.com 上问过同样的问题,但没有收到回复,所以我现在希望也许有人可以在这里帮助我。

为了提取R,我只修改了controlDict,如下所示:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile

    version     2.0;
    format      ascii;
    class       dictionary;
    object      controlDict;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     simpleFoam;

startTime       0;

stopAt          endTime;

endTime         5000;

deltaT          1;

writeControl    timeStep;

writeInterval   100;

purgeWrite      2;

writeFormat     ascii;

writePrecision  8;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

functions

#includeFunc    residuals

    turbulenceFields1
    
        type            turbulenceFields;
        libs            ("libfieldFunctionObjects.so");
        field           R;
    


// ************************************************************************* //

当我尝试使用上述 controlDict 解决时,我得到以下信息:

/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.1                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 4.1
Exec   : simpleFoam
Date   : May 18 2017
Time   : 07:08:01
Host   : "..."
PID    : 11073
Case   : /home...
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


SIMPLE: convergence criteria
    field p     tolerance 0.001
    field U     tolerance 0.001
    field "(k|epsilon|omega|f|v2)"     tolerance 0.001

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs

    Cmu             0.09;
    C1              1.44;
    C2              1.92;
    C3              -0.33;
    sigmak          1;
    sigmaEps        1.3;


No MRF models present

No finite volume options present


Starting time loop

turbulenceFields turbulenceFields1: storing fields:
    turbulenceProperties:R

Time = 1

smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 0.068919891, No Iterations 6
smoothSolver:  Solving for Uy, Initial residual = 1, Final residual = 0.094423261, No Iterations 4
smoothSolver:  Solving for Uz, Initial residual = 1, Final residual = 0.065365879, No Iterations 6
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.0086113464, No Iterations 26
time step continuity errors : sum local = 0.51812432, global = -0.07783965, cumulative = -0.07783965
smoothSolver:  Solving for epsilon, Initial residual = 0.59675441, Final residual = 0.051409907, No Iterations 3
smoothSolver:  Solving for k, Initial residual = 1, Final residual = 0.092548244, No Iterations 2
ExecutionTime = 0.81 s  ClockTime = 1 s



--> FOAM FATAL ERROR: 
object of type N4Foam9Function1INS_10SymmTensorIdEEEE is not allocated

    From function T* Foam::autoPtr<T>::operator->() [with T = Foam::Function1<Foam::SymmTensor<double> >]
    in file /home/ubuntu/OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/autoPtrI.H at line 176.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::timeVaryingMappedFixedValueFvPatchField<Foam::SymmTensor<double> >::write(Foam::Ostream&) const at ??:?
#3  Foam::GeometricField<Foam::SymmTensor<double>, Foam::fvPatchField, Foam::volMesh>::Boundary::writeEntry(Foam::word const&, Foam::Ostream&) const at ??:?
#4  Foam::GeometricField<Foam::SymmTensor<double>, Foam::fvPatchField, Foam::volMesh>::writeData(Foam::Ostream&) const at ??:?
#5  Foam::regIOobject::writeObject(Foam::IOstream::streamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType) const at ??:?
#6  Foam::functionObjects::regionFunctionObject::writeObject(Foam::word const&) at ??:?
#7  Foam::functionObjects::turbulenceFields::write() at ??:?
#8  Foam::functionObjectList::execute() at ??:?
#9  Foam::Time::loop() at ??:?
#10  Foam::simpleControl::loop() at ??:?
#11  ? at ??:?
#12  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#13  ? at ??:?
Aborted (core dumped)

从上面看来,openFoam 解决了第一个时间步,然后出现了问题。在目录“1”中,现在只有一个文件“turbulenceProperties:R”,其中包含每个点的应力张量的 6 个元素。

有人知道如何解决这个问题吗?

【问题讨论】:

【参考方案1】:

我想我在 cfd-online 论坛的 this 链接中找到了答案。

【讨论】:

以上是关于OpenFOAM中funkySetFields的安装与使用的主要内容,如果未能解决你的问题,请参考以下文章

OpenFOAM 学习路线 转载

在 openfoam 中,paraview 无法连接到 X 服务器

如何在 openFOAM 的 docker 版本中挂载卷

在 OpenFOAM 中使用 snappyHexMesh 和 STL 文件的教程

OpenFOAM 如何从列表中删除一些元素?

openfoam需要多少linux知识?