[petsc-users] using '-snes_type test' to test my coded Jacobian

Zou (Non-US), Ling ling.zou at inl.gov
Wed Sep 19 14:56:26 CDT 2012


No Jacobian output showed when I did this,

./my-project-opt -i input.i -snes_compare_explicit

Any suggestion?

Ling



On Wed, Sep 19, 2012 at 1:12 PM, Zou (Non-US), Ling <ling.zou at inl.gov>wrote:

>
>
> On Wed, Sep 19, 2012 at 1:03 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>> On Wed, Sep 19, 2012 at 1:54 PM, Zou (Non-US), Ling <ling.zou at inl.gov>wrote:
>>
>>> Dear Matt,
>>>
>>> Thanks again for helping me on the '-snes_type test' issue. This is a
>>> great tool which helped us make really good progress recently.
>>>
>>> I have couple of more questions about the '-snes_type test'. From my
>>> understanding, this finite difference method is based on a tiny
>>> perturbation from a base solution vector. This base solution vector, from
>>> my observation, seems to be [1, 1, 1, ....].  However, this solution vector
>>> sometimes is very far from real physics, which causes issue, for example a
>>> dependent pressure variable get negative value.
>>>
>>> I wonder,
>>> 1), if this [1, 1, 1, ...] base solution vector is always used during
>>> the real simulation, for example when using the finite difference
>>> preconditioner. Or this base solution vector will change as solution gets
>>> updated?
>>>
>>
>> -snes_type test tries three different states: your user-defined state,
>> then constant -1.0, then constant +1.0. It does not solve the system so you
>> can't continue stepping, but you can just look at the result from the first
>> test.
>>
>
> Ahhh....... I see, that's why I always see three comparisons there. The
> first one should help me better when dealing with real simulation case.
>
>>
>>
>>> 2), is it possible to choose a different base solution, for example,
>>> [1000, 1000, 1000, 10, 10, 10, 1.e9, 1.e9, 1.e9] as the base solution
>>> vector when using the '-snes_type test'  option to test my hand-coded
>>> Jacobian.
>>>
>>
>> You can also use -snes_compare_explicit which shows the matrix (only
>> linearized around your actual state) and actually solves the system. There
>> is also -snes_compare_explicit_draw. If you know that you preallocated
>> correctly, -snes_compare_coloring is better. Details here.
>>
>>
>> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESComputeJacobian.html
>>
>
> This is something new to me. I'd take a look at the link. Thanks a lot,
> Jed.
>
> Best,
>
> Ling
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120919/780ee5af/attachment.html>


More information about the petsc-users mailing list