FinalFunctional isn't defined

Bug #1027046 reported by emmanuel.malherbe
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dolfin-adjoint
Fix Committed
Undecided
Unassigned

Bug Description

I'm facing a problem while installing adjoint. It seems that your class "FinalFunctional" in all the tutorials and examples is called "Functional" in the installed python files (in functional.py)
And when I change (in the tutorial) the FinalFunctional into Functional, I get an error:

AttributeError: 'Form' object has no attribute 'terms'

that still occurs in the functional.py file.

I tried to re install it, it doesn't change. Sorry to bother you, but can you tell me if I'm wrong somewhere and what could I do?

Many thanks.

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

Dear Emmanuel,

Apologies for the confusion: we updated the API, but haven't changed the documentation or made a release to reflect this. I am travelling for a conference now, but I will fix that as soon as I can.

The short answer to your question: If you had

FinalFunctional(whatever)

change it to

Functional(whatever*dt[FINISH_TIME])

where dt comes pre-defined in dolfin_adjoint. If you've redefined dt (to use it as a timestep length, say), create another time measure and use it like

dtm = TimeMeasure()
Functional(whatever*dtm[FINISH_TIME])

Long answer: The syntax works as follows:
  - *dt means "integrate over all time" (analogous to *dx)
 - * dt[0.5] means "evaluate at time=0.5"
 - * dt[FINISH_TIME] means "evaluate at the final time"
 - * dt[a:b] means "integrate over the time interval a to b

The time integration is currently only working for linear in time, but that will be fixed soon. The evaluation at the end of time works fine.

Hope this helps,

Patrick

Changed in dolfin-adjoint:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

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