[petsc-users] Strange behavior of TS after setting hand-coded Jacobian

仓宇 yhcy1993 at gmail.com
Mon Oct 25 08:53:12 CDT 2021


I'm using TS to solve a set of DAE, which originates from a
one-dimensional problem. The grid points are uniformly distributed.
For simplicity, the DMDA is not employed for discretization.

At first, only the residual function is prescribed through
'TSSetIFunction', and PETSC produces converged results. However, after
providing hand-coded Jacobian through 'TSSetIJacobian', the internal
SNES object fails (residual norm does not change), and TS reports
'DIVERGED_STEP_REJECTED'.

I have tried to add the option '-snes_test_jacobian' to see if the
hand-coded jacobian is somewhere wrong, but it shows '||J -
Jfd||_F/||J||_F = 1.07488e-10, ||J - Jfd||_F = 2.14458e-07',
indicating that the hand-coded jacobian is correct.

Then, I added a monitor for the internal SNES object through
'SNESMonitorSet', in which the solution vector will be displayed at
each iteration. It is interesting to find that, if the jacobian is not
provided, meaning finite-difference is utilized for jacobian
evaluation internally, the solution vector converges to steady
solution and the SNES residual norm is reduced continuously. However,
it turns out that, as long as the jacobian is provided, the solution
vector will NEVER get changed! So the solution procedure stucked!

This is quite strange!  Hope to get some advice.
PETSC version=3.14.6, program run in serial mode.

Regards

Yu Cang


More information about the petsc-users mailing list