Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable calling of pre-compiled kinetics in CKWYP format #126

Open
tpg2114 opened this issue Dec 31, 2021 · 6 comments
Open

Enable calling of pre-compiled kinetics in CKWYP format #126

tpg2114 opened this issue Dec 31, 2021 · 6 comments
Labels
feature-request New feature request

Comments

@tpg2114
Copy link

tpg2114 commented Dec 31, 2021

Abstract

Reduced kinetics (those composed of non-elementary reactions, quasi-steady-state assumptions, and/or algebraic relationships) are often distributed in a common format originating from Chemkin, the CKWYP format, and are generally in the form of a set of Fortran or C routines. The resulting kinetics are useful in many practical simulations, both standalone and when coupled to a reacting flow code.

Possible Solutions

Back many years ago, our research group added the capability to call reduced kinetics mechanisms to Cantera v1.8. We added a new reaction type that could be specified in the CTI file and that would point Cantera to a function name that was compiled into it, corresponding to the desired reduced kinetics. The required set of changes were not very extensive, once one knew how to do it.

That approach was a bit brittle because all the CKWYP kinetics had to be compiled into Cantera and so it wasn't particularly user-friendly. Since we were often using Cray supercomputers that did not support dynamic linking of shared libraries, it was the only path forward for us at the time. However, this is no longer a constraint and it would be easy enough to add a reaction type that can be specified in the YAML file to point to a shared library to load and a function within it to call, and Cantera can use dlopen and related functions to get the requested routine from the specified library.

Unfortunately, I do not have the bandwidth to port these changes forward from v1.8 to the latest Cantera. However, if somebody who is familiar with the current state of the kinetics classes is willing to work on it, I will share the modified v1.8 source code and can advise on how to use kinetics compiled into a shared library (as I have done this in other codes).

@tpg2114 tpg2114 added the feature-request New feature request label Dec 31, 2021
@ischoegl
Copy link
Member

ischoegl commented Dec 31, 2021

Thank you @tpg2114 for the enhancement request! I believe having the ability to use skeletal mechanisms would be an interesting addition. Some of the recent work on the way Cantera evaluates reaction rates as well as a new methodology to make extensible classes should (hopefully?) simplify these efforts. I am also linking Cantera/cantera#437 here as there have been previous attempts to support QSS natively, which could be further extended.

@speth
Copy link
Member

speth commented Jan 1, 2022

I had been thinking that Boost.DLL would be useful for enabling this in a cross-platform manner, along with some similar capabilities related to #79.

@tpg2114
Copy link
Author

tpg2114 commented Jan 1, 2022

I forget about cross-platform needs sometimes!

Given the extent of other changes, perhaps the implementation from v1.8 won't be as useful a template as it once was. I did port it forward a few years back to v2.1 I think but that got lost somewhere -- it was essentially drop-in at that time, but maybe that isn't the case now.

Anyway -- if somebody is interested in that v1.8 implementation (and it had some other handy things in it like the thickened flame model, support for BFER-style mechanisms, power-law and Sutherland transport model with/without non-unity Lewis numbers), I can put it up on a private repo and give somebody access to it.

@bryanwweber
Copy link
Member

@tpg2114 thanks for the offer to post the code! I wonder if you have to post it in a private repo, what's the license on that code? Would it be compatible with our modified BSD license?

@tpg2114
Copy link
Author

tpg2114 commented Jan 1, 2022

@bryanwweber It is compatible -- I'd prefer to post it privately because if I personally distribute something publicly, it must go through a lengthy review process due to the nature of my employment. If I can control who has access to the original material, then the review process is not needed.

I'd be happy to explain more privately (email, or in person if you happen to be headed to SciTech).

@bryanwweber
Copy link
Member

@bryanwweber It is compatible -- I'd prefer to post it privately because if I personally distribute something publicly, it must go through a lengthy review process due to the nature of my employment. If I can control who has access to the original material, then the review process is not needed.

I'd be happy to explain more privately (email, or if you happen to be headed to SciTech).

Thanks @tpg2114. That's actually exactly my concern - the code needs to be reviewed by lawyers before public distribution, and according to the lawyers, reimplementing the code while looking at it might count as distribution. That happens, for example, with the GPL, where reimplementing code while looking at it is considered a derivative work, so the new code must also have the GPL license if it is distributed publicly (due to conditions in the GPL).

If you have more info to provide but email is better, developers@cantera.org will go to me, @speth, @ischoegl, and @decaluwe.

Thanks 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature request
Projects
None yet
Development

No branches or pull requests

4 participants