# AD-Compatible Fluid Property Backend for Heat Pump Simulations

**URL:** https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658
**Category:** New to Julia
**Created:** [November 4, 2025, 4:48pm UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658 "2025-11-04T16:48:36Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![junsin0106](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junsin0106/32/218493_2.png) [@junsin0106](https://discourse.julialang.org/u/junsin0106)
#### Post date: [November 4, 2025, 4:48pm UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/1 "2025-11-04T16:48:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![langestefan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/langestefan/32/207923_2.png) [@langestefan](https://discourse.julialang.org/u/langestefan)
#### Post date: [November 4, 2025, 6:15pm UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/2 "2025-11-04T18:15:55Z")

</div>

maybe CarnotCycles.jl works for your usecase?

---

<div class="post-metadata">

### Author: ![Sebastian\_Schmitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sebastian_schmitt/32/210190_2.png) [@Sebastian\_Schmitt](https://discourse.julialang.org/u/Sebastian_Schmitt)
#### Post date: [November 4, 2025, 7:41pm UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/3 "2025-11-04T19:41:19Z")

</div>

You should try out Clapeyron.jl (the CoolProp fluids are also available there, but as pure Julia implementation)

---

<div class="post-metadata">

### Author: ![junsin0106](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junsin0106/32/218493_2.png) [@junsin0106](https://discourse.julialang.org/u/junsin0106)
#### Post date: [November 5, 2025, 2:42am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/4 "2025-11-05T02:42:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![junsin0106](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junsin0106/32/218493_2.png) [@junsin0106](https://discourse.julialang.org/u/junsin0106)
#### Post date: [November 5, 2025, 2:46am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/5 "2025-11-05T02:46:24Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![karei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karei/32/214809_2.png) [@karei](https://discourse.julialang.org/u/karei)
#### Post date: [November 5, 2025, 3:35am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/6 "2025-11-05T03:35:11Z")

</div>

REFPROP is a closed-source commercial software. You have to pay for it, which is the biggest difference between it and the other two

---

<div class="post-metadata">

### Author: ![Sebastian\_Schmitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sebastian_schmitt/32/210190_2.png) [@Sebastian\_Schmitt](https://discourse.julialang.org/u/Sebastian_Schmitt)
#### Post date: [November 5, 2025, 3:38am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/7 "2025-11-05T03:38:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [November 5, 2025, 5:34am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/8 "2025-11-05T05:34:09Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![junsin0106](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junsin0106/32/218493_2.png) [@junsin0106](https://discourse.julialang.org/u/junsin0106)
#### Post date: [November 5, 2025, 6:01am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/9 "2025-11-05T06:01:50Z")

</div>

Oh, I see. Maybe I just need to learn more about how automatic differentiation is implemented in Clapeyron.

---

<div class="post-metadata">

### Author: ![junsin0106](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junsin0106/32/218493_2.png) [@junsin0106](https://discourse.julialang.org/u/junsin0106)
#### Post date: [November 5, 2025, 6:32am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/10 "2025-11-05T06:32:34Z")

</div>

Thanks for your reply 🙂

If I had to write the rules myself, I’d probably refer to articles like this one:  
[Partial derivatives of thermodynamic state properties for dynamic simulation (M Thorade et al., 2013)](https://10.1007/s12665-013-2394-z)

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?

---

<div class="post-metadata">

### Author: ![Sebastian\_Schmitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sebastian_schmitt/32/210190_2.png) [@Sebastian\_Schmitt](https://discourse.julialang.org/u/Sebastian_Schmitt)
#### Post date: [November 5, 2025, 3:25pm UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/11 "2025-11-05T15:25:28Z")

</div>

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](https://clapeyronthermo.github.io/Clapeyron.jl/v0.6/properties/bulk/#Clapeyron.isothermal_compressibility) etc. Not sure if this is possible in your case.

---

<div class="post-metadata">

### Author: ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)
#### Post date: [November 6, 2025, 8:38pm UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/12 "2025-11-06T20:38:22Z")

</div>

if you need any Clapeyron.jl help, happy to answer any questions, here or in the github repository

---

<div class="post-metadata">

### Author: ![junsin0106](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junsin0106/32/218493_2.png) [@junsin0106](https://discourse.julialang.org/u/junsin0106)
#### Post date: [November 7, 2025, 8:46am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/13 "2025-11-07T08:46:49Z")

</div>

Hello. I have a question about loading CoolProp data in Clapeyron.

According to the documentation below:

> **[Extensions – CoolProp · Clapeyron.jl](https://clapeyronthermo.github.io/Clapeyron.jl/stable/tutorials/extensions_coolprop/)**
>
> Documentation for Clapeyron.jl.

If I run:

```julia-auto
using CoolProp
using Clapeyron

model = SingleFluid("r134a")

```

This successfully loads the EOS data for R134a from the CoolProp JSON file.  
However, when I try:

```julia-auto
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`?

---

<div class="post-metadata">

### Author: ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)
#### Post date: [November 7, 2025, 7:34pm UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/14 "2025-11-07T19:34:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![junsin0106](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junsin0106/32/218493_2.png) [@junsin0106](https://discourse.julialang.org/u/junsin0106)
#### Post date: [November 8, 2025, 6:42am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/15 "2025-11-08T06:42:55Z")

</div>

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.

Thank you again for all the work on Clapeyron.

---

<div class="post-metadata">

### Author: ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)
#### Post date: [November 11, 2025, 5:32am UTC](https://discourse.julialang.org/t/ad-compatible-fluid-property-backend-for-heat-pump-simulations/133658/16 "2025-11-11T05:32:52Z")

</div>

got pseudo-pures working in the latest master:

```julia
julia> model = EmpiricPseudoPure("R410A")
MultiParameter Pseudo-Pure Equation of state for R410A:
 Polynomial power terms: 5
 Exponential terms: 16

julia> dew_temperature(model,1e5,[1.0])
(221.52761616090058, 5.376121328091072e-5, 0.017602536047533646, [1.0])

julia> bubble_temperature(model,1e5,[1.0])
(221.44972990854794, 5.3751419376901554e-5, 0.01759490410595897, [1.0])

```

On NIST REFPROP, probably porting the python version from [REFPROP-wrappers/wrappers/python/ctypes/ctREFPROP/ctREFPROP.py at master · usnistgov/REFPROP-wrappers · GitHub](https://github.com/usnistgov/REFPROP-wrappers/blob/master/wrappers/python/ctypes/ctREFPROP/ctREFPROP.py) could be a start, probably an LLM could do it
