<span class="Apple-style-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: normal normal normal 10px/normal Monaco; "> <font class="Apple-style-span" face="arial, helvetica, sans-serif"> </font><span class="Apple-style-span" style="font-size: small; "><font class="Apple-style-span" 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; font: normal normal normal 10px/normal Monaco; "><span class="Apple-style-span" style="font-size: small; "><font class="Apple-style-span" 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; font: normal normal normal 10px/normal Monaco; "><span class="Apple-style-span" style="font-size: small; "><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br>
</font></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-style-span" style="font-size: small; "><font class="Apple-style-span" 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; font: normal normal normal 10px/normal Monaco; "><span class="Apple-style-span" style="font-size: small; "><font class="Apple-style-span" 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; font: normal normal normal 10px/normal Monaco; "><span class="Apple-style-span" style="font-size: small; "><font class="Apple-style-span" face="arial, helvetica, sans-serif">the solver always zeroes out the initial guess.</font></span></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><br></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">
<font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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: normal normal normal 10px/normal Monaco; ">
<font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-size: small; ">Thanks,</span></font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">
<font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-size: small; ">Verena</span></font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">
<font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-size: small; "><br></span></font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">
<font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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: normal normal normal 10px/normal Monaco; ">
<font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-size: small; "></span></font></p><font class="Apple-style-span" face="arial, helvetica, sans-serif"><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">
KSPCreate(PETSC_COMM_WORLD,&ksp);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; ">        </span>KSPSetInitialGuessNonzero(ksp,PETSC_TRUE);</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">
<span class="Apple-tab-span" style="white-space: pre; ">        </span>KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">
<span class="Apple-tab-span" style="white-space: pre; ">        </span>KSPGetPC(ksp,&pc);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">
<span class="Apple-tab-span" style="white-space: pre; ">        </span>PCSetInitialGuessNonzero(pc,PETSC_TRUE);</p><div><font class="Apple-style-span" face="Monaco, helvetica, sans-serif" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br>
</span></font></div></font><p></p></div></span>