<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><div>Hi Matt,</div><div>I wrote the following line after DMMGSetKSP() in ex22.c&nbsp;</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt">ierr =DMMGSetNullSpace(dmmg,PETSC_TRUE,0,PETSC_NULL);</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><br></div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><br></div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt">Still I get the difference in the values calculated by single processor and the multiple processors.</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt">The two input values for b that I used are 1 and 10 for all the elements in the vector. I am using this</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt">code in one of my
 programs where I assign a random number to b. I get the discrepancy between&nbsp;</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt">single and multiple processors there as well. &nbsp;</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><br></div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt">Thanks.</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><br></div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt">Khalid</div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><br><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Matthew Knepley &lt;knepley@gmail.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> PETSc users list &lt;petsc-users@mcs.anl.gov&gt;<br><b><span style="font-weight:
 bold;">Cc:</span></b> khalid ashraf &lt;khalid_eee@yahoo.com&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Fri, April 15, 2011 4:38:25 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [petsc-users] DMMG with PBC<br></font><br>
On Fri, Apr 15, 2011 at 4:28 AM, khalid ashraf <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:khalid_eee@yahoo.com" target="_blank" href="mailto:khalid_eee@yahoo.com">khalid_eee@yahoo.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;"><div>Hi,</div><div>I am running src/ksp/ksp/examples/tutorials/ex22.c</div><div>I matched the output of single processor and multiprocessor results and it works fine.</div>
<div>But I want to use a periodic boundary condition. I make the following changes in the main function and this works fine with this change as well:</div><div><br></div><div><div>&nbsp;&nbsp;ierr = DMMGCreate(PETSC_COMM_WORLD,1,PETSC_NULL,&amp;dmmg);CHKERRQ(ierr);</div>
<div>&nbsp;&nbsp;ierr = DACreate3d(PETSC_COMM_WORLD,DA_XYZPERIODIC,DA_STENCIL_STAR,10,10,2,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&amp;da);CHKERRQ(ierr);</div><div><br></div><div><br></div><div>However, when I comment out these following lines since I am using a PBC, then the result of 1 proc and multi-proc are not the same. They vary within 5 decimal points and
 the difference increases with increasing number of processors.&nbsp;</div></div></div></div></blockquote><div><br></div><div>The periodic operator has a null space. You must put that in the solver DMMGSetNullSpace(), so that it is projected out at each step.</div>
<div><br></div><div>&nbsp;&nbsp; Matt</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;">
<div><div>/* &nbsp; &nbsp; &nbsp;if (i==0 || j==0 || k==0 || i==mx-1 || j==my-1 || k==mz-1){</div><div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v[0] = 2.0*(HxHydHz + HxHzdHy + HyHzdHx);</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ierr = MatSetValuesStencil(B,1,&amp;row,1,&amp;row,v,INSERT_VALUES);CHKERRQ(ierr);</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} else */</div><div><br></div><div>Could you please tell me what is going wrong here.</div><div><br></div><div>Thanks.</div></div></div><div></div>


</div></div></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></div><div style="position:fixed"></div>


</div></body></html>