[petsc-users] Understanding the -ksp_monitor_true_residual output
Dave May
dave.mayhem23 at gmail.com
Tue Apr 12 12:21:14 CDT 2016
On 12 April 2016 at 15:39, Aulisa, Eugenio <eugenio.aulisa at ttu.edu> wrote:
> Hi,
>
> I am trying to understand better the meaning of
> the output obtained using the option
>
> -ksp_monitor_true_residual
>
> For this particular ksp gmres solver I used
>
> KSPSetTolerances( ksp, 1.0e-4, 1.0e-20, 1.0e50, 60);
>
> Below I am reporting the output for 5 different solutions
>
> In each of them the convergence reason is 2, the relative tolerance.
>
> If I well understood the manual I would expect the solver to exit when the
> output of the third column ||r(i)||/||b|| would fall below 1.0e-04, but it
> is not.
>
By default, GMRES uses left preconditioning,
thus iterations are terminated when || P^{-1} r_i || / || P^{-1} b || <
1e-4
With GMRES, you can change the side of the preconditioning via
-ksp_pc_side right
(note that not all methods support both left and right preconditioning)
FGMRES and GCR use right preconditioning by default
Thanks,
Dave
Only in the last solution this is the case.
> So probably I did not understood well the manual, and there is a rescaling
> involved.
>
> Can anybody clarify?
>
> Thanks,
> Eugenio Aulisa
>
>
>
> ********* solution 1 *********
> 0 KSP preconditioned resid norm 3.410562043865e+01 true resid norm
> 2.677893657847e-02 ||r(i)||/||b|| 3.993927934126e+00
> 1 KSP preconditioned resid norm 5.824255715066e+00 true resid norm
> 1.393228808527e-02 ||r(i)||/||b|| 2.077922489826e+00
> 2 KSP preconditioned resid norm 2.044834259922e+00 true resid norm
> 9.998998076659e-03 ||r(i)||/||b|| 1.491294384100e+00
> 3 KSP preconditioned resid norm 7.983786718994e-01 true resid norm
> 7.993995927780e-03 ||r(i)||/||b|| 1.192259578632e+00
> 4 KSP preconditioned resid norm 5.088731995172e-01 true resid norm
> 8.593150583543e-03 ||r(i)||/||b|| 1.281620129208e+00
> 5 KSP preconditioned resid norm 4.857006661570e-01 true resid norm
> 9.145941228163e-03 ||r(i)||/||b|| 1.364065748018e+00
> 6 KSP preconditioned resid norm 4.709624056986e-01 true resid norm
> 8.186977687270e-03 ||r(i)||/||b|| 1.221041723798e+00
> 7 KSP preconditioned resid norm 3.220045108449e-01 true resid norm
> 4.352636436074e-03 ||r(i)||/||b|| 6.491712692992e-01
> 8 KSP preconditioned resid norm 2.317017366518e-01 true resid norm
> 3.068984741076e-03 ||r(i)||/||b|| 4.577218311441e-01
> 9 KSP preconditioned resid norm 1.910797150631e-01 true resid norm
> 2.564718555990e-03 ||r(i)||/||b|| 3.825133628412e-01
> 10 KSP preconditioned resid norm 1.729613253747e-01 true resid norm
> 2.555884137267e-03 ||r(i)||/||b|| 3.811957589244e-01
> 11 KSP preconditioned resid norm 1.708323617518e-01 true resid norm
> 2.699641560429e-03 ||r(i)||/||b|| 4.026363708929e-01
> 12 KSP preconditioned resid norm 1.606003434286e-01 true resid norm
> 2.148175491821e-03 ||r(i)||/||b|| 3.203883051534e-01
> 13 KSP preconditioned resid norm 1.205953154320e-01 true resid norm
> 1.319733567910e-03 ||r(i)||/||b|| 1.968308467752e-01
> 14 KSP preconditioned resid norm 6.473668392252e-02 true resid norm
> 7.750007977497e-04 ||r(i)||/||b|| 1.155870146685e-01
> 15 KSP preconditioned resid norm 4.210976512647e-02 true resid norm
> 3.627137178803e-04 ||r(i)||/||b|| 5.409671312704e-02
> 16 KSP preconditioned resid norm 2.167079981806e-02 true resid norm
> 1.885937330161e-04 ||r(i)||/||b|| 2.812769567181e-02
> *************** MG linear solver time: 1.710646e+01
> *************** Number of outer ksp solver iterations = 16
> *************** Convergence reason = 2
> *************** Residual norm = 0.0216708
>
>
>
>
>
> ********* solution 2 *********
> ********* Level Max 4 MG PROJECTION MATRICES TIME: 1.199155
> ********* Level Max 4 MGINIT TIME: 0.691589
> ********* Level Max 4 ASSEMBLY TIME: 11.470600
> ********* Linear Cycle + Residual Update iteration 1
> *************** Linear iteration 1 ***********
> 0 KSP preconditioned resid norm 5.264510580035e+01 true resid norm
> 4.446470526095e-03 ||r(i)||/||b|| 1.343097318343e+00
> 1 KSP preconditioned resid norm 1.194632734776e+00 true resid norm
> 2.650838633150e-03 ||r(i)||/||b|| 8.007101899472e-01
> 2 KSP preconditioned resid norm 2.514505382950e-01 true resid norm
> 8.961867887367e-04 ||r(i)||/||b|| 2.707014621199e-01
> 3 KSP preconditioned resid norm 4.126701684642e-02 true resid norm
> 2.828561525607e-04 ||r(i)||/||b|| 8.543930242012e-02
> 4 KSP preconditioned resid norm 2.990078801994e-02 true resid norm
> 3.012123557665e-04 ||r(i)||/||b|| 9.098396242766e-02
> 5 KSP preconditioned resid norm 2.498986435717e-02 true resid norm
> 3.492907889867e-04 ||r(i)||/||b|| 1.055064953780e-01
> 6 KSP preconditioned resid norm 2.212280334220e-02 true resid norm
> 2.649097730890e-04 ||r(i)||/||b|| 8.001843344081e-02
> 7 KSP preconditioned resid norm 1.270611663385e-02 true resid norm
> 1.114378752133e-04 ||r(i)||/||b|| 3.366083514611e-02
> *************** MG linear solver time: 1.032488e+01
> *************** Number of outer ksp solver iterations = 7
> *************** Convergence reason = 2
> *************** Residual norm = 0.012706117
>
>
>
>
> ********* solution 3 *********
> 0 KSP preconditioned resid norm 8.243929775966e-02 true resid norm
> 1.154408051359e-04 ||r(i)||/||b|| 1.020198211331e+00
> 1 KSP preconditioned resid norm 9.646734506593e-03 true resid norm
> 1.275532346161e-04 ||r(i)||/||b|| 1.127240767696e+00
> 2 KSP preconditioned resid norm 9.036645252734e-03 true resid norm
> 1.308042358485e-04 ||r(i)||/||b|| 1.155971212173e+00
> 3 KSP preconditioned resid norm 9.031542604401e-03 true resid norm
> 1.291290364679e-04 ||r(i)||/||b|| 1.141166781368e+00
> 4 KSP preconditioned resid norm 5.171448589573e-03 true resid norm
> 8.206502754373e-05 ||r(i)||/||b|| 7.252426402812e-01
> 5 KSP preconditioned resid norm 2.891929663032e-03 true resid norm
> 7.598041857685e-05 ||r(i)||/||b|| 6.714704305557e-01
> 6 KSP preconditioned resid norm 2.343001795062e-03 true resid norm
> 7.025844324392e-05 ||r(i)||/||b|| 6.209029644586e-01
> 7 KSP preconditioned resid norm 2.185509183830e-03 true resid norm
> 6.344926688255e-05 ||r(i)||/||b|| 5.607274525472e-01
> 8 KSP preconditioned resid norm 2.058441165493e-03 true resid norm
> 5.444619590411e-05 ||r(i)||/||b|| 4.811635851791e-01
> 9 KSP preconditioned resid norm 1.932842861175e-03 true resid norm
> 4.852637232344e-05 ||r(i)||/||b|| 4.288476521667e-01
> 10 KSP preconditioned resid norm 1.898825969952e-03 true resid norm
> 4.918129150547e-05 ||r(i)||/||b|| 4.346354442501e-01
> 11 KSP preconditioned resid norm 1.891602735935e-03 true resid norm
> 4.710536993558e-05 ||r(i)||/||b|| 4.162896654766e-01
> 12 KSP preconditioned resid norm 1.781187329134e-03 true resid norm
> 3.777014072473e-05 ||r(i)||/||b|| 3.337903782266e-01
> 13 KSP preconditioned resid norm 1.099066136430e-03 true resid norm
> 1.424597383325e-05 ||r(i)||/||b|| 1.258975715410e-01
> 14 KSP preconditioned resid norm 6.280243703281e-04 true resid norm
> 5.012017417525e-06 ||r(i)||/||b|| 4.429327392944e-02
> 15 KSP preconditioned resid norm 3.076374051756e-04 true resid norm
> 2.605020117635e-06 ||r(i)||/||b|| 2.302164179611e-02
> 16 KSP preconditioned resid norm 1.368303935548e-04 true resid norm
> 1.393123702916e-06 ||r(i)||/||b|| 1.231161120372e-02
> 17 KSP preconditioned resid norm 7.228043655761e-05 true resid norm
> 7.895171494272e-07 ||r(i)||/||b|| 6.977290072715e-03
> 18 KSP preconditioned resid norm 3.866647775994e-05 true resid norm
> 4.528577419728e-07 ||r(i)||/||b|| 4.002091442486e-03
> *************** MG linear solver time: 1.798489e+01
> *************** Number of outer ksp solver iterations = 18
> *************** Convergence reason = 2
> *************** Residual norm = 3.8666478e-05
>
>
>
>
> ********* solution 4 *********
> 0 KSP preconditioned resid norm 1.580191013568e-04 true resid norm
> 4.329063484560e-07 ||r(i)||/||b|| 9.556132759754e-01
> 1 KSP preconditioned resid norm 3.193492170557e-05 true resid norm
> 3.833183963598e-07 ||r(i)||/||b|| 8.461510204077e-01
> 2 KSP preconditioned resid norm 1.771193813393e-05 true resid norm
> 3.779057891921e-07 ||r(i)||/||b|| 8.342030337691e-01
> 3 KSP preconditioned resid norm 1.457271790528e-05 true resid norm
> 3.908277498762e-07 ||r(i)||/||b|| 8.627274414739e-01
> 4 KSP preconditioned resid norm 1.450745561248e-05 true resid norm
> 3.973502432864e-07 ||r(i)||/||b|| 8.771254315185e-01
> 5 KSP preconditioned resid norm 1.413655961039e-05 true resid norm
> 3.690661275865e-07 ||r(i)||/||b|| 8.146900420664e-01
> 6 KSP preconditioned resid norm 1.250367472770e-05 true resid norm
> 2.896966438369e-07 ||r(i)||/||b|| 6.394869464109e-01
> 7 KSP preconditioned resid norm 8.752862209538e-06 true resid norm
> 1.583120202644e-07 ||r(i)||/||b|| 3.494637324001e-01
> 8 KSP preconditioned resid norm 5.705999073439e-06 true resid norm
> 9.765760786693e-08 ||r(i)||/||b|| 2.155729684041e-01
> 9 KSP preconditioned resid norm 4.192178998873e-06 true resid norm
> 8.201685117361e-08 ||r(i)||/||b|| 1.810469911442e-01
> 10 KSP preconditioned resid norm 3.787794183624e-06 true resid norm
> 8.005205894911e-08 ||r(i)||/||b|| 1.767098370670e-01
> 11 KSP preconditioned resid norm 3.786646339736e-06 true resid norm
> 8.038622787957e-08 ||r(i)||/||b|| 1.774474937623e-01
> 12 KSP preconditioned resid norm 3.485518782082e-06 true resid norm
> 6.939667236683e-08 ||r(i)||/||b|| 1.531887477714e-01
> 13 KSP preconditioned resid norm 2.521214592414e-06 true resid norm
> 4.378155291157e-08 ||r(i)||/||b|| 9.664499805635e-02
> 14 KSP preconditioned resid norm 1.284994591466e-06 true resid norm
> 2.240582241084e-08 ||r(i)||/||b|| 4.945943027010e-02
> 15 KSP preconditioned resid norm 6.133028069300e-07 true resid norm
> 1.361309969809e-08 ||r(i)||/||b|| 3.005005319295e-02
> 16 KSP preconditioned resid norm 3.455523081821e-07 true resid norm
> 9.658743967776e-09 ||r(i)||/||b|| 2.132106400789e-02
> 17 KSP preconditioned resid norm 2.505109883585e-07 true resid norm
> 6.870409301721e-09 ||r(i)||/||b|| 1.516599228338e-02
> 18 KSP preconditioned resid norm 1.443203299992e-07 true resid norm
> 2.920265170395e-09 ||r(i)||/||b|| 6.446299935659e-03
> 19 KSP preconditioned resid norm 6.636071800703e-08 true resid norm
> 8.697314690164e-10 ||r(i)||/||b|| 1.919876992541e-03
> 20 KSP preconditioned resid norm 2.714859523602e-08 true resid norm
> 3.148984178618e-10 ||r(i)||/||b|| 6.951182623347e-04
> 21 KSP preconditioned resid norm 1.117207550910e-08 true resid norm
> 9.396722225928e-11 ||r(i)||/||b|| 2.074266765035e-04
> *************** MG linear solver time: 2.005832e+01
> *************** Number of outer ksp solver iterations = 21
> *************** Convergence reason = 2
> *************** Residual norm = 1.1172076e-08
>
>
>
>
> ********* solution 5 *********
> 0 KSP preconditioned resid norm 8.454401619840e-09 true resid norm
> 8.452738510071e-11 ||r(i)||/||b|| 8.995416179570e-01
> 1 KSP preconditioned resid norm 4.580659647172e-09 true resid norm
> 8.265563180408e-11 ||r(i)||/||b|| 8.796223931180e-01
> 2 KSP preconditioned resid norm 4.256081515265e-09 true resid norm
> 8.549582845321e-11 ||r(i)||/||b|| 9.098478056991e-01
> 3 KSP preconditioned resid norm 3.976359790239e-09 true resid norm
> 8.007959832870e-11 ||r(i)||/||b|| 8.522082087375e-01
> 4 KSP preconditioned resid norm 2.913165841066e-09 true resid norm
> 6.211100493580e-11 ||r(i)||/||b|| 6.609861857942e-01
> 5 KSP preconditioned resid norm 2.130900661500e-09 true resid norm
> 4.739159015704e-11 ||r(i)||/||b|| 5.043419672409e-01
> 6 KSP preconditioned resid norm 1.606110624311e-09 true resid norm
> 3.793019756253e-11 ||r(i)||/||b|| 4.036536945295e-01
> 7 KSP preconditioned resid norm 1.194061891991e-09 true resid norm
> 3.460284393549e-11 ||r(i)||/||b|| 3.682439505559e-01
> 8 KSP preconditioned resid norm 1.116001295092e-09 true resid norm
> 3.338332136751e-11 ||r(i)||/||b|| 3.552657742805e-01
> 9 KSP preconditioned resid norm 1.101694508395e-09 true resid norm
> 3.242096748193e-11 ||r(i)||/||b|| 3.450243907306e-01
> 10 KSP preconditioned resid norm 1.101137265122e-09 true resid norm
> 3.225308396705e-11 ||r(i)||/||b|| 3.432377720103e-01
> 11 KSP preconditioned resid norm 1.100600624436e-09 true resid norm
> 3.226535049788e-11 ||r(i)||/||b|| 3.433683126034e-01
> 12 KSP preconditioned resid norm 1.092907627060e-09 true resid norm
> 3.134764252264e-11 ||r(i)||/||b|| 3.336020514577e-01
> 13 KSP preconditioned resid norm 9.870087224964e-10 true resid norm
> 2.277199172927e-11 ||r(i)||/||b|| 2.423398554190e-01
> 14 KSP preconditioned resid norm 6.855374335133e-10 true resid norm
> 8.872613630455e-12 ||r(i)||/||b|| 9.442247871666e-02
> 15 KSP preconditioned resid norm 3.960223027036e-10 true resid norm
> 3.394176790592e-12 ||r(i)||/||b|| 3.612087701758e-02
> 16 KSP preconditioned resid norm 1.977336550448e-10 true resid norm
> 1.661499967555e-12 ||r(i)||/||b|| 1.768170596156e-02
> 17 KSP preconditioned resid norm 8.560605344251e-11 true resid norm
> 7.411831253461e-13 ||r(i)||/||b|| 7.887681216944e-03
> 18 KSP preconditioned resid norm 3.819157888961e-11 true resid norm
> 4.556531922343e-13 ||r(i)||/||b|| 4.849067663472e-03
> 19 KSP preconditioned resid norm 2.031569059250e-11 true resid norm
> 2.030960472074e-13 ||r(i)||/||b|| 2.161350983329e-03
> 20 KSP preconditioned resid norm 9.966436828718e-12 true resid norm
> 9.192887548370e-14 ||r(i)||/||b|| 9.783083824378e-04
> 21 KSP preconditioned resid norm 4.416012066006e-12 true resid norm
> 4.607062767741e-14 ||r(i)||/||b|| 4.902842660027e-04
> 22 KSP preconditioned resid norm 1.740999775043e-12 true resid norm
> 1.452842765632e-14 ||r(i)||/||b|| 1.546117309173e-04
> 23 KSP preconditioned resid norm 6.762885582183e-13 true resid norm
> 3.253813922193e-15 ||r(i)||/||b|| 3.462713340314e-05
> *************** MG linear solver time: 2.151817e+01
> *************** Number of outer ksp solver iterations = 23
> *************** Convergence reason = 2
> *************** Residual norm = 6.7628856e-13
>
>
>
>
>
>
> Eugenio Aulisa
>
> Department of Mathematics and Statistics,
> Texas Tech University
> Lubbock TX, 79409-1042
> room: 226
> http://www.math.ttu.edu/~eaulisa/
> phone: (806) 834-6684
> fax: (806) 742-1112
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160412/b0dd7128/attachment.html>
More information about the petsc-users
mailing list