<div dir="ltr">On Tue, Apr 2, 2013 at 10:16 AM, Dharmendar Reddy <span dir="ltr"><<a href="mailto:dharmareddy84@gmail.com" target="_blank">dharmareddy84@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hello,<br></div> I am confused about the usage of SNESSetFunction, DMSNESSetFunction, DMSNESSetFunctionLocal and the corresponding Jacobin routines.<br>
<br></div>At present my code is set up as follows. <br>
<br></div>I initiate SNES with getFunction and getJacobain routines required as per SNESSet<Function,Jacobian>. I pass a user context which has the mesh and field layout information. I assemble the residual function and Jacobin element wise using the information from user context. My code at this point is serial, so i run the element loop from 1 to numberofTotalElements.<br>
<br></div><div>Now i want to switch to using DMPlex. How should i change the interface to my code. <br></div></div></blockquote><div><br></div><div>You can always look at SNES ex62 <a href="http://www.mcs.anl.gov/petsc/petsc-dev/src/snes/examples/tutorials/ex62.c.html">http://www.mcs.anl.gov/petsc/petsc-dev/src/snes/examples/tutorials/ex62.c.html</a></div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>If i set the dm for snes using SNESSetDM, i can see that the DM can be accessed via SNESGetDM inside getFunction and getJacobian, then i get the elementStartID and elementEndID to run the loop for assmbler. But now i will have to assemble to local vector into global vector right ? <br>
</div></div></blockquote><div><br></div><div style>No, here is the sequence:</div><div style><br></div><div style> 1) SNESSetDM(snes, dm)</div><div style><br></div><div style> 2) DMSNESSetFunctionLocal(dm, userResidual, userCtx)</div>
<div style><br></div><div style>where we have</div><div style><br></div><div style> userResidual(DM dm, Vec X, Vec F, void *userCtx)</div><div style><br></div><div style>Both X and F are local vectors which I normally interact with using DMPlexVecGet/SetClosure(). If you</div>
<div style>are using FEM, you can DMPlexComputeResidualFEM() here and use DMPlexSetFEMIntegration() to</div><div style>input point-wise physics functions as is done in ex62.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div></div><div>Looks like the DMSNESSetFunctionLocal will assemble the local <br></div><div>vector into global vector. The function provided to this should just evaluate the local vector. Did i understand this right ?<br clear="all">
</div><div><div><div><div><div><div><br></div><div>I am confused about passing the DM in DMSNESSet<Function,Jacobian>. When the DM can be accessed via SNESGetDM, why do we pass it again explicitly ?</div></div></div>
</div></div></div></div></blockquote><div><br></div><div style>You are not passing the SNES, so where would it come from in this call?</div><div style><br></div><div style> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div><div><span><font color="#888888"><br>
</font></span></div><span><font color="#888888"><div>-- <br>
-----------------------------------------------------<br>Dharmendar Reddy Palle<br>Graduate Student<br>Microelectronics Research center,<br>University of Texas at Austin,<br>10100 Burnet Road, Bldg. 160<br>MER 2.608F, TX 78758-4445<br>
e-mail: <a href="mailto:dharmareddy84@gmail.com" target="_blank">dharmareddy84@gmail.com</a><br>Phone: <a href="tel:%2B1-512-350-9082" value="+15123509082" target="_blank">+1-512-350-9082</a><br>United States of America.<br>
Homepage: <a href="https://webspace.utexas.edu/~dpr342" target="_blank">https://webspace.utexas.edu/~dpr342</a><br>
</div></font></span></div></div></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <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
</div></div>