negative indices

Cristian Tibirna ctibirna at
Tue Aug 12 11:08:13 CDT 2008


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 

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

More information about the petsc-users mailing list