[petsc-users] reuse an assembled matrix when a linear problem is solved with KSP and DM
Roc Wang
pengxwang at hotmail.com
Tue Sep 17 20:35:41 CDT 2013
Hello,
I am trying to solve a linear problem by using KSPSolve and DM. In the example /src/ksp/ksp/examples/tutorials/ex45.c, the Matrix and the RHS vector are computed by calling KSPSetComputeRHS and KSPSetComputeOperators in which functions ComputeRHS() and ComputeMatrix() are called and the matrix is assembled in ComputeMatrix().
Since the linear system is solved in an iteration, it will save time to reuse the matrix assembled in ComputeMatrix(). That is the ComputeMatrix() is called only once, but ComputeRHS() is called in each iteration. Can anyone tell me what should I do to keep the assembled matrix?
I am thinking not to use KSPSetComputeOperators for assembling the matrix, but use DMCreateMatrix() alternatively. Am I right?
Any hits would be appreciated very much. Thanks alot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130917/45239218/attachment-0001.html>
More information about the petsc-users
mailing list