<div dir="ltr">I can do exactly what I want using SNESLineSearchPrecheck and -snes_linesearch_type basic ... I just can't use any more exotic line searches</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 30, 2023 at 1:22 PM Alexander Lindsay <<a href="mailto:alexlindsay239@gmail.com">alexlindsay239@gmail.com</a>> wrote:<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 dir="ltr">If someone passes me just L, where L represents the "global" degrees of freedom, in this case they represent unknowns on the trace of the mesh, this is insufficient information for me to evaluate my function. Because in truth my degrees of freedom are the sum of the trace unknowns (the unknowns in the global solution vector) and the eliminated unknowns which are entirely local to each element. So I will say my dofs are L + U.</div><div dir="ltr"><br></div><div>I start with some initial guess L0 and U0. I perform a finite element assembly procedure on each element which gives me things like K_LL, K_UL, K_LU, K_UU, F_U, and F_L. I can do some math:</div><div><br></div><div>K_LL = -K_LU * K_UU^-1 * K_UL + K_LL</div><div>F_L = -K_LU * K_UU^-1 * F_U + F_L</div><div><br></div><div>And then I feed K_LL and F_L into the global system matrix and vector respectively. I do something (like a linear solve) which gives me an increment to L, I'll call it dL. I loop back through and do a finite element assembly again using **L0 and U0** (or one could in theory save off the previous assemblies) to once again obtain the same K_LL, K_UL, K_LU, K_UU, F_U, F_L. And now I can compute the increment for U, dU, according to</div><div><br></div><div>dU = K_UU^-1 * (-F_U - K_UL * dL)</div><div><br></div><div>Armed now with both dL and dU, I am ready to perform a new residual evaluation with (L0 + dL, U0 + dU) = (L1, U1). </div><div><br></div><div>The key part is that I cannot get U1 (or more generally an arbitrary U) just given L1 (or more generally an arbitrary L). In order to get U1, I must know both L0 and dL (and U0 of course). This is because at its core U is not some auxiliary vector; it represents true degrees of freedom.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 30, 2023 at 12:32 PM Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Why is this all not part of the function evaluation?<br>
<br>
<br>
> On Nov 30, 2023, at 3:25 PM, Alexander Lindsay <<a href="mailto:alexlindsay239@gmail.com" target="_blank">alexlindsay239@gmail.com</a>> wrote:<br>
> <br>
> Hi I'm looking at the sources, and I believe the answer is no, but is there a dedicated callback that is akin to SNESLineSearchPrecheck but is called before *each* function evaluation in a line search method? I am using a Hybridized Discontinuous Galerkin method in which most of the degrees of freedom are eliminated from the global system. However, an accurate function evaluation requires that an update to the "global" dofs also trigger an update to the eliminated dofs.<br>
> <br>
> I can almost certainly do this manually but I believe it would be more prone to error than a dedicated callback.<br>
<br>
</blockquote></div></div>
</blockquote></div>