CoolProp / IF97

Open-source C++ implementation of the IAPWS-IF97 equations
MIT License
86 stars 32 forks source link

IAPWS water static dielectric constant and Debye Huckel coefficients #33

Closed stuart-nolan closed 3 years ago

stuart-nolan commented 3 years ago

After a quick look through this IF97 repo, I don't see support for calculating these quantities (ref. here). Is this the right place to check or are these values available elsewhere in CoolProp?

ibell commented 3 years ago

You are correct - that quantity is not available anywhere in CoolProp for water. Want to add it to the IF97 repo?

stuart-nolan commented 3 years ago

I can give it a try as I already have it in python code (using CoolProp HEOS for some water thermodynamic properties). May take a bit of time before I submit a PR for you to look at and that might not be what you want. In any event, I want something different than I have now and I won't be bothered if you don't accept it.

ibell commented 3 years ago

Yes, a PR would be great.

stuart-nolan commented 3 years ago

EDIT: "PDF of document" from the link in the first post above indicates that the IAPWS-95 formulation should be used for the water EOS (apparently CoolProps HEOS for water).

IF97 might work for a water EOS but is limited to pressures less than 100 MPa while the referenced model for the dielectric constant and Debye Huckel coefficients is valid up to pressures of 1000 MPa.

As CoolProp's IF97 repo does not seem like the right place to develop this, I'm going to close this and look into alternatives. If I come up with something based on CoolProp, I'll open a new issue to share it.

henningjp commented 3 years ago

I have coded this in C++ and used it with the IF97 water properties functions with errors within the uncertainty in the IAPWS document. However, as you mention, this limits the pressures to 100 MPa.

I think the issue is that the static dielectric constant isn't built into CoolProp for any of the other fluids either, so there is no structure for it in the fluids files and no output string for retrieving that quantity. Otherwise, it would be trivial to add this into the HEOS fluid file for water. I think this would require a larger mod to CoolProp in general.

stuart-nolan commented 3 years ago

@henningjp Out of curiosity, does your implementation calculate the apparent molar compressibility (AK, first partial derivative of the apparent molar volume with respect to pressure at constant temperature) and apparent molar heat capacity (AC, first partial derivative of the apparent molar enthalpy with respect to temperature at constant pressure)?

My python implementation will reproduce the values reported in the Fernandez et. al. paper to its reported significant figures except for these two quantities which are off by one or two (least) sig. figs. (which annoys me and implies I'm doing it wrong).

EDIT: quoting the documentation from LLNL's H2OI95 implementation:

Fernandez et al. (1997) suggest that if higher-order functions such as AK and AC are desired, one might utilize numerical differentiation. They include examples of this approach. Although they do not explicitly say this, their tone seems to suggest that a better model for the dielectric constant might be desirable if one were to seriously address the higher-order parameters.

EDIT: A 5 point central difference formula (what I believe is used in Fernandez et al.) with a delta T of 0.2 K for AC and a delta P of 2.000000001 Pa for AK does reproduce Fernandez et al. AC and AK to their sig. figs for 5 of 7 T, P pairs I check. For the non matching T, P pairs, only two AK's are off by one sig. fig. (e.g. -8.3152e-15 by my calculation compared to -8.3153e-15 at 800 K and 1000 MPa). I guess the AK calculation is just sensitive to the delta P used and round off error.

Thank you and @ibell for responding above.