On Sat, Aug 24, 2013 at 6:48 AM, 丁老师 <[email protected]> wrote:
> thank you . but the matrix element has been changed in the third and > fourth call. how to re calculate the preconditioner. > Don't give SAME_PRECONDITIONER, and read the KSP section of the manual. Matt > > > 在 2013-08-24 18:18:17,"Matthew Knepley" <[email protected]> 写道: > > > On Sat, Aug 24, 2013 at 4:57 AM, 丁老师 <[email protected]> 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 > > > > -- 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
