# Initial guess for a PETSc solver

**URL:** <https://community.freefem.org/t/initial-guess-for-a-petsc-solver/1213>\
**Category:** General Discussion\
**Created:** [September 16, 2021, 1:13pm UTC](https://community.freefem.org/t/initial-guess-for-a-petsc-solver/1213 "2021-09-16T13:13:23Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![aszaboa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aszaboa/32/2918_2.png) [@aszaboa](https://community.freefem.org/u/aszaboa)\
**Post date:** [January 25, 2022, 12:00pm UTC](https://community.freefem.org/t/initial-guess-for-a-petsc-solver/1213/5 "2022-01-25T12:00:39Z")

</div>

Dear @prj ,

I just realized that when I am solving my linear system with reusing the LU factorization (discussed in [this topic](https://community.freefem.org/t/adding-matdiagonalset-mataxpy-and-mataypx/1345), I am not using the option `-ksp_initial_guess_nonzero true` option, with which the solution time can be reduced even further. However, when I am trying to switch on and off `-ksp_initial_guess_nonzero ` similarly to `ksp_reuse_preconditioner`, I get a strange error message

> [0]PETSC ERROR: Running KSP of preonly doesn’t make sense with nonzero initial guess  
> you probably want a KSP type of Richardson

I also made an MWE which reproduces this behavior with some small modifications to the Stokes-PETSc example. Could you please take a look at this, and suggest a possible solution to this problem?  
[stokes-2d-PETSc.edp](https://community.freefem.org/uploads/short-url/gTpo0pu4U4Rz997lj1gYQdH27xc.edp) (1.6 KB)

Thanks  
András

---

_[View the full topic](https://community.freefem.org/t/initial-guess-for-a-petsc-solver/1213)._
