<div class="gmail_quote">On Sat, Mar 10, 2012 at 11:47, Xavier Garnaud <span dir="ltr">&lt;<a href="mailto:xavier.garnaud@ladhyx.polytechnique.fr">xavier.garnaud@ladhyx.polytechnique.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":21r">I assemble 12 matrices (for each dimension : viscous and inviscid fluxes (2 matrices for the dependency on the flow field and the stresses), viscous stresses, inviscid BCs (x2 as they depend on the flow field and its derivative)).</div>
</blockquote><div><br></div><div>Okay, this effectively involves more traversals of memory, so it&#39;s expected to be slower than the nonlinear version that does it all in one shot.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":21r"> There is no linear or non-linear solve.<br>
<br>I want an assembled matrix for two reasons. First, it allows me to linearize automatically the operators (by using a variation of the variable of ~1e-8: as all the matrices correspond to functions local to each discretization points, this can be done with as many function evaluations as DOFs per discretization point) without doing it &quot;on the fly&quot;, and second it allows to take the adjoint of the linear operator.</div>
</blockquote></div><br><div>Okay, the adjoint is the key reason. I can imagine code being structured so that this is a good way to apply the adjoint. If that&#39;s the case, just go with it, it&#39;s entirely reasonable for an adjoint to cost twice as much as the forward operator.</div>
<div><br></div><div>Note that you might want to consider assembling one operator that is the entire action (instead of many separate sparse matrices for different terms). The single operator should be faster to apply and is what you generally want to use for preconditioning (if you wanted to use an implicit time integration method).</div>