[petsc-users] KSP Set Operators to be calculated before RHS
Matthew Knepley
knepley at gmail.com
Sat Nov 28 06:28:45 CST 2015
On Sat, Nov 28, 2015 at 12:40 AM, Mostafa Ghadamyari <m.ghadam at gmail.com>
wrote:
> 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?
>
If there is a computation that is shared between the RHS and system matrix
and you with to reuse it, put
the result in a context that is shared between the two operations.
Thanks,
Matt
> Thanks
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151128/fd87009f/attachment.html>
More information about the petsc-users
mailing list