libantioch / antioch

C++ Chemical Kinetics, Thermodynaimics, and Transport Library
https://libantioch.github.io/
Other
23 stars 17 forks source link

Form Sensitivity Adjoints #21

Open nicholasmalaya opened 11 years ago

nicholasmalaya commented 11 years ago

We need to get gradient information out of Antioch. This will involve essentially take the form, d(outputs)/d(parameters), e.g. derivative of the species concentration with respect to a diffusion coefficient, for instance.

However, I need some help to proceed with this. In particular, I'm curious we are already forming a Jacobian elsewhere in Antioch, as well as knowing how much of Roy's AD infrastructure has already been incorporated into the codebase. Any help getting me on the appropriate track would be appreciated.

roystgnr commented 11 years ago

On Tue, 17 Sep 2013, Nicholas Malaya wrote:

We need to get gradient information out of Antioch. This will involve essentially take the form, d(outputs)/d(parameters),

This is currently doable. See tests/arrhenius_rate_deriv.C for our first example.

The Antioch APIs ought to be slightly tweaked to make the interface less ugly. (See where we have to construct that temperature input into a DualNumber manually? That was supposed to happen automatically.) However, the existing APIs should be completely functional now with that workaround, and the tweak I have in mind would be completely backwards compatible.

e.g. derivative of the species concentration with respect to a diffusion coefficient, for instance.

However, I need some help to proceed with this.

Gladly. In fact, I was about to try and figure out what derivatives to take for additional tests/ coverage; if you want to give me a prioritized list I'll start by cooking up some examples of the ones you need.

In particular, I'm curious we are already forming a Jacobian elsewhere in Antioch,

We've got some hand coded derivatives in there too; temperature derivative of reaction source terms, at least.

as well as knowing how much of Roy's AD infrastructure has already been incorporated into the codebase.

None, which is actually a good thing. Antioch is supposed to be 100% interoperable with MetaPhysicL (or any other source of operator-overloaded AD) while being 0% dependent on it.

So the only place we actually use that stuff is in optional unit tests; other users will do the combinations in their own apps. I think this probably will be even easier on users in the long run than adding a bunch more "_derivative" methods to Antioch's own APIs - you see a derivative() method and you learn how to take that derivative; you see an AD-based unit test and you learn how to take any derivative.

Any help getting me on the appropriate track would be appreciated.

Happily.

Roy

SylvainPlessis commented 11 years ago

The kinetics parameters are already differentiated with temperature and densities, thermodynamics derivatives with respect to reaction extents will also be included (soon, I promise) and thermodynamics are derived with respect to temperature. Those are the derivatives are aware of, just ask for any question, I'll be glad to help.