accessing iterative vectors in CG

Barry Smith bsmith at mcs.anl.gov
Thu May 15 11:43:08 CDT 2008


On May 15, 2008, at 11:10 AM, Matthew Knepley wrote:

> On Thu, May 15, 2008 at 11:04 AM, Pearl Flath  
> <pflath at ices.utexas.edu> wrote:
>> Hi,
>> I'd like to do some additional calculations for another purpose  
>> with the
>> iterative vectors in each step of the KSP CG solve. How do I get  
>> access to
>> them?
>
> We do not expose those vectors to the user in the interface. I think  
> the easiest
> thing to do is copy the cg.c code into another solver, mycg.c and do
> the requisite
> calculations in that one.
>
> You register the solver in the same way as CG is registered in
> src/ksp/ksp/interface/itregis.c
> with a call to KSPRegisterDynamic(). Then from the command-line you
> can use -ksp_type mycg.
>
>   Matt
>

    If you merely want to access the current solution, residual at  
each iteration
when the convergence test or monitoring is done you could just provide  
your
own monitor or convergence test.

    Barry

>> Pearl Flath
> -- 
> 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
>
>




More information about the petsc-users mailing list