[petsc-users] KSP Set Operators to be calculated before RHS

Mostafa Ghadamyari m.ghadam at gmail.com
Sat Nov 28 00:40:09 CST 2015


 

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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151128/ea59e43f/attachment.html>


More information about the petsc-users mailing list