[petsc-users] Get solution and rhs in the ts monitor

Stefano Zampini stefano.zampini at gmail.com
Thu Nov 10 10:15:05 CST 2022


-ksp_view_mat
-ksp_view_rhs
-ksp_view_solution

> On Nov 10, 2022, at 5:00 PM, Tang, Qi <tangqi at msu.edu> wrote:
> 
> Yes, but I need to get A, x and b out, so that I can test them in pyamg for other preconditioner options. I can get A, x, and b through what I described, but I do not think x or b is the original one in the linear system. 
> 
> Is there a simple way to get x and b (I just need once) of TS? Thanks.
> 
> Qi 
> From: Matthew Knepley <knepley at gmail.com>
> Sent: Thursday, November 10, 2022 6:15 AM
> To: Tang, Qi <tangqi at msu.edu>
> Cc: petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
> Subject: Re: [petsc-users] Get solution and rhs in the ts monitor
>  
> On Thu, Nov 10, 2022 at 3:18 AM Tang, Qi <tangqi at msu.edu <mailto:tangqi at msu.edu>> wrote:
> Hi,
> 
> How could I get rhs and solution in a ksp solve of ts?
> 
> I am testing a linear problem (TS_Linear) using a bdf integrator. I tried to get the operator, rhs, and solution in the ts monitor through TSGetKSP and KSPGet***. But r = Ax-b is much larger than the ksp norm. I know the solver works fine. 
> 
> Ax - b is the _unpreconditioned_ norm. By default we are printing the preconditioned norm. You can see the difference by running with
> 
>   -ksp_monitor_true_residual
> 
>   Thanks,
> 
>      Matt
>  
> Did I misunderstand something about how TS works here? Perhaps one of the vectors is changed after the ksp solve? If so, is there a simple way to get rhs and solution that ksp of ts solved?
> 
> Thanks,
> Qi
> 
> 
> 
> 
> -- 
> 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/ <https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!HXCxUKc!3RV8f9M7XpqGA1c3nvF50ATD6Y_bSM5A5JQIMqg5pWOA-Hq_kiY0qbQKZlYrdS9iU-s0J2cgwCEWJg$>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221110/1b9dde27/attachment.html>


More information about the petsc-users mailing list