[petsc-users] DAGlobalToLocalBegin()

Barry Smith bsmith at mcs.anl.gov
Wed Mar 24 15:34:24 CDT 2010


On Mar 24, 2010, at 2:41 PM, (Rebecca) Xuefei YUAN 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.
>

     There is not enough information here to determine what is going  
on. Where is X coming from? Where is dafield coming from?

     Send the entire FormFunction(). Sending a few code fragments is  
almost always useless.


    Barry

> 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
> (gdb) where
> #0  FormFunction (snes=0x8a47840, X=0x8a39c20, F=0x8a37570,  
> dummg=0x8a2b810)
>    at twgcqt2unffnictv.c:8382
> #1  0x080fb28f in SNESComputeFunction (snes=0x8a47840, x=0x8a39c20,
>    y=0x8a37570) at snes.c:1093
> #2  0x08123d1b in SNESSolve_LS (snes=0x8a47840) at ls.c:159
> #3  0x08103fac in SNESSolve (snes=0x8a47840, b=0x0, x=0x8a39c20) at  
> snes.c:2242
> #4  0x0811db31 in DMMGSolveSNES (dmmg=0x8a2b6b0, level=0) at  
> damgsnes.c:510
> #5  0x08117029 in DMMGSolve (dmmg=0x8a2b6b0) at damg.c:313
> #6  0x08052ecc in Solve (dmmg=0x8a2b6b0) at twgcqt2unffnictv.c:679
> #7  0x0804def5 in main (argc=Cannot access memory at address 0x0
> ) at twgcqt2unffnictv.c:303
>
> 3: nlocalFIELD = 100
> 2: nF = 120
> 1: nX = 100
> (gdb) where
> #0  FormFunction (snes=0x8a47840, X=0x8b39cc0, F=0x8adb2f0,  
> dummg=0x8a2b810)
>    at twgcqt2unffnictv.c:8382
> #1  0x0860c63d in MatFDColoringApply_AIJ (J=0x8a6bbb0,  
> coloring=0x8aa7b40,
>    x1=0x8b12a60, flag=0xbfbf4404, sctx=0x8a47840) at fdmatrix.c:680
> #2  0x0860abaf in MatFDColoringApply (J=0x8a6bbb0, coloring=0x8aa7b40,
>    x1=0x8b12a60, flag=0xbfbf4404, sctx=0x8a47840) at fdmatrix.c:521
> #3  0x08122e45 in SNESDefaultComputeJacobianColor (snes=0x8a47840,
>    x1=0x8b12a60, J=0x8a47910, B=0x8a47914, flag=0xbfbf4404,  
> ctx=0x8aa7b40)
>    at snesj2.c:49
> #4  0x0811c7cf in DMMGComputeJacobianWithFD (snes=0x8a47840,  
> x1=0x8a39c20,
>    J=0x8a47910, B=0x8a47914, flag=0xbfbf4404, ctx=0x8a2b810) at  
> damgsnes.c:365
> #5  0x0811a883 in DMMGComputeJacobian_Multigrid (snes=0x8a47840,  
> X=0x8a39c20,
>    J=0x8a47910, B=0x8a47914, flag=0xbfbf4404, ptr=0x8a2b6b0) at  
> damgsnes.c:60
> #6  0x080fc610 in SNESComputeJacobian (snes=0x8a47840, X=0x8a39c20,
>    A=0x8a47910, B=0x8a47914, flg=0xbfbf4404) at snes.c:1188
> #7  0x08124471 in SNESSolve_LS (snes=0x8a47840) at ls.c:189
> #8  0x08103fac in SNESSolve (snes=0x8a47840, b=0x0, x=0x8a39c20) at  
> snes.c:2242
> #9  0x0811db31 in DMMGSolveSNES (dmmg=0x8a2b6b0, level=0) at  
> damgsnes.c:510
> #10 0x08117029 in DMMGSolve (dmmg=0x8a2b6b0) at damg.c:313
> #11 0x08052ecc in Solve (dmmg=0x8a2b6b0) at twgcqt2unffnictv.c:679
> #12 0x0804def5 in main (argc=Cannot access memory at address 0x1
> ) at twgcqt2unffnictv.c:303
>
> Why nX changes from 120 to 100? Is X a global vector or a local  
> vector?
>
> Thanks very much!
>
>
>
> -- 
> (Rebecca) Xuefei YUAN
> Department of Applied Physics and Applied Mathematics
> Columbia University
> Tel:917-399-8032
> www.columbia.edu/~xy2102
>



More information about the petsc-users mailing list