[petsc-users] Getting DMDA local coordinates
Jed Brown
jedbrown at mcs.anl.gov
Mon Oct 21 06:55:39 CDT 2013
Åsmund Ervik <asmund.ervik at ntnu.no> writes:
> Dear all,
>
> I'm using a DMDA to manage my grid, and I want to have uniform
> coordinates, so I use DMDASetUniformCoordinates. Since I let PETSc
> decide the grid partitioning, I need to get the local coordinates, i.e.
> xmin,xmax for the local grid. I found the function
> DMGetCoordinatesLocal, but I can't seem to figure out how it works (not
> in the manual, examples are confusing). What I do is
>
> call DMDASetUniformCoordinates(SolScal,0.1,1.0,0.0,1.2,0.0,1.0,ierr)
> call DMGetCoordinatesLocal(SolScal,coordVec,ierr)
> call DMDAVecGetArrayF90(SolScal,coordVec,coords,ierr)
>
> Then I have the "coords" F90 array, which has the same dimensions as my
> local part of the DA, i.e. dof:imax:jmax:kmax (all starting at 0).
Actually, the dimensions are dim:imax:jmax:kmax. Use
call DMGetCoordinateDM(SolScal,CoordDM,ierr)
call DMDAVecGetArrayF90(CoordDM,coordVec,coords,ierr)
> Where in this array can I find the values xmin,xmax etc? It looks
> really strange, e.g. a slice in i-direction gives 0.10 0.00 1.20 0.55
> 0.00
>
> I do realize I can compute these on my own, but I think using
> DMGetCoordinatesLocal has less potential for errors.
>
> Best regards,
> Åsmund Ervik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131021/482ca565/attachment.pgp>
More information about the petsc-users
mailing list