[petsc-users] Assembling a matrix for a DMComposite vector

Anush Krishnan anush at bu.edu
Tue Apr 29 00:07:48 CDT 2014


Hi all,

I created a DMComposite using two DMDAs (representing the x and y
components of velocity in a 2-D staggered cartesian grid used for CFD
simulations). DMCompositeGetISLocalToGlobalMappings gives me the global
indices of the elements and ghost cells, which I can use to set up a matrix
that operates on the vector created with the DMComposite. I obtain the
correct global indices for all the interior points. But when I look at the
global indices of the ghost cells, the ones outside the domain from the
x-component DM return -1, but the ones outside the domain from the
y-component DM return a positive value (which seems to be the largest
global index of the interior points on Process 0). My question is: Why do
they not return -1? Wouldn't that make matrix assembly easier (since
MatSetValues ignores negative indices)? I have attached a code which
demonstrates the above.

On a related note: Is it possible to use MatSetValuesStencil for assembling
a block diagonal matrix that operates on a vector created using the above
DMComposite?

Thanks,
Anush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140429/df06e196/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex15.c
Type: text/x-csrc
Size: 4073 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140429/df06e196/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: makefile
Type: application/octet-stream
Size: 2287 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140429/df06e196/attachment.obj>


More information about the petsc-users mailing list