In case someone else encounters this, handled by adding a dummy term to the form:
# Hack: Add a zero term with a function that references the mesh
R = FunctionSpace(mesh, "Real", 0)
f0 = Function(R, name="dummy_zero_constant")
J += f0**2*ds*dt[START_TIME]
The reason this was necessary is that the previous J only used Constants and so no mesh was available through the form when dolfin-adjoint assembled it.
In case someone else encounters this, handled by adding a dummy term to the form:
# Hack: Add a zero term with a function that references the mesh zero_constant" ) dt[START_ TIME]
R = FunctionSpace(mesh, "Real", 0)
f0 = Function(R, name="dummy_
J += f0**2*ds*
The reason this was necessary is that the previous J only used Constants and so no mesh was available through the form when dolfin-adjoint assembled it.