[petsc-users] Getting Different Solution from KSP with different resolution

Armelius Cameron armeliusc at gmail.com
Thu Jul 18 12:48:09 CDT 2013


Thanks for the pointer; I include the Dirichlet boundary in the matrix
operator now, but your comment also reminded me that I was missing the
scale factor dx^2 ! (which is a function of  the resolution nsize). So it
seems all work as expected now. Thanks again.

AC


On Thu, Jul 18, 2013 at 1:24 PM, Zou (Non-US), Ling <ling.zou at inl.gov>wrote:

> I suppose you need at least one Dirichlet boundary condition for your
> problem?
> i.e., you could not do this:
> 2T(1) - T(2) = 0
> and
> -T(N-1) + 2T(N) = 0
> at the same time.
>
> On Thu, Jul 18, 2013 at 11:09 AM, Armelius Cameron <armeliusc at gmail.com>
> wrote:
> > Hello,
> > I am trying to work on getting to know PETSc by doing an example myself.
> > Basically, I am trying to solve Ax = b using KSP where A is 1D laplacian
> > operator (tri-diag banded matrix with {-1,2,-1} on the diagonal), and b
> is
> > the forcing term, so it's just basically a simple 1-D poisson equation.
> >
> > The size of the matrix is n by n, and the vectors have size n. The issue
> I
> > am getting is that when I change n, I get different answer for the
> vector x.
> > When I plot the result x, the shape still looks like the shape of the
> > potential I expect, except it's scaled somehow, and the scale is related
> to
> > n, somehow.
> >
> > I am at a loss in trying to figure out what would cause this, so any help
> > would be appreciated. I've attached the code (fortran) I have.
> > Thank you.
> >
> > AC
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130718/45c2053c/attachment.html>


More information about the petsc-users mailing list