[petsc-users] use kspsolve repeately

丁老师 ztdepyahoo at 163.com
Sat Aug 24 04:57:00 CDT 2013


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.


 


 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130824/f1da7836/attachment.html>


More information about the petsc-users mailing list