[petsc-users] zero pattern of result of matmatmult

Jed Brown jedbrown at mcs.anl.gov
Fri Sep 6 08:36:26 CDT 2013


Frederik Treue <frtr at fysik.dtu.dk> writes:

> Resending to mail-list, sorry about the double post, Jed.
>
> PS. is there a reason why the listserver doesn't set the Reply-To header field?

http://mail-archive.com/search?l=mid&q=8738uog8i3.fsf@mcs.anl.gov

Just configure your mailer to properly do group replies.

>>   Multiplying difference operators together is really brittle
>> (boundary conditions, geometry, etc) and uses more memory than
>> necessary.
>
> Why? Ofcourse, it could go wrong if you get the non-zero pattern of the
> product matrix wrong, but that's the same as with all other instances of
> SAME_NONZERO_PATTERN throughout petsc. Why is this one special?

The symbolic part of the matrix multiply does not use entries, and
ensures that the numeric part has no memory allocation and no
conditionals.

Implementing boundary conditions and variable mesh spacing by splitting
into first order operators is quite clumsy and a lot less flexible when
you want to change the discretization.  I think your approach is a false
economy and you should just write the local routines that evaluate the
actual Jacobian.  You can factor those functions however you like
(e.g., finite element and finite volume would look a bit different).

> Anyway, is there, as an alternative, a mat copy that doesn't reallocate
> the matrix? If I use the standard MatCopy, the stencil size of the
> resulting matrix seems to be the same as the original, regardless of how
> I've allocated the target matrix.

See MatChop()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130906/890db036/attachment.pgp>


More information about the petsc-users mailing list