<div dir="ltr">I see your point. Since the residue ff[0] and ff[xs+xm-1] are going to be minimized to zero, it forces that xx[0]=0 and xx[xs+xm-1]-1.0=0. So the BC is satisfied.<div><br></div><div>Thank you.</div><div><br>
</div><div>Xiangdong</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 2, 2014 at 3:26 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><br>
On Apr 2, 2014, at 1:48 PM, Xiangdong <<a href="mailto:epscodes@gmail.com">epscodes@gmail.com</a>> wrote:<br>
<br>
><br>
><br>
><br>
> On Wed, Apr 2, 2014 at 9:50 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
> On Wed, Apr 2, 2014 at 8:23 AM, Xiangdong <<a href="mailto:epscodes@gmail.com">epscodes@gmail.com</a>> wrote:<br>
> Hello everyone,<br>
><br>
> I have two quick questions about src/snes/examples/tutorials/ex3.c.<br>
><br>
> 1) In line 150-151, why do we need to call MatSeqAIJSetPreallocation before MatMPIAIJSetPreallocation? I found that without the seqaij call, the program crashed. However, the mat J we want to create is the mpiaij.<br>

><br>
> 2) In line 390-397, it sets the values of the residue function at the boundary. Where do these values come from? In other words, I am not clear about ff[0]=xx[0] and ff[xs+xm-1] = xx[xs+xm-1] - 1.0;<br>
<br>
</div>   At  0 we want to force the solution to be 0. and at 1 we want to force the solution to be 1. So this is just a way to apply Dirichlet boundary conditions.<br>
<span class="HOEnZb"><font color="#888888"><br>
   Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> These are just the BC we choose.<br>
><br>
> The exact solution used in the code is u=x^3. The thing not clear to me is how this is  translated to the boundary conditions I mentioned above. More like a formulation question, in fact.<br>
><br>
> Thank you.<br>
><br>
> Xiangdong<br>
><br>
><br>
>   Matt<br>
><br>
> Thank you.<br>
><br>
> Xiangdong<br>
><br>
><br>
><br>
> --<br>
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
> -- Norbert Wiener<br>
><br>
<br>
</div></div></blockquote></div><br></div>