[petsc-users] KSP for successive linear systems

K. Wu wuktsinghua at gmail.com
Tue Mar 14 06:25:20 CDT 2023


Hi all,

Good day!

I am trying to solve an optimization problem where I need to solve multiple
successive linear systems inside each optimization loop. The matrices are
based on the same grid, but their data structure will change for each
linear system.

Currently I am doing it by setting up just one single KSP object. Then call
KSPSetOperators() and KSPSolve() for each solve. This means the KSP object
is solving the successive linear systems one by one, and in the next
optimization iteration, it starts all over again.

I am wondering that should I use separate KSP objects for each linear
system so that during optimization the same KSP will be specialized in
solving its corresponding system all the time?

I use non-zero initial guess, so I pay attention to use different x vectors
for different linear systems, so that the x vectors from the previous
iteration can be used as initial guesses for linear systems in the next
iteration. Not sure whether some similar thing should also be done for KSP?

Thanks for your kind help!

Best regards,
Kai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230314/609912b4/attachment.html>


More information about the petsc-users mailing list