# [petsc-users] direct solver question

Tabrez Ali stali at geology.wisc.edu
Tue Aug 7 13:53:57 CDT 2012

```Matt

So if I want to use a direct solver I should really use (2) instead of (3).

Tabrez

On 08/07/2012 01:05 PM, Matthew Knepley wrote:
> On Tue, Aug 7, 2012 at 12:48 PM, Tabrez Ali <stali at geology.wisc.edu
> <mailto:stali at geology.wisc.edu>> wrote:
>
>     Barry
>
>     So which one of the two gives the correct solution? And yes the
>     condition number is high.
>
>     Actually I am trying to solve a trivial quasi-static problem with
>     the following flags
>
>     (1) -ksp_type gmres -pc_type asm
>     (2) -ksp_type gmres -pc_type lu -pc_factor_shift_type nonzero
>     (3) -ksp_type preonly -pc_type lu -pc_factor_shift_type nonzero
>
>
> This does no iterative refinement, so you are stuck with the initial
> accuracy of the LU
> factorization, which can be bad for an ill-conditioned matrix.
>
>    Matt
>
>     The results at t=0 for all three cases are equivalent.
>
>     For the time dependent part (linear system is solved again),
>     results from (1) and (2) are the same. But (3) gives a very
>
>     I also solve the same quasi-static problem using a different code
>     (does not use PETSc) and the results obtained are similar to (1)
>     and (2).
>
>     So basically I am trying to understand why '-ksp_type preonly'
>     gives me a (potentially) wrong solution.
>
>     Thanks
>     Tabrez
>
>
>
>     On 08/07/2012 12:01 PM, Barry Smith wrote:
>
>         On Aug 7, 2012, at 12:06 PM, Tabrez Ali<stali at geology.wisc.edu
>         <mailto:stali at geology.wisc.edu>>  wrote:
>
>             Hello list
>
>             By any chance is using
>
>             -ksp_type gmres -pc_type lu
>
>             similar to
>
>             -ksp_type preonly -pc_type lu?
>
>             Should the results be equivalent?
>
>             T
>
>             The should be similar but will not be identical
>         necessarily, in particular when the matrix is ill conditioned
>         they can be very different and in fact GMRES may iterate a few
>         times.
>
>             Barry
>
>
>
>     --
>     No one trusts a model except the one who wrote it; Everyone trusts
>     an observation except the one who made it- Harlow Shapley
>
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which