Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Store error of iterations of solvers.CG

More
4 years 11 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
4 years 8 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
4 years 8 months ago #1780 by creativeworker
Thank you, that is great news! For my application this fits perfectly.
More
3 years 5 months 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
3 years 5 months 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.116 seconds