[petsc-users] KSP convergence

Barry Smith bsmith at mcs.anl.gov
Fri Aug 5 12:05:24 CDT 2011


  KSPSolve(ksp,b,x) solves A x = b. So if you want to start with an initial guess that is not zero you must set into x the initial guess you wish to use (which you could get from a file).

   Barry

On Aug 5, 2011, at 10:57 AM, Ataollah Mesgarnejad wrote:

> On Aug 5, 2011, at 11:47 AM, Barry Smith wrote:
> 
>> 
>> On Aug 5, 2011, at 10:43 AM, Ataollah Mesgarnejad wrote:
>> 
>>> Dear all,
>>> 
>>> I use KSPSetInitialGuessNonzero for my KSP solver and it works perfectly. But when I restart my computations (I read petsc binaries and set up my fields) the first KSP solve takes forever. I guess my question is: is there a way to set the initial guess for KSP back to where it was before termination (i.e. write the KSP out) or set it to be a predefined vector?
>>> 
>>> Thanks,
>>> Ata
>> 
>>   There isn't a way automatically with the KSP. But why not save the last solution to the binary file and read it in at restart and put it into x before your first new KSPSolve?
>> 
>>   Barry
>> 
> 
> Ok so if I get it correctly I need to pass  ierr = KSPSolve(ksp,x ,u);CHKERRQ(ierr); and set "x" to be the last thing I had for "u"?
> 
> Thanks,
> Ata



More information about the petsc-users mailing list