[petsc-users] How to reuse matrix A

Matthew Knepley knepley at gmail.com
Mon Sep 9 15:14:37 CDT 2013


On Mon, Sep 9, 2013 at 3:10 PM, Frank <fangxingjun0319 at gmail.com> wrote:

> Hi,
>
> I am solving Ax=b repeatedly, and A does not change all the time. I did
> things like this:
>
> %1. Set up entries for matrix A%%%
>     CALL MATASSEMBLYBEGIN(A,MAT_FINAL_**ASSEMBLY,IERR)
>     CALL MATASSEMBLYEND(A,MAT_FINAL_**ASSEMBLY,IERR)
>     CALL MATSETOPTION(A,MAT_NEW_**NONZERO_LOCATIONS,PETSC_FALSE,**ierr)
>     CALL KSPSetOperators(ksp,A,A,SAME_**NONZERO_PATTERN,ierr)
>
>     Call KSPSetOperators(ksp,A,A,SAME_**NONZERO_PATTERN,ierr)
>
>    Do i=1,100
>            % Set up entries for vector b%%%%%
>           CALL VECASSEMBLYBEGIN(b,IERR)
>           CALL VECASSEMBLYEND(b,IERR)
>           CALL KSPSolve(ksp,b,x,ierr)
>     ENDDO
>
> However, it does not work. I don't know why. Could anybody help me with
> this? Thank you very much.
>

"Does not work" is an unacceptable bug report. With that you are likely to
get an answer like "yes it does".

   Matt


> Sincerely
> Xingjun Fang
>



-- 
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/20130909/8310aaa5/attachment.html>


More information about the petsc-users mailing list