On Fri, 8 Nov 2013, at 15:17, Jed Brown wrote: > Svetlana Tkachenko <[email protected]> writes: > > The example has a line to compute matrix A from Ax = b, and a line to > > compute source term (vector b). > > > >> call KSPSetComputeOperators(ksp,ComputeMatrix,ctx,ierr) > >> call KSPSetComputeRHS(ksp,ComputeRHS,ctx,ierr) > > > > What do I use to give it the initial guess on x? > > Those lines are registering callbacks, in order to have a uniform > interface that can rediscretize the original operator and on coarse > levels of multigrid. Look at the implementation of ComputeMatrix and > ComputeRHS for more.
Thank you. I realised I have a set of dummy items to keep around the main matrix (1, x_dim, with only items 2 ... x_dim-1 included into matrix A itself). They are boundary conditions and the existing (serial) preconditioner relies on them. In PETSC, I couldn't find examples with similar setup.
