solve successive linear systems
Matthew Knepley
knepley at gmail.com
Fri Feb 6 08:20:48 CST 2009
On Thu, Feb 5, 2009 at 10:39 PM, <enjoywm at cs.wm.edu> wrote:
> Hi,
> I have a linear system KU=F. I need to solve it successively in several
> iterations. Both K and F will be chaged in each iteration.
> Q1. In each iteration I need to chage some elements in K and F. How to
> allocate the space for K and F to make this changing efficiently? In
> another words, to avoid copy operations.
If you know the eventual nonzero pattern, allocate the whole thing up front.
If not, we do not have a dynamic structure for this. However, I
suggest profiling
first to make sure that any copy is a significant part of the runtime. We always
find that the solve dominates, which is why we never coded it.
> Q2. Manual said to solve successive linear system with different
> preconditioner matrix (The preconditioner matrix is same with K, so
> preconditioner matrix is different as K changes) user must call
> KSPSetOperators() and KSPSolve() for each solve. How to set the flag in
> each solve?
Which flag? Just call KSPSetOperators() each time you solve.
Matt
> Thanks!
>
> Yixun
>
--
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
More information about the petsc-users
mailing list