<div dir="ltr">You seem to be confusing the degree of the mesh and the "degree" of the matrix and vector. <div><br></div><div>A matrix is always N x M (2D if you like), a vector is always N (or 1 x N, or 1D if you like). </div><div><br></div><div>The mesh in a DM or DA can be 1, 2 or 3D.</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 19, 2018 at 4:44 PM Sajid Ali via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>So, DMDA is used for sparse matrices arising from FD/FE and MatCreateMPIAIJ can be used for dense matrices (though it is strongly discouraged). <br><br></div>My confusion stemmed from DMDAGetElements giving the element indices for the 1D mesh/vector of size N(when the DMDACreate1d is used). But these indices were then used as local indices to set the values for a 2D matrix (via 
<span class="m_-5998679446980408887gmail-pl-c1">MatSetValuesLocal</span>

) created using the same DM (now we have NxN elements). <br><br></div>
</blockquote></div>