Thanks, Dr. Smith,<div> I guess it is wrong since I validate with my own code to solve a Poisson equation: Delta p = 1.0. The result from PETSc is exactly the negative value of what I get. The file is in /src/ksp/ksp/example/tutorial/ex29.c</div>
<div><br></div><div>best,</div><div>Alan</div><div><br><div class="gmail_quote">On Wed, Sep 21, 2011 at 12:03 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">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;"><br>
Alan,<br>
<br>
It is very possible that the comment in the example code is wrong and has an incorrect sign. If you tell us what example this is we'll check it and fix the comment it if is wrong.<br>
<font color="#888888"><br>
Barry<br>
</font><div><div></div><div class="h5"><br>
On Sep 21, 2011, at 11:28 AM, Alan Wei wrote:<br>
<br>
> Oh, Thanks, Matt,<br>
> I got a little bit confused, since in the code, it described:<br>
> div \rho grad u = f, 0 < x,y < 1,<br>
> But you said, the solver solves -\Delta u = f (Eq.1), which means:<br>
> 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?<br>
><br>
> thanks in advance,<br>
> Alan<br>
><br>
> On Wed, Sep 21, 2011 at 11:19 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
> On Wed, Sep 21, 2011 at 4:16 PM, Alan Wei <<a href="mailto:zhenglun.wei@gmail.com">zhenglun.wei@gmail.com</a>> wrote:<br>
> However, why signs for v[] in ComputeMatrix, which 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:<br>
> 1) u[j][i] = (u[j+1][i] + u[j-1][i] + u[j][i+1] + u[j][i-1] - rhs * dx*dy)/4<br>
> or<br>
> 2) 4u[j][i] - u[j+1][i] - u[j-1][i] - u[j][i+1] - u[j][i-1] + rhs * dx*dy = 0<br>
><br>
> The Laplacian is a negative definite operator, so we usually solver -\Delta u = f since that<br>
> is a positive definite problem.<br>
><br>
> Thanks,<br>
><br>
> Matt<br>
><br>
> thanks,<br>
> Alan<br>
><br>
><br>
> On Wed, Sep 21, 2011 at 8:22 AM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><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>
> We do not change the sign of the right hand side.<br>
><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">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>
><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>