[petsc-users] MINRES accuracy for a SPD matrix
Matthew Knepley
knepley at gmail.com
Wed Jul 31 15:51:19 CDT 2019
On Thu, Aug 1, 2019 at 8:29 AM Mohammad Gohardoust via petsc-users <
petsc-users at mcs.anl.gov> wrote:
> Thanks Jed,
>
> In the code I have it took five (Picard) iterations for single time-step
> and here are the outputs from "ksp_monitor_true_residual -ksp_view" for one
> iteration:
>
I think there is a problem in your code. The "true residual" for step 0
should be identical since it ignores the preconditioner, but
it is crazy for the MINRES case.
Thanks,
Matt
> CG with bjacobi:
>
> 0 KSP preconditioned resid norm 1.084140086188e+03 true resid norm
> 7.471524858215e-01 ||r(i)||/||b|| 1.114656457671e-37
> 1 KSP preconditioned resid norm 6.296985199017e+02 true resid norm
> 6.804895514298e-01 ||r(i)||/||b|| 1.015203840277e-37
> 2 KSP preconditioned resid norm 2.107325578297e+02 true resid norm
> 3.137762047326e-01 ||r(i)||/||b|| 4.681141795093e-38
> 3 KSP preconditioned resid norm 4.225436610327e+01 true resid norm
> 1.732061654699e-01 ||r(i)||/||b|| 2.584015639554e-38
> 4 KSP preconditioned resid norm 3.812640492590e+01 true resid norm
> 1.011864685639e-01 ||r(i)||/||b|| 1.509573383666e-38
> 5 KSP preconditioned resid norm 1.883814249049e+01 true resid norm
> 5.398301531955e-02 ||r(i)||/||b|| 8.053579125059e-39
> 6 KSP preconditioned resid norm 6.625289830879e+00 true resid norm
> 3.680797942761e-02 ||r(i)||/||b|| 5.491282267192e-39
> 7 KSP preconditioned resid norm 7.791516954461e+00 true resid norm
> 2.236588077783e-02 ||r(i)||/||b|| 3.336704878000e-39
> 8 KSP preconditioned resid norm 2.968740859730e+00 true resid norm
> 1.501379468210e-02 ||r(i)||/||b|| 2.239867164217e-39
> 9 KSP preconditioned resid norm 3.027103876686e+00 true resid norm
> 1.041339881198e-02 ||r(i)||/||b|| 1.553546625669e-39
> 10 KSP preconditioned resid norm 1.702923094998e+00 true resid norm
> 5.758722184966e-03 ||r(i)||/||b|| 8.591280887390e-40
> 11 KSP preconditioned resid norm 6.959360907334e-01 true resid norm
> 3.209679120577e-03 ||r(i)||/||b|| 4.788432919244e-40
> 12 KSP preconditioned resid norm 5.947063495977e-01 true resid norm
> 1.792219139479e-03 ||r(i)||/||b|| 2.673762953736e-40
> 13 KSP preconditioned resid norm 1.638992222627e-01 true resid norm
> 9.582599930477e-04 ||r(i)||/||b|| 1.429602001797e-40
> 14 KSP preconditioned resid norm 1.619641126005e-01 true resid norm
> 5.129340629231e-04 ||r(i)||/||b|| 7.652323674838e-41
> 15 KSP preconditioned resid norm 6.298555854405e-02 true resid norm
> 2.630662976191e-04 ||r(i)||/||b|| 3.924614493042e-41
> 16 KSP preconditioned resid norm 3.381480328186e-02 true resid norm
> 1.405167435648e-04 ||r(i)||/||b|| 2.096331051529e-41
> 17 KSP preconditioned resid norm 2.188634069174e-02 true resid norm
> 7.170524515175e-05 ||r(i)||/||b|| 1.069751035753e-41
> 18 KSP preconditioned resid norm 6.591386695704e-03 true resid norm
> 3.789193478287e-05 ||r(i)||/||b|| 5.652994616344e-42
> 19 KSP preconditioned resid norm 5.988963507321e-03 true resid norm
> 1.922304552896e-05 ||r(i)||/||b|| 2.867833841361e-42
> 20 KSP preconditioned resid norm 1.890309986311e-03 true resid norm
> 9.615814496304e-06 ||r(i)||/||b|| 1.434557192470e-42
> 21 KSP preconditioned resid norm 1.322603958495e-03 true resid norm
> 4.933661540922e-06 ||r(i)||/||b|| 7.360395368965e-43
> 22 KSP preconditioned resid norm 6.147516465031e-04 true resid norm
> 2.434568419681e-06 ||r(i)||/||b|| 3.632066361467e-43
> 23 KSP preconditioned resid norm 2.443285908381e-04 true resid norm
> 1.258673156233e-06 ||r(i)||/||b|| 1.877780223336e-43
> 24 KSP preconditioned resid norm 1.903790820937e-04 true resid norm
> 6.814992942512e-07 ||r(i)||/||b|| 1.016710248109e-43
> 25 KSP preconditioned resid norm 5.897463754127e-05 true resid norm
> 3.612787156069e-07 ||r(i)||/||b|| 5.389818825638e-44
> KSP Object: 1 MPI processes
> type: cg
> maximum iterations=10000, nonzero initial guess
> tolerances: relative=1e-10, absolute=1e-10, divergence=1e+300
> left preconditioning
> using PRECONDITIONED norm type for convergence test
> PC Object: 1 MPI processes
> type: bjacobi
> number of blocks = 1
> Local solve is same for all blocks, in the following KSP and PC
> objects:
> KSP Object: (sub_) 1 MPI processes
> type: preonly
> maximum iterations=10000, initial guess is zero
> tolerances: relative=1e-05, absolute=1e-50, divergence=10000.
> left preconditioning
> using NONE norm type for convergence test
> PC Object: (sub_) 1 MPI processes
> type: ilu
> out-of-place factorization
> 0 levels of fill
> tolerance for zero pivot 2.22045e-14
> matrix ordering: natural
> factor fill ratio given 1., needed 1.
> Factored matrix follows:
> Mat Object: 1 MPI processes
> type: seqaij
> rows=408848, cols=408848
> package used to perform factorization: petsc
> total: nonzeros=5918082, allocated nonzeros=5918082
> total number of mallocs used during MatSetValues calls =0
> not using I-node routines
> linear system matrix = precond matrix:
> Mat Object: 1 MPI processes
> type: seqaij
> rows=408848, cols=408848
> total: nonzeros=5918082, allocated nonzeros=5918082
> total number of mallocs used during MatSetValues calls =0
> not using I-node routines
> linear system matrix = precond matrix:
> Mat Object: 1 MPI processes
> type: seqaij
> rows=408848, cols=408848
> total: nonzeros=5918082, allocated nonzeros=5918082
> total number of mallocs used during MatSetValues calls =0
> not using I-node routines
>
>
>
> MINRES with bjacobi:
>
> 0 KSP preconditioned resid norm 1.400513201683e+03 true resid norm
> 7.911033287257e+31 ||r(i)||/||b|| 1.181672927444e-05
> 1 KSP preconditioned resid norm 2.320798481784e-13 true resid norm
> 5.094603145770e-03 ||r(i)||/||b|| 7.609820860095e-40
> KSP Object: 1 MPI processes
> type: minres
> maximum iterations=10000, nonzero initial guess
> tolerances: relative=1e-10, absolute=1e-10, divergence=1e+300
> left preconditioning
> using PRECONDITIONED norm type for convergence test
> PC Object: 1 MPI processes
> type: bjacobi
> number of blocks = 1
> Local solve is same for all blocks, in the following KSP and PC
> objects:
> KSP Object: (sub_) 1 MPI processes
> type: preonly
> maximum iterations=10000, initial guess is zero
> tolerances: relative=1e-05, absolute=1e-50, divergence=10000.
> left preconditioning
> using NONE norm type for convergence test
> PC Object: (sub_) 1 MPI processes
> type: ilu
> out-of-place factorization
> 0 levels of fill
> tolerance for zero pivot 2.22045e-14
> matrix ordering: natural
> factor fill ratio given 1., needed 1.
> Factored matrix follows:
> Mat Object: 1 MPI processes
> type: seqaij
> rows=408848, cols=408848
> package used to perform factorization: petsc
> total: nonzeros=5918082, allocated nonzeros=5918082
> total number of mallocs used during MatSetValues calls =0
> not using I-node routines
> linear system matrix = precond matrix:
> Mat Object: 1 MPI processes
> type: seqaij
> rows=408848, cols=408848
> total: nonzeros=5918082, allocated nonzeros=5918082
> total number of mallocs used during MatSetValues calls =0
> not using I-node routines
> linear system matrix = precond matrix:
> Mat Object: 1 MPI processes
> type: seqaij
> rows=408848, cols=408848
> total: nonzeros=5918082, allocated nonzeros=5918082
> total number of mallocs used during MatSetValues calls =0
> not using I-node routines
>
>
>
> On Wed, Jul 31, 2019 at 3:19 AM Jed Brown <jed at jedbrown.org> wrote:
>
>> Are you saying that the MINRES error is larger than CG error? In which
>> norm? And which norm are you using for CG? (Output from
>> -ksp_monitor_true_residual -ksp_view would be useful.)
>>
>> CG does find a solution that is optimal in a different inner product,
>> though this is usually pretty benign unless you have a poor
>> preconditioner.
>>
>> Mohammad Gohardoust via petsc-users <petsc-users at mcs.anl.gov> writes:
>>
>> > Hi,
>> >
>> > I am trying to evaluate different solver/preconditioner combinations for
>> > solving Richards' equation in porous media. The coefficient matrix is
>> > symmetric positive definite and is usually solved by CG solver. I tried
>> > MINRES with various preconditioners. The solution is acceptable but with
>> > somehow considerable errors (compared to other solvers) which requires
>> me
>> > to decrease the tolerance threshold in my Picard iteration leading to
>> > larger computation time. I would like to know if this is common for
>> MINRES
>> > and how to possibly overcome this?
>> >
>> > Thanks,
>> > Mohammad
>>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190801/494c12ef/attachment-0001.html>
More information about the petsc-users
mailing list