[petsc-users] using '-snes_type test' to test my coded Jacobian
Jed Brown
jedbrown at mcs.anl.gov
Wed Sep 19 14:03:10 CDT 2012
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.
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120919/f835eb5c/attachment.html>
More information about the petsc-users
mailing list