How can I wrap a media package that isn’t compatible with automatic differentiation?
I need the Jacobians of density and temperature with respect to enthalpy and pressure for developing a transient heat pump simulation. Since CoolProp doesn’t accept Dual numbers, automatic differentiation can’t be used during the DE.jl solve process, and the simulation runs much slower than expected.
What’s the simplest way to handle this problem? I need easy access to R410a and humid air properties, like in CoolProp.
Thank you for sharing helpful examples. It seems that CarnotCycles.jl mainly focuses on design optimization and steady-state analysis, so it might not be ideal for cases that require frequent DE solve, Jacobian evaluations, or property calculations. I’ll take a closer look at how Clapeyron.jl serves as a replacement for CoolProp.
I’ve been very interested in Clapeyron.jl, but I haven’t been using it because I didn’t fully understand how it differs from REFPROP and CoolProp. Would it be fair to say that the relationship between CoolProp and Clapeyron.jl is similar to that between REFPROP and teqp developed by NIST?
No, there is no such relationship. Clapeyron.jl is an independent package for thermodynamic models. Amongst these models are the multiparameter EoS models from CoolProp. Clapeyron.jl is a pure Julia implementation, whereas CoolProp.jl is a wrapper to the C++ (?) CoolProp API. That is why you cannot differentiate through the CoolProp.jl models, but through the Clapeyron.jl models.
Even if you cannot AD through the library, you can define AD rules if you know how to calculate the derivative so that AD works on the library. This of course can take a good chunk of work, and for two-phase flows you have to be very careful in order to get numerical stability.
For these models, you may want to look at HVAC.jl? @avinash1 builds these kinds of models and can give more info.
It seems I should follow the derivative-writing rules for Symbolics.jl, which would involve checking the phase of the substance through conditional branching, then writing the derivatives for each phase. If you have any relevant examples or links, that would be really helpful.
If Clapeyron.jl already includes this kind of functionality and supports AD-compatible property calculations, and if CoolProp has enough EOS data for refrigerants like R410a, I could compute the derivatives for density and other properties without much effort.
Regarding HVAC.jl, I understand that it has developed an independent package tailored for Dyad, separate from Clapeyron.jl and CoolProp.jl. Is it available for academic use, and how can I access it?
Btw, you should first try to rewrite your derivatives consistently and take into account which thermodynamic variables are held constant (isothermal, isentropic, etc.). E.g. drho/dp might directly be related to the isothermal compressibility etc. Not sure if this is possible in your case.
Hello. I have a question about loading CoolProp data in Clapeyron.
According to the documentation below:
If I run:
using CoolProp
using Clapeyron
model = SingleFluid("r134a")
This successfully loads the EOS data for R134a from the CoolProp JSON file.
However, when I try:
using CoolProp
using Clapeyron
model2 = SingleFluid("r410a")
From what I understand, Clapeyron’s cas function works for fluids that appear in database/properties/identifiers.csv. So even though CoolProp provides JSON for R410A, Clapeyron doesn’t automatically recognize it because it is not listed in the identifiers file.
Is there a simple way to load a CoolProp fluid (e.g., R410A) whose JSON exists in CoolProp, but is not listed in Clapeyron’s identifiers.csv?
R410A is a really particular case. it is a multicomponent equation of state, but with fixed composition. (known as the pseudo-pure approach). i didn’t add support for those at first, but i suppose it is not too hard to activate that support now, give a couple of days to give you a working example.
Thank you. Since R410A is one of the most widely used refrigerants in vapor compression systems, it would be great if Clapeyron could support it as well.
Additionally, if Clapeyron could interface with NIST REFPROP data in a similar way to CoolProp, it would likely be very appealing to researchers who want to use REFPROP directly from Julia. CoolProp, for example, provides a wrapper to access REFPROP data when REFPROP is already installed on the system.