MatCreateMPIAIJ

Matthew Knepley knepley at gmail.com
Wed Oct 4 13:28:55 CDT 2006


On 10/4/06, Xiaoxu Wang <xiwang at dragon.rutgers.edu> wrote:
>
> Hi, Thank you for your help already. Can anybody tell me how to set the
> size of local matrix? Can I set it arbitrarily?


Yes, you can. If you also set the global size it must be consistent.

   Matt

Xiaoxu
>
> Xiaoxu Wang wrote:
>
> >
> > The error is at line 1023 of "plog.c".
> > ---------------
> > An unhandled exception of type 'System.NullReferenceException'
> > occurred in Unknown Module.
> >
> > Additional information: Object reference not set to an instance of an
> > object.
> > ----------------
> >
> > The matrix I am trying to initialize is the stiffness matrix K of
> > finite element methods. Later the dynamical system is solved as  (I +
> > Dt*K) U(t+1) = U(t) + Dt.F(t) by calling KSPSolve. Any idea how to set
> > the number of local rows?  I am running the code on PC now, but want
> > to keep MatCreateMPIAIJ in it.
> > Xiaoxu
> > ----- Original Message ----- From: "Barry Smith" <bsmith at mcs.anl.gov>
> > To: <petsc-users at mcs.anl.gov>
> > Sent: Tuesday, October 03, 2006 8:32 AM
> > Subject: Re: MatCreateMPIAIJ
> >
> >
> >>
> >>
> >> On Mon, 2 Oct 2006, Xiaoxu Wang wrote:
> >>
> >>> Hi,
> >>>
> >>>      I am a beginner on PETSC. This is my question about
> >>> MatCreateMPIAIJ. I
> >>> have a sparse matrix and only know the total number of nonzeros each
> >>> row. The
> >>> number of local rows and the number of local columns has been set to
> >>> PETSC_DECIDE. Therefore I don't know the size of each portion and it
> >>> is hard
> >>> to tell d_nnz and o_nnz. I use the total number of nunzeros as d_nnz
> >>> and get
> >>> an allocation error.
> >>
> >>
> >>
> >>   It would be helpful to know the exact error message:
> >>
> >>>  How to deal  with  this problem?  Should  I  explicitly
> >>> specify the number of local rows and the number of local columns and
> >>> calculate
> >>> d_nnz and o_nnz? Or let PETSC decide the number of local rows and
> >>> the number
> >>> of local columns, and  then use another function to get these
> >>> values? Any
> >>> other better solution?
> >>
> >>
> >>
> >>   You should specifically set the number of local rows and columns
> >> and then
> >> compute the values of d_nnz and o_nnz. How you determine d_nnz and
> >> o_nnz is
> >> problem dependent and depends on what type of discretization you are
> >> using:
> >> finite differences, elements etc.
> >>
> >>
> >>   Barry
> >>
> >>>
> >>> Thanks a lot,
> >>> Xiaoxu
> >>>
> >>>
> >>
> >>
> >
>
>


-- 
"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec
Guiness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20061004/e1a7390e/attachment.htm>


More information about the petsc-users mailing list