Oh, Thanks, Matt,<div> I got a little bit confused, since in the code, it described:</div><div> div \rho grad u = f, 0 < x,y < 1,</div><div> But you said, the solver solves -\Delta u = f (Eq.1), which means: </div>
<div> for example, to solve a equation like Delta p = 1, I should put rhs = -1 = f in (Eq.1) in the code, therefore -\Delta u = -1, which, then, will give me a good result for Delta p = 1, is that true?</div><div><br></div>
<div>thanks in advance, </div><div>Alan<br><br><div class="gmail_quote">On Wed, Sep 21, 2011 at 11:19 AM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Wed, Sep 21, 2011 at 4:16 PM, Alan Wei <span dir="ltr"><<a href="mailto:zhenglun.wei@gmail.com" target="_blank">zhenglun.wei@gmail.com</a>></span> wrote:<br></div><div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
However, why signs for v[] in ComputeMatrix, which <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 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 face="arial, sans-serif">or</font></div>
<div><font 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></blockquote><div><br></div></div><div>The Laplacian is a negative definite operator, so we usually solver -\Delta u = f since that</div>
<div>is a positive definite problem.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font face="arial, sans-serif">thanks,</font></div><div><font face="arial, sans-serif">Alan</font></div><div><font 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>
</blockquote></div></div><font color="#888888"><br><br clear="all"><div><br></div>-- <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>
</font></blockquote></div><br></div>