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
R1233zd does not work in the saturation region close to the bubble point #2142
Comments
If it could be of any help, the same issue occurs when using CoolProp through ExternalMedia,
It fails with the following error that we believe is the same underlying issue that causes inf to be printed when calling CoolProp directly:
and this error is cused by an exception being thrown from |
Hi,
any updates on this issue? |
@msaitta-mpr do you think you could dig into this a little bit? |
Thanks for looking into this! |
Looks another issue of the ancillary solver giving a bad limit when near the bubble point. I will need to spend some time to look into it further, but a few ideas off the top of my head:
|
I looked into this a little bit more and there seem to be two issues at play:
With regards to item 2, I am unsure what the provenance of the ancillary equation is here. @ibell do you know? I do not have access to the cited EOS paper: https://link.springer.com/article/10.1007/s10765-016-2040-6. |
See the following image to illustrate the issue with the current ancillary curve. The blue line indicates where the current ancillary function estimates the saturation line, and the orange line indicates where a TQ update indicates the saturation curve to be. The green curve illustrates the ancillary curve less the provided error limit. Any point that falls into the space between the curves will erroneously use the subcooled liquid solver, whereas it should use the two-phase solver. |
Is this behaviour specific of the R1233zd refrigerant, or is it a commonplace problem? |
Does that mean that the ancillary curve coefficients are not that good and should be improved? |
You might want to just replace the ancillaries with the ones that are in
the published EOS: https://aip.scitation.org/doi/suppl/10.1063/5.0083026 .
That would be at least a worthwhile test.
|
It looks like the linked ancillaries do not contain the function of interest. The function of current interest is the molar enthalpy of a saturated liquid as a function of temperature (hL). Do you know how these curves were originally generated? If not, I will go ahead and regress a polynomial of my own to see how well it performs and if it solves this issue. |
First try deleting the ancillary for enthalpy. Then we can talk about
refitting.
|
Deleting the enthalpy ancillary fixes the issue and the expected values are returned. |
@ibell how can we get this improvement into ExternalMedia, eventually? |
@msaitta-mpr knows how to make a pull request (PR) with the change, I will accept it, and then you can build ExternalMedia with the new CoolProp code |
Do I need some special git commands to pull the updates to CoolProp into ExternalMedia? Sorry for the dumb question 😅 |
Once the PR is merged into master, you should be able to run the following commands to update your copy of the repository.
The above assumes that you have set the main copy of the repository as your default and you are not working off of a fork. Once you have pulled the changes, you should be able to build the library. See CoolProp's fantastic documentation on how to build. The library can then be compiled into your program. I am not familiar with ExternalMedia, so I am not sure if you have a more robust build system that will automatically update and build CoolProp. If so, you should use the appropriate tools that are available. |
Thanks a lot for the fix, very much appreciated! We'll follow up on ExternalMedia ASAP. |
Thanks! I think that for ExtenalMedia to import the change first a new CoolProp release will have to be made through SourceForge, and then this line needs updating: |
I'm not an expert in CMAKE, but it's not clear to me from https://github.com/modelica-3rdparty/ExternalMedia/blob/master/Projects/CMakeLists.txt if the idea was to use the sources from zipped released versions of CoolProp, downloaded from sourceforge (line #53), or rather to use git external to get the source code from git (line #52). And, in that case, which version of the GIT repository is used. I think this is decided in some other script of the GitHub CI, but I'm only guessing, I'm not familiar with that either. @jowr you originally wrote the CMAKE script, could you please comment on that? How would you recommend to proceed? Should we stick to released versions of CoolProp, or can we dare using development versions? |
I did not write the CMake script, I only reverse engineered it as much as I needed to get a working build locally. However, the CoolProp.git at line 52 seems to have nothing to do with downloading it from git. It's just the name of the zipped directory downloaded from sourceforge once extracted and renamed, see line 64 of the same file. Also note that I tried replacing the sourceforge download path with the github path, as also github has the feature to download zip files, but it cannot work as:
The zip downloaded through sourceforge also does not have a .git directory, but at least it contains the submodules, I have no idea what magic happens in sourceforge. |
Try the following minimal working example
On my machine ti produces the following results
The expected behavior is to see 299.609875 in place of inf
@jowr could you please have a look, I'm keeping @casella and @albertoleva in the loop.
The text was updated successfully, but these errors were encountered: