OpenFOAM的k-e湍流模型字典设置

请教各位前辈,我最近发现 k-e 湍流模型 k 与 eplison 字典设置若是如下,则计算一开始就会报错:

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

也就是说,uniform 后面那个数字不能为 0;

问题来了,对于一个如下面所示的 k 字典,uniform 后面的数字是任意的吗(非0就行)?是否有什么依据?(除了进口有经验公式外,内部,壁面似乎没有经验公式,好奇这个值该怎么设置,同时为什么设置0会报错),望不吝赐教,谢谢!

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0.01;

boundaryField
{
    walls
    {
        type            kqRWallFunction;
        value           uniform 0.01;
    }
}

初始值设置不好也会导致发散。不知道你说的出错是什么情况?

初始值的设置可参考:

湍流边界条件:https://www.cfd-online.com/Wiki/Turbulence_free-stream_boundary_conditions

湍流特征长度:https://www.cfd-online.com/Wiki/Turbulent_length_scale

前辈,不是湍流边界条件,根据经验公式算湍流边界条件,这个我知道。我计算的是一个回路,没有入口出口。我说的是

internalField   uniform 0;

也就是整个内部初始条件设置为0,会出错,如下所示,完全看不懂(也许是发散吧):

Selecting finite volume options model type vectorSemiImplicitSource

    Source: pumpSource
    - selecting cells using cellZone pump
    - selected 1794 cell(s) with volume 0.00425576694402
[3] #0  [4] #0  [6] #0  [0] [1] #0  [2] #0Foam::error::printStack(Foam::Ostream
&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)
Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)#0
Foam::error::printStack(Foam::Ostream&)[5] #0  Foam::error::printStack(Foam::Ostream
&) at ??:?
……
……

如果这样设置,
internalField uniform 0.01;
那可以正确运行,如下:

Selecting finite volume options model type vectorSemiImplicitSource
    Source: pumpSource
    - selecting cells using cellZone pump
    - selected 1794 cell(s) with volume 0.00425576694402

Starting time loop
Time = 1

DILUPBiCGStab:  Solving for Ux, Initial residual = 1.1847739771e-09, Final residual = 1.1847739771e-09, No Iterations 0
DILUPBiCGStab:  Solving for Uy, Initial residual = 1, Final residual = 0.00435718579989, No Iterations 1
……

依我的理解是:
选择完源项的作用域后,就出错了。跟初始化有关系。

k\epsilon 的求解方程跟这个有关系。kEpsilon.C 这个文件里有

    // Dissipation equation
    tmp<fvScalarMatrix> epsEqn
    (
        fvm::ddt(alpha, rho, epsilon_)
      + fvm::div(alphaRhoPhi, epsilon_)
      - fvm::laplacian(alpha*rho*DepsilonEff(), epsilon_)
     ==
        C1_*alpha()*rho()*G*epsilon_()/k_()
      - fvm::SuSp(((2.0/3.0)*C1_ - C3_)*alpha()*rho()*divU, epsilon_)
      - fvm::Sp(C2_*alpha()*rho()*epsilon_()/k_(), epsilon_)
      + epsilonSource()
      + fvOptions(alpha, rho, epsilon_)
    );

    // Turbulent kinetic energy equation
    tmp<fvScalarMatrix> kEqn
    (
        fvm::ddt(alpha, rho, k_)
      + fvm::div(alphaRhoPhi, k_)
      - fvm::laplacian(alpha*rho*DkEff(), k_)
     ==
        alpha()*rho()*G
      - fvm::SuSp((2.0/3.0)*alpha()*rho()*divU, k_)
      - fvm::Sp(alpha()*rho()*epsilon_()/k_(), k_)
      + kSource()
      + fvOptions(alpha, rho, k_)
    );

可以看到 k_() 作为分母了。所以 k 不能为 0.

3 Likes

谢谢前辈,赞同!