Hello,

I cannot fetch right values of a local vector after a second time calling
DMSetLocalSection.  My program runs like

====================
call PetscSectionSetup(section1,ierr)
call DMSetLocalSection(dm_mesh,section1,ierr)
call PetscSectionDestroy(section1,ierr)

call DMCreateGlobalVector(dm_mesh,vec_a,ierr)

call VecDestroy(vec_a,ierr)
call DMClearLocalVectors(dm_mesh, ierr);

call PetscSectionSetup(section2,ierr)
call DMSetLocalSection(dm_mesh,section2,ierr)

call DMCreateGlobalVector(dm_mesh,vec_a,ierr)
call DMGetLocalVector(dm_mesh,lvec,ierr);
call DMGlobalToLocal(dm_mesh,vec_a,INSERT_VALUES,lvec,ierr)
call VecGetArrayReadF90(lvec,tempv,ierr)
call VecGetArrayReadF90(vec_a,tempv1,ierr)
========================

In this program, I got two Fortran style arrays, *tempv* and *tempv1*, from
a Vec *vec_a*. When only 1 cpu is used, those two arrays should be
completely the same. Am I right? But I found there are differences as
follows:

*  In array *tempv*,  dofs newly introduced by section2 are zero valued.
Looks like those values are ignored by DMGlobalToLocal. But in array
*tempv1*, all dofs values are set correctly.

Did I do something wrong in the above code?

Much thanks for your help.

X. Yuan, Ph.D. in Solid Mechanics

Reply via email to