# [petsc-users] direct solver question

Matthew Knepley knepley at gmail.com
Tue Aug 7 13:05:01 CDT 2012

```On Tue, Aug 7, 2012 at 12:48 PM, Tabrez Ali <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 different answer.
>
> 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>  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 their