diff --git a/Web/coolprop/LowLevelAPI.rst b/Web/coolprop/LowLevelAPI.rst index e33acddb..27ebe6c7 100644 --- a/Web/coolprop/LowLevelAPI.rst +++ b/Web/coolprop/LowLevelAPI.rst @@ -1,3 +1,5 @@ +.. _low_level_api: + ******************* Low Level Interface ******************* diff --git a/Web/coolprop/Tabular.rst b/Web/coolprop/Tabular.rst index 77580fd2..34ab1314 100644 --- a/Web/coolprop/Tabular.rst +++ b/Web/coolprop/Tabular.rst @@ -1,4 +1,4 @@ -.. _low_level_api: +.. _tabular_interpolation: ********************** Tabular Interpolation @@ -8,7 +8,7 @@ Especially when evaluating inputs as a function of pressure and enthalpy (common As of version 5.1 of CoolProp, the tabular interpolation methods of CoolProp v4 have been brought back from the dead, and significantly improved. They are approximately 4 times faster than the equivalent methods in v4 of CoolProp due to a more optimized structure. In order to make the most effective use of the tabular interpolation methods, you must be using the :ref:`low-level interface `, otherwise significant overhead and slowdown will be experienced. Thus, this method is best suited to C++, python, and the SWIG wrappers. -There are two backends implemented for tabular interpolation, ``BICUBIC`` and ``TTSE``. Both consume the same gridded tabular data that is stored to your user home directory in the folder ``HOME/.CoolProp/Tables``. If you want to find the directory that CoolProp is using as your home directory, you can do something like +There are two backends implemented for tabular interpolation, ``BICUBIC`` and ``TTSE``. Both consume the same gridded tabular data that is stored to your user home directory in the folder ``HOME/.CoolProp/Tables``. If you want to find the directory that CoolProp is using as your home directory (``HOME``), you can do something like .. ipython:: @@ -42,19 +42,17 @@ It is critical that you try to only initialize one AbstractState instance and th TTSE Interpolation ------------------ +The basic concept behind Tabular Taylor Series Extrapolation (TTSE) extrapolation is that you cache the value and its derivatives with respect to a set of two variables over a regularly (linearly or logarithmically) spaced grid. It is therefore easy to look up the index of the independent variables ``x`` and ``y`` by interval bisection. Once the coordinates of the given grid point :math:`i,j` are known, you can used the cached derivatives of the desired variable :math:`z` to obtain it in terms of the given independent variables :math:`x` and :math:`y`: + .. math:: - T = T_{i,j}+\Delta h\left(\frac{\partial T}{\partial h}\right)_{p}+\Delta p\left(\frac{\partial T}{\partial p}\right)_{h}+\frac{1}{2}\Delta h^2\left(\frac{\partial^2 T}{\partial h^2}\right)_{p}+\frac{1}{2}\Delta p^2\left(\frac{\partial^2T}{\partial p^2}\right)_{h}+\Delta h\Delta p\left(\frac{\partial^2T}{\partial p\partial h}\right) - - s = s_{i,j}+\Delta h\left(\frac{\partial s}{\partial h}\right)_{p}+\Delta p\left(\frac{\partial s}{\partial p}\right)_{h}+\frac{1}{2}\Delta h^2\left(\frac{\partial^2 s}{\partial h^2}\right)_{p}+\frac{1}{2}\Delta p^2\left(\frac{\partial^2s}{\partial p^2}\right)_{h}+\Delta h\Delta p\left(\frac{\partial^2s}{\partial p\partial h}\right) - - \rho = s_{i,j}+\Delta h\left(\frac{\partial \rho}{\partial h}\right)_{p}+\Delta p\left(\frac{\partial \rho}{\partial p}\right)_{h}+\frac{1}{2}\Delta h^2\left(\frac{\partial^2 \rho}{\partial h^2}\right)_{p}+\frac{1}{2}\Delta p^2\left(\frac{\partial^2\rho}{\partial p^2}\right)_{h}+\Delta h\Delta p\left(\frac{\partial^2\rho}{\partial p\partial h}\right) + z = z_{i,j}+\Delta x\left(\frac{\partial z}{\partial x}\right)_{y}+\Delta y\left(\frac{\partial z}{\partial y}\right)_{x}+\frac{1}{2}\Delta x^2\left(\frac{\partial^2 z}{\partial x^2}\right)_{y}+\frac{1}{2}\Delta y^2\left(\frac{\partial^2z}{\partial y^2}\right)_{y}+\Delta x\Delta y\left(\frac{\partial^2z}{\partial y\partial x}\right) .. math:: - \Delta h = h-h_i + \Delta x = x-x_i - \Delta p = p-p_i + \Delta x = y-y_j See the `IAPWS TTSE report `_ for a description of the method. Analytic derivatives are used to build the tables @@ -106,8 +104,8 @@ A more complete comparison of the accuracy of these methods can be obtained by s T = np.linspace(CP.PropsSI(Ref,'Tmin')+0.1, CP.PropsSI(Ref,'Tcrit')-0.01, 300) pV = CP.PropsSI('P','T',T,'Q',1,Ref) - hL = CP.PropsSI('Hmolar','T',T,'Q',0,Ref) - hV = CP.PropsSI('Hmolar','T',T,'Q',1,Ref) + hL = CP.PropsSI('Hmass','T',T,'Q',0,Ref) + hV = CP.PropsSI('Hmass','T',T,'Q',1,Ref) HHH1, PPP1, EEE1 = [], [], [] HHH2, PPP2, EEE2 = [], [], [] @@ -156,7 +154,7 @@ A more complete comparison of the accuracy of these methods can be obtained by s for ax in [ax1, ax2]: - ax.set_xlim(250000*MM, 550000*MM) + ax.set_xlim(250000, 550000) ax.set_ylim(100000, 7000000) ax.set_yscale('log') @@ -167,14 +165,14 @@ A more complete comparison of the accuracy of these methods can be obtained by s ax.set_yticklabels(labels) ax.get_yaxis().set_major_formatter(matplotlib.ticker.ScalarFormatter()) - ticks = [150000*MM, 250000*MM,350000*MM,450000*MM,550000*MM] + ticks = [150000, 250000,350000,450000,550000] labels = [str(tick) for tick in ticks] ax.set_xticks(ticks) ax.set_xticklabels(labels) ax.tick_params(axis='y',which='minor', left='off') - ax.set_xticklabels(ax.get_xticks()/MM/1e3) + ax.set_xticklabels(ax.get_xticks()/1e3) ax.set_xlabel('Enthalpy [kJ/kg]') ax.set_yticklabels(ax.get_yticks()/10**3) ax.set_ylabel('Pressure [kPa]') @@ -189,19 +187,14 @@ A more complete comparison of the accuracy of these methods can be obtained by s Speed comparison ---------------- -The primary motivation for the use of tabular interpolation is the improvement in computational speed. Thus a small summary could be useful. This tabular data was obtained by the python script :download:` (link to script) `. +The primary motivation for the use of tabular interpolation is the improvement in computational speed. Thus a small summary could be useful. This tabular data was obtained by the python script :download:` (link to script) `. + +.. include :: tabular_data.rst.in More Information ---------------- -The tables are stored in a zipped format using the msgpack package and zlib. They can be read back into python (or other high-level languages) using something roughly like:: - - with open(r'/path/to/home/.CoolProp/Tables/HelmholtzEOSBackend(R245fa)/single_phase_logph.bin','rb') as fp: - values = msgpack.load(fp) - revision, matrices = values[0:2] - T,h,p,rho = np.array(matrices['T']), np.array(matrices['hmolar']), np.array(matrices['p']), np.array(matrices['rhomolar']) - -To save space, the uncompressed binary tables are not stored, but if you want them to be stored as well as the compressed tables, you can do something like: +The tables are stored in a zipped format using the msgpack package and zlib. To save space, the uncompressed binary tables are not stored, but if you want them to be stored as well as the compressed tables, you can do something like: .. ipython:: @@ -217,4 +210,14 @@ before you run your code to debug the tables. This can be useful for debugging .. warning:: - Make sure you delete the tables that are already there, otherwise it will entirely just load the zipped tables \ No newline at end of file + Make sure you delete the tables that are already there, otherwise it will entirely just load the zipped tables + +The uncompressed tabled can be read back into python (or other high-level languages) using something roughly like:: + + with open(r'/path/to/home/.CoolProp/Tables/HelmholtzEOSBackend(R245fa)/single_phase_logph.bin','rb') as fp: + values = msgpack.load(fp) + revision, matrices = values[0:2] + T,h,p,rho = np.array(matrices['T']), np.array(matrices['hmolar']), np.array(matrices['p']), np.array(matrices['rhomolar']) + +You'll need msgpack wrapper for your target language. + diff --git a/dev/TTSE/AbstractStateTTSE.py b/dev/TTSE/AbstractStateTTSE.py index 55cc2b6f..7ae63e53 100644 --- a/dev/TTSE/AbstractStateTTSE.py +++ b/dev/TTSE/AbstractStateTTSE.py @@ -6,97 +6,103 @@ import CoolProp import timeit - -H_TP = 350e3 -P_TP = 400e3 - -H_SP = 250e3 -P_SP = 1000e3 - -P_PT = 101325 -T_PT = 300 - -fluid = 'R245fa' -number = 10000 -repeat = 3 - -if int(CoolProp.__version__[0])>4: - loaded = 5 - print("Loaded CoolProp version 5") - from CoolProp.CoolProp import generate_update_pair,get_parameter_index,set_debug_level - TTSE = CoolProp.AbstractState('TTSE&HEOS',fluid) - BICUBIC = CoolProp.AbstractState('BICUBIC&HEOS',fluid) - HEOS = CoolProp.AbstractState('HEOS',fluid) - def two_phase_TTSE(): - TTSE.update(CoolProp.HmassP_INPUTS, H_TP, P_TP) - TTSE.rhomolar() - def single_phase_TTSE(): - TTSE.update(CoolProp.HmassP_INPUTS, H_SP, P_SP) - TTSE.rhomolar() - def single_phase_pT_TTSE(): - TTSE.update(CoolProp.PT_INPUTS, P_PT, T_PT) - TTSE.rhomolar() - - def two_phase_BICUBIC(): - BICUBIC.update(CoolProp.HmassP_INPUTS, H_TP, P_TP) - BICUBIC.rhomolar() - def single_phase_BICUBIC(): - BICUBIC.update(CoolProp.HmassP_INPUTS, H_SP, P_SP) - BICUBIC.rhomolar() - def single_phase_pT_BICUBIC(): - BICUBIC.update(CoolProp.PT_INPUTS, P_PT, T_PT) - BICUBIC.rhomolar() - - def two_phase_HEOS(): - HEOS.update(CoolProp.HmassP_INPUTS, H_TP, P_TP) - HEOS.rhomolar() - def single_phase_HEOS(): - HEOS.update(CoolProp.HmassP_INPUTS, H_SP, P_SP) - HEOS.rhomolar() - def single_phase_pT_HEOS(): - HEOS.update(CoolProp.PT_INPUTS, P_PT, T_PT) - HEOS.rhomolar() +def get_speed_data(): -else: - loaded = 4 - print("Loaded CoolProp version 4") - #from CoolProp.CoolProp import set_debug_level,set_standard_unit_system,enable_TTSE_LUT,disable_TTSE_LUT - CoolProp.CoolProp.set_standard_unit_system(CoolProp.UNIT_SYSTEM_SI) - state = CoolProp.State.State(fluid,{"H":H_TP*2,"P":P_TP}) - def two_phase_HP(): - state.update({"H":H_TP,"P":P_TP}) - state.get_rho() - def single_phase_HP(): - state.update({"H":H_SP,"P":P_SP}) - state.get_rho() - def single_phase_PT(): - state.update({"P":P_PT,"T":T_PT}) - state.get_rho() + H_TP = 350e3 + P_TP = 400e3 -if loaded==4: - CoolProp.CoolProp.disable_TTSE_LUT(fluid) - two_phase_hp_heos = min(timeit.Timer(two_phase_HP).repeat(repeat=repeat, number=number))/number - single_phase_hp_heos = min(timeit.Timer(single_phase_HP).repeat(repeat=repeat, number=number))/number - single_phase_pt_heos = min(timeit.Timer(single_phase_PT).repeat(repeat=repeat, number=number))/number - CoolProp.CoolProp.enable_TTSE_LUT(fluid) - two_phase_hp_ttse = min(timeit.Timer(two_phase_HP).repeat(repeat=repeat, number=number))/number - single_phase_hp_ttse = min(timeit.Timer(single_phase_HP).repeat(repeat=repeat, number=number))/number - single_phase_pt_ttse = min(timeit.Timer(single_phase_PT).repeat(repeat=repeat, number=number))/number - CoolProp.CoolProp.disable_TTSE_LUT(fluid) -elif loaded==5: - two_phase_hp_heos = min(timeit.Timer(two_phase_HEOS).repeat(repeat=repeat, number=number))/number - single_phase_hp_heos = min(timeit.Timer(single_phase_HEOS).repeat(repeat=repeat, number=number))/number - single_phase_pt_heos = min(timeit.Timer(single_phase_pT_HEOS).repeat(repeat=repeat, number=number))/number - two_phase_hp_ttse = min(timeit.Timer(two_phase_TTSE).repeat(repeat=repeat, number=number))/number - single_phase_hp_ttse = min(timeit.Timer(single_phase_TTSE).repeat(repeat=repeat, number=number))/number - single_phase_pt_ttse = min(timeit.Timer(single_phase_pT_TTSE).repeat(repeat=repeat, number=number))/number - two_phase_hp_bicubic = min(timeit.Timer(two_phase_BICUBIC).repeat(repeat=repeat, number=number))/number - single_phase_hp_bicubic = min(timeit.Timer(single_phase_BICUBIC).repeat(repeat=repeat, number=number))/number - single_phase_pt_bicubic = min(timeit.Timer(single_phase_pT_BICUBIC).repeat(repeat=repeat, number=number))/number -else: - raise ValueError("Unknown CoolProp version.") + H_SP = 250e3 + P_SP = 1000e3 -print("{0:15s}: {1:6d} calls, {2:2d} repetitions, CoolProp version {3:1d}".format(fluid,number,repeat,loaded)) -print("{0:15s}: 2P HEOS: {1:6.2f} us, 1P HEOS: {2:6.2f} us, PT HEOS: {3:6.2f} us".format(fluid,two_phase_hp_heos*1e6,single_phase_hp_heos*1e6,single_phase_pt_heos*1e6)) -print("{0:15s}: 2P TTSE: {1:6.2f} us, 1P TTSE: {2:6.2f} us, PT TTSE: {3:6.2f} us".format(fluid,two_phase_hp_ttse*1e6,single_phase_hp_ttse*1e6,single_phase_pt_ttse*1e6)) -print("{0:15s}: 2P BICU: {1:6.2f} us, 1P BICU: {2:6.2f} us, PT BICU: {3:6.2f} us".format(fluid,two_phase_hp_bicubic*1e6,single_phase_hp_bicubic*1e6,single_phase_pt_bicubic*1e6)) + P_PT = 101325 + T_PT = 300 + + fluid = 'R245fa' + number = 10000 + repeat = 3 + version = CoolProp.__version__ + + if int(CoolProp.__version__[0])>4: + loaded = 5 + print("Loaded CoolProp version 5") + from CoolProp.CoolProp import generate_update_pair,get_parameter_index,set_debug_level + TTSE = CoolProp.AbstractState('TTSE&HEOS',fluid) + BICUBIC = CoolProp.AbstractState('BICUBIC&HEOS',fluid) + HEOS = CoolProp.AbstractState('HEOS',fluid) + def two_phase_TTSE(): + TTSE.update(CoolProp.HmassP_INPUTS, H_TP, P_TP) + TTSE.rhomolar() + def single_phase_TTSE(): + TTSE.update(CoolProp.HmassP_INPUTS, H_SP, P_SP) + TTSE.rhomolar() + def single_phase_pT_TTSE(): + TTSE.update(CoolProp.PT_INPUTS, P_PT, T_PT) + TTSE.rhomolar() + + def two_phase_BICUBIC(): + BICUBIC.update(CoolProp.HmassP_INPUTS, H_TP, P_TP) + BICUBIC.rhomolar() + def single_phase_BICUBIC(): + BICUBIC.update(CoolProp.HmassP_INPUTS, H_SP, P_SP) + BICUBIC.rhomolar() + def single_phase_pT_BICUBIC(): + BICUBIC.update(CoolProp.PT_INPUTS, P_PT, T_PT) + BICUBIC.rhomolar() + + def two_phase_HEOS(): + HEOS.update(CoolProp.HmassP_INPUTS, H_TP, P_TP) + HEOS.rhomolar() + def single_phase_HEOS(): + HEOS.update(CoolProp.HmassP_INPUTS, H_SP, P_SP) + HEOS.rhomolar() + def single_phase_pT_HEOS(): + HEOS.update(CoolProp.PT_INPUTS, P_PT, T_PT) + HEOS.rhomolar() + + else: + loaded = 4 + print("Loaded CoolProp version 4") + #from CoolProp.CoolProp import set_debug_level,set_standard_unit_system,enable_TTSE_LUT,disable_TTSE_LUT + CoolProp.CoolProp.set_standard_unit_system(CoolProp.UNIT_SYSTEM_SI) + state = CoolProp.State.State(fluid,{"H":H_TP*2,"P":P_TP}) + def two_phase_HP(): + state.update({"H":H_TP,"P":P_TP}) + state.get_rho() + def single_phase_HP(): + state.update({"H":H_SP,"P":P_SP}) + state.get_rho() + def single_phase_PT(): + state.update({"P":P_PT,"T":T_PT}) + state.get_rho() + + if loaded==4: + CoolProp.CoolProp.disable_TTSE_LUT(fluid) + two_phase_hp_heos = min(timeit.Timer(two_phase_HP).repeat(repeat=repeat, number=number))/number + single_phase_hp_heos = min(timeit.Timer(single_phase_HP).repeat(repeat=repeat, number=number))/number + single_phase_pt_heos = min(timeit.Timer(single_phase_PT).repeat(repeat=repeat, number=number))/number + CoolProp.CoolProp.enable_TTSE_LUT(fluid) + two_phase_hp_ttse = min(timeit.Timer(two_phase_HP).repeat(repeat=repeat, number=number))/number + single_phase_hp_ttse = min(timeit.Timer(single_phase_HP).repeat(repeat=repeat, number=number))/number + single_phase_pt_ttse = min(timeit.Timer(single_phase_PT).repeat(repeat=repeat, number=number))/number + CoolProp.CoolProp.disable_TTSE_LUT(fluid) + elif loaded==5: + two_phase_hp_heos = min(timeit.Timer(two_phase_HEOS).repeat(repeat=repeat, number=number))/number + single_phase_hp_heos = min(timeit.Timer(single_phase_HEOS).repeat(repeat=repeat, number=number))/number + single_phase_pt_heos = min(timeit.Timer(single_phase_pT_HEOS).repeat(repeat=repeat, number=number))/number + two_phase_hp_ttse = min(timeit.Timer(two_phase_TTSE).repeat(repeat=repeat, number=number))/number + single_phase_hp_ttse = min(timeit.Timer(single_phase_TTSE).repeat(repeat=repeat, number=number))/number + single_phase_pt_ttse = min(timeit.Timer(single_phase_pT_TTSE).repeat(repeat=repeat, number=number))/number + two_phase_hp_bicubic = min(timeit.Timer(two_phase_BICUBIC).repeat(repeat=repeat, number=number))/number + single_phase_hp_bicubic = min(timeit.Timer(single_phase_BICUBIC).repeat(repeat=repeat, number=number))/number + single_phase_pt_bicubic = min(timeit.Timer(single_phase_pT_BICUBIC).repeat(repeat=repeat, number=number))/number + else: + raise ValueError("Unknown CoolProp version.") + + return locals() + +if __name__ == '__main__': + + print("{0:15s}: {1:6d} calls, {2:2d} repetitions, CoolProp version {3:1d}".format(fluid,number,repeat,loaded)) + print("{0:15s}: 2P HEOS: {1:6.2f} us, 1P HEOS: {2:6.2f} us, PT HEOS: {3:6.2f} us".format(fluid,two_phase_hp_heos*1e6,single_phase_hp_heos*1e6,single_phase_pt_heos*1e6)) + print("{0:15s}: 2P TTSE: {1:6.2f} us, 1P TTSE: {2:6.2f} us, PT TTSE: {3:6.2f} us".format(fluid,two_phase_hp_ttse*1e6,single_phase_hp_ttse*1e6,single_phase_pt_ttse*1e6)) + print("{0:15s}: 2P BICU: {1:6.2f} us, 1P BICU: {2:6.2f} us, PT BICU: {3:6.2f} us".format(fluid,two_phase_hp_bicubic*1e6,single_phase_hp_bicubic*1e6,single_phase_pt_bicubic*1e6)) diff --git a/include/Configuration.h b/include/Configuration.h index 9f4b7676..35d01609 100644 --- a/include/Configuration.h +++ b/include/Configuration.h @@ -117,7 +117,7 @@ class ConfigurationItem } case CONFIGURATION_DOUBLE_TYPE: { - rapidjson::Value v(v_double); + rapidjson::Value v(v_double); // Try to upcast val.AddMember(name, v, d.GetAllocator()); break; } case CONFIGURATION_STRING_TYPE: @@ -134,7 +134,12 @@ class ConfigurationItem switch (type){ case CONFIGURATION_BOOL_TYPE: if (!val.IsBool()){throw ValueError(format("Input is not boolean"));}; v_bool = val.GetBool(); break; case CONFIGURATION_INTEGER_TYPE: if (!val.IsInt()){throw ValueError(format("Input is not integer"));}; v_integer = val.GetInt(); break; - case CONFIGURATION_DOUBLE_TYPE: if (!val.IsDouble()){throw ValueError(format("Input is not double"));}; v_double = val.GetDouble(); break; + case CONFIGURATION_DOUBLE_TYPE: { + if (!val.IsDouble() && !val.IsInt()){throw ValueError(format("Input [%s] is not double (or something that can be cast to double)",cpjson::to_string(val).c_str()));}; + if (val.IsDouble()){ v_double = val.GetDouble(); } + else{ v_double = static_cast(val.GetInt()); } + break; + } case CONFIGURATION_STRING_TYPE: if (!val.IsString()){throw ValueError(format("Input is not string"));}; v_string = val.GetString(); break; case CONFIGURATION_ENDOFLIST_TYPE: case CONFIGURATION_NOT_DEFINED_TYPE: diff --git a/src/Backends/Tabular/TTSEBackend.cpp b/src/Backends/Tabular/TTSEBackend.cpp index d864967b..38a32337 100644 --- a/src/Backends/Tabular/TTSEBackend.cpp +++ b/src/Backends/Tabular/TTSEBackend.cpp @@ -81,7 +81,7 @@ void CoolProp::TTSEBackend::update(CoolProp::input_pairs input_pair, double val1 } /// Use the single-phase table to evaluate an output -double CoolProp::TTSEBackend::evaluate_single_phase(SinglePhaseGriddedTableData &table, parameters output, std::size_t i, std::size_t j) +double CoolProp::TTSEBackend::evaluate_single_phase(SinglePhaseGriddedTableData &table, parameters output, double x, double y, std::size_t i, std::size_t j) { // Define pointers for the matrices to be used; std::vector > *z, *dzdx, *dzdy, *d2zdxdy, *d2zdy2, *d2zdx2; @@ -122,7 +122,7 @@ double CoolProp::TTSEBackend::evaluate_single_phase(SinglePhaseGriddedTableData } // Calculate the output value desired - double val = (*z)[i][j]+deltax*(*dzdx)[i][j]+deltay*(*dzdy)[i][j]+0.5*deltax*deltax*(*d2ydx2)[i][j]+0.5*deltay*deltay*(*d2zdy2)[i][j]+deltay*deltax*(*d2zdxdy)[i][j]; + double val = (*z)[i][j]+deltax*(*dzdx)[i][j]+deltay*(*dzdy)[i][j]+0.5*deltax*deltax*(*d2zdx2)[i][j]+0.5*deltay*deltay*(*d2zdy2)[i][j]+deltay*deltax*(*d2zdxdy)[i][j]; // Cache the output value calculated switch(output){ diff --git a/src/Backends/Tabular/TTSEBackend.h b/src/Backends/Tabular/TTSEBackend.h index fc4983e6..ba642894 100644 --- a/src/Backends/Tabular/TTSEBackend.h +++ b/src/Backends/Tabular/TTSEBackend.h @@ -13,12 +13,12 @@ class TTSEBackend : public TabularBackend /// Instantiator; base class loads or makes tables TTSEBackend(shared_ptr AS) : TabularBackend (AS) {} void update(CoolProp::input_pairs input_pair, double val1, double val2); - double evaluate_single_phase(SinglePhaseGriddedTableData &table, parameters output, std::size_t i, std::size_t j); + double evaluate_single_phase(SinglePhaseGriddedTableData &table, parameters output, double x, double y, std::size_t i, std::size_t j); double evaluate_single_phase_phmolar(parameters output, std::size_t i, std::size_t j){ - return evaluate_single_phase(single_phase_logph, output, i, j); + return evaluate_single_phase(single_phase_logph, output, _hmolar, _p, i, j); } double evaluate_single_phase_pT(parameters output, std::size_t i, std::size_t j){ - return evaluate_single_phase(single_phase_logpT, output, i, j); + return evaluate_single_phase(single_phase_logpT, output, _T, _p, i, j); } }; diff --git a/src/Backends/Tabular/TabularBackends.cpp b/src/Backends/Tabular/TabularBackends.cpp index f35c1e7b..f8dffc1c 100644 --- a/src/Backends/Tabular/TabularBackends.cpp +++ b/src/Backends/Tabular/TabularBackends.cpp @@ -134,8 +134,11 @@ void CoolProp::SinglePhaseGriddedTableData::build(shared_ptrviscosity(); - cond[i][j] = AS->conductivity(); + try{ + visc[i][j] = AS->viscosity(); + cond[i][j] = AS->conductivity(); + } + catch(std::exception &){} // ---------------------------------------- // First derivatives of state variables