Store error of iterations of solvers.CG

More
5 years 6 months ago #1612 by creativeworker
Hey,

is there any possibility to store the printed error of the iterations of the solvers.CG solver? I want to make a plot of the error to show different convergence behavior in relation.

Thanks in advance!
More
5 years 3 months ago #1778 by christopher
It is quite an old thread but there are updates on this front, sorry for not answering earlier.
In the current nightly version there is a little rework of the cg solver, you can get it as a basematrix object now and use either its Solve method or do a matrix vector product. You can afterwards get the iteration count and the convergence history:
Code:
from ngsolve.krylovspace import CGSolver solver = CGSolver(a.mat, pre.mat) u.vec.data = solver * f.vec print("iteration count =", solver.iterations) print("convergence history = ", solver.errors)
The design and names might still change, thats why it is not yet exposed to the solvers, but if you want to get anything else let us know.
Best
Christopher
More
5 years 3 months ago #1780 by creativeworker
Thank you, that is great news! For my application this fits perfectly.
More
4 years 2 weeks ago #3289 by creativeworker
Hello,

sorry to dig out this old thread but I think it fits here: Is there any way to get the iterations and errors for the GMRes solver?

Thanks for your support!
More
4 years 2 weeks ago #3291 by christopher
With the current implementation not really, but you could just copy paste the GMRes solver from the krylovspace.py file to your file and add that functionality.
github.com/NGSolve/ngsolve/blob/master/p.../krylovspace.py#L554

Best Christopher
The following user(s) said Thank You: creativeworker
Time to create page: 0.114 seconds