[petsc-users] PETSC DMDA fields matrix operations

Alfredo J Duarte Gomez aduarteg at utexas.edu
Mon Jul 19 15:32:08 CDT 2021


Good morning,

I am developing an application for PETSC using the DMDA object. For my
purposes, I need to create a few matrix operators and then apply them to
the fields in my DMDA object.

I have so far successfully created and validated these matrices for a DMDA
with one field using the DMCreateMatrix() and MatSetValuesStencil() very
efficiently. However it is unclear to me what is the best way to use  these
matrices in a context with more than one field.

It would be easy for me to modify my routine slightly to include all fields
on the stencil for when I call MatSetValuesStencil() since most of these
operators will act on all fields. I do wonder what to do when I have an
operator acting on one field only. Is it reasonable to only assign the
values corresponding to that field and do the matrix-vector multiply? Or is
that very wasteful in terms of efficiency?

On that note and for other applications (intermediate linear system
solutions of lower order) what is the cleanest way to pull out a vector
that has only one field from the dmda? The resulting vector from operations
with this field vector can hopefully still maintain the i,j structure of
the dmda. Is DMCreateFieldDecomposition() what I am looking for?

Thank you,

-Alfredo
-- 
Alfredo Duarte
Graduate Research Assistant
The University of Texas at Austin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210719/a2c19c36/attachment.html>


More information about the petsc-users mailing list