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.