[petsc-users] Extract subdomain values from DMDA

Jed Brown jed at jedbrown.org
Sat Apr 22 22:09:29 CDT 2017


Tina Patel <tinap89 at yahoo.com> writes:

> Hello everyone,
> I want to manipulate a global vector that has values only on the subgrid of a larger grid obtained by DMDACreate3d(). For example, I'd like to extract a 6x6x6 chunk from a 7x7x7 grid. 
> At some point, I need to put that 6x6x6 chunk from the logical xyz
> cartesian coordinates into a natural vector "b" 

This doesn't sounds like "natural ordering" as defined in the users
manual.

> to solve Ax=b at every iteration, then map it back to xyz coordinate
> system to do further calculations with ghost values.  The closest
> thing I can compare it to is MPI_Type_create_subarray. 

You could use DMDACreate3d to create a new child DMDA with smaller
sizes, then create a VecScatter to extract the portion of the parent
vector.  The MPI calls should not be needed or relevant here.

> Do I just use this or is there a better way?
>
> Thanks for your time,Tina
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170422/35f90515/attachment.pgp>


More information about the petsc-users mailing list