Dear Petsc developer: Hi, Thank you very much for your previous reply, they really helped me a lot.
I've been doing neutron calculations recently, and I want to use the power Iteration method to calculate the neutron flux, essentially to solve linear equations, but after each solution is done, a scalar *K* is updated to form a new right end term *b*, and the next linear equation system is solved until the convergence criterion is satisfied. The flow of the source iteration algorithm is as follows: 1: *Φ*(0) = arbitrary nonzero vector 2: K(0) = arbitrary nonzero constant 3: *for* n = 1; 2; 3; ::: do 4: *b *= 1 / K(n-1) *F * Φ(n-1) 5: *Φ*(n) * M = *b* 6: K(n) = k(n-1)* (F * *Φ*(n) ,F *Φ*(n) ) / (F *Φ*(n-1) ,F *Φ* (n-1) ) 7: check convergence of eigenvalue and eigenvector 8: *end for* (F , M are the coefficient matrix.) The difficulty is that I need to set up an extra loop to regulate KSP. Does PETSc have such an example? How do I implement this algorithm in PETsc? Please tell me the key functions if possible. Thanks, Yingjie