On 10/4/06, <b class="gmail_sendername">Xiaoxu Wang</b> &lt;<a href="mailto:xiwang@dragon.rutgers.edu">xiwang@dragon.rutgers.edu</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi, Thank you for your help already. Can anybody tell me how to set the<br>size of local matrix? Can I set it arbitrarily?</blockquote><div><br>Yes, you can. If you also set the global size it must be consistent.<br><br>&nbsp;&nbsp; Matt
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Xiaoxu<br><br>Xiaoxu Wang wrote:<br><br>&gt;<br>&gt; The error is at line 1023 of &quot;
plog.c&quot;.<br>&gt; ---------------<br>&gt; An unhandled exception of type 'System.NullReferenceException'<br>&gt; occurred in Unknown Module.<br>&gt;<br>&gt; Additional information: Object reference not set to an instance of an
<br>&gt; object.<br>&gt; ----------------<br>&gt;<br>&gt; The matrix I am trying to initialize is the stiffness matrix K of<br>&gt; finite element methods. Later the dynamical system is solved as&nbsp;&nbsp;(I +<br>&gt; Dt*K) U(t+1) = U(t) + 
Dt.F(t) by calling KSPSolve. Any idea how to set<br>&gt; the number of local rows?&nbsp;&nbsp;I am running the code on PC now, but want<br>&gt; to keep MatCreateMPIAIJ in it.<br>&gt; Xiaoxu<br>&gt; ----- Original Message ----- From: &quot;Barry Smith&quot; &lt;
<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt;<br>&gt; To: &lt;<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>&gt;<br>&gt; Sent: Tuesday, October 03, 2006 8:32 AM<br>&gt; Subject: Re: MatCreateMPIAIJ
<br>&gt;<br>&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; On Mon, 2 Oct 2006, Xiaoxu Wang wrote:<br>&gt;&gt;<br>&gt;&gt;&gt; Hi,<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I am a beginner on PETSC. This is my question about<br>&gt;&gt;&gt; MatCreateMPIAIJ. I
<br>&gt;&gt;&gt; have a sparse matrix and only know the total number of nonzeros each<br>&gt;&gt;&gt; row. The<br>&gt;&gt;&gt; number of local rows and the number of local columns has been set to<br>&gt;&gt;&gt; PETSC_DECIDE. Therefore I don't know the size of each portion and it
<br>&gt;&gt;&gt; is hard<br>&gt;&gt;&gt; to tell d_nnz and o_nnz. I use the total number of nunzeros as d_nnz<br>&gt;&gt;&gt; and get<br>&gt;&gt;&gt; an allocation error.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;&nbsp;&nbsp; It would be helpful to know the exact error message:
<br>&gt;&gt;<br>&gt;&gt;&gt;&nbsp;&nbsp;How to deal&nbsp;&nbsp;with&nbsp;&nbsp;this problem?&nbsp;&nbsp;Should&nbsp;&nbsp;I&nbsp;&nbsp;explicitly<br>&gt;&gt;&gt; specify the number of local rows and the number of local columns and<br>&gt;&gt;&gt; calculate<br>&gt;&gt;&gt; d_nnz and o_nnz? Or let PETSC decide the number of local rows and
<br>&gt;&gt;&gt; the number<br>&gt;&gt;&gt; of local columns, and&nbsp;&nbsp;then use another function to get these<br>&gt;&gt;&gt; values? Any<br>&gt;&gt;&gt; other better solution?<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;&nbsp;&nbsp; You should specifically set the number of local rows and columns
<br>&gt;&gt; and then<br>&gt;&gt; compute the values of d_nnz and o_nnz. How you determine d_nnz and<br>&gt;&gt; o_nnz is<br>&gt;&gt; problem dependent and depends on what type of discretization you are<br>&gt;&gt; using:
<br>&gt;&gt; finite differences, elements etc.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;&nbsp;&nbsp; Barry<br>&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Thanks a lot,<br>&gt;&gt;&gt; Xiaoxu<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;
<br>&gt;<br><br></blockquote></div><br><br clear="all"><br>-- <br>&quot;Failure has a thousand explanations. Success doesn't need one&quot; -- Sir Alec Guiness