[petsc-users] Getting DMDA local coordinates
Åsmund Ervik
asmund.ervik at ntnu.no
Mon Oct 21 06:40:06 CDT 2013
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). 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
More information about the petsc-users
mailing list