lp:~pefarrell/dolfin-adjoint/alnaes-replay-cb
- Get this branch:
- bzr branch lp:~pefarrell/dolfin-adjoint/alnaes-replay-cb
Branch merges
Branch information
Recent revisions
- 641. By Patrick Farrell
-
Implement a replay_cb in the ReducedFunctional to let users look at convergence of the state.
- 640. By Patrick Farrell
-
Handle Constant.assign.
There are two options how to handle this. (Well, three, really).
The first option is to just consider Constants like Functions in
FunctionSpace(mesh, "R", 0), and then all the machinery just works: they are
annotated as initial conditions, their updates get assignment equations, etc.
The disadvantage of that is the unacceptable performance penalty: most likely
Constants will be used in many equations, and so their adjoint equation will
have lots and lots of entries, and be a nightmare to assemble (c.f. Marie's
experiences of the integral-constraint Lagrange multiplier in the cardiac
example). It isn't necessary at all to compute it, but it would be computed if
they were treated like Functions.The second option (adopted) is to consider the value of Constants as a mutable
part of the state to be bundled with the context of the callbacks registered
with libadjoint, just as the values of parameters to Expressions are. This
slightly increases the memory required, but hopefully people aren't declaring
millions of Constants. It has a nasty side-effect which I'll discuss below.The third option (preferred) is to not assign to Constants. They're either
Constant or they're NotConstant! A Constant that changes value is a
contradiction in my book, but anyway. I don't get to define dolfin semantics.The nasty side effect: so, when a callback is called, it re-sets the values of
all Constants to the values they had when it was registered -- as described
above, the values of Constants are now part of the state to be re-set. Except
when they're not! And when are they not? When you're perturbing the value of
the damn Constant (such as for a Taylor test, or an optimisation). Then you
don't want to re-set the Constant value! Agh! You only want to re-set the values
of the "other" constants. Hideous, no? Anyway, the best solution I could come up
with was to say that "Constants that are part of a ScalarParameter aren't to be
re-set", which fixes the Taylor test/optimisation problem at the cost of a
nauseating hack. An alternative would be to introduce a NotConstant class, which
behaves like a Constant except it can be assigned to, but I doubt that would
fly. - 638. By Patrick Farrell
-
Expose some utility functions useful for annotating nonlinear problems with Picard: annotate, and record.
Branch metadata
- Branch format:
- Branch format 7
- Repository format:
- Bazaar repository format 2a (needs bzr 1.16 or later)
- Stacked on:
- lp:dolfin-adjoint