关于多相流的电势方程(Laplace方程)的求解问题
-
大家好,最近我在编写考虑电场力的多相流流动问题,其中需要求解准静态的电势场方程(本质就是一个 纯Laplace方程),但其电导系数(sigma)在不同的相中具有不同的值。
但是方程求解出现了问题,我在想如何能够提高求解稳定性?代码很简单,我是这样编写的
sigmaE == alpha1*sigmaE1 + alpha2*sigmaE2; sigmaE.write(); fvScalarMatrix phiEEqn ( fvm::laplacian( sigmaE, phiE) ); phiEEqn.relax(); phiEEqn.solve();
在两相的电导率系数不相同的情况下,这个方程总会在几次迭代后发散,发散首先应该发生在相界面附近
这是一个简单的静止液滴算例
发散时,电势场会在界面附近出现条纹状的分布。
我很疑惑,为什么上千的密度比条件下,求解压力possion方程都很稳定,laplace方程的求解却出了问题。
请问有没有办法可以改进这个方程求解稳定性,万分感谢! -
谢谢东岳老师!
下面是求解的log。我从log里看到,电势场phiE在求解几个时间步后就会发散( Initial residual迅速增大),因为有电场力的存在,进而会导致了速度场和压力场也会出问题。
我换过不同的参数比和算例(轴对称 和 二维),发散情况都是类似的,所以应该不是我的算例设置的问题。
而从log看来,应该是电势场phiE求解首先出了问题,所以目前在思考有什么样的方法可以改善求解稳定性。目前我使用的版本是openFOAM4.0,换个版本会不会有帮助? 或者是不是可以引入虚时间项?
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 4.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 4.x Exec : rheoEHDPhaseFieldFoam Date : Oct 28 2019 Time : 10:16:57 Host : "cfd" PID : 101769 Case : /home/cfd/OpenFOAM/cfd-4.x/run/rheoEHDPhaseFieldFoam/electric_test2 nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 PIMPLE: Operating solver in PISO mode Reading field p_rgh Reading field U Reading/calculating face flux field phi Reading transportProperties Selecting constitutive equation Newtonian Selecting constitutive equation Newtonian Reading g Reading hRef Calculating field g.h No MRF models present No finite volume options present DICPCG: Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 0, global = 0, cumulative = 0 Courant Number mean: 0 max: 0 Starting time loop Courant Number mean: 0 max: 0 Interface Courant Number mean: 0 max: 0 Time = 0.001 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -2.12354e-55 Max(alpha.water) - 1 = 0 smoothSolver: Solving for phiE, Initial residual = 2.00047e-06, Final residual = 9.0829e-09, No Iterations 2 DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 7.19064e-11, No Iterations 48 DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 7.05718e-11, No Iterations 48 DILUPBiCG: Solving for Uz, Initial residual = 0.999733, Final residual = 9.09381e-11, No Iterations 43 DICPCG: Solving for p_rgh, Initial residual = 1, Final residual = 9.55899e-11, No Iterations 472 time step continuity errors : sum local = 1.85794e-16, global = -1.25801e-26, cumulative = -1.25801e-26 ExecutionTime = 7.87 s ClockTime = 8 s Courant Number mean: 3.28229e-07 max: 0.000165681 Interface Courant Number mean: 9.93206e-08 max: 0.000165681 Time = 0.002 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -9.27462e-35 Max(alpha.water) - 1 = 2.04281e-14 smoothSolver: Solving for phiE, Initial residual = 2.00062e-06, Final residual = 9.08496e-09, No Iterations 2 DILUPBiCG: Solving for Ux, Initial residual = 0.73978, Final residual = 6.88788e-11, No Iterations 45 DILUPBiCG: Solving for Uy, Initial residual = 0.778514, Final residual = 7.18204e-11, No Iterations 45 DILUPBiCG: Solving for Uz, Initial residual = 0.257106, Final residual = 6.30463e-11, No Iterations 41 DICPCG: Solving for p_rgh, Initial residual = 0.247421, Final residual = 8.92367e-11, No Iterations 451 time step continuity errors : sum local = 4.29837e-16, global = 4.13759e-26, cumulative = 2.87958e-26 ExecutionTime = 10.67 s ClockTime = 10 s Courant Number mean: 5.70667e-07 max: 0.000159836 Interface Courant Number mean: 1.39649e-07 max: 0.000159836 Time = 0.003 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -3.15388e-34 Max(alpha.water) - 1 = 4.10783e-14 smoothSolver: Solving for phiE, Initial residual = 2.00079e-06, Final residual = 9.08756e-09, No Iterations 2 DILUPBiCG: Solving for Ux, Initial residual = 0.731166, Final residual = 6.50645e-11, No Iterations 44 DILUPBiCG: Solving for Uy, Initial residual = 0.762298, Final residual = 9.62212e-11, No Iterations 43 DILUPBiCG: Solving for Uz, Initial residual = 0.209536, Final residual = 6.22079e-11, No Iterations 41 DICPCG: Solving for p_rgh, Initial residual = 0.150284, Final residual = 8.62896e-11, No Iterations 437 time step continuity errors : sum local = 5.57365e-16, global = -5.54826e-24, cumulative = -5.51947e-24 ExecutionTime = 13.35 s ClockTime = 13 s Courant Number mean: 7.81037e-07 max: 0.000139188 Interface Courant Number mean: 1.64071e-07 max: 0.000139188 Time = 0.004 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -6.64008e-34 Max(alpha.water) - 1 = 5.72875e-14 smoothSolver: Solving for phiE, Initial residual = 2.00098e-06, Final residual = 9.09235e-09, No Iterations 2 DILUPBiCG: Solving for Ux, Initial residual = 0.714142, Final residual = 7.0353e-11, No Iterations 43 DILUPBiCG: Solving for Uy, Initial residual = 0.741214, Final residual = 6.54722e-11, No Iterations 43 DILUPBiCG: Solving for Uz, Initial residual = 0.188744, Final residual = 8.34101e-11, No Iterations 40 DICPCG: Solving for p_rgh, Initial residual = 0.109736, Final residual = 9.36881e-11, No Iterations 428 time step continuity errors : sum local = 7.29945e-16, global = -1.6172e-23, cumulative = -2.16915e-23 ExecutionTime = 15.89 s ClockTime = 16 s Courant Number mean: 9.78462e-07 max: 0.000120603 Interface Courant Number mean: 1.82678e-07 max: 0.000120603 Time = 0.005 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -1.13416e-33 Max(alpha.water) - 1 = 6.52811e-14 smoothSolver: Solving for phiE, Initial residual = 2.00131e-06, Final residual = 9.10815e-09, No Iterations 2 DILUPBiCG: Solving for Ux, Initial residual = 0.69994, Final residual = 8.23253e-11, No Iterations 42 DILUPBiCG: Solving for Uy, Initial residual = 0.725325, Final residual = 8.55657e-11, No Iterations 42 DILUPBiCG: Solving for Uz, Initial residual = 0.178405, Final residual = 9.55568e-11, No Iterations 40 DICPCG: Solving for p_rgh, Initial residual = 0.0867534, Final residual = 9.85572e-11, No Iterations 414 time step continuity errors : sum local = 8.85704e-16, global = 4.77708e-24, cumulative = -1.69144e-23 ExecutionTime = 20.18 s ClockTime = 20 s Courant Number mean: 1.16828e-06 max: 0.000100363 Interface Courant Number mean: 1.98849e-07 max: 0.000100363 Time = 0.006 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -1.71911e-33 Max(alpha.water) - 1 = 6.95e-14 smoothSolver: Solving for phiE, Initial residual = 2.0024e-06, Final residual = 9.20454e-09, No Iterations 2 DILUPBiCG: Solving for Ux, Initial residual = 0.685888, Final residual = 6.27208e-11, No Iterations 42 DILUPBiCG: Solving for Uy, Initial residual = 0.711619, Final residual = 6.37637e-11, No Iterations 42 DILUPBiCG: Solving for Uz, Initial residual = 0.165978, Final residual = 9.8562e-11, No Iterations 40 DICPCG: Solving for p_rgh, Initial residual = 0.0716882, Final residual = 9.70995e-11, No Iterations 411 time step continuity errors : sum local = 9.8208e-16, global = 4.10549e-24, cumulative = -1.28089e-23 ExecutionTime = 22.66 s ClockTime = 22 s Courant Number mean: 1.35215e-06 max: 8.21777e-05 Interface Courant Number mean: 2.13695e-07 max: 8.21777e-05 Time = 0.007 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -2.41101e-33 Max(alpha.water) - 1 = 7.06102e-14 smoothSolver: Solving for phiE, Initial residual = 2.0075e-06, Final residual = 1.05167e-08, No Iterations 2 DILUPBiCG: Solving for Ux, Initial residual = 0.671959, Final residual = 8.24532e-11, No Iterations 41 DILUPBiCG: Solving for Uy, Initial residual = 0.699008, Final residual = 8.1174e-11, No Iterations 41 DILUPBiCG: Solving for Uz, Initial residual = 0.168219, Final residual = 6.25039e-11, No Iterations 41 DICPCG: Solving for p_rgh, Initial residual = 0.0610722, Final residual = 9.86158e-11, No Iterations 408 time step continuity errors : sum local = 1.10463e-15, global = 6.78982e-24, cumulative = -6.01905e-24 ExecutionTime = 25.09 s ClockTime = 25 s Courant Number mean: 1.53042e-06 max: 6.70786e-05 Interface Courant Number mean: 2.2758e-07 max: 6.70786e-05 Time = 0.008 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -3.20144e-33 Max(alpha.water) - 1 = 2.75335e-14 smoothSolver: Solving for phiE, Initial residual = 2.06836e-06, Final residual = 2.19715e-08, No Iterations 2 DILUPBiCG: Solving for Ux, Initial residual = 0.658854, Final residual = 6.57997e-11, No Iterations 41 DILUPBiCG: Solving for Uy, Initial residual = 0.686306, Final residual = 6.71642e-11, No Iterations 41 DILUPBiCG: Solving for Uz, Initial residual = 0.186854, Final residual = 7.79857e-11, No Iterations 41 DICPCG: Solving for p_rgh, Initial residual = 0.0531412, Final residual = 9.87827e-11, No Iterations 410 time step continuity errors : sum local = 1.21099e-15, global = -1.62538e-23, cumulative = -2.22728e-23 ExecutionTime = 27.55 s ClockTime = 27 s Courant Number mean: 1.70326e-06 max: 5.49639e-05 Interface Courant Number mean: 2.40558e-07 max: 5.49639e-05 Time = 0.009 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -4.08167e-33 Max(alpha.water) - 1 = 2.66454e-14 smoothSolver: Solving for phiE, Initial residual = 2.73527e-06, Final residual = 8.44216e-08, No Iterations 2 DILUPBiCG: Solving for Ux, Initial residual = 0.646601, Final residual = 9.45671e-11, No Iterations 40 DILUPBiCG: Solving for Uy, Initial residual = 0.672996, Final residual = 9.70688e-11, No Iterations 40 DILUPBiCG: Solving for Uz, Initial residual = 0.296747, Final residual = 7.13875e-11, No Iterations 43 DICPCG: Solving for p_rgh, Initial residual = 0.0470533, Final residual = 9.65488e-11, No Iterations 414 time step continuity errors : sum local = 1.28304e-15, global = -4.60962e-24, cumulative = -2.68825e-23 ExecutionTime = 30.01 s ClockTime = 30 s Courant Number mean: 1.87115e-06 max: 4.53535e-05 Interface Courant Number mean: 2.52996e-07 max: 4.53535e-05 Time = 0.01 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -5.04249e-33 Max(alpha.water) - 1 = 3.26406e-14 smoothSolver: Solving for phiE, Initial residual = 7.34465e-06, Final residual = 2.6863e-08, No Iterations 4 DILUPBiCG: Solving for Ux, Initial residual = 0.634282, Final residual = 8.84402e-11, No Iterations 41 DILUPBiCG: Solving for Uy, Initial residual = 0.661658, Final residual = 7.69445e-11, No Iterations 40 DILUPBiCG: Solving for Uz, Initial residual = 0.536089, Final residual = 7.55206e-11, No Iterations 45 DICPCG: Solving for p_rgh, Initial residual = 0.0422388, Final residual = 9.79562e-11, No Iterations 425 time step continuity errors : sum local = 1.39982e-15, global = 1.78305e-23, cumulative = -9.052e-24 ExecutionTime = 34.28 s ClockTime = 34 s Courant Number mean: 2.05425e-06 max: 3.78064e-05 Interface Courant Number mean: 2.73112e-07 max: 3.78064e-05 Time = 0.011 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -6.06711e-33 Max(alpha.water) - 1 = 3.44169e-14 smoothSolver: Solving for phiE, Initial residual = 3.12889e-05, Final residual = 3.85311e-08, No Iterations 5 DILUPBiCG: Solving for Ux, Initial residual = 0.622554, Final residual = 6.185e-11, No Iterations 45 DILUPBiCG: Solving for Uy, Initial residual = 0.66698, Final residual = 9.00947e-11, No Iterations 40 DILUPBiCG: Solving for Uz, Initial residual = 0.771461, Final residual = 9.08377e-11, No Iterations 45 DICPCG: Solving for p_rgh, Initial residual = 0.0410365, Final residual = 9.17412e-11, No Iterations 449 time step continuity errors : sum local = 1.4013e-15, global = 5.50027e-23, cumulative = 4.59507e-23 ExecutionTime = 36.84 s ClockTime = 37 s Courant Number mean: 3.21942e-06 max: 0.000138236 Interface Courant Number mean: 4.91772e-07 max: 0.000138236 Time = 0.012 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -6.87675e-33 Max(alpha.water) - 1 = 3.95239e-14 smoothSolver: Solving for phiE, Initial residual = 0.000150524, Final residual = 5.71868e-08, No Iterations 6 DILUPBiCG: Solving for Ux, Initial residual = 0.750188, Final residual = 8.45101e-11, No Iterations 48 DILUPBiCG: Solving for Uy, Initial residual = 0.676186, Final residual = 6.28741e-11, No Iterations 43 DILUPBiCG: Solving for Uz, Initial residual = 0.886135, Final residual = 9.82202e-11, No Iterations 46 DICPCG: Solving for p_rgh, Initial residual = 0.151211, Final residual = 9.89136e-11, No Iterations 464 time step continuity errors : sum local = 1.74769e-15, global = -2.65631e-21, cumulative = -2.61036e-21 ExecutionTime = 39.51 s ClockTime = 39 s Courant Number mean: 4.64624e-05 max: 0.00244373 Interface Courant Number mean: 7.31079e-06 max: 0.00244373 Time = 0.013 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -1.38643e-41 Max(alpha.water) - 1 = 4.50751e-14 smoothSolver: Solving for phiE, Initial residual = 0.00075826, Final residual = 8.67228e-08, No Iterations 7 DILUPBiCG: Solving for Ux, Initial residual = 0.864196, Final residual = 7.64271e-11, No Iterations 49 DILUPBiCG: Solving for Uy, Initial residual = 0.74503, Final residual = 8.88437e-11, No Iterations 45 DILUPBiCG: Solving for Uz, Initial residual = 0.916031, Final residual = 6.1685e-11, No Iterations 47 DICPCG: Solving for p_rgh, Initial residual = 0.760973, Final residual = 9.44783e-11, No Iterations 479 time step continuity errors : sum local = 6.82822e-15, global = -6.31618e-20, cumulative = -6.57722e-20 ExecutionTime = 42.23 s ClockTime = 42 s Courant Number mean: 0.00118022 max: 0.0566661 Interface Courant Number mean: 0.000167166 max: 0.0566661 Time = 0.014 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -4.62356e-40 Max(alpha.water) - 1 = 4.15994e-11 smoothSolver: Solving for phiE, Initial residual = 0.00391259, Final residual = 3.74673e-08, No Iterations 9 DILUPBiCG: Solving for Ux, Initial residual = 0.873186, Final residual = 7.82112e-11, No Iterations 49 DILUPBiCG: Solving for Uy, Initial residual = 0.862851, Final residual = 9.82152e-11, No Iterations 46 DILUPBiCG: Solving for Uz, Initial residual = 0.920753, Final residual = 9.7826e-11, No Iterations 46 DICPCG: Solving for p_rgh, Initial residual = 0.919158, Final residual = 9.10323e-11, No Iterations 478 time step continuity errors : sum local = 1.3723e-13, global = -2.02802e-18, cumulative = -2.0938e-18 ExecutionTime = 44.94 s ClockTime = 45 s Courant Number mean: 0.0318863 max: 1.40357 Interface Courant Number mean: 0.00409102 max: 1.40357 Time = 0.015 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -6.44669e-36 Max(alpha.water) - 1 = 8.39747e-10 smoothSolver: Solving for phiE, Initial residual = 0.0198467, Final residual = 5.61338e-08, No Iterations 10 DILUPBiCG: Solving for Ux, Initial residual = 0.875682, Final residual = 7.90876e-11, No Iterations 49 DILUPBiCG: Solving for Uy, Initial residual = 0.890631, Final residual = 6.73206e-11, No Iterations 47 DILUPBiCG: Solving for Uz, Initial residual = 0.921635, Final residual = 9.31668e-11, No Iterations 46 DICPCG: Solving for p_rgh, Initial residual = 0.927443, Final residual = 9.23287e-11, No Iterations 479 time step continuity errors : sum local = 3.66826e-12, global = -3.63803e-17, cumulative = -3.84741e-17 ExecutionTime = 49.3 s ClockTime = 49 s Courant Number mean: 0.895789 max: 36.4071 Interface Courant Number mean: 0.104717 max: 36.4071 Time = 0.016 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -12.9764 Max(alpha.water) - 1 = 16.3676 smoothSolver: Solving for phiE, Initial residual = 0.178398, Final residual = 5.01895e-08, No Iterations 12 DILUPBiCG: Solving for Ux, Initial residual = 0.949693, Final residual = 4.90005e-11, No Iterations 59 DILUPBiCG: Solving for Uy, Initial residual = 0.956785, Final residual = 9.72316e-11, No Iterations 56 DILUPBiCG: Solving for Uz, Initial residual = 0.854327, Final residual = 8.38113e-11, No Iterations 60 DICPCG: Solving for p_rgh, Initial residual = 0.956897, Final residual = 9.07e-11, No Iterations 480 time step continuity errors : sum local = 1.23635e-10, global = -2.53679e-15, cumulative = -2.57527e-15 ExecutionTime = 52.17 s ClockTime = 52 s Courant Number mean: 19.9163 max: 942.958 Interface Courant Number mean: 1.01201 max: 684.842 Time = 0.017 Phase-1 volume fraction = -4.19188e+65 Min(alpha.water) = -6.90079e+85 Max(alpha.water) - 1 = 2.35261e+86 smoothSolver: Solving for phiE, Initial residual = 0.343677, Final residual = 8.04139e-08, No Iterations 11 #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 ? in "/lib/x86_64-linux-gnu/libc.so.6" #3 Foam::multiply(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:? #4 void Foam::multiply<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ??:? #5 Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::operator*<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&) at ??:? #6 Foam::interfaceEHDPropertiesPFM::surfaceTensionForcePFM() const at ??:? #7 ? at ??:? #8 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #9 ? at ??:?
-
@东岳
谢谢东岳老师!
我简单修改了一下代码,让它迭代多次
scalar phiEEqRes = cttProperties.lookupOrDefault<scalar>("phiEEqRes", 1e-6 ) ; // Max number of iterations int maxIterPhiE = cttProperties.lookupOrDefault<int>("maxIterPhiE", 20 ) ; // Transport of passive scalar sigmaE == alpha1*sigmaE1 + alpha2*sigmaE2; scalar res=GREAT; int iter=0; while (res > phiEEqRes && iter < maxIterPhiE) { fvScalarMatrix phiEEqn ( fvm::laplacian( sigmaE, phiE) ); phiEEqn.relax(); res = phiEEqn.solve().initialResidual(); iter++; }
同样的算例下,log文件如下
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 4.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 4.x Exec : rheoEHDPhaseFieldFoam Date : Oct 28 2019 Time : 11:01:00 Host : "cfd" PID : 103447 Case : /home/cfd/OpenFOAM/cfd-4.x/run/rheoEHDPhaseFieldFoam/electric_test2 nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 PIMPLE: Operating solver in PISO mode Reading field p_rgh Reading field U Reading/calculating face flux field phi Reading transportProperties Selecting constitutive equation Newtonian Selecting constitutive equation Newtonian Reading g Reading hRef Calculating field g.h No MRF models present No finite volume options present DICPCG: Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 0, global = 0, cumulative = 0 Courant Number mean: 0 max: 0 Starting time loop Courant Number mean: 0 max: 0 Interface Courant Number mean: 0 max: 0 Time = 0.001 Phase-1 volume fraction = 0.0248178 Min(alpha.water) = -2.12354e-55 Max(alpha.water) - 1 = 0 smoothSolver: Solving for phiE, Initial residual = 2.00047e-06, Final residual = 9.0829e-09, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 2.00062e-06, Final residual = 9.08496e-09, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 2.00079e-06, Final residual = 9.08756e-09, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 2.00098e-06, Final residual = 9.09235e-09, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 2.00131e-06, Final residual = 9.10815e-09, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 2.0024e-06, Final residual = 9.20389e-09, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 2.00751e-06, Final residual = 1.05039e-08, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 2.06764e-06, Final residual = 2.18651e-08, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 2.72883e-06, Final residual = 8.38954e-08, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 7.30545e-06, Final residual = 2.6689e-08, No Iterations 4 smoothSolver: Solving for phiE, Initial residual = 3.10926e-05, Final residual = 3.82843e-08, No Iterations 5 smoothSolver: Solving for phiE, Initial residual = 0.000149551, Final residual = 5.68219e-08, No Iterations 6 smoothSolver: Solving for phiE, Initial residual = 0.000753353, Final residual = 8.61768e-08, No Iterations 7 smoothSolver: Solving for phiE, Initial residual = 0.00389063, Final residual = 3.72685e-08, No Iterations 9 smoothSolver: Solving for phiE, Initial residual = 0.0201471, Final residual = 5.71e-08, No Iterations 10 smoothSolver: Solving for phiE, Initial residual = 0.0968377, Final residual = 8.0832e-08, No Iterations 11 smoothSolver: Solving for phiE, Initial residual = 0.330082, Final residual = 8.08282e-08, No Iterations 12 smoothSolver: Solving for phiE, Initial residual = 0.583957, Final residual = 4.1842e-08, No Iterations 13 smoothSolver: Solving for phiE, Initial residual = 0.671177, Final residual = 4.92793e-08, No Iterations 13 smoothSolver: Solving for phiE, Initial residual = 0.687466, Final residual = 5.15537e-08, No Iterations 13 DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 8.88689e-11, No Iterations 49 DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 8.54483e-11, No Iterations 47 DILUPBiCG: Solving for Uz, Initial residual = 1, Final residual = 9.77718e-11, No Iterations 46 DICPCG: Solving for p_rgh, Initial residual = 1, Final residual = 9.26224e-11, No Iterations 481 time step continuity errors : sum local = 5.4911e-05, global = -9.71439e-09, cumulative = -9.71439e-09 ExecutionTime = 9.1 s ClockTime = 9 s Courant Number mean: 1.63727e+07 max: 5.36038e+08 Interface Courant Number mean: 1.56047e+06 max: 5.36038e+08 Time = 0.002 #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 ? in "/lib/x86_64-linux-gnu/libc.so.6" #3 Foam::multiply(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:? #4 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator*<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) at ??:? #5 Foam::interfaceEHDPropertiesPFM::calculateMobility() at ??:? #6 ? at ??:? #7 ? at ??:? #8 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #9 ? at ??:?
可以看到,Initial residual在几个迭代步后迅速增大,这应该是计算发散的表征。这个算例里,我的不同相的sigmaE的比值是5,Laplace方程求解的格式是常用的Gauss linear corrected。所以,我猜想这应该和我引入的电场力无关,而主要是laplace方程的求解分散问题。
-
@cfd_lilili 在 关于多相流的电势方程(Laplace方程)的求解问题 中说:
fvScalarMatrix phiEEqn
(
fvm::laplacian( sigmaE, phiE)
);这个方程不需要迭代多次
-
@东岳 和@yfclark 感谢两位的建议
对这个问题,我实在无从下手,于是刚刚尝试了一下换个版本的求解器试试看。于是,我将同样的代码片段植入到of4.0和fe4.0的interFoam求解器中,并做了同样的算例。结果发现同样的条件下的Laplace方程,of4.0解不了,fe4.0可以解。这让我很迷惑。这个是of4.0求解器的算例的log文件,可以看到它的 Initial residual并没有收敛的迹象。
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 4.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 4.x Exec : interFoamtest Date : Oct 28 2019 Time : 16:51:11 Host : "cfd" PID : 116917 Case : /home/cfd/OpenFOAM/cfd-4.x/run/interFoamtest/damBreak nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 PIMPLE: Operating solver in PISO mode Reading field p_rgh Reading field U Reading/calculating face flux field phi Reading transportProperties Selecting incompressible transport model Newtonian Selecting incompressible transport model Newtonian Selecting turbulence model type laminar Reading g Reading hRef Calculating field g.h No MRF models present No finite volume options present DICPCG: Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 0, global = 0, cumulative = 0 Courant Number mean: 0 max: 0 Starting time loop Courant Number mean: 0 max: 0 Interface Courant Number mean: 0 max: 0 Time = 0.001 PIMPLE: iteration 1 smoothSolver: Solving for alpha.water, Initial residual = 0, Final residual = 0, No Iterations 0 Phase-1 volume fraction = 0.0247173 Min(alpha.water) = 0 Max(alpha.water) = 1 MULES: Correcting alpha.water MULES: Correcting alpha.water Phase-1 volume fraction = 0.0247173 Min(alpha.water) = 0 Max(alpha.water) = 1 smoothSolver: Solving for phiE, Initial residual = 1, Final residual = 0.00666667, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.969654, Final residual = 0.955898, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999906, Final residual = 0.999906, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999943, Final residual = 0.999943, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999959, Final residual = 0.999959, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.99997, Final residual = 0.99997, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999977, Final residual = 0.999977, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999982, Final residual = 0.999982, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999986, Final residual = 0.999986, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999989, Final residual = 0.999989, No Iterations 1000 DICPCG: Solving for p_rgh, Initial residual = 1, Final residual = 0.0288118, No Iterations 2 time step continuity errors : sum local = 3.79873e-07, global = -1.14217e-22, cumulative = -1.14217e-22 DICPCG: Solving for p_rgh, Initial residual = 0.014257, Final residual = 0.000679011, No Iterations 51 time step continuity errors : sum local = 1.80931e-08, global = 1.97801e-23, cumulative = -9.44368e-23 DICPCG: Solving for p_rgh, Initial residual = 0.000685827, Final residual = 9.85239e-08, No Iterations 330 time step continuity errors : sum local = 2.59978e-12, global = -2.24454e-24, cumulative = -9.66814e-23 ExecutionTime = 29.16 s ClockTime = 29 s Courant Number mean: 8.45892e-06 max: 0.00486238 Interface Courant Number mean: 0 max: 0 Time = 0.002 PIMPLE: iteration 1 smoothSolver: Solving for alpha.water, Initial residual = 1.03138e-05, Final residual = 1.278e-11, No Iterations 1 Phase-1 volume fraction = 0.0247173 Min(alpha.water) = 0 Max(alpha.water) = 1 MULES: Correcting alpha.water MULES: Correcting alpha.water Phase-1 volume fraction = 0.0247173 Min(alpha.water) = -1.02138e-12 Max(alpha.water) = 1 smoothSolver: Solving for phiE, Initial residual = 0.999991, Final residual = 0.999991, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999993, Final residual = 0.999993, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999994, Final residual = 0.999994, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999995, Final residual = 0.999995, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999996, Final residual = 0.999996, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999997, Final residual = 0.999997, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999997, Final residual = 0.999997, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999998, Final residual = 0.999998, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999998, Final residual = 0.999998, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999998, Final residual = 0.999998, No Iterations 1000 DICPCG: Solving for p_rgh, Initial residual = 0.148216, Final residual = 0.00717185, No Iterations 8 time step continuity errors : sum local = 1.53736e-07, global = 1.00047e-22, cumulative = 3.36563e-24 DICPCG: Solving for p_rgh, Initial residual = 0.00694699, Final residual = 0.00032885, No Iterations 69 time step continuity errors : sum local = 7.31529e-09, global = -5.63383e-24, cumulative = -2.2682e-24 DICPCG: Solving for p_rgh, Initial residual = 0.000331229, Final residual = 9.04502e-08, No Iterations 320 time step continuity errors : sum local = 2.00174e-12, global = -1.03358e-23, cumulative = -1.2604e-23 ExecutionTime = 55.26 s ClockTime = 55 s Courant Number mean: 1.00744e-05 max: 0.00608536 Interface Courant Number mean: 0 max: 0 Time = 0.003 PIMPLE: iteration 1 smoothSolver: Solving for alpha.water, Initial residual = 1.17667e-05, Final residual = 1.48862e-11, No Iterations 1 Phase-1 volume fraction = 0.0247173 Min(alpha.water) = -7.81203e-23 Max(alpha.water) = 1 MULES: Correcting alpha.water MULES: Correcting alpha.water Phase-1 volume fraction = 0.0247173 Min(alpha.water) = -2.49888e-15 Max(alpha.water) = 1 smoothSolver: Solving for phiE, Initial residual = 0.999998, Final residual = 0.999998, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 DICPCG: Solving for p_rgh, Initial residual = 0.0570031, Final residual = 0.00216312, No Iterations 3 time step continuity errors : sum local = 4.53781e-08, global = -1.07358e-25, cumulative = -1.27114e-23 DICPCG: Solving for p_rgh, Initial residual = 0.00216994, Final residual = 0.000103227, No Iterations 32 time step continuity errors : sum local = 2.19448e-09, global = 2.56894e-23, cumulative = 1.29781e-23 DICPCG: Solving for p_rgh, Initial residual = 0.000103679, Final residual = 9.68435e-08, No Iterations 180 time step continuity errors : sum local = 2.06555e-12, global = 2.39499e-23, cumulative = 3.6928e-23 ExecutionTime = 80.51 s ClockTime = 80 s Courant Number mean: 1.02305e-05 max: 0.0059902 Interface Courant Number mean: 0 max: 0 Time = 0.004 PIMPLE: iteration 1 smoothSolver: Solving for alpha.water, Initial residual = 1.14624e-05, Final residual = 1.20817e-11, No Iterations 1 Phase-1 volume fraction = 0.0247173 Min(alpha.water) = -2.32959e-16 Max(alpha.water) = 1 MULES: Correcting alpha.water MULES: Correcting alpha.water Phase-1 volume fraction = 0.0247173 Min(alpha.water) = -6.27415e-12 Max(alpha.water) = 1 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 DICPCG: Solving for p_rgh, Initial residual = 0.025679, Final residual = 0.00121229, No Iterations 2 time step continuity errors : sum local = 2.4847e-08, global = 4.56559e-24, cumulative = 4.14936e-23 DICPCG: Solving for p_rgh, Initial residual = 0.00123628, Final residual = 5.7827e-05, No Iterations 29 time step continuity errors : sum local = 1.18735e-09, global = -1.92179e-25, cumulative = 4.13014e-23 DICPCG: Solving for p_rgh, Initial residual = 5.83662e-05, Final residual = 9.44483e-08, No Iterations 129 time step continuity errors : sum local = 1.94768e-12, global = -2.79384e-23, cumulative = 1.3363e-23 ExecutionTime = 105.48 s ClockTime = 105 s Courant Number mean: 1.02721e-05 max: 0.00571222 Interface Courant Number mean: 0 max: 0 Time = 0.005 PIMPLE: iteration 1 smoothSolver: Solving for alpha.water, Initial residual = 1.10272e-05, Final residual = 9.91906e-12, No Iterations 1 Phase-1 volume fraction = 0.0247173 Min(alpha.water) = -1.84397e-16 Max(alpha.water) = 1 MULES: Correcting alpha.water MULES: Correcting alpha.water Phase-1 volume fraction = 0.0247173 Min(alpha.water) = -5.64491e-12 Max(alpha.water) = 1 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.999999, Final residual = 0.999999, No Iterations 1000 DICPCG: Solving for p_rgh, Initial residual = 0.0170557, Final residual = 0.000707649, No Iterations 2 time step continuity errors : sum local = 1.40556e-08, global = 5.55595e-24, cumulative = 1.8919e-23 DICPCG: Solving for p_rgh, Initial residual = 0.00072258, Final residual = 3.40642e-05, No Iterations 66 time step continuity errors : sum local = 6.7235e-10, global = -1.97122e-24, cumulative = 1.69477e-23 DICPCG: Solving for p_rgh, Initial residual = 3.47482e-05, Final residual = 9.44334e-08, No Iterations 110 time step continuity errors : sum local = 1.97407e-12, global = 2.71579e-25, cumulative = 1.72193e-23 ExecutionTime = 132.15 s ClockTime = 132 s Courant Number mean: 1.03787e-05 max: 0.00551763
这里是fe4.0的求解器的算例的log文件,它的Initial residual则呈现了收敛的趋势
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | | \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ Build : 4.0 Exec : interFoamtest Date : Oct 28 2019 Time : 16:44:23 Host : cfd PID : 116498 CtrlDict : "/home/cfd/foam/cfd-4.0/run/damBreak/system/controlDict" Case : /home/cfd/foam/cfd-4.0/run/damBreak nProcs : 1 SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 PIMPLE: Operating solver in PISO mode Reading g Reading field pd Reading field alpha1 Reading field U Reading/calculating face flux field phi Reading transportProperties Selecting incompressible transport model Newtonian Selecting incompressible transport model Newtonian Calculating field g.h Selecting turbulence model type laminar time step continuity errors : sum local = 0, global = 0, cumulative = 0 PCG: Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 0, global = 0, cumulative = 0 Courant Number mean: 0 max: 0 velocity magnitude: 0 Starting time loop Courant Number mean: 0 max: 0 velocity magnitude: 0 Time = 0.001 PIMPLE: iteration 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = 0 Max(alpha1) = 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = 0 Max(alpha1) = 1 BiCGStab: Solving for Ux, Initial residual = 1, Final residual = 8.84344e-16, No Iterations 1 BiCGStab: Solving for Uy, Initial residual = 1, Final residual = 2.39687e-15, No Iterations 1 BiCGStab: Solving for Uz, Initial residual = 0.999809, Final residual = 1.01154e-15, No Iterations 1 smoothSolver: Solving for phiE, Initial residual = 1, Final residual = 0.00885022, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.00440562, Final residual = 0.00275942, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.00276397, Final residual = 0.00177986, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.00178161, Final residual = 0.00114823, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.00114896, Final residual = 0.000740514, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.000740817, Final residual = 0.000477462, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.000477588, Final residual = 0.000307809, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.000307862, Final residual = 0.000198419, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.000198441, Final residual = 0.000127897, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 0.000127906, Final residual = 8.24364e-05, No Iterations 1000 DICPCG: Solving for pd, Initial residual = 1, Final residual = 0.0228419, No Iterations 2 DICPCG: Solving for pd, Initial residual = 0.0113008, Final residual = 0.000494115, No Iterations 19 DICPCG: Solving for pd, Initial residual = 0.00049866, Final residual = 2.39276e-05, No Iterations 115 DICPCG: Solving for pd, Initial residual = 2.39472e-05, Final residual = 9.68596e-08, No Iterations 302 time step continuity errors : sum local = 9.29479e-09, global = 1.57022e-22, cumulative = 1.57022e-22 ExecutionTime = 30.3 s ClockTime = 30 s Courant Number mean: 0.000308178 max: 0.120588 velocity magnitude: 1.20588 Time = 0.002 PIMPLE: iteration 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = 0 Max(alpha1) = 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = 0 Max(alpha1) = 1 BiCGStab: Solving for Ux, Initial residual = 0.776521, Final residual = 8.28489e-11, No Iterations 2 BiCGStab: Solving for Uy, Initial residual = 0.488694, Final residual = 2.35091e-11, No Iterations 2 BiCGStab: Solving for Uz, Initial residual = 0.492107, Final residual = 6.27383e-10, No Iterations 2 smoothSolver: Solving for phiE, Initial residual = 8.24401e-05, Final residual = 5.31333e-05, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 5.31349e-05, Final residual = 3.42459e-05, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 3.42465e-05, Final residual = 2.20722e-05, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 2.20724e-05, Final residual = 1.42259e-05, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 1.4226e-05, Final residual = 9.16875e-06, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 9.1688e-06, Final residual = 5.90937e-06, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 5.90939e-06, Final residual = 3.80865e-06, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 3.80866e-06, Final residual = 2.45471e-06, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 2.45471e-06, Final residual = 1.58208e-06, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 1.58208e-06, Final residual = 1.01967e-06, No Iterations 1000 DICPCG: Solving for pd, Initial residual = 0.146545, Final residual = 0.00361308, No Iterations 2 DICPCG: Solving for pd, Initial residual = 0.00335961, Final residual = 0.000167276, No Iterations 105 DICPCG: Solving for pd, Initial residual = 0.000188382, Final residual = 9.23987e-06, No Iterations 49 DICPCG: Solving for pd, Initial residual = 9.8482e-06, Final residual = 9.46082e-08, No Iterations 286 time step continuity errors : sum local = 2.47934e-09, global = -3.54267e-22, cumulative = -1.97245e-22 ExecutionTime = 58.46 s ClockTime = 58 s Courant Number mean: 0.000218338 max: 0.0405799 velocity magnitude: 0.405799 Time = 0.003 PIMPLE: iteration 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = 0 Max(alpha1) = 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = 0 Max(alpha1) = 1 BiCGStab: Solving for Ux, Initial residual = 0.431649, Final residual = 2.74542e-08, No Iterations 1 BiCGStab: Solving for Uy, Initial residual = 0.223545, Final residual = 5.07216e-10, No Iterations 1 BiCGStab: Solving for Uz, Initial residual = 0.212763, Final residual = 1.13065e-09, No Iterations 1 smoothSolver: Solving for phiE, Initial residual = 1.01967e-06, Final residual = 6.57184e-07, No Iterations 1000 smoothSolver: Solving for phiE, Initial residual = 6.57184e-07, Final residual = 4.23565e-07, No Iterations 1000 DICPCG: Solving for pd, Initial residual = 0.027659, Final residual = 0.000699273, No Iterations 2 DICPCG: Solving for pd, Initial residual = 0.00069462, Final residual = 3.42751e-05, No Iterations 109 DICPCG: Solving for pd, Initial residual = 3.70155e-05, Final residual = 1.75277e-06, No Iterations 49 DICPCG: Solving for pd, Initial residual = 1.78108e-06, Final residual = 9.77867e-08, No Iterations 266 time step continuity errors : sum local = 2.18185e-09, global = 1.21446e-22, cumulative = -7.57986e-23 ExecutionTime = 65.25 s ClockTime = 65 s Courant Number mean: 0.000237433 max: 0.0260814 velocity magnitude: 0.260814 Time = 0.004 PIMPLE: iteration 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = -5.52899e-28 Max(alpha1) = 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = 0 Max(alpha1) = 1 BiCGStab: Solving for Ux, Initial residual = 0.212063, Final residual = 1.20667e-11, No Iterations 1 BiCGStab: Solving for Uy, Initial residual = 0.157791, Final residual = 5.26792e-13, No Iterations 1 BiCGStab: Solving for Uz, Initial residual = 0.144847, Final residual = 8.02311e-13, No Iterations 1 smoothSolver: Solving for phiE, Initial residual = 4.23565e-07, Final residual = 2.73004e-07, No Iterations 1000 DICPCG: Solving for pd, Initial residual = 0.00638702, Final residual = 0.000228527, No Iterations 2 DICPCG: Solving for pd, Initial residual = 0.000229721, Final residual = 1.09143e-05, No Iterations 115 DICPCG: Solving for pd, Initial residual = 1.142e-05, Final residual = 4.41946e-07, No Iterations 58 DICPCG: Solving for pd, Initial residual = 4.43246e-07, Final residual = 9.98953e-08, No Iterations 236 time step continuity errors : sum local = 1.92551e-09, global = -2.38779e-22, cumulative = -3.14578e-22 ExecutionTime = 69.77 s ClockTime = 69 s Courant Number mean: 0.000307195 max: 0.0317014 velocity magnitude: 0.317014 Time = 0.005 PIMPLE: iteration 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = 0 Max(alpha1) = 1 MULES: Solving for alpha1 Liquid phase volume fraction = 0.0247173 Min(alpha1) = 0 Max(alpha1) = 1 BiCGStab: Solving for Ux, Initial residual = 0.141162, Final residual = 1.73043e-11, No Iterations 1 BiCGStab: Solving for Uy, Initial residual = 0.123101, Final residual = 6.00829e-13, No Iterations 1 BiCGStab: Solving for Uz, Initial residual = 0.11123, Final residual = 9.9712e-13, No Iterations 1 smoothSolver: Solving for phiE, Initial residual = 2.73004e-07, Final residual = 1.75965e-07, No Iterations 1000 DICPCG: Solving for pd, Initial residual = 0.0068371, Final residual = 0.000235051, No Iterations 2 DICPCG: Solving for pd, Initial residual = 0.000232659, Final residual = 1.10913e-05, No Iterations 27 DICPCG: Solving for pd, Initial residual = 1.12968e-05, Final residual = 5.32458e-07, No Iterations 125 DICPCG: Solving for pd, Initial residual = 5.36239e-07, Final residual = 9.64374e-08, No Iterations 42 time step continuity errors : sum local = 1.68223e-09, global = 4.27902e-22, cumulative = 1.13324e-22 ExecutionTime = 74.91 s ClockTime = 75 s Courant Number mean: 0.000376038 max: 0.0360665 velocity magnitude: 0.360665
姑且假设我写的求解器没有大问题的条件下,上述结果说明,两个版本的求解结果存在了不同。
所以,我在想是不是of40和fe40的Laplace求解器在什么地方存在差异,导致了这样的结果? -
-
@东岳 openFoam-extend4.0,不好意思,我以为这个是通用的简写
-
@cfd_lilili 在 关于多相流的电势方程(Laplace方程)的求解问题 中说:
smoothSolver: Solving for phiE, Initial residual = 1, Final residual = 0.00666667, No Iterations 1000
smoothSolver: Solving for phiE, Initial residual = 0.969654, Final residual = 0.955898, No Iterations 1000
smoothSolver: Solving for phiE, Initial residual = 0.999906, Final residual = 0.999906, No Iterations 1000
smoothSolver: Solving for phiE, Initial residual = 0.999943, Final residual = 0.999943, No Iterations 1000
smoothSolver: Solving for phiE, Initial residual = 0.999959, Final residual = 0.999959, No Iterations 1000
smoothSolver: Solving for phiE, Initial residual = 0.99997, Final residual = 0.99997, No Iterations 1000
smoothSolver: Solving for phiE, Initial residual = 0.999977, Final residual = 0.999977, No Iterations 1000
smoothSolver: Solving for phiE, Initial residual = 0.999982, Final residual = 0.999982, No Iterations 1000
smoothSolver: Solving for phiE, Initial residual = 0.999986, Final residual = 0.999986, No Iterations 1000
smoothSolver: Solving for phiE, Initial residual = 0.999989, Final residual = 0.999989, No Iterations 1000你在求解一个方程求解多次。另外,迭代次数1000,没有收敛,
这是一个非常简单的方程,你需要更细心的debug
-
@东岳 谢谢老师
我把代码换了写法,问题就解决了
这是原来的写法fvScalarMatrix phiEEqn ( fvm::laplacian( phiE ) ); phiEEqn.relax(); solve(phiEEqn);
把它简单地写为
solve( fvm::laplacian(sigmaE, phiE) );
问题勉强算解决了,但还不知道之前的问题出在哪。