LES控制方程

OpenFOAM内含有非常丰富的操作符和算子等。只要确定了控制方程,就能在求解器里自定义要程序解的方程了。在大涡模拟中,省去推导过程,控制方程一般如下形式(张兆顺,2007):

大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_方程组


如果写成矩阵形式,引用李东岳的网站:

大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_02


大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_03


先看上面的分量形式。在这个控制方程中,要想在OpenFOAM里求解流场变量,仍需要知道大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_04大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_运算符_05才能封闭方程组。在这里,大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_运算符_05即为亚格子涡粘系数,它在OpenFOAM中是nuSgs。而正应力大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_07则可以用亚格子动能代替:大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_08大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_09在OpenFOAM中是k。

Boussinesq假定

具体推导可参照李东岳的博文,这里给出不可压时的结果:

大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_10


该方程描述了亚格子应力大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_运算符_11大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_12大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_09的关系。

Smagorinsky模型

在1967年Lilly给出了大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_04的表达式(相关文献):

大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_15

而正应力大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_07又可以通过大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_08来替换,最后得到大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_12大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_09的关系:

大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_20

由此,方程的封闭还差最后一个变量大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_09。Smagorinsky提出模型:

大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_22

通过代入上述各式,即可求解大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_09。过程可参考CFD中文网中一二发的帖子。

Ps:运算符“:”是双重内积,即两张量先作矩阵乘法运算(点积),再进行缩并(Contraction)。因为参与运算的两个张量都是二阶,点积后仍为二阶,但缩并后降二阶,最后是零阶,即一个数。最后这个方程是一个一元二次方程,按公式法求解即可。

在此引用一二发的帖子中的结果:

大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_运算符_24

OpenFOAM中代码

在OpenFOAM中,公式与上文所述一致,只是所用的变量名字不同:

\verbatim
        B = 2/3*k*I - 2*nuSgs*dev(D)

    where

        D = symm(grad(U));
        k from D:B + Ce*k^3/2/delta = 0
        nuSgs = Ck*sqrt(k)*delta
    \endverbatim

B就是大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_运算符_11,D就是大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_26
在Smagorinsky.C的代码中,先计算了大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_点积_09

template<class BasicTurbulenceModel>
tmp<volScalarField> Smagorinsky<BasicTurbulenceModel>::k
(
    const tmp<volTensorField>& gradU
) const
{
    volSymmTensorField D(symm(gradU));

    volScalarField a(this->Ce_/this->delta());
    volScalarField b((2.0/3.0)*tr(D));
    volScalarField c(2*Ck_*this->delta()*(dev(D) && D));

    return volScalarField::New
    (
        IOobject::groupName("k", this->alphaRhoPhi_.group()),
        sqr((-b + sqrt(sqr(b) + 4*a*c))/(2*a))
    );
}

代码中abc都与上面的结果一一对应。
再计算大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_openfoam_12并修正控制方程中的nut:

template<class BasicTurbulenceModel>
void Smagorinsky<BasicTurbulenceModel>::correctNut()
{
    volScalarField k(this->k(fvc::grad(this->U_)));

    this->nut_ = Ck_*this->delta()*sqrt(k);
    this->nut_.correctBoundaryConditions();
    fv::options::New(this->mesh_).correct(this->nut_);

    BasicTurbulenceModel::correctNut();
}

correctNut()在各求解器中都会有的,在计算完这一时间步之后,修正湍流粘度系数,作下一时间步所用。这就是OpenFOAM植入湍流模型的逻辑:在不改变其控制方程的情况下,只修改湍流粘度系数,就能达到计算湍流的目的。
参数大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_方程组_29在Lilly(1967)的文章中是0.094,和OpenFOAM中的对应。而大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_cfd_30的来源尚不清楚,博文说大模型训练中 slurm Kubernetes 比较优缺点 smagorinsky模型_运算符_31是因为湍流模型基于GenEddyVisc model(一般涡粘性假设?),如有误,请加qq1019003721进行勘误,谢谢!

参考文献

  1. Smagorinsky J. General circulation experiments with the primitive
    equations: I. the basic experiment[J]. Monthly weather review, 1963,
    91(3): 99-164.
  2. Smagorinsky, J. , Manabe, S. , & Holloway, J. L. . (1963).
    “numerical results from a nine-layer general circulation model,”.
    monthly weather review, 91(12), 263-270.
  3. Deardorff, J. W. . (1970). A numerical study of three-dimensional
    turbulent channel flow at large reynolds number. Journal of Fluid
    Mechanics, 41.
  4. LILLY, D. K. 1967 Proceedings of the IBM Scientific Computing
    Symposium on Environmental Sciencer, IBM Form no. 320-1951, 195.
  5. 张兆顺, 崔桂香, 许春晓. 湍流大涡数值模拟的理论与应用[M]. 清华大学出版社, 2008.