<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Dave, Hong, thank you. Setting and getting the context from TS is definitely the way to go, as I have to compute an exchange of particle forces and geometry information. Working fine now.</p>
<p><br>
</p>
<p>Christian</p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="font-family:Helvetica; font-size:12px">_______________________________<br>
</div>
<div style="font-family:Helvetica; font-size:12px">Christian Peco Regales, Ph.D. <br>
</div>
<div style="font-family:Helvetica; font-size:12px">Postdoctoral Research Associate<br>
</div>
<div style="font-family:Helvetica; font-size:12px">Civil and Environmental Engineering <br>
</div>
<div style="font-family:Helvetica; font-size:12px">Pratt School of Engineering<br>
</div>
<div style="font-family:Helvetica; font-size:12px">Duke University<br>
</div>
<div style="font-family:Helvetica; font-size:12px">2407 CIEMAS (office)<br>
</div>
<div style="font-family:Helvetica; font-size:12px">Durham, NC 27708, USA</div>
<div style="font-family:Helvetica; font-size:12px">email: christian.peco@duke.edu<br>
</div>
<div style="font-family:Helvetica; font-size:12px">web: <a href="http://christianpeco.com" id="LPNoLP">
http://www.christianpeco.com</a></div>
<div style="font-family:Helvetica; font-size:12px">_______________________________<br>
</div>
</div>
</div>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dave May <dave.mayhem23@gmail.com><br>
<b>Sent:</b> Wednesday, March 30, 2016 2:38 PM<br>
<b>To:</b> Christian Peco Regales, Ph.D.<br>
<b>Cc:</b> petsc-users@mcs.anl.gov<br>
<b>Subject:</b> Re: [petsc-users] TS prestep function</font>
<div> </div>
</div>
<div>
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 30 March 2016 at 19:54, Christian Peco Regales, Ph.D.
<span dir="ltr"><<a href="mailto:cp226@duke.edu" target="_blank">cp226@duke.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<p>I have started to use the TS environment to solve a diffusion problem with XFEM in which, at the beginning of every step, a number of values have to be recomputed in order to properly fill the Jacobian (e.g. change some quadrature weights). However, I see
 that the the function is expected with the format func(TS ts), with no possibility of getting a user context to perform the computations I need.</p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>There are a number of ways to get around this:<br>
<br>
[1] Set an application context on the TS<br>
<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetApplicationContext.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetApplicationContext.html</a><br>
</div>
<div> <br>
</div>
<div>and retrieve via<br>
<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSGetApplicationContext.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSGetApplicationContext.html</a><br>
</div>
<div><br>
</div>
<div>[2] It sounds like your information is related to geometry, so you could bundle it into a DM and use<br>
<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetDM.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetDM.html</a><br>
<br>
</div>
<div>[3] The "nastiest" way is to use<br>
<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscContainerCreate.html#PetscContainerCreate">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscContainerCreate.html#PetscContainerCreate</a><br>
<br>
</div>
<div>and then compose the PetscContainer object with the TS object via<br>
</div>
<div><br>
<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscObjectCompose.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscObjectCompose.html</a><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks,<br>
</div>
<div>  Dave<br>
</div>
<div><br>
</div>
<div><br>
 </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<p></p>
<p>Is there a way to get around that? Thanks!</p>
<p><br>
</p>
<p>Christian <span>     </span></p>
<p><br>
</p>
<div>
<div style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="font-family:Helvetica; font-size:12px">_______________________________<br>
</div>
<div style="font-family:Helvetica; font-size:12px">Christian Peco Regales, Ph.D. <br>
</div>
<div style="font-family:Helvetica; font-size:12px">Postdoctoral Research Associate<br>
</div>
<div style="font-family:Helvetica; font-size:12px">Civil and Environmental Engineering <br>
</div>
<div style="font-family:Helvetica; font-size:12px">Pratt School of Engineering<br>
</div>
<div style="font-family:Helvetica; font-size:12px">Duke University<br>
</div>
<div style="font-family:Helvetica; font-size:12px">2407 CIEMAS (office)<br>
</div>
<div style="font-family:Helvetica; font-size:12px">Durham, NC 27708, USA</div>
<div style="font-family:Helvetica; font-size:12px">email: <a href="mailto:christian.peco@duke.edu" target="_blank">
christian.peco@duke.edu</a><br>
</div>
<div style="font-family:Helvetica; font-size:12px">web: <a href="http://christianpeco.com" target="_blank">
http://www.christianpeco.com</a></div>
<div style="font-family:Helvetica; font-size:12px">_______________________________<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>