It really impossible to see what is happening in your code from this post. Is this<div>FormFunction or FormFunctionLocal?</div><div><br></div><div> Matt<br><br><div class="gmail_quote">On Wed, Mar 24, 2010 at 2:41 PM, (Rebecca) Xuefei YUAN <span dir="ltr"><<a href="mailto:xy2102@columbia.edu">xy2102@columbia.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,all,<br>
<br>
I have an error from<br>
<br>
ierr = DAGlobalToLocalBegin(dafield,X,INSERT_VALUES,localFIELD); CHKERRQ(ierr);<br>
<br>
where<br>
<br>
ierr = DMMGSetSNES(dmmg, FormFunction,0);CHKERRQ(ierr); is used for set up the SNES.<br>
<br>
So I check up the vector size of X, F, localFIELD where<br>
ierr = DAGetLocalVector(dafield,&localFIELD);CHKERRQ(ierr);<br>
PetscInt nlocalFIELD,nX,nF;<br>
ierr = VecGetSize(localFIELD,&nlocalFIELD);CHKERRQ(ierr);<br>
ierr = VecGetSize(X,&nX);CHKERRQ(ierr);<br>
ierr = VecGetSize(F,&nF);CHKERRQ(ierr);<br>
ierr = DAGlobalToLocalBegin(dafield,X,INSERT_VALUES,localFIELD); CHKERRQ(ierr);<br>
ierr = DAGlobalToLocalEnd(dafield,X,INSERT_VALUES,localFIELD);CHKERRQ(ierr);<br>
ierr = DAVecGetArray(dafield,localFIELD,&localfield);CHKERRQ(ierr);<br>
<br>
<br>
(gdb) disp nX<br>
1: nX = 120<br>
(gdb) disp nF<br>
2: nF = 120<br>
(gdb) disp nlocalFIELD<br>
3: nlocalFIELD = 100<br>
(gdb) where<br>
#0 FormFunction (snes=0x8a47840, X=0x8a39c20, F=0x8a37570, dummg=0x8a2b810)<br>
at twgcqt2unffnictv.c:8382<br>
#1 0x080fb28f in SNESComputeFunction (snes=0x8a47840, x=0x8a39c20,<br>
y=0x8a37570) at snes.c:1093<br>
#2 0x08123d1b in SNESSolve_LS (snes=0x8a47840) at ls.c:159<br>
#3 0x08103fac in SNESSolve (snes=0x8a47840, b=0x0, x=0x8a39c20) at snes.c:2242<br>
#4 0x0811db31 in DMMGSolveSNES (dmmg=0x8a2b6b0, level=0) at damgsnes.c:510<br>
#5 0x08117029 in DMMGSolve (dmmg=0x8a2b6b0) at damg.c:313<br>
#6 0x08052ecc in Solve (dmmg=0x8a2b6b0) at twgcqt2unffnictv.c:679<br>
#7 0x0804def5 in main (argc=Cannot access memory at address 0x0<br>
) at twgcqt2unffnictv.c:303<br>
<br>
3: nlocalFIELD = 100<br>
2: nF = 120<br>
1: nX = 100<br>
(gdb) where<br>
#0 FormFunction (snes=0x8a47840, X=0x8b39cc0, F=0x8adb2f0, dummg=0x8a2b810)<br>
at twgcqt2unffnictv.c:8382<br>
#1 0x0860c63d in MatFDColoringApply_AIJ (J=0x8a6bbb0, coloring=0x8aa7b40,<br>
x1=0x8b12a60, flag=0xbfbf4404, sctx=0x8a47840) at fdmatrix.c:680<br>
#2 0x0860abaf in MatFDColoringApply (J=0x8a6bbb0, coloring=0x8aa7b40,<br>
x1=0x8b12a60, flag=0xbfbf4404, sctx=0x8a47840) at fdmatrix.c:521<br>
#3 0x08122e45 in SNESDefaultComputeJacobianColor (snes=0x8a47840,<br>
x1=0x8b12a60, J=0x8a47910, B=0x8a47914, flag=0xbfbf4404, ctx=0x8aa7b40)<br>
at snesj2.c:49<br>
#4 0x0811c7cf in DMMGComputeJacobianWithFD (snes=0x8a47840, x1=0x8a39c20,<br>
J=0x8a47910, B=0x8a47914, flag=0xbfbf4404, ctx=0x8a2b810) at damgsnes.c:365<br>
#5 0x0811a883 in DMMGComputeJacobian_Multigrid (snes=0x8a47840, X=0x8a39c20,<br>
J=0x8a47910, B=0x8a47914, flag=0xbfbf4404, ptr=0x8a2b6b0) at damgsnes.c:60<br>
#6 0x080fc610 in SNESComputeJacobian (snes=0x8a47840, X=0x8a39c20,<br>
A=0x8a47910, B=0x8a47914, flg=0xbfbf4404) at snes.c:1188<br>
#7 0x08124471 in SNESSolve_LS (snes=0x8a47840) at ls.c:189<br>
#8 0x08103fac in SNESSolve (snes=0x8a47840, b=0x0, x=0x8a39c20) at snes.c:2242<br>
#9 0x0811db31 in DMMGSolveSNES (dmmg=0x8a2b6b0, level=0) at damgsnes.c:510<br>
#10 0x08117029 in DMMGSolve (dmmg=0x8a2b6b0) at damg.c:313<br>
#11 0x08052ecc in Solve (dmmg=0x8a2b6b0) at twgcqt2unffnictv.c:679<br>
#12 0x0804def5 in main (argc=Cannot access memory at address 0x1<br>
) at twgcqt2unffnictv.c:303<br>
<br>
Why nX changes from 120 to 100? Is X a global vector or a local vector?<br>
<br>
Thanks very much!<br><font color="#888888">
<br>
<br>
<br>
-- <br>
(Rebecca) Xuefei YUAN<br>
Department of Applied Physics and Applied Mathematics<br>
Columbia University<br>
Tel:917-399-8032<br>
<a href="http://www.columbia.edu/~xy2102" target="_blank">www.columbia.edu/~xy2102</a><br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>
</div>