<br><br><div class="gmail_quote">On Fri, Feb 10, 2012 at 5:24 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On Feb 10, 2012, at 5:14 PM, Jed Brown wrote:<br>
<br>
> On Fri, Feb 10, 2012 at 17:08, Dmitry Karpeev <<a href="mailto:karpeev@mcs.anl.gov">karpeev@mcs.anl.gov</a>> wrote:<br>
> I think it's completely natural for a DM to assemble two operators -- the discretizations for the two are likely to be related anyway -- as soon as we decide that it's natural for KSP to take in two matrices and, more importantly, for the callback set with DMSetJacobian() to compute two matrices: if a DM knows how to compute two "Jacobians",<br>
<br>
</div> DM doesn't/shouldn't know how to compute two Jacobians. Where did you get that from?<br></blockquote><div><br></div><div> Here's the current declaration of DMSetJacobian:</div><div> PetscErrorCode DMSetJacobian(DM dm,PetscErrorCode (*f)(DM,Vec,Mat,Mat,MatStructure*))</div>
<div>This attaches (to a single DM) a callback that computes *two* matrices, just like SNES/KSP would want.</div><div>Dmitry.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> why wouldn't it know how to create/preallocate the two corresponding matrices?<br>
<br>
<br>
</div> The reason I don't like having the single DM doing this is that one could use very different beasties to do the true Jacobian and preconditioner (not just a simple stencil change) and shoving that stuff into a single DM is unnatural. For example true problem is on an unstructured grid, preconditioner problem on a simplier structured grid.<br>
<div class="im"><br>
<br>
><br>
> Lots of functions get messy if the DM has multiple ways to do something. Should DMCreateLocalVector() use the full stencil or the preconditioning stencil, what should DMGlobalToLocalBegin() be updating, etc.<br>
><br>
> Barry's solution of having separate DMs sounds cleaner to me, at least modulo needing conventions about which DM on which to PetscObjectCompose() things needed by certain callbacks (e.g. in the FAS with TS stuff I'm doing).<br>
<br>
</div> Clean that up and provide a formal way to do those callbacks that don't use kludgy PetscObjectCompose() or PetscObjectComposeFunction()<br>
<br>
Barry<br>
<br>
Yes, it will be slightly painful to pass two DM into the KSP and PC and track them in multigrid but we do do that with the two operators already so using two DM seems very natural.</blockquote></div><br>