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.

    Barry


   
On Mar 18, 2012, at 9:43 AM, Xavier Garnaud wrote:

> Dear PETSc team,
> 
> I am performing nonlinear and linearized computations. Nonlinear computations 
> are performed using real numbers (it would be approximately twice slower to 
> use complex numbers instead). For linearized computations however, it is much 
> more convenient to use complex numbers. These two types of computations are 
> performed separately: first a run a nonlinear simulation, I save the result 
> on the disk, and then I load it in a different code to perform linear 
> operations. 
> I would therefore like to be able to use VecView using a  version of PETSc 
> compiled with real numbers and VecLoad using a version compiled for complex 
> numbers. I would like to do this using binary or HDF5 format. I tried to 
> create a real vector with twice the size of my non-linear result and fill 
> every other element with a 0, but it does not work. Is there a way to do this 
> using existing functions?
> Thank you very much,
> 
> Sincerely,
> 
> Xavier

Reply via email to