kOmega模型的求解器添加温度方程方法



  • 这里主要是参考了OpenFoam中的传热求解器buoyantBoussinesqPimpleFoam

    参考代码:

    alphat = turbulence->nut()/Prt;//计算湍流热扩散系数alphat,需要在H文件中声明该场,nut通过湍流模型计算得到。
    alphat.correctBoundaryConditions();
    
    volScalarField alphaEff("alphaEff", turbulence->nu()/Pr + alphat);//建立体标量场alphaEff(综合热扩散系数),直接在主程序中声明了
    

    然后将上述alphaEff放到温度方程中就行了。同是在fvSchemes中定义其格式

    fvScalarMatrix TEqn
    (fvm::ddt(T
     +fvm::div(phi,T)
    -fvm::laplacian(alphaEff,T)//laplacian(alphaEff,T)在fvSchemes中定义其格式
    );
    

    需要注意的是kOmega模型代码中有alpha,这个系数,这并不是热扩散系数,而是Omega方程中的一个系数(与传热无关),只不过OF在写代码时写成这样了,可以看1988年wilcox发表的论文“Reassessment of the scale-determining equation for advance turbulence models”。

    之前因为刚开始设置时将零文件中Omega的边界条件设置成了0(零),所以才会报如下除零错误(附带一浮点数例外和模型问题(因为 alphat = turbulence->nut))

    [16] #1  Foam::sigFpe::sigHandler(int) at ??:?//这个错误是除零错误
    [37] #1  Foam::sigFpe::sigHandler(int)[20] #0   
    Foam::error::printStack(Foam::Ostream&) at ??:?
    [2] #1  Foam::sigFpe::sigHandler(int) at ??:?
    [47] #4  void Foam::divide<Foam::fvPatchField, Foam::volMesh>      
    (Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&,   
    Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/lib/x86_64-linux-gnu/libc.so.6"
    [23] #3  Foam::divide(Foam::Field<double>&, 
    Foam::UList<double> const&, Foam::UList<double> const&) at ??:?
    
    [kdd:28991] *** Process received signal ***
    [kdd:28991] Signal: Floating point exception (8)//浮点数例外错误
    [kdd:28991] Signal code:  (-6)
    [kdd:28991] Failing at address: 0x3e80000713f
    
    --------------------------------------------------------------------------
    mpirun noticed that process rank 30 with PID 31201 on node kdd exited on signal 8 (Floating point exception).
    

    在求解器中的速度方程代码引入湍流模型的同时,还需要更新速度边界条件的后一行添加湍流修正,如下:

    U.correctBoundaryConditions();
    turbulence->correct();
    

    否则不会求解k、Omega这两个变量(在显示屏中没有这两个),同时算例的fvSolutions中设置k、Omega的矩阵求解器;
    还有一个与一般不同的是,因为在H文件中声明alphat时,因为用到了湍流模型,所以需要将H文件底部指向湍流模型的指针代码放到声明alphat场的前面,这在OF中也有。希望可以帮到其他小伙伴。



  • 感谢鸭蛋分享


Log in to reply
 

CFD中文网 2016 - 2020 | 京ICP备15017992号-2