[petsc-users] DMDA and vector PDE

Jed Brown jedbrown at mcs.anl.gov
Tue Nov 1 11:13:39 CDT 2011


On Tue, Nov 1, 2011 at 10:06, Alexander Grayver <agrayver at gfz-potsdam.de>wrote:

> Thanks Jed, looks easy. I've read about this parameter in documentation,
> but it wasn't obvious how to use it.
> May be it's worth to mention it shortly in "2.4.4 Accessing the Vector
> Entries for DMDA Vectors" or somewhere else.
>

I'll add a note. The most common approach is to declare a struct

typedef struct {
    PetscScalar u,v,omega,temp;
} Field;

and then access as x[j][i].omega, etc. An example:

http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex50.c.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111101/9b3b7e1b/attachment.htm>


More information about the petsc-users mailing list