<div class="gmail_quote">On Sat, Nov 12, 2011 at 11:50, behzad baghapour <span dir="ltr"><<a href="mailto:behzad.baghapour@gmail.com">behzad.baghapour@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
The nonlinear residual and Jacobian matrix are evaluated with a face-based method. Two integrals are involved (the effect of element internal connections and face flux connections). All of my calculations of flow states are solved and stored in arrays of objects called elements.</blockquote>
<div><br></div><div>Are you talking about intermediate quantities like Roe averages on face quadrature points? The state X at which the residual is evaluated is different each time, so you would be using old values if you stashed them. The residual might be evaluated multiple times before a Jacobian is requested. Normally the residual is much less expensive than the Jacobian, so it's not worth stashing the intermediate quantities. See also this FAQ:</div>
<div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#functionjacobian">http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#functionjacobian</a></div><div><br></div></div>