<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 11, 2018 at 7:05 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">"Smith, Barry F." <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> writes:<br>
<br>
</span><span class="">>    Here is MY summary of the discussion so far.<br>
><br>
> 1) the IFunction/IJacobian interface has its supporters. There is valid argument that for certain cases it can be more efficient than the proposed alternative; but this seems largely a theoretical believe at this time since there are no comparisons between nontrivial (or even trivial) codes that use the assembly directly the mass shift plus Jacobian vs the assembly separately and MatAXPY the two parts together.  As far as I can see this potential performance is the ONLY benefit to keeping the IFunction/IJacobian() interface? Please list additional benefits if there are any?<br>
<br>
</span>PCShell<br>
<span class=""><br>
> 2) The IFunction/IJacobian approach makes it impossible for TS to access the mass matrix alone. <br>
<br>
</span>Without wasted work, yes.<br>
<span class=""><br>
> 3) But one can access the IJacobian matrix alone by passing a shift of zero<br>
><br>
> 4) TSComputeIJacobian() is an ugly piece of shit code that has a confusing name since it also can incorporates the RHS Jacobian. <br>
<br>
</span>If you get rid of that, then every implicit integrator will need to<br>
handle the RHSFunction/RHSJacobian itself.  It will be significantly<br>
more code to maintain.<br>
<span class=""><br>
> 4a) the TSComputeIJacobian() has issues for linear problems because it overwrites the user provided Jacobian and has hacks to deal with it<br>
<br>
</span>Yes, however that choice reduces memory usage which is sometimes an<br>
important factor.<br>
<span class=""><br>
> 5) There is no standard way to solve M u = F() explicitly from the IFunction() form, (and cannot even with expressed with the explicit RHS approach) the user must manage the M solve themselves inside their RHSFunction.<br>
<br>
</span>We could write this as an IMEX method with IFunction providing M u and<br>
RHSFunction providing F.  I think this could be specialized for constant<br>
M and provided automatically for any explicit method.</blockquote><div><br></div><div>We need this for PyLith, and are doing what you suggest by hand right now. Automating it would</div><div>go a long way toward removing objection to the current division I think.</div><div><br></div><div>  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> 6) There is some support for adding two new function callbacks that a) compute the mass matrix and b) compute the Jacobian part of the IJacobian. This appears particularly useful for implementing adjoints.<br>
><br>
> 7) If we added the two new interfaces the internals of an already<br>
> overly complicated TS become even more convoluted and unmaintainable.  <br>
<br>
</span>We could split the shift into ashift and bshift (elided as always 1.0<br>
now), then users could opt to skip work if one of those was nonzero.<br>
That would be a modest generalization from what we have now and would<br>
enable any desired optimization.  Integrators that wish to take<br>
advantage of M not changing could interpret a flag saying that it was<br>
constant and then always call the IJacobian with ashift=0.  That would<br>
be unintrusive for existing users and still enable all optimizations.<br>
It's only one additional parameter and then optimized user code could<br>
look like<br>
<br>
  for (each element) {<br>
    Ke[m][m] = {};<br>
    if (ashift != 0) {<br>
      Ke += ashift * (mass stuff);<br>
    }<br>
    if (bshift != 0) {<br>
      Ke += bshift * (non-mass stuff);<br>
    }<br>
  }<br>
<br>
Naive user code would elide the conditionals, but would still work with<br>
all integrators.<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>