Adam,
Good eye for detecting this; it was an error.
I have pushed a fix for 3.3 and dev but rather than changing the diagonal
entry I have changed the rhs for those locations. The reason is that for the
geometric multigrid to converge well it is better to scale the "zeroed-out
rows" diagonal associated with Dirichlet boundary conditions with a value near
the rest of the diagonal entries.
Barry
On Jul 19, 2012, at 12:59 PM, Adam Rose wrote:
> To whom it may concern,
>
> I believe that I've found a small error in some example code located in
> $PETSC_DIR/src/ksp/ksp/examples/tutorials/ex45.c, and I just wanted to bring
> it to your attention. It's a Laplace equation equation example with
> Dirichlet boundary conditions u=1 on the square [0,1]x[0,1], but on running
> the program I noticed that the boundary condition wasn't consistent with the
> solution. This seems due to line 119 which sets the diagonal values of our
> discretization matrix in the case of boundary points. It currently reads
> "v[0] = 2.0*(HxHydHz + HxHzdHy + HyHzdHx);" which is the same as the diagonal
> away from the boundary, but a quick change to "v[0] = Hx*Hy*Hz;" produces the
> desired result.
>
> Thanks for reading,
> Adam Rose (Intern, Tech-X Corporation)