-
Notifications
You must be signed in to change notification settings - Fork 36
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
Testing CoolProp 6 (6.4.2) #27
Conversation
@dongkeun-oh, thank you very much for your contribution. I'm try to get again up to speed with this project after a long delay, it's a bit hard for me to keep up among multiple tasks, sorry about that. I agreed with @jowr that we should first stabilize version 3.3.0 with CoolProp 5, and possibly release it, then we can move on to CoolProp 6. He already made PR #26 with many improvements, that I am going to test and merge in ASAP. We could then try what you put in this PR. Is that ok for you? Thanks! |
Sure! First of all, would you check 'TestCoolProp' which I attached to my previous message? As I figured out, the CoolProp 5 has the same problems which I listed up in my original comment #24. Thanks a lot, too! |
I tested the CoolProp/CoolProp#2016, but I'm getting some issue:
I'm using Refprop 10. Do you know why this might happen? |
I agree with @casella - there are a lot of good ideas here, but my focus is to release something and then look at updating CoolProp. Also moving to a DLL has been a long term goal, thanks for bringing it up again. |
Hi, friends~~
To test this PR in OpenModelica, please just try
I found MSVC (VS2019) doesn't work yet.. |
Do not keep old junk as comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your updates.
Could you please explain why you create an additional target *_DLL? For me this should be an option - either one wants the shared or the static library, but creating both probably only creates confusion.
I am going to include some of our suggestions in v3.3.0 and then we can focus on OpenModelica and CoolProp v6.4.2 in v3.4.0.
@@ -49,7 +49,11 @@ option(FLUIDPROP "Include the FluidProp library for fluid properties" OFF) | |||
if(COOLPROP) | |||
# Get the CoolProp code | |||
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../externals/CoolProp.git") | |||
file(DOWNLOAD https://sourceforge.net/projects/coolprop/files/CoolProp/5.1.1/source/CoolProp_sources.zip/download "${CMAKE_BINARY_DIR}/coolprop.zip") | |||
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../externals") | |||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../externals") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is redundant, see line 37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
@@ -41,6 +40,7 @@ endif() | |||
|
|||
option(COOLPROP "Include the CoolProp library for fluid properties" ON) | |||
option(FLUIDPROP "Include the FluidProp library for fluid properties" OFF) | |||
option(OPENMODELICA "Add the shared library required by the OpenModelica's NF" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you introduce an extra option? Can't we just use the shared library switch for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the main part of comment below..
@@ -60,26 +64,31 @@ if(COOLPROP) | |||
#file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/coolprop.zip) | |||
#execute_process(COMMAND unzip ${CMAKE_BINARY_DIR}/coolprop.zip -d "${CMAKE_BINARY_DIR}/coolprop-tmp") | |||
#execute_process(COMMAND sed -i '421s;^;\#;' "${CMAKE_BINARY_DIR}/coolprop-tmp/CoolProp.sources/CMakeLists.txt") | |||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../externals") | |||
file(RENAME "${CMAKE_BINARY_DIR}/coolprop-tmp/CoolProp.sources" "${CMAKE_CURRENT_SOURCE_DIR}/../externals/CoolProp.git") | |||
file(RENAME "${CMAKE_BINARY_DIR}/coolprop-tmp/CoolProp.sources" "${CMAKE_CURRENT_SOURCE_DIR}/../externals/CoolProp.git") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful with the indentation 😉 - no change needed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fine!
# Add the CoolProp sources | ||
ADD_SUBDIRECTORY ("${CMAKE_CURRENT_SOURCE_DIR}/../externals/CoolProp.git" "${CMAKE_CURRENT_BINARY_DIR}/CoolProp") | ||
list (APPEND INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../externals/CoolProp.git") | ||
list (APPEND INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../externals/CoolProp.git/include") | ||
list (APPEND INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../externals/CoolProp.git/externals/msgpack-c/include") | ||
list (APPEND INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../externals/CoolProp.git/externals/cppformat") | ||
list (APPEND INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../externals/CoolProp.git/externals/fmtlib") | ||
else() | ||
list(REMOVE_ITEM LIB_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/Sources/coolpropsolver.cpp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be required - please note that C++ macros handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean 90 an 91?
@@ -134,12 +143,12 @@ set_property(TARGET ${LIBRARY_NAME} PROPERTY VERSION ${APP_VERSION}) | |||
target_compile_definitions(${LIBRARY_NAME} PRIVATE EXTERNALMEDIA_FLUIDPROP=$<IF:$<BOOL:${FLUIDPROP}>,1,0>) | |||
target_compile_definitions(${LIBRARY_NAME} PRIVATE EXTERNALMEDIA_COOLPROP=$<IF:$<BOOL:${COOLPROP}>,1,0>) | |||
target_compile_definitions(${LIBRARY_NAME} PRIVATE EXTERNALMEDIA_MODELICA_ERRORS=1) # Use 0 for a shared library and 1 for a static library | |||
#target_compile_definitions(${LIBRARY_NAME} PRIVATE EXTERNALMEDIA_LIBRARY_EXPORTS) # Use this for a shared library | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove this? I think it actually is required for Windows DLLs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your updates.
Could you please explain why you create an additional target *_DLL? For me this should be an option - either one wants the shared or the static library, but creating both probably only creates confusion.
I am going to include some of our suggestions in v3.3.0 and then we can focus on OpenModelica and CoolProp v6.4.2 in v3.4.0.
In the recent update in openmodelica, the new-frontend (NF) just requires such a DLL to initialize any constant by an external function. So, I just took a conservative manner to preserve the original cmake script as much as possible, and to add up the DLL only in case of openmodelica; if you like the DLL for a major option of the build process, we can define such an option to generate the DLL instead of the static library. Do you prefer that manner?
This is super valuable - OpenModelica-support has been a long-term goal. I think we should take it in two steps
What do you think? |
Thank you for the comment!! First for all, I have tested with two different nightly-built (1.18.0~dev) set-ups - one is in Ununtu 18.04 (nightly-built binary package with gcc 7.5), and the other is Windows 10 (source build by clang++ from GitHub with gcc 10.2)
Then, there are issues, potentially, under discussion.
How about you? |
Folks, I'm sorry these months have been terrible for me. I hope I will be able to pick this up from next week |
@dongkeun-oh have there been any updates on this PR in the meantime? are you able to fix the merge conflict that is present in the PR? |
Also, when the conflict is removed and CI compiles artifacts, I can offer to test on Windows 10 with OpenModelica 1.18. if desired. I'm less sure about compiling everything myself. |
I'll be back to this issue in the middle of October or later. |
Hello, I tested both and currently use them e.g. for the calculation of ammonia properties in various circuits on a daily basis. You might try BICUBIC and TTSE interpolation for the calculation of fluid properties. (i found that this might cause some errors using the Coolprop Nightly Version) |
Thank you Michael, much appreciated! Did you have to do any patching/tweaking on ExternalMedia to achieve that? If so, could that be upstreamed here? E.g. creating both static and dynamic libraries in the CI/releases could be useful I reckon. |
@jowr did you close this PR intentionally, or was that a side-effect of deleting the target branch? |
Hi, this is Dong Keun with KFE (Korean Institute of Fusion Energy, former NFRI) in Korea.
It's a pilot to check the interoperability of the newest CoolProp (v 6.4.2).
As I left a comment on the issue #24, there are 3 items to solve with the latest CoolProp.
By means of this test, item 1 and 2 seem to be solved; the most radical attempt in this test is "building DLL (shared object) instead of static library". So, I have to ask you whether it's fine to be accepted; I just checked that the DLL is much faster than the static library in compilation. Moreover, I would recommend not to pull this commit to the master branch, because it's just a test to share my attempt discussing whether this approach is reasonable. Then, your feedback is very appreciated for me to go ahead.
I tested the following model, which doesn't work without my amendment, and it works fine in Windows 10 (64bit MSYS, gcc 10.2.0) as well as in Linux (Ubuntu 18.04, gcc 7.5.0).
Another important thing is the recent CP 6.4.2 gives error configuring the object library; I issued a pull request to Ian, and you can solve immediately by removing the line of target_link_libraries which makes such an error.
Later, I will be pleased to activate a discussion to improve how to handle the cases of "out of range" in the runtime process, and I hope to contribute more to the issue of REFPROP.