[petsc-users] Mat indices

Jed Brown jed at jedbrown.org
Sun Sep 21 13:49:49 CDT 2014


Feng  Shi <fshi at fit.edu> writes:

> Hi Jed,
>
> I mean, for the 3-D Maxwellian equations, the field E and B are both
> vectors, so we have 6 scalars, in which case I can define dof=6 for
> each node, right? 

If you use a collocated discretization, yes.  Though you might want to
use a staggered/mixed scheme for curl-compatibility.

> For each node in this case, there are 6*6=36 elements for each block,
> am I right?

Yes, for collocated.

> As for setting the values, I understand I can use routine MatSetValuesBlockedStencil to set Jacobian. But I don't know what indices we should use in this case? Just as the same indices as the case with dof=1? row.i=i, row.j=j and col[1:5].i=..., col[1:5].j=... then call:
> MatSetValuesBlockedStencil(B,1,&row, 7, &col, &Value[0][0],INSERT_VALUES);
> Am I right?

The "..." part above is important, but yes, that's the general idea.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140921/746e6765/attachment.pgp>


More information about the petsc-users mailing list