However, why signs for v[] in ComputeMatrix, which <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">contains the values of a row of the matrix. They all have a negative signs. Therefore, I got confused which equation does this program solve for:</span><div>
<font class="Apple-style-span" face="arial, sans-serif">1) u[j][i] = (u[j+1][i] + u[j-1][i] + u[j][i+1] + u[j][i-1] - rhs * dx*dy)/4</font></div><div><font class="Apple-style-span" face="arial, sans-serif">or</font></div>
<div><font class="Apple-style-span" face="arial, sans-serif">2) 4u[j][i] - u[j+1][i] - u[j-1][i] - u[j][i+1] - u[j][i-1] + rhs * dx*dy = 0</font></div><div><font class="Apple-style-span" face="arial, sans-serif"><br></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif">thanks,</font></div><div><font class="Apple-style-span" face="arial, sans-serif">Alan</font></div><div><font class="Apple-style-span" face="arial, sans-serif"><br>
</font><br><div class="gmail_quote">On Wed, Sep 21, 2011 at 8:22 AM, 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><br>
On Sep 20, 2011, at 10:47 PM, Alan Wei wrote:<br>
<br>
> Dear Dr. Smith,<br>
> I figure out this problem. Actually, I made my own RHS, but I did not multiply them by the volume (dx*dy).<br>
> However, I met another problem. All values calculated from this example are exactly opposite to values from my own code. I wonder if the RHS I input by ComputeRHS are the really RHS or -1.*RHS?<br>
<br>
</div> We do not change the sign of the right hand side.<br>
<div><div></div><div><br>
Barry<br>
<br>
><br>
> thanks in advance,<br>
> Alan<br>
><br>
> On Mon, Sep 19, 2011 at 8:43 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
> On Sep 19, 2011, at 6:25 PM, Alan Wei wrote:<br>
><br>
> > Dear folks,<br>
> > I hope you guys are having a nice day.<br>
> > I'm reading the /src/ksp/ksp/examples/tutorials/ex29.c.html and wonder how to set up the convergence criteria?<br>
><br>
> -ksp_rtol 1.e-10 for example<br>
><br>
> Run with -ksp_monitor_true_residual -ksp_converged_reason<br>
><br>
><br>
> > Currently I use it as a poisson solver to solve a Poisson Equation with three direction Neumann BC's and one direction Diriechlet BC's. It seems very bad on it.<br>
><br>
> Hmm, multigrid should likely converge well. Are you sure you've set the BC's correctly?<br>
><br>
> Barry<br>
><br>
> ><br>
> > thanks in advance,<br>
> > Alan<br>
><br>
><br>
<br>
</div></div></blockquote></div><br>
</div>