On Fri, Jul 9, 2010 at 2:55 PM, Verena Kuhlemann <span dir="ltr">&lt;<a href="mailto:vkuhlem@emory.edu">vkuhlem@emory.edu</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<span style="font-family:Helvetica;font-size:medium">Hello,<div><br></div><div>I am trying to solve a linear system with GMRES and a preconditioner.</div><div>I need a nonzero initial guess and tried to do so by using</div>

<div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">       <font face="arial, helvetica, sans-serif"> </font><span style="font-size:small"><font face="arial, helvetica, sans-serif"> KSPSetInitialGuessNonzero(ksp,PETSC_TRUE);</font></span></p>

<p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-size:small"><font face="arial, helvetica, sans-serif">and       PCSetInitialGuessNonzero(pc,PETSC_TRUE);</font></span></p>
<p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-size:small"><font face="arial, helvetica, sans-serif"><br>
</font></span></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-size:small"><font face="arial, helvetica, sans-serif">Without a preconditioner (setting: PCSetType(pc,PCNONE)) it works and</font></span></p>

<p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-size:small"><font face="arial, helvetica, sans-serif">my nonzero initial guess is used. But if I try to use a preconditioner</font></span></p>

<p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-size:small"><font face="arial, helvetica, sans-serif">the solver always zeroes out the initial guess.</font></span></p></div>
</span></blockquote><div><br></div><div>1) You only need to call to KSP</div><div><br></div><div>2) How do you determine that the guess is not used? I try it in PETSc examples and it works fine.</div><div>    It would be helpful to include a small example.</div>
<div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><span style="font-family:Helvetica;font-size:medium"><div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">

<font face="arial, helvetica, sans-serif"><span style="font-size:small">I would greatly appreciate any help.</span></font></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<font face="arial, helvetica, sans-serif"><span style="font-size:small">Thanks,</span></font></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<font face="arial, helvetica, sans-serif"><span style="font-size:small">Verena</span></font></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<font face="arial, helvetica, sans-serif"><span style="font-size:small"><br></span></font></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<font face="arial, helvetica, sans-serif"><span style="font-size:small">Here is the relevant part of my code:</span></font></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<font face="arial, helvetica, sans-serif"><span style="font-size:small"></span></font></p><font face="arial, helvetica, sans-serif"><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
        KSPCreate(PETSC_COMM_WORLD,&amp;ksp);</p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="white-space:pre-wrap">        </span>KSPSetInitialGuessNonzero(ksp,PETSC_TRUE);</p>
<p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;min-height:14px"><br></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<span style="white-space:pre-wrap">        </span>KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN);</p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<span style="white-space:pre-wrap">        </span>KSPGetPC(ksp,&amp;pc);</p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<span style="white-space:pre-wrap">        </span>PCSetInitialGuessNonzero(pc,PETSC_TRUE);</p><div><font face="Monaco, helvetica, sans-serif" size="2"><span style="font-size:10px"><br>
</span></font></div></font><p></p></div></span>
</blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>