[petsc-users] Writing a domain decomposition code with PETSc
Matthew Knepley
knepley at gmail.com
Fri Oct 11 08:02:37 CDT 2013
On Fri, Oct 11, 2013 at 7:50 AM, Åsmund Ervik <asmund.ervik at ntnu.no> wrote:
> Hi again,
>
> I am using a 3D DMDA and I want to extract the bounds for the local
> domain. For some reason, DMDAGetGhostCorners gives me the wrong
> numbers. Consider this code:
>
> call DMCreateLocalVector(SolScal,Lpressure,ierr)
> call DMDAVecGetArrayF90(SolScal,Lpressure,array,ierr)
> tmp=shape(array)
> call DMDAVecRestoreArrayF90(SolScal,Lpressure,array,ierr)
> call DMDAGetGhostCorners(SolScal,i,j,k,m,n,p,ierr)
> write(*,*) tmp(2:)
> write(*,*) m-i,n-j,p-k
>
> I.e. I create a local array and inquire about it's shape, and then I
> get info from DMDAGetGhostCorners. So the two last lines should print
> the same, but they don't:
>
> mpirun -np 2 meph
> 25 26 50
> 25 2 50
> 25 26 50
> 25 26 50
>
> Note the difference between the first and second lines.
>
> Am I using DMDAGetGhostCorners wrong here, or what?
>
Yes. n-j does not mean anything. n is the local size, whereas j is the
global y offset.
Matt
> Best regards,
> Åsmund Ervik
>
>
>
> On 07. okt. 2013 17:55, Jed Brown wrote:
> > Åsmund Ervik <asmund.ervik at ntnu.no> writes:
> >> Thanks for this comment; I have been suspecting this is a bad
> >> idea, nice to get confirmation. I will follow your advice.
> >
> > Cool.
> >
> >> Other than that, does the mapping from local to global using
> >> Fortran assumed-shape arrays make sense, or is there a better way
> >> of doing it?
> >
> > It looks okay to me.
> >
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131011/56606123/attachment.html>
More information about the petsc-users
mailing list