compute_gradient yields wrong results for multiple parameters

Bug #1204884 reported by Simon Funke
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dolfin-adjoint
Fix Committed
Undecided
Simon Funke

Bug Description

The helper function compute_gradient returns in some cases None instead of the correct gradient.

This occurs for pScalarParameters which are part of the functional definition only (i.e. do not show up in the forward annotation) and if the gradient of 2 or more parameters is to be computed.

For example:
J = Functional((forward-x)*(forward-x)*dx) # x is a Constant that only shows up the the functional definition

m1 = [ScalarParameter("nu")] # nu is a Constant that show up in the forward model
m2 = [ScalarParameter("x")]

dJdm1 = compute_gradient(J, m1, forget=False) # => Constant(...)
dJdm2 = compute_gradient(J, m2, forget=False) # => Constant(...)
dJdm = compute_gradient(J, m1 + m2, forget=False) # => [Constant(...), None] (!!!!!)

A full code demonstration is attached.

Revision history for this message
Simon Funke (simon-funke) wrote :
Revision history for this message
Simon Funke (simon-funke) wrote :

This is now fixed in commit 784.

Changed in dolfin-adjoint:
status: New → Incomplete
status: Incomplete → Fix Committed
assignee: nobody → Simon Funke (simon-funke)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.