CFD中文网

    CFD中文网

    • 登录
    • 搜索
    • 最新

    关于nOuterCorrectors影响计算速度和计算精度的问题

    OpenFOAM
    7
    14
    1766
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • wuyukai
      wuyukai 最后由 wuyukai 编辑

      计算一个简单二维多圆柱绕流的动网格算例,网格数量大概40-50万,fvsolution中的nOuterCorrectors和nCorrecters我尝试了不同的值,发现随着该值设置的越来越大,结果才会收敛,最终分别等于20和10。但是这个条件下,计算时间特别久,一个二维40-50万网格的算例要计算将近90个小时,感觉很不合理。想请教一下各位大佬,我是不是哪里设置出错了?

      /*--------------------------------*- C++ -*----------------------------------*\
      | =========                 |                                                 |
      | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
      |  \\    /   O peration     | Version:  v2006                                 |
      |   \\  /    A nd           | Website:  www.openfoam.com                      |
      |    \\/     M anipulation  |                                                 |
      \*---------------------------------------------------------------------------*/
      FoamFile
      {
          version     2.0;
          format      ascii;
          class       dictionary;
          location    "system";
          object      fvSolution;
      }
      // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
      
      solvers
      {
          "(p|pcorr)"
          {
              solver          PCG;
              preconditioner        DIC;
              tolerance       1e-04;
              relTol          0.1;
          }
          "(p|pcorr)Final"
          {
              $p;
              relTol          0;
          }
          U
          {
              solver          smoothSolver;
              smoother        symGaussSeidel;
              tolerance       1e-04;
              relTol          0.1;
          }
          UFinal
          {
              $U;
              tolerance       1e-04;
              relTol          0.0;
          }
      }
      
      
      PIMPLE
      {
          momentumPredictor   no;
          correctPhi          yes;
          nOuterCorrectors    20;
          nCorrectors         10;
          nNonOrthogonalCorrectors 1;
          ddtCorr             true;
      
          pRefPoint           (20.0 0.0 0.5);
          pRefValue           0.0;
      }
      
      relaxationFactors
      {
         fields
         {
         }
         equations
         {
             "U.*"             1;
         }
      }
      // ************************************************************************* //
      
      /*--------------------------------*- C++ -*----------------------------------*\
      | =========                 |                                                 |
      | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
      |  \\    /   O peration     | Version:  v2006                                 |
      |   \\  /    A nd           | Website:  www.openfoam.com                      |
      |    \\/     M anipulation  |                                                 |
      \*---------------------------------------------------------------------------*/
      FoamFile
      {
          version     2.0;
          format      ascii;
          class       dictionary;
          location    "system";
          object      fvSchemes;
      }
      // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
      
      ddtSchemes
      {
          default         Euler;
      }
      
      gradSchemes
      {
          default         Gauss linear;
      }
      
      divSchemes
      {
          default         none;
          div(U)          Gauss linear;
          div(phi,U)      Gauss linearUpwind grad(U);
          div(phi,k)      Gauss linearUpwind grad(U);
          div(phi,K)      Gauss linearUpwind grad(U);
          div(phi,omega)  Gauss linearUpwind grad(U);
          div((nuEff*dev2(T(grad(U))))) Gauss linear;
      }
      
      laplacianSchemes
      {
          default         Gauss linear corrected;
      }
      
      interpolationSchemes
      {
          default         linear;
      }
      
      snGradSchemes
      {
          default         corrected;
      }
      
      wallDist
      {
          method meshWave;
      }
      
      
      // ************************************************************************* //
      
      
      
      1 条回复 最后回复 回复 引用
      • 波
        波流力 最后由 编辑

        算的什么多圆柱?有多少个圆柱?图形摆出来看看

        wuyukai 1 条回复 最后回复 回复 引用
        • C
          cccrrryyy 教授 最后由 编辑

          nCorrectors太大了,推荐1-3,最多我见过用到3的。PISO算法本来只有2步压力修正,所以这个值你可以固定,不放心的话用3好了。

          nOuterCorrectors你需要仔细的测试一下,这个和时间步大小也有关系。大致范围5-100左右吧。FLUENT那边的推荐值是20-25,我自己不管是在FLUENT还是FOAM测试出来的结果也都差不多,最多会用到30,一般情况下20左右。如果很多外迭代还无法收敛那你需要考虑缩小时间步长,而不是去无限制的去增大外迭代步数。另外你没有给relaxationFactors,为什么?

          收敛不收敛是你自己设置的,不是说收敛了就对,没收敛就错。最终要靠结果去判断,特别是和实验结果的对比。

          I don't want to survive, I want to thrive.

          wuyukai 1 条回复 最后回复 回复 引用
          • wuyukai
            wuyukai @cccrrryyy 最后由 编辑

            @cccrrryyy 感谢感谢,我在正式计算之前,算了单个圆柱的,和Oseen公式推出来的理论解能够比上。
            您说的方法我试试,由于OpenFoam我也只是初学,没有特别系统的学过,您说的relaxationFactors 我还不太清楚,我去好好了解一下。

            1 条回复 最后回复 回复 引用
            • wuyukai
              wuyukai @波流力 最后由 编辑

              @波流力 网格差不多长这样
              eaf21545-7678-4bbb-bd08-af74bada3421-image.png

              1 条回复 最后回复 回复 引用
              • J
                Joann 最后由 编辑

                参考DTCHullMoving算例中nOuterCorrectors为3,每个时间步里迭代3次,获得3个模型中心的运动坐标,那么如果要获得时间-运动的曲线,是不是选择最后一次迭代的坐标比较好呢?

                Hello, CFD. Hello, OpenFOAM.

                1 条回复 最后回复 回复 引用
                • 李东岳
                  李东岳 管理员 最后由 编辑

                  log文件贴一下

                  线上CFD课程开始报名:http://www.dyfluid.com/class.html

                  CFD高性能服务器 http://dyfluid.com/servers.html

                  J 1 条回复 最后回复 回复 引用
                  • J
                    Joann @李东岳 最后由 编辑

                    @李东岳 比如这个时间步里,PIMPLE迭代了3次,分别有三个旋转中心,如果一个时间步就取一个值,是不是迭代最后一次的旋转中心较好?

                    Courant Number mean: 0.00758176 max: 1.02562
                    Interface Courant Number mean: 8.04602e-05 max: 0.732939
                    Time = 8.89
                    
                    PIMPLE: Iteration 1
                    forces forces:
                        Not including porosity effects
                    Rigid-body motion of the hull
                        Centre of rotation: (3 0 0.189302)
                        Orientation: (0.999758 0 -0.0219868 0 1 0 0.0219868 0 0.999758)
                        Linear velocity: (0 0 -0.0427599)
                        Angular velocity: (0 -0.0134282 0)
                    GAMG:  Solving for pcorr, Initial residual = 1, Final residual = 0.000933377, No Iterations 20
                    time step continuity errors : sum local = 1.87363e-10, global = 7.57308e-13, cumulative = -3.15194e-09
                    smoothSolver:  Solving for alpha.water, Initial residual = 2.27988e-05, Final residual = 6.44668e-12, No Iterations 3
                    Phase-1 volume fraction = 0.803336  Min(alpha.water) = -3.41348e-13  Max(alpha.water) = 1
                    Applying the previous iteration compression flux
                    MULES: Correcting alpha.water
                    MULES: Correcting alpha.water
                    MULES: Correcting alpha.water
                    MULES: Correcting alpha.water
                    Phase-1 volume fraction = 0.803336  Min(alpha.water) = -9.55996e-09  Max(alpha.water) = 1
                    GAMG:  Solving for p_rgh, Initial residual = 0.00721682, Final residual = 4.55154e-08, No Iterations 17
                    time step continuity errors : sum local = 1.0765e-09, global = -2.39228e-12, cumulative = -3.15433e-09
                    PIMPLE: Iteration 2
                    forces forces:
                        Not including porosity effects
                    Rigid-body motion of the hull
                        Centre of rotation: (3 0 0.189302)
                        Orientation: (0.999758 0 -0.0219868 0 1 0 0.0219868 0 0.999758)
                        Linear velocity: (0 0 -0.0427459)
                        Angular velocity: (0 -0.0134156 0)
                    GAMG:  Solving for pcorr, Initial residual = 1, Final residual = 0.000949765, No Iterations 19
                    time step continuity errors : sum local = 1.34488e-10, global = -1.2392e-13, cumulative = -3.15445e-09
                    smoothSolver:  Solving for alpha.water, Initial residual = 1.58142e-05, Final residual = 6.39378e-12, No Iterations 3
                    Phase-1 volume fraction = 0.803336  Min(alpha.water) = -3.4121e-13  Max(alpha.water) = 1
                    Applying the previous iteration compression flux
                    MULES: Correcting alpha.water
                    MULES: Correcting alpha.water
                    MULES: Correcting alpha.water
                    MULES: Correcting alpha.water
                    Phase-1 volume fraction = 0.803336  Min(alpha.water) = -8.31726e-10  Max(alpha.water) = 1
                    GAMG:  Solving for p_rgh, Initial residual = 0.000213947, Final residual = 4.56853e-08, No Iterations 19
                    time step continuity errors : sum local = 1.07998e-09, global = -2.92566e-12, cumulative = -3.15738e-09
                    PIMPLE: Iteration 3
                    forces forces:
                        Not including porosity effects
                    Rigid-body motion of the hull
                        Centre of rotation: (3 0 0.189302)
                        Orientation: (0.999758 0 -0.0219868 0 1 0 0.0219868 0 0.999758)
                        Linear velocity: (0 0 -0.0427505)
                        Angular velocity: (0 -0.0134234 0)
                    GAMG:  Solving for pcorr, Initial residual = 1, Final residual = 0.000923356, No Iterations 22
                    time step continuity errors : sum local = 1.36977e-10, global = -1.34327e-13, cumulative = -3.15751e-09
                    smoothSolver:  Solving for alpha.water, Initial residual = 1.57985e-05, Final residual = 6.20267e-12, No Iterations 3
                    Phase-1 volume fraction = 0.803336  Min(alpha.water) = -3.412e-13  Max(alpha.water) = 1
                    Applying the previous iteration compression flux
                    MULES: Correcting alpha.water
                    MULES: Correcting alpha.water
                    MULES: Correcting alpha.water
                    MULES: Correcting alpha.water
                    Phase-1 volume fraction = 0.803336  Min(alpha.water) = -5.01932e-08  Max(alpha.water) = 1
                    GAMG:  Solving for p_rgh, Initial residual = 0.000101498, Final residual = 4.62009e-08, No Iterations 19
                    time step continuity errors : sum local = 1.09272e-09, global = 4.09503e-12, cumulative = -3.15342e-09
                    smoothSolver:  Solving for omega, Initial residual =2.53013e-05, Final residual = 7.65699e-09, No Iterations 2
                    smoothSolver:  Solving for k, Initial residual = 5.87558e-05, Final residual = 2.49652e-08, No Iterations 3
                    ExecutionTime = 27536.4 s  ClockTime = 27737 s
                    

                    Hello, CFD. Hello, OpenFOAM.

                    1 条回复 最后回复 回复 引用
                    • 李东岳
                      李东岳 管理员 最后由 李东岳 编辑

                      多贴几个时间步,完整的,我再看下。

                      咦,看错了, @wuyukai 你的log文件贴下

                      线上CFD课程开始报名:http://www.dyfluid.com/class.html

                      CFD高性能服务器 http://dyfluid.com/servers.html

                      L 1 条回复 最后回复 回复 引用
                      • L
                        luofq-sysu @李东岳 最后由 编辑

                        @李东岳 李老师,借楼问一下:滑移网格计算,每三个时间步会出现pcorr iteration 1000,可能出现的原因在哪方面?网格checkMesh无问题,可能会是GAMGPCG这些格式吗?

                        李东岳 1 条回复 最后回复 回复 引用
                        • 李东岳
                          李东岳 管理员 @luofq-sysu 最后由 编辑

                          @luofq-sysu 对,你换一下PCG,很有可能会改善

                          线上CFD课程开始报名:http://www.dyfluid.com/class.html

                          CFD高性能服务器 http://dyfluid.com/servers.html

                          L 1 条回复 最后回复 回复 引用
                          • L
                            luofq-sysu @李东岳 最后由 编辑

                            @李东岳 谢谢李老师。1. solver.pcorr改成PCG,虽然还是出现iteration 1000,但确实快了很多。2.尝试将pcorr的tolerance从 1e-06改成1e-05,还是会出现 iteration 1000。这个有没有可能跟网格有关呢?整体计算速度慢的原因还有P_rgh也挺费事的

                            李东岳 zhanghan 2 条回复 最后回复 回复 引用
                            • 李东岳
                              李东岳 管理员 @luofq-sysu 最后由 编辑

                              @luofq-sysu

                              这个有没有可能跟网格有关呢

                              有关。

                              整体计算速度慢的原因还有P_rgh也挺费事的

                              网格多少。网格多的话就是那么慢咯

                              线上CFD课程开始报名:http://www.dyfluid.com/class.html

                              CFD高性能服务器 http://dyfluid.com/servers.html

                              1 条回复 最后回复 回复 引用
                              • zhanghan
                                zhanghan @luofq-sysu 最后由 李东岳 编辑

                                fvSolution中修改每一项的tolerance,我的case是bubbleColumnEvaporatingReacting,自带的tolerance是1e-20,我修改为1e-10后计算的非常快,而且计算结果几乎相同。

                                FoamFile
                                {
                                    version     2.0;
                                    format      ascii;
                                    class       dictionary;
                                    location    "system";
                                    object      fvSolution;
                                }
                                // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
                                
                                solvers
                                {
                                    "alpha.*"
                                    {
                                        nAlphaCorr      1;
                                        nAlphaSubCycles 3;
                                    }
                                
                                    p_rgh
                                    {
                                        solver          GAMG;
                                        smoother        DIC;
                                        tolerance       1e-10;
                                        relTol          0.001;
                                    }
                                
                                    p_rghFinal
                                    {
                                        $p_rgh;
                                        relTol          0;
                                    }
                                
                                    "U.*"
                                    {
                                        solver          smoothSolver;
                                        smoother        symGaussSeidel;
                                        tolerance       1e-10;
                                        relTol          0;
                                        minIter         1;
                                    }
                                
                                    "(e|h).*"
                                    {
                                        solver          smoothSolver;
                                        smoother        symGaussSeidel;
                                        tolerance       1e-10;
                                        relTol          0;
                                        minIter         1;
                                    }
                                
                                    "(k|epsilon|Theta).*"
                                    {
                                        solver          smoothSolver;
                                        smoother        symGaussSeidel;
                                        tolerance       1e-10;
                                        relTol          0;
                                        minIter         1;
                                    }
                                
                                    Yi
                                    {
                                        solver          smoothSolver;
                                        smoother        symGaussSeidel;
                                        tolerance       1e-10;
                                        relTol          0;
                                        minIter         1;
                                        residualAlpha   1e-8;
                                    }
                                }
                                
                                PIMPLE
                                {
                                    nOuterCorrectors 1;
                                    nCorrectors      1;
                                    nNonOrthogonalCorrectors 0;
                                }
                                
                                relaxationFactors
                                {
                                    equations
                                    {
                                        ".*"            0.3;
                                    }
                                }
                                
                                
                                // ************************************************************************* //
                                
                                1 条回复 最后回复 回复 引用
                                • First post
                                  Last post