[petsc-users] Question about petsc-3.2-p5/src/ts/examples/tutorials/ex15.c

Fatcharm wolfshow at gmail.com
Tue Dec 27 00:32:02 CST 2011


Dear all,

I am working with an example of "petsc-3.2-p5/src/ts/examples/tutorials/ex15.c"

I noticed that in ex15.c,

Jtype == 0 means  that /* use user provided Jacobian evaluation routine */
Jtype == 1 is for /* slow finite difference J; */
and Jtype == 2 is /* Use coloring to compute  finite difference J efficiently */

I found a problem, when I run ex15 with

mpiexec -n 8 ./ex15 -da_grid_x 101 -da_grid_y 101 -Jtype 0 -drawcontours

or

mpiexec -n 8 ./ex15 -da_grid_x 101 -da_grid_y 101 -Jtype 2 -drawcontours

, it works well.

However, when I run ex15 with

mpiexec -n 8 ./ex15 -da_grid_x 101 -da_grid_y 101 -Jtype 1 -drawcontours

the solution remains the same as the initial condition.

If I reduced the da_grid_x and da_grid_y, the command

mpiexec -n 8 ./ex15 -da_grid_x 51 -da_grid_y 51 -Jtype 1 -drawcontours

works well.

The manual tells me that "Although SNESDefaultComputeJacobian() is not
recommended for general use in large-scale applications, It can be
useful in checking the correctness of a user-provided Jacobian."

I am confused that if SNESDefaultComputeJacobian() can not give the
correct Jacobian when using "mpiexec -n 8 ./ex15 -da_grid_x 101
-da_grid_y 101 -Jtype 1 -drawcontours", then how can it be used to
check the user-provided Jacobian?

Is there somebody encountering the same problem or give me some advice?

Thank you very much!

Feng-Chao Wang


More information about the petsc-users mailing list