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.


 


 

Reply via email to