- Thank you received: 0
Store error of iterations of solvers.CG
- creativeworker
- Topic Author
- Offline
- Senior Member
Less
More
5 years 6 months ago #1612
by creativeworker
Store error of iterations of solvers.CG was created 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!
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!
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 3 months ago #1778
by christopher
Replied by christopher on topic Store error of iterations of solvers.CG
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:
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
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)
Best
Christopher
- creativeworker
- Topic Author
- Offline
- Senior Member
Less
More
- Thank you received: 0
5 years 3 months ago #1780
by creativeworker
Replied by creativeworker on topic Store error of iterations of solvers.CG
Thank you, that is great news! For my application this fits perfectly.
- creativeworker
- Topic Author
- Offline
- Senior Member
Less
More
- Thank you received: 0
4 years 2 weeks ago #3289
by creativeworker
Replied by creativeworker on topic Store error of iterations of solvers.CG
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!
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!
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
4 years 2 weeks ago #3291
by christopher
Replied by christopher on topic Store error of iterations of solvers.CG
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
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