[petsc-users] use kspsolve repeately

Matthew Knepley knepley at gmail.com
Sat Aug 24 05:18:17 CDT 2013


On Sat, Aug 24, 2013 at 4:57 AM, 丁老师 <ztdepyahoo at 163.com> wrote:

> in  my code, i need to use kspsolve in the following way
>
>     KSP ksp;
>
>     KSPCreate(PETSC_COMM_WORLD,&ksp);
>     KSPSetOperators(ksp,A,A,SAME_NONZERO_PATTERN);
>     KSPSetOperators(ksp,A,A,SAME_PRECONDITIONER);
>     KSPSetInitialGuessNonzero(ksp,PETSC_TRUE)
>      KSPSetType(ksp,KSPBCGS);
>     KSPSetFromOptions(ksp);
>
>   set the matrix A value and right hand side bu and bv.
>     kspsolve(A,bu);
>     kspsolve(A,bv);
>   change the value of matrix A and bu bv,
>      kspsolve(A,bu);
>      kspsolve(A,bv);
>
>  the first and second call to the kspsolve use the same preconditioner.
> but which preconditoner does the third and fourth call to the kspsolve
> since the value of the matrix A has changed.
>

The first call is redundant, and the subsequent solves use the same
preconditioner, as you asked.

   Matt


>
>
>
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130824/1e63fb83/attachment.html>


More information about the petsc-users mailing list