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

Hong Zhang hzhang at mcs.anl.gov
Tue Dec 27 10:16:10 CST 2011


Feng-Chao,
Jtype == 1 is for /* slow finite difference J; */
computes dense Jacobian one column at a time, taking prohibitively
long time for large
matrices. For 101*101 matrix, i.e., it evaluates 1.e+4 columns
(evaluate function 1.e+4 times).
Running it on my Mac, the execution terminates after a hang with error
timestep 0: time 0, solution norm 391.65, max 1, min 0
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR:   !
[0]PETSC ERROR: TSStep has failed due to DIVERGED_NONLINEAR_SOLVE!

With -da_grid_x 51 -da_grid_y 51, it runs, but is extremely slow.

As stated in the petsc manual, SNESDefaultComputeJacobian() is not
recommended for general use in large-scale applications. It only works on
tiny matrices for checking the correctness of a user-provided Jacobian.
For ex15.c, it obviously only works for up to 51x51 grids on the
machine we tested.

Hong


On Tue, Dec 27, 2011 at 12:32 AM, Fatcharm <wolfshow at gmail.com> wrote:
> 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