[petsc-users] difference between local and global vectors

TAY wee-beng zonexo at gmail.com
Tue Aug 18 20:38:03 CDT 2015


Hi,

I am using DA. For e.g.

DM da_u

call 
DMDACreate3d(MPI_COMM_WORLD,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DMDA_STENCIL_STAR,size_x,size_y,&

size_z,1,PETSC_DECIDE,PETSC_DECIDE,1,stencil_width,lx,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da_u,ierr)

call DMCreateGlobalVector(da_u,u_global,ierr)

call DMCreateLocalVector(da_u,u_local,ierr)

To update the ghost values, I use:

call DMLocalToLocalBegin(da_u,u_local,INSERT_VALUES,u_local,ierr)

call DMLocalToLocalEnd(da_u,u_local,INSERT_VALUES,u_local,ierr)

It seems that I don't need to use global vector at all.

So what's the difference between local and global vector?

When will I need to use?:

call DMGlobalToLocalBegin(da_u,u_global,INSERT_VALUES,u_local,ierr)

call DMGlobalToLocalEnd(da_u,u_global,INSERT_VALUES,u_local,ierr)

-- 
Thank you

Yours sincerely,

TAY wee-beng



More information about the petsc-users mailing list