<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Dec 2, 2013 at 4:29 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>
<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 class="im">Geoffrey Irving <<a href="mailto:irving@naml.us">irving@naml.us</a>> writes:<br>

<br>
> For weak form PDEs which arise as the gradient of an integrated energy<br>
> function, it would be great to have a routine to perform the<br>
> appropriate integral.  It would be best to structure this as a generic<br>
> "perform an integral" function, evaluating<br>
><br>
>     E(f) = sum_i w_i f(u(x_i), grad u(x_i))<br>
<br>
</div>There is a SNES interface for quadratic functionals, SNESSetObjective(),<br>
and it has been plumbed down to DMDASNESSetObjectiveLocal(), but there<br>
is no DMSNESSetObjectiveLocal.  I would add that, and a<br>
DMPlexComputeResidualFEM().<br>
<br>
Actually, I would have made DMPlexSNESSetFunctionFEM() and now<br>
DMPlexSNESSetObjectiveFEM(), which configures the SNES appropriately,<br>
rather than calling SNES methods and passing in pointers to library<br>
functions.  All the other DMs work this way.  Matt, why did you do it<br>
differently with DMPlex?<br></blockquote><div><br></div><div>When you and Peter changed the way SNES used to work, I asked you how I should</div><div>change Plex. You told me to do this:</div><div><br></div><div>    ierr = DMSNESSetFunctionLocal(dm,  (PetscErrorCode (*)(DM,Vec,Vec,void*)) DMPlexComputeResidualFEM, &user);CHKERRQ(ierr);</div>
<div>    ierr = DMSNESSetJacobianLocal(dm,  (PetscErrorCode (*)(DM,Vec,Mat,Mat,MatStructure*,void*)) DMPlexComputeJacobianFEM, &user);CHKERRQ(ierr);</div><div><br></div><div>which I did. Moreover, this is how it always worked, namely specifying the local function.</div>
<div>What exactly are you proposing to replace this?</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 class="im"><br>
> for a set of FE fields u (plus auxiliary fields) and some quadrature<br>
> rule.  The quadrature rule might need to be passed in independently of<br>
> the PetscFE objects, since the integral might tie together several<br>
> different fields connected to several different PetscFE's, conceivably<br>
> with distinct quadrature rules.  The integral is only valid as a<br>
> discrete energy if all the quadrature rules match, but there might be<br>
> other integral application where this doesn't hold.<br>
<br>
</div>How is any of this different from evaluating residuals?  Each element<br>
computes a scalar now, all of which are summed together, but otherwise I<br>
think it's the same mechanics.</blockquote><div><br></div><div>It looks the same as DMPlexComputeL2Diff().</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 class="im">
> Relatedly, how does one ensure that a PetscFE object is Galerkin<br>
> (matching primal and dual spaces) so that the energy to be discretely<br>
> valid?<br>
<br>
</div>How does one ensure that the weak form itself is symmetric and how do<br>
you ensure that it is not indefinite (like a saddle; the Lagrangian is<br>
not the energy)?  We can do consistency checks, like verifying that the<br>
provided residual function is the gradient of the objective (energy).<br>
</blockquote></div><br>We do not have any way to check that the spaces are the same, and I think</div><div class="gmail_extra">its not trivial. Here I think we fall back on the user giving us the correct input.</div><div class="gmail_extra">
<br></div><div class="gmail_extra">   Matt<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>