<div dir="ltr">Hi all,<div><br></div><div>So I am faced with this debacle. I have a neutron transport solver with a sweep code that can compute the action of the matrix on a vector.</div><div><br></div><div>I use a matrix shell to set up the action of the matrix. The method works but only if I can get the solution converged before GMRES restarts. It gets the right answer. Now my first problem is (and I only saw this when I hit the first restart) is that it looks like the solver completely resets after the GMRES-restart. Below is an iteration log with restart interval set to 10. At first I thought it wasn't updating the initial guess but it became clear that it initial guess always had no effect. I do set KSPSetInitialGuessNonZero but it has no effect.</div><div><br></div><div>Is the matrix-free business defaulting my initial guess to zero everytime? What can I do to actually supply an initial guess? I've used PETSc for diffusion many times and the initial guess always works, just not now.</div><div><br></div><div>





<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Computing b</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 0 Residual 169.302</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 1 Residual 47.582</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 2 Residual 13.2614</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 3 Residual 4.46795</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 4 Residual 1.03038</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 5 Residual 0.246807</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 6 Residual 0.0828341</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 7 Residual 0.0410627</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 8 Residual 0.0243749</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 9 Residual 0.0136067</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 10 Residual 169.302</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 11 Residual 47.582</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 12 Residual 13.2614</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 13 Residual 4.46795</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 14 Residual 1.03038</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 15 Residual 0.246807</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 16 Residual 0.0828341</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 17 Residual 0.0410627</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 18 Residual 0.0243749</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 19 Residual 0.0136067</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[0]<span class="gmail-Apple-converted-space">  </span>Iteration 20 Residual 169.302</span></p></div><div><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Jan Izak Cornelius Vermaak <br>(M.Eng Nuclear)<br>Email: <a href="mailto:janicvermaak@gmail.com" target="_blank">janicvermaak@gmail.com</a><br>Cell:    +1-979-739-0789</div></div></div></div>