[petsc-users] Writing a domain decomposition code with PETSc

Åsmund Ervik asmund.ervik at ntnu.no
Fri Oct 11 07:50:50 CDT 2013


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?

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.
> 


More information about the petsc-users mailing list