[petsc-users] Convergence Criteria?

Alan Wei zhenglun.wei at gmail.com
Wed Sep 21 13:19:58 CDT 2011


Thanks, Dr. Smith,
   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

best,
Alan

On Wed, Sep 21, 2011 at 12:03 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>  Alan,
>
>   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.
>
>   Barry
>
> On Sep 21, 2011, at 11:28 AM, Alan Wei wrote:
>
> > Oh, Thanks, Matt,
> >    I got a little bit confused, since in the code, it described:
> >          div \rho grad u = f,  0 < x,y < 1,
> >    But you said, the solver solves -\Delta u = f  (Eq.1), which means:
> >    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?
> >
> > thanks in advance,
> > Alan
> >
> > On Wed, Sep 21, 2011 at 11:19 AM, Matthew Knepley <knepley at gmail.com>
> wrote:
> > On Wed, Sep 21, 2011 at 4:16 PM, Alan Wei <zhenglun.wei at gmail.com>
> wrote:
> > 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:
> > 1)  u[j][i] = (u[j+1][i] + u[j-1][i] + u[j][i+1] + u[j][i-1] - rhs *
> dx*dy)/4
> > or
> > 2)  4u[j][i] - u[j+1][i] - u[j-1][i] - u[j][i+1] - u[j][i-1] + rhs *
> dx*dy = 0
> >
> > The Laplacian is a negative definite operator, so we usually solver
> -\Delta u = f since that
> > is a positive definite problem.
> >
> >   Thanks,
> >
> >      Matt
> >
> > thanks,
> > Alan
> >
> >
> > On Wed, Sep 21, 2011 at 8:22 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> >
> > On Sep 20, 2011, at 10:47 PM, Alan Wei wrote:
> >
> > > Dear Dr. Smith,
> > >     I figure out this problem. Actually, I made my own RHS, but I did
> not multiply them by the volume (dx*dy).
> > >     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?
> >
> >   We do not change the sign of the right hand side.
> >
> >   Barry
> >
> > >
> > > thanks in advance,
> > > Alan
> > >
> > > On Mon, Sep 19, 2011 at 8:43 PM, Barry Smith <bsmith at mcs.anl.gov>
> wrote:
> > >
> > > On Sep 19, 2011, at 6:25 PM, Alan Wei wrote:
> > >
> > > > Dear folks,
> > > >     I hope you guys are having a nice day.
> > > >     I'm reading the /src/ksp/ksp/examples/tutorials/ex29.c.html and
> wonder how to set up the convergence criteria?
> > >
> > >   -ksp_rtol 1.e-10 for example
> > >
> > >   Run with -ksp_monitor_true_residual -ksp_converged_reason
> > >
> > >
> > > > 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.
> > >
> > >    Hmm, multigrid should likely converge well. Are you sure you've set
> the BC's correctly?
> > >
> > >   Barry
> > >
> > > >
> > > > thanks in advance,
> > > > Alan
> > >
> > >
> >
> >
> >
> >
> >
> > --
> > What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> > -- Norbert Wiener
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110921/90471ee1/attachment.htm>


More information about the petsc-users mailing list