关于nOuterCorrectors影响计算速度和计算精度的问题
-
计算一个简单二维多圆柱绕流的动网格算例,网格数量大概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; } // ************************************************************************* //
-
nCorrectors太大了,推荐1-3,最多我见过用到3的。PISO算法本来只有2步压力修正,所以这个值你可以固定,不放心的话用3好了。
nOuterCorrectors你需要仔细的测试一下,这个和时间步大小也有关系。大致范围5-100左右吧。FLUENT那边的推荐值是20-25,我自己不管是在FLUENT还是FOAM测试出来的结果也都差不多,最多会用到30,一般情况下20左右。如果很多外迭代还无法收敛那你需要考虑缩小时间步长,而不是去无限制的去增大外迭代步数。另外你没有给relaxationFactors,为什么?
收敛不收敛是你自己设置的,不是说收敛了就对,没收敛就错。最终要靠结果去判断,特别是和实验结果的对比。
-
@李东岳 比如这个时间步里,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
-
@luofq-sysu 对,你换一下PCG,很有可能会改善
-
-
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; } } // ************************************************************************* //