[petsc-users] DMDA stencil for union jack triangular meshes

Jed Brown jedbrown at mcs.anl.gov
Tue Jan 10 08:00:18 CST 2012


On Tue, Jan 10, 2012 at 03:45, Thomas Witkowski <
Thomas.Witkowski at tu-dresden.de> wrote:

> I'm about to implement the multigrid preconditioner for my FEM code for
> the case of regulare 2D triangular meshes. My meshes have a union jack
> pattern, thus the nodes are equidistributed in both directions but the
> stencil varies between a 9-point and a 5-point stencil. Is it possible to
> fit this into the DMDA framework?


It's not easy to make DMCreateMatrix() preallocate for this arrangement,
but you can overallocate (all 9-point), use

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMSetMatrixPreallocateOnly.html

and then assemble what you have. The resulting matrix will be compacted so
that the used part is contiguous, so the run-time performance will be the
same as with perfect preallocation (but needed to allocate slightly more
memory).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120110/1b502a95/attachment.htm>


More information about the petsc-users mailing list