Finite difference Jacobian?
Is there a way to check Jacobians for a nonlinear problem with a finite difference Jacobian?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Paul Constantine
- Solved:
- 2013-02-05
- Last query:
- 2013-02-05
- Last reply:
I did it this way, given a rank one form F.
# finite difference interlude
eps = 1e-6
w0 = Function(V)
F0 = action(F,w0)
w1 = Function(V)
w1.vector()[:] = eps*np.
F1 = action(F,w1)
fdJac = (1/e)*(assemble(F1) - assemble(F0))
F = action(F,w_)
dF = derivative(F,w_,w)
adJac = assemble(
print norm( fdJac - adJac )
The PETScSNESSolver has a method called "test" that would do this, but it doesn't look like the DOLFIN interface is set up for it. That would be pretty nice. Where could I suggest this?
Martin Sandve Alnæs (martinal) said : | #3 |
Go to
https:/
and "Register a new blueprint", in the upper right corner.
When you're done, click "Subscribe someone else" on the right, and add "dolfin-core".
Patrick Farrell (pefarrell) said : | #4 |
Pass "method": "test" in the snes_solver options to solve.