negative indices

Matthew Knepley knepley at
Tue Aug 12 11:27:47 CDT 2008

If you ignore entries for the rows and columns associated with BCs, but do
eliminate them from the ordering, do you remember to put something on the
diagonal of the Jacobian?


On Tue, Aug 12, 2008 at 11:08 AM, Cristian Tibirna <ctibirna at
> wrote:

> Hello
> We recently decided to use PETSc's negative indices features in a FEM code
> that originated long time ago, long before PETSc 2.0.24 (which, it seems,
> introduced negative indices for matrices and vectors).
> I attempted to write an algorithm that produces negative indices at
> assembly
> for matrix lines and columns and vector entries imposed by Dirichlet
> boundary
> conditions. All seemed straightforward up until the final testing.
> Our FEM solver is written "in terms of correction". Thus, we get the
> solution
> as a correction vector, which should have null entries corresponding to the
> original Dirichlet-imposed DOFs.
> To my surprise, even if I initialize the correction vector by filling it
> with
> zeros, I get the Dirichlet-imposed entries (and then a few more) set to
> NaN-s.
> The bigger surprise is that, even if I set manually to zero the
> Dirichlet-imposed entries in the correction vector _after_ the solver
> finishes, I still have the "few more" entries set to NaN.
> All the values in the correction vector that are not nan-s are the exact
> solution of the system, as expected. Thus, I conclude that the solver
> assembles the matrix and the residual vector correctly and returns the
> right
> solution of the matricial system.
> Any idea what should I look at for debugging this?
> NOTE: I solve the system by PREONLY (LU preconditioner, of course).
> Thanks in advance for any help.
> --
> Cristian Tibirna                                (1-418-) 656-2131 / 4340
>  Laval University - Quebec, CAN ...<>
>  Research professional at GIREF ... ctibirna at

What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the petsc-users mailing list