Thank you for your help. <br><br>Using h5py I finally wrote a 10 lines python script that translates a real hdf5 file to a complex one. <br><br><div class="gmail_quote">On Sun, Mar 18, 2012 at 8:57 PM, Jed Brown <span dir="ltr">&lt;<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><div class="gmail_quote">On Sun, Mar 18, 2012 at 14:52, Barry Smith <span dir="ltr">&lt;<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>&gt;</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><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>

</blockquote></div><br>