[petsc-users] -snes_type test

Gianluca Meneghello gianmail at gmail.com
Fri Mar 18 08:16:31 CDT 2011


Sorry, one more thing... is there a way to see/save/load into matlab
the difference between the computed jacobian and the fd one, apart
from output to screen?

thanks

gianlu

On 18 March 2011 14:03, Gianluca Meneghello <gianmail at gmail.com> wrote:
> Yes, my starting state is 0, not such a good guess...
>
> what do you mean by constant +1 and constant -1? Is it the
> starting/user-defined state vector +1 and -1?
>
> My problem should not be ill posed --- it's the Jacobian of the Navier
> Stokes operator, with good boundary conditions, at least theoretically
> --- but still I tried what you suggested. Here is the output
>
> using -mat_fd_type_ds -snes_type test:
>
>   Testing hand-coded Jacobian, if the ratio is
>   O(1.e-8), the hand-coded Jacobian is probably correct.
>   Run with -snes_test_display to show difference
>   of hand-coded and finite difference Jacobian.
>   Norm of matrix ratio 9.17279e-09 difference 2.58883e-06
>   Norm of matrix ratio 8.79304e-08 difference 2.59233e-05
>   Norm of matrix ratio 8.87045e-08 difference 2.58875e-05
>
> while using -ksp_rtol 1e-12 -pc_type lu -snes_monitor
>
>  0 SNES Function norm 2.981436587230e+00
>  1 SNES Function norm 1.487397936082e+00
>  2 SNES Function norm 3.490136703474e-01
>  3 SNES Function norm 1.303397000344e-01
>  4 SNES Function norm 3.181190030949e-02
>  5 SNES Function norm 5.280858553562e-03
>  6 SNES Function norm 3.168168082141e-04
>  7 SNES Function norm 1.217775965490e-06
>  8 SNES Function norm 1.559322624068e-11
>
>
> do I have to deduce that it's ill posed?
> thanks
>
> gianluca
>
> On 18 March 2011 12:54, Jed Brown <jed at 59a2.org> wrote:
>> On Fri, Mar 18, 2011 at 12:41, Gianluca Meneghello <gianmail at gmail.com>
>> wrote:
>>>
>>> One more thing: what does the three lines stand for then? I was
>>> thinking it was three Newton steps, but I understand it's not...
>>
>> It is your Jacobian evaluated at user-defined state, constant -1.0, and
>> constant 1.0. I added this to the output for petsc-dev:
>> $ ./ex5 -snes_type test
>> Testing hand-coded Jacobian, if the ratio is
>> O(1.e-8), the hand-coded Jacobian is probably correct.
>> Run with -snes_test_display to show difference
>> of hand-coded and finite difference Jacobian.
>> Norm of matrix ratio 2.77166e-08 difference 2.17871e-07 (user-defined state)
>> Norm of matrix ratio 1.34123e-08 difference 1.23213e-07 (constant state
>> -1.0)
>> Norm of matrix ratio 1.31875e-07 difference 9.05494e-07 (constant state 1.0)
>> [0]PETSC ERROR: SNESSolve() line 2360 in
>> /home/jed/petsc/src/snes/interface/snes.c
>> [0]PETSC ERROR: main() line 220 in src/snes/examples/tutorials/ex5.c
>>
>>>
>>> The output I sent was actually the output of one of your examples. The
>>> one from my own code is
>>>
>>> Testing hand-coded Jacobian, if the ratio is
>>> O(1.e-8), the hand-coded Jacobian is probably correct.
>>> Run with -snes_test_display to show difference
>>> of hand-coded and finite difference Jacobian.
>>> Norm of matrix ratio 9.17257e-08 difference 2.58876e-05
>>
>> Is your starting state zero?
>>
>>>
>>> Norm of matrix ratio 1.45865e-06 difference 0.000430034
>>> Norm of matrix ratio 1.47148e-06 difference 0.000429436
>>
>> If your problem is ill-conditioned, this might come from differencing error.
>> Try with -mat_fd_type ds to use a slightly more robust scheme. You can also
>> run with -ksp_rtol 1e-12 -pc_type lu -snes_monitor and check if you see
>> quadratic convergence.
>
>
>
> --
> "[Je pense que] l'homme est un monde qui vaut des fois les mondes et
> que les plus ardentes ambitions sont celles qui ont eu l'orgueil de
> l'Anonymat" -- Non omnibus, sed mihi et tibi
> Amedeo Modigliani
>



-- 
"[Je pense que] l'homme est un monde qui vaut des fois les mondes et
que les plus ardentes ambitions sont celles qui ont eu l'orgueil de
l'Anonymat" -- Non omnibus, sed mihi et tibi
Amedeo Modigliani


More information about the petsc-users mailing list