diff --git a/CMakeLists.txt b/CMakeLists.txt index b4b0764c..ede42dc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,10 @@ if (COOLPROP_64BIT_SHARED_LIBRARY_MODULE OR COOLPROP_64BIT_SHARED_LIBRARY) add_dependencies (${app_name} generate_headers) if (MSVC) + + # Force visual studio to statically link the c runtime to avoid dependency on MSVCRXXX.dll + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") # No lib prefix for the shared library set_target_properties(${app_name} PROPERTIES PREFIX "") @@ -243,6 +247,11 @@ if (COOLPROP_32BIT_SHARED_LIBRARY_LINUX_MODULE OR COOLPROP_32BIT_SHARED_LIBRARY_ add_library(${app_name} SHARED ${APP_SOURCES}) set_target_properties (${app_name} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DEXTERNC -DCONVENTION= -m32" LINK_FLAGS "-m32") add_dependencies (${app_name} generate_headers) + if (MSVC) + # Force visual studio to statically link the c runtime to avoid dependency on MSVCRXXX.dll + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + endif() install (TARGETS ${app_name} DESTINATION shared_library/${CMAKE_SYSTEM_NAME}/32bit__cdecl_calling_convention) install (FILES ${CMAKE_SOURCE_DIR}/include/CoolPropLib.h DESTINATION shared_library) endif() @@ -257,6 +266,10 @@ if (COOLPROP_32BIT_CDECL_SHARED_LIBRARY_MODULE OR COOLPROP_32BIT_CDECL_SHARED_LI add_dependencies (${app_name} generate_headers) set_target_properties(${app_name} PROPERTIES PREFIX "") if (MSVC) + # Force visual studio to statically link the c runtime to avoid dependency on MSVCRXXX.dll + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + add_custom_command(TARGET ${app_name} POST_BUILD COMMAND dumpbin /EXPORTS $ > ${CMAKE_CURRENT_BINARY_DIR}/exports.txt) @@ -276,6 +289,9 @@ if (COOLPROP_32BIT_STDCALL_SHARED_LIBRARY_MODULE OR COOLPROP_32BIT_STDCALL_SHARE add_dependencies (${app_name} generate_headers) set_target_properties(${app_name} PROPERTIES PREFIX "") if (MSVC) + # Force visual studio to statically link the c runtime to avoid dependency on MSVCRXXX.dll + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") add_custom_command(TARGET ${app_name} POST_BUILD COMMAND dumpbin /EXPORTS $ > ${CMAKE_CURRENT_BINARY_DIR}/exports.txt) diff --git a/CoolPropBibTeXLibrary.bib b/CoolPropBibTeXLibrary.bib index 5f428726..2b1b9d30 100644 --- a/CoolPropBibTeXLibrary.bib +++ b/CoolPropBibTeXLibrary.bib @@ -1088,6 +1088,20 @@ timestamp = {2013.04.10} } +@ARTICLE{Mylona-JPCRD-2014-xylenes, + author = {S. K. Mylona and K. D. Antoniadis and M. J. Assael and M. L. Huber + and R. A. Perkins}, + title = {{Reference Correlations of the Thermal Conductivity of o-Xylene, + m-Xylene, p-Xylene, and Ethylbenzene from the Triple Point to 700 + K and Moderate Pressures}}, + journal = {J. Phys. Chem. Ref. Data}, + year = {2014}, + volume = {43}, + pages = {043104}, + owner = {Belli}, + timestamp = {2014.12.10} +} + @ARTICLE{Okada-IJT-1999, author = {M. Okada and T. Shibata and Y. Sato and Y. Higashi}, title = {{Surface Tension of HFC Refrigerant Mixtures}}, diff --git a/dev/fluids/EthylBenzene.json b/dev/fluids/EthylBenzene.json index c9357418..c0b1cb5d 100644 --- a/dev/fluids/EthylBenzene.json +++ b/dev/fluids/EthylBenzene.json @@ -463,5 +463,114 @@ "smolar": 130.0635462854396, "smolar_units": "J/mol/K" } + }, + "TRANSPORT": { + "conductivity": { + "BibTeX": "Mylona-JPCRD-2014-xylenes", + "critical": { + "GAMMA": 0.056, + "R0": 1.03, + "gamma": 1.239, + "qD": 1416430594.9008498, + "type": "simplified_Olchowy_Sengers", + "zeta0": 2.35e-10 + }, + "dilute": { + "A": [ + -0.00110708, + 0.0108026, + -0.0289015, + 0.0419227, + 0.0209133, + -0.00401492 + ], + "B": [ + 0.259475, + -0.343879, + 1 + ], + "T_reducing": 617.12, + "T_reducing_units": "K", + "m": [ + 0, + 1, + 2 + ], + "n": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "type": "ratio_of_polynomials" + }, + "residual": { + "B": [ + -0.0497837, + 0.0663073, + 0.106739, + -0.146279, + -0.0685137, + 0.12143899999999999, + 0.0226133, + -0.0462245, + -0.0027945500000000002, + 0.00658554 + ], + "T_reducing": 617.12, + "T_reducing_units": "K", + "d": [ + 1, + 1, + 2, + 2, + 3, + 3, + 4, + 4, + 5, + 5 + ], + "rhomass_reducing": 291.0, + "rhomass_reducing_units": "kg/m^3", + "t": [ + 0, + -1, + 0, + -1, + 0, + -1, + 0, + -1, + 0, + -1 + ], + "type": "polynomial" + } + }, + "viscosity": { + "BibTeX": "Huber-RP912", + "epsilon_over_k": 490.05, + "epsilon_over_k_units": "K", + "psi": { + "a": [ + 0.846125588, + 0.046896067 + ], + "rhomolar_reducing": 2741.016, + "rhomolar_reducing_units": "mol/m^3", + "t": [ + 0, + 1, + 2 + ] + }, + "reference_fluid": "Propane", + "sigma_eta": 5.781e-10, + "sigma_eta_units": "m", + "type": "ECS" + } } } \ No newline at end of file diff --git a/dev/fluids/m-Xylene.json b/dev/fluids/m-Xylene.json index 3968b0b0..5e5671bd 100644 --- a/dev/fluids/m-Xylene.json +++ b/dev/fluids/m-Xylene.json @@ -467,5 +467,117 @@ "smolar": 96.25768607417126, "smolar_units": "J/mol/K" } + }, + "TRANSPORT": { + "conductivity": { + "BibTeX": "Mylona-JPCRD-2014-xylenes", + "critical": { + "GAMMA": 0.057, + "R0": 1.03, + "gamma": 1.239, + "qD": 1402524544.179523, + "type": "simplified_Olchowy_Sengers", + "zeta0": 2.35e-10 + }, + "dilute": { + "A": [ + 0.00024210699999999998, + 0.013522000000000001, + -0.123168, + 0.296882, + -0.107973, + 0.018686, + -0.0012916700000000002 + ], + "B": [ + -0.850118, + 3.11646, + 0.0001 + ], + "T_reducing": 616.89, + "T_reducing_units": "K", + "m": [ + 0, + 1, + 2 + ], + "n": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "type": "ratio_of_polynomials" + }, + "residual": { + "B": [ + -0.0679314, + 0.0592537, + 0.22577799999999998, + -0.162626, + -0.18569300000000002, + 0.133036, + 0.0619006, + -0.044905099999999996, + -0.0071166400000000005, + 0.0056186 + ], + "T_reducing": 616.89, + "T_reducing_units": "K", + "d": [ + 1, + 1, + 2, + 2, + 3, + 3, + 4, + 4, + 5, + 5 + ], + "rhomass_reducing": 282.9297, + "rhomass_reducing_units": "kg/m^3", + "t": [ + 0, + -1, + 0, + -1, + 0, + -1, + 0, + -1, + 0, + -1 + ], + "type": "polynomial" + } + }, + "viscosity": { + "BibTeX": "Huber-RP912", + "epsilon_over_k": 489.87, + "epsilon_over_k_units": "K", + "psi": { + "a": [ + 1.96357, + -0.722142, + 0.130396 + ], + "rhomolar_reducing": 2665, + "rhomolar_reducing_units": "mol/m^3", + "t": [ + 0, + 1, + 2 + ] + }, + "reference_fluid": "Propane", + "sigma_eta": 5.8e-10, + "sigma_eta_units": "m", + "type": "ECS" + } } } \ No newline at end of file diff --git a/dev/fluids/o-Xylene.json b/dev/fluids/o-Xylene.json index 05bd53f7..9df4122e 100644 --- a/dev/fluids/o-Xylene.json +++ b/dev/fluids/o-Xylene.json @@ -446,5 +446,111 @@ "smolar": 84.06314685071537, "smolar_units": "J/mol/K" } + }, + "TRANSPORT": { + "conductivity": { + "BibTeX": "Mylona-JPCRD-2014-xylenes", + "critical": { + "GAMMA": 0.058, + "R0": 1.03, + "gamma": 1.239, + "qD": 1406469760.9001405, + "type": "simplified_Olchowy_Sengers", + "zeta0": 2.36e-10 + }, + "dilute": { + "A": [ + -0.0008374880000000001, + 0.012785600000000001, + -0.0371925, + 0.06395479999999999, + -0.00443443 + ], + "B": [ + 0.262226, + -0.490519, + 1 + ], + "T_reducing": 630.259, + "T_reducing_units": "K", + "m": [ + 0, + 1, + 2 + ], + "n": [ + 0, + 1, + 2, + 3, + 4 + ], + "type": "ratio_of_polynomials" + }, + "residual": { + "B": [ + -0.0346292, + 0.0455879, + 0.0757735, + -0.0594473, + -0.06743779999999999, + 0.0550012, + 0.027695, + -0.0255522, + -0.00374238, + 0.00418805 + ], + "T_reducing": 630.259, + "T_reducing_units": "K", + "d": [ + 1, + 1, + 2, + 2, + 3, + 3, + 4, + 4, + 5, + 5 + ], + "rhomass_reducing": 285.0, + "rhomass_reducing_units": "kg/m^3", + "t": [ + 0, + -1, + 0, + -1, + 0, + -1, + 0, + -1, + 0, + -1 + ], + "type": "polynomial" + } + }, + "viscosity": { + "BibTeX": "Huber-RP912", + "epsilon_over_k": 500.48, + "epsilon_over_k_units": "K", + "psi": { + "a": [ + 0.814805, + 0.0589219 + ], + "rhomolar_reducing": 2684.5, + "rhomolar_reducing_units": "mol/m^3", + "t": [ + 0, + 1 + ] + }, + "reference_fluid": "Propane", + "sigma_eta": 5.8e-10, + "sigma_eta_units": "m", + "type": "ECS" + } } } \ No newline at end of file diff --git a/dev/fluids/p-Xylene.json b/dev/fluids/p-Xylene.json index 52b999df..6b1e0930 100644 --- a/dev/fluids/p-Xylene.json +++ b/dev/fluids/p-Xylene.json @@ -465,5 +465,117 @@ "smolar": 78.13377271225741, "smolar_units": "J/mol/K" } + }, + "TRANSPORT": { + "conductivity": { + "BibTeX": "Mylona-JPCRD-2014-xylenes", + "critical": { + "GAMMA": 0.056, + "R0": 1.03, + "gamma": 1.239, + "qD": 1408450704.225352, + "type": "simplified_Olchowy_Sengers", + "zeta0": 2.35e-10 + }, + "dilute": { + "A": [ + -0.00388568, + 0.0294648, + -0.0815299, + 0.07715340000000001, + 0.00755487, + -0.0038897, + 0.00040689199999999995 + ], + "B": [ + 0.00404188, + -0.424893, + 1 + ], + "T_reducing": 616.168, + "T_reducing_units": "K", + "m": [ + 0, + 1, + 2 + ], + "n": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "type": "ratio_of_polynomials" + }, + "residual": { + "B": [ + -0.101022, + 0.107531, + 0.224828, + -0.205499, + -0.1591, + 0.150348, + 0.049949, + -0.0502584, + -0.00562422, + 0.00644051 + ], + "T_reducing": 616.168, + "T_reducing_units": "K", + "d": [ + 1, + 1, + 2, + 2, + 3, + 3, + 4, + 4, + 5, + 5 + ], + "rhomass_reducing": 286.0, + "rhomass_reducing_units": "kg/m^3", + "t": [ + 0, + -1, + 0, + -1, + 0, + -1, + 0, + -1, + 0, + -1 + ], + "type": "polynomial" + } + }, + "viscosity": { + "BibTeX": "Huber-RP912", + "epsilon_over_k": 500.48, + "epsilon_over_k_units": "K", + "psi": { + "a": [ + 0.312445906, + 0.403396269, + -0.0603026419 + ], + "rhomolar_reducing": 2693.92, + "rhomolar_reducing_units": "mol/m^3", + "t": [ + 0, + 1, + 2 + ] + }, + "reference_fluid": "Propane", + "sigma_eta": 5.813e-10, + "sigma_eta_units": "m", + "type": "ECS" + } } } \ No newline at end of file diff --git a/src/Backends/Helmholtz/TransportRoutines.cpp b/src/Backends/Helmholtz/TransportRoutines.cpp index 7f2d0992..f4853977 100644 --- a/src/Backends/Helmholtz/TransportRoutines.cpp +++ b/src/Backends/Helmholtz/TransportRoutines.cpp @@ -942,7 +942,7 @@ void TransportRoutines::conformal_state_solver(HelmholtzEOSMixtureBackend &HEOS, Eigen::Vector2d r; Eigen::Matrix2d J; // Update the reference fluid with the conformal state - HEOS_Reference.update(DmolarT_INPUTS, rhomolar0, T0); + HEOS_Reference.update_DmolarT_direct(rhomolar0, T0); do{ long double dtau_dT = -HEOS_Reference.T_critical()/(T0*T0); long double ddelta_drho = 1/HEOS_Reference.rhomolar_critical(); @@ -969,7 +969,7 @@ void TransportRoutines::conformal_state_solver(HelmholtzEOSMixtureBackend &HEOS, double T_new = T0_init + frac*v(0); double rhomolar_new = rhomolar0_init + frac*v(1); // Update state with step - HEOS_Reference.update(DmolarT_INPUTS, rhomolar_new, T_new); + HEOS_Reference.update_DmolarT_direct(rhomolar_new, T_new); resid = sqrt(POW2(HEOS_Reference.alphar() - alphar) + POW2(HEOS_Reference.keyed_output(iZ) - Z)); if (resid > resid_old){ continue; @@ -1033,10 +1033,13 @@ long double TransportRoutines::viscosity_ECS(HelmholtzEOSMixtureBackend &HEOS, H // Solver for conformal state // ************************** + // + HEOS_Reference.specify_phase(iphase_gas); // something homogeneous + conformal_state_solver(HEOS, HEOS_Reference, T0, rhomolar0); - + // Update the reference fluid with the updated conformal state - HEOS_Reference.update(DmolarT_INPUTS, rhomolar0*psi, T0); + HEOS_Reference.update_DmolarT_direct(rhomolar0*psi, T0); // Recalculate ESRR f = HEOS.T()/T0; diff --git a/src/Tests/CoolProp-Tests.cpp b/src/Tests/CoolProp-Tests.cpp index 0e3fd346..db6cb598 100644 --- a/src/Tests/CoolProp-Tests.cpp +++ b/src/Tests/CoolProp-Tests.cpp @@ -240,6 +240,12 @@ vel("Benzene", "T", 300, "Dmass", 875, "V", 608.52e-6, 1e-4), vel("Benzene", "T", 400, "Dmass", 760, "V", 211.74e-6, 1e-4), vel("Benzene", "T", 550, "Dmass", 500, "V", 60.511e-6, 1e-4), +// From Mylona, JPCRD, 2014 +vel("o-Xylene", "T", 635, "Dmass", 270, "V", 28.59e-6, 1e-2), +vel("m-Xylene", "T", 616, "Dmass", 220, "V", 41.6424e-6, 1e-2), // CoolProp is correct, paper is incorrect (it seems) +vel("p-Xylene", "T", 620, "Dmass", 287, "V", 23.98e-6, 1e-2), +vel("EthylBenzene", "T", 617, "Dmass", 316, "V", 33.22e-6, 1e-2), + }; class TransportValidationFixture @@ -485,6 +491,21 @@ vel("R134a", "T", 330, "D", 1e-10, "L", 0.015907606 , 1e-4), vel("R134a", "T", 330, "Q", 0, "L", 0.06746432253 , 1e-4), vel("R134a", "T", 240, "Q", 1, "L", 0.00873242359, 1e-4), +// Mylona, JPCRD, 2014 +vel("o-Xylene", "T", 635, "D", 270, "L", 96.4e-3 , 1e-2), +vel("m-Xylene", "T", 616, "D", 220, "L", 79.5232e-3 , 1e-2), // CoolProp is correct, paper is incorrect (it seems) +vel("p-Xylene", "T", 620, "D", 287, "L", 107.7e-3 , 1e-2), +vel("EthylBenzene", "T", 617, "D", 316, "L", 140.2e-3, 1e-2), +// dilute values +vel("o-Xylene", "T", 300, "D", 1e-12, "L", 13.68e-3 , 1e-3), +vel("o-Xylene", "T", 600, "D", 1e-12, "L", 41.6e-3 , 1e-3), +vel("m-Xylene", "T", 300, "D", 1e-12, "L", 9.45e-3 , 1e-3), +vel("m-Xylene", "T", 600, "D", 1e-12, "L", 40.6e-3 , 1e-3), +vel("p-Xylene", "T", 300, "D", 1e-12, "L", 10.57e-3 , 1e-3), +vel("p-Xylene", "T", 600, "D", 1e-12, "L", 41.73e-3 , 1e-3), +vel("EthylBenzene", "T", 300, "D", 1e-12, "L", 9.71e-3, 1e-3), +vel("EthylBenzene", "T", 600, "D", 1e-12, "L", 41.14e-3, 1e-3), + }; TEST_CASE_METHOD(TransportValidationFixture, "Compare thermal conductivities against published data", "[conductivity],[transport]") diff --git a/src/main.cxx b/src/main.cxx index 80a3fd75..b32deee6 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -447,8 +447,9 @@ int main() #endif #if 1 shared_ptr CP(CoolProp::AbstractState::factory("HEOS", "Water")); - shared_ptr RP(CoolProp::AbstractState::factory("REFPROP", "Water&Ethanol")); + shared_ptr RP(CoolProp::AbstractState::factory("REFPROP", "Water")); std::vector fluids = RP->fluid_names(); + double tt = RP->rhomolar_critical(); int rr = 3l; #endif #if 0 diff --git a/wrappers/Excel/CoolProp.xlam b/wrappers/Excel/CoolProp.xlam index 9d7e75d7..075249c6 100644 Binary files a/wrappers/Excel/CoolProp.xlam and b/wrappers/Excel/CoolProp.xlam differ