negative indices
Barry Smith
bsmith at mcs.anl.gov
Thu Aug 14 11:20:24 CDT 2008
The idea with using the negative indices iin Vec/MatSetValues is
that those
grid nodes (vertices) are NOT assigned a global number at all.
For example, say you have an element with global number of its
vertices 2, 5, 22 and
say say the first of these (what is labeled global number 2) is a
Dirichlet boundary
vertex. Then what you do is RENUMBER the vertices removing the
Dirichlet boundary
vertices from the numbering. In this case the vertices of this element
would then be
labeled -1, 4, 21 (the other vertices are decreased by 1 since a
vertex with global
number 2 which is less than 5 and 22 was removed.
Since you do this before creating the PETSc objects, the PETSc
solvers (Vec, Mat, KSP, etc)
never see (or even know about these "extra" locations.
Barry
Note: the renumbering simply compresses out the numbers of the
Dirichlet boundary.
On Aug 14, 2008, at 9:56 AM, Cristian Tibirna wrote:
> On Tuesday, 12 August 2008, Matthew Knepley wrote:
>> If you ignore entries for the rows and columns associated with BCs,
>> but do
>> not
>> eliminate them from the ordering, do you remember to put something
>> on the
>> diagonal of the Jacobian?
>
> Thank you for the heads up. Indeed my initial intention was to
> eliminate the
> lines completely from the matrix structure (i.e. I preallocate zero
> non-zero
> entries for these lines), but after checking my code more
> attentively, I
> found that was failing to do it correctly because of a subtle error.
>
> Unfortunately, even after fixing this error and thus eliminating the
> lines
> completely, I can't manage to do this Dirichlet elimination work.
> This time,
> the LU preconditioner complains that the matrix has an empty row
> (which I
> thought should be permitted).
>
> I examined the aij.c code a bit and could tell (to my humble
> understanding)
> that using matrices with completely empty rows should work for
> iterative
> solvers -- at least the MatMult method does seem to ignore empty lines
> completely -- but I didn't do actual tests yet.
>
> Shouldn't it also be possible to eliminate lines completely even
> when using
> direct solving?
>
> --
> Cristian Tibirna (1-418-) 656-2131 / 4340
> Laval University - Quebec, CAN ... http://www.giref.ulaval.ca/~ctibirna
> Research professional at GIREF ... ctibirna at giref.ulaval.ca
>
More information about the petsc-users
mailing list