<div class="gmail_quote">On Sun, Mar 18, 2012 at 14:52, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Just run your single code in complex numbers (where the nonlinear part may have zero imaginary part). You are introducing a complicated work flow (saving to files ...) (that is also not well supported in PETSc) just to save some work on the nonlinear part when generally most nonlinear solvers spend much more time in the linear solve than the nonlinear computations. Make your life easy, just use complex numbers; your time is much more valuable than the computers.</blockquote>
</div><br><div>Also, if the nonlinear function is very expensive, you can read the state from the Vec into PetscReal locally (e.g. one stencil at a time) and compute with reals.</div><div><br></div><div>Writing to files creates a _serious_ bottleneck that will likely take orders of magnitude longer than everything else your code does if you scale it to large problems/computers.</div>