加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

[转载]OpenFOAM求解器开发入门(九):Pimple算法与伪时间步长

(2017-05-31 16:10:43)
标签:

转载

在of240的solvers文件夹中搜索pseudo-transient,得到如下四个求解器:
  • rhoPimpleFoam
  • rhoLTSPimpleFoam
  • rhoPimpleDyMFoam
  • rhoPimplecFoam
事实上不止这四个,比如LTSReactingFoam也是。关于LTS局部时间步的详细分析见东岳流体技术文档:LTS局部时间步

下面我们看在算例中具体如何使用伪时间步长方法获得稳态解。

看OpenFOAM-2.4.0tutorialscompressiblerhoPimpleFoamrasangledDuct
首先,m4 blockMeshDict.m4 > blockMeshDict
然后blockMesh
然后运行pyFoamPlotRunner.py  --clear rhoPimpleFoam -case abgledDuct
很快就可以得到结果。

我们先看controlDict,注意有颜色标记的地方:
application     rhoPimpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         10;

deltaT          1;

writeControl    adjustableRunTime;

writeInterval   1; //(自带的是10,为了验证确实达到了稳态,这里改为1进行测试)

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

adjustTimeStep  no;

maxCo           10;

maxDeltaT       1;

我们看fvSolution
solvers
{
    p
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance       1e-06;
        relTol          0.01;
    }

    pFinal
    {
        $p;
        tolerance       1e-06;
        relTol          0;
    }

    "(rho|U|h|k|epsilon|omega)"
    {
        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-05;
        relTol          0.1;
    }

    "(rho|U|h|k|epsilon|omega)Final"
    {
        $U;
        tolerance       1e-05;
        relTol          0;
    }

}

PIMPLE
{
    momentumPredictor yes;
    transonic       no;
    nOuterCorrectors 50;
    nCorrectors     1;
    nNonOrthogonalCorrectors 0;
    rhoMin          rhoMin [ 1 -3 0 0 0 ] 0.5;
    rhoMax          rhoMax [ 1 -3 0 0 0 ] 1.5;

    residualControl //nOuterCorrectors
    {
        "(U|k|epsilon)"
        {
            relTol          0;
            tolerance       0.0001;
        }
    }

    turbOnFinalIterOnly off;
}

relaxationFactors
{
    fields
    {
        "p.*"           0.3;
        "rho.*"         0.01;
    }
    equations
    {
        "(U|h|k|epsilon|omega).*" 0.7;
    }
}

我们回过头来看求解过程中的输出信息,initial residual确实在减小,这说明确实在稳态化。
那么如何使得initial residual更小呢?这就需要我们理解上述求解控制字典的具体含义了。

solvers中指定的残差是每一个时间步内每一个nOuterCorrectors(PIMPLE iteration)中代数方程组求解的残差Final residual。
residualControl和nOuterCorrectors在每一个时间步内只需要满足一个,而且residualControl指的是initial residual。PIMPLE iteration中的initial residual波动是松弛引起的。nOuterCorrectors=1时即为PISO算法。nOuterCorrectors=10~15加上松弛因子,这使得PIMPLE可以在较大的库郎数下进行计算。总之,瞬态算法中的时间步长十分关键!

所以现在明白了吧,nOuterCorrectors要足够大以保证residualControl可以使得初始残差降低的比较小,endTime也要足够大以使得最终的解充分稳态化。在此基础上可以调整solvers,nOuterCorrectors和residualControl以加快收敛。

最后,为什么reactingFoam施行不了伪时间步长法呢(时间步长大就发散!)?通过仔细对比reactingFoam和rhoPimpleFoam,可以发现问题主要出在连续性方程的求解上。

最后,PIMPLE算法控制的诸多微妙,慢慢体会吧!

reference
  1. OpenFOAM求解器开发入门(四):buoyantSimpleFoam和buoyantPimpleFoam
  2. http://www.cfd-online.com/Forums/openfoam-solving/134903-question-transient-simulation-openfoam-fluent.html
  3. http://www.cfd-online.com/Forums/openfoam-solving/111790-what-definitions-noutercorrectors-ncorrectors.html
  4. http://www.cfd-online.com/Forums/openfoam/121711-why-pimple-foam-used-under-relaxation-all-iteration-pimple-loop.html#post481037
  5. http://www.cfd-online.com/Forums/openfoam-solving/161212-pimple-pressure-residual-behaviour.html
  6. http://www.cfd-online.com/Forums/blogs/tobi/2489-all-about-pimple-algorithm-part-i.html
  7. http://www.cfd-online.com/Forums/blogs/tobi/2490-all-about-pimple-algorithm-part-ii.html
  8. http://www.cfd-online.com/Forums/openfoam-solving/130629-trouble-using-residual-control-pimplefoam.html
  9. http://www.cfd-online.com/Forums/openfoam-solving/73365-convergence-openfoam.html



有CFD或者of相关的问题,欢迎联系一起讨论,邮箱:wangyan14@mails.tsinghua.edu.cn。
请使用单位邮箱。
所需信息:
姓名
具体单位
职务职称
问题的具体描述,可以的话请带上相关的文献和代码等附件

0

  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有