[petsc-users] use kspsolve repeately
Matthew Knepley
knepley at gmail.com
Sat Aug 24 07:00:40 CDT 2013
On Sat, Aug 24, 2013 at 6:48 AM, 丁老师 <ztdepyahoo at 163.com> 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" <knepley at gmail.com> 写道:
>
>
> 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
>
>
>
>
--
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/98abc7fa/attachment.html>
More information about the petsc-users
mailing list