Import black-box models? #3234
longemen3000
started this conversation in
General
Replies: 1 comment
|
I have recently been thinking very much along these lines. My first thought had been to add more backends to CoolProp, for instance teqp and feos would fit naturally via runtime dynamic linkage. Clapeyon less so because of the Julia basis. If you could develop a MWE, I would be happy to take a look and give my feedback. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Motivation
I see a lot of duplicate effort in reimplementing the same equations of state across different frameworks. While each framework may have advantages in specific functionalities, effort is wasted trying to replicate results. Let’s say, for example, that someone wants to use a specific SAFT-VR-Mie model (with some special modifications) for simulation purposes. CoolProp does have almost all the infrastructure to handle that specific workload except the implementation of that custom SAFT-VR-Mie model.
A reverse example is the design of an ML-powered EoS: someone has a model implementation and now requires a thermodynamic framework to get properties. Most papers just implement a simple saturation pressure solver and a simple volume solver and call it a day, but more complex properties could provide more insight into the EoS behaviour.
In the case of Clapeyron.jl, teqp, or feos, parameter sharing may work for the first case (if we know the modifications of the EoS), but in the second case, a reimplementation of the model is needed. For CoolProp, a reimplementation for each model is necessary.
Proposal
We need a way to share models between different frameworks in binary form. One thermodynamic framework may emit a specific EoS binary file, and another framework could calculate properties based on queries to the functions stored in that file. The model parameters are considered a black box, and one can only query properties in the primal basis (V,T for Helmholtz-based models).
Other properties may be needed; for example, in Clapeyron we use
lb_volume, while teqp usesmax_density. Some EoS may use the old gas constant. The binary must also provide these.There is already a similar standard for sharing simulations: the FMI standard. Its
.fmufiles are just a zip file containing a JSON metadata file and a shared library (.dllon Windows,.soon Linux,.dylibon Apple systems).Now, CoolProp is not a framework particularly suited for developing equations of state, but it really shines at property evaluation and flash calculations; so, while it may not be especially suited for exporting models, it could benefit greatly from importing other models.
I’m writing this mainly to get an opinion on what it would take for a black-box model to work in CoolProp. I know that most models depend on ancillaries (and super-ancillaries) for equilibrium properties, but apart from that, any comments are appreciated.
All reactions