Comment 1 for bug 1186262

Revision history for this message
Patrick Farrell (pefarrell) wrote :

Hi Gabriel,

Yep. The fix is simple.

The clue is the Taylor remainders. Even the first-order ones aren't first order:
Convergence orders for Taylor remainder without gradient information (should all be 1): [0.5612058296487964, 0.4863431171924579, 0.4194999069935161, 0.4390197925250572]

This always means that your seed value for the Taylor test is too large. Those numbers have nothing to do with dolfin-adjoint, and should always be 1 (even if your model isn't differentiable, say). As discussed on http://dolfin-adjoint.org/documentation/verification.html, the fix is to pass a smaller seed value. Passing seed=1.0e-5 to taylor_test yields:
Convergence orders for Taylor remainder with gradient information (should all be 2): [1.9882784834167722, 1.9941105578851968, 1.9970480600786011, 1.9985222301337167]

This makes sense because the seed value depends on the scaling of the parameter. If the parameter is a ScalarParameter, taylor_test scales the seed from that one number. But when the parameter is a field, it can't (it doesn't know your field happens to be spatially constant). That's why changing ScalarParameter -> TimeConstantParameter made the difference.

Hope this helps!

Patrick