[petsc-users] DAGlobalToLocalBegin()

Jed Brown jed at 59A2.org
Wed Mar 24 14:55:56 CDT 2010


On Wed, 24 Mar 2010 15:41:38 -0400, "(Rebecca) Xuefei YUAN" <xy2102 at columbia.edu> wrote:
> Hi,all,
> 
> I have an error from
> 
> ierr = DAGlobalToLocalBegin(dafield,X,INSERT_VALUES,localFIELD);  
> CHKERRQ(ierr);
> 
> where
> 
> ierr = DMMGSetSNES(dmmg, FormFunction,0);CHKERRQ(ierr); is used for  
> set up the SNES.
> 
> So I check up the vector size of X, F, localFIELD where
> 	ierr = DAGetLocalVector(dafield,&localFIELD);CHKERRQ(ierr);
> 	PetscInt	nlocalFIELD,nX,nF;
> 	ierr = VecGetSize(localFIELD,&nlocalFIELD);CHKERRQ(ierr);
> 	ierr = VecGetSize(X,&nX);CHKERRQ(ierr);
> 	ierr = VecGetSize(F,&nF);CHKERRQ(ierr);
> 	ierr = DAGlobalToLocalBegin(dafield,X,INSERT_VALUES,localFIELD);  
> CHKERRQ(ierr);
> 	ierr = DAGlobalToLocalEnd(dafield,X,INSERT_VALUES,localFIELD);CHKERRQ(ierr);
>   	ierr = DAVecGetArray(dafield,localFIELD,&localfield);CHKERRQ(ierr);
> 
> 
> (gdb) disp nX
> 1: nX = 120
> (gdb) disp nF
> 2: nF = 120
> (gdb) disp nlocalFIELD
> 3: nlocalFIELD = 100

Is this run in parallel?  Note that the sizes of X and F are global,
while localFIELD is serial.  What error did you get?


Matt, it's clearly FormFunction and not FormFunctionLocal because the
function prototype has the SNES.

Jed


More information about the petsc-users mailing list