Hi all,
I've used PETSc to develop my SIMPLE algorithm CFD code. SIMPLE algorithm has its own way to handle non-linearity of Navier-Stokes equation's so I only used PETSc's KSP solvers. In the SIMPLE algorithm, the diagonal coefficient of the matrix is used in the right hand side for implicit calculation of relaxation factor, so it has to be calculated before the RHS. The linear matrix has also to be calculated in each iteration as the algorithm is iterative in nature. I first used the KSPSetComputeOperators and KSPSetComputeRHS to do this and call KSPSetComputeOperators in each iteration so that the operator matrix is calculated but the problem was that PETSc always calculates RHS before the operator matrix. So I had to manually call the functions to fill operator matrix and rhs vector and then use KSPSolve to solve them. Now I want to use multigrid solvers and I guess I have to use KSPSetComputeOperators and KSPSetComputeRHS for this purpose, right? If so, is it possible to set PETSc to compute operators before RHS? Thanks