diff --git a/wrappers/Python/CoolProp/CoolProp.pyx b/wrappers/Python/CoolProp/CoolProp.pyx index 129294155d..cef74783f3 100644 --- a/wrappers/Python/CoolProp/CoolProp.pyx +++ b/wrappers/Python/CoolProp/CoolProp.pyx @@ -27,7 +27,7 @@ cimport constants_header cdef bint iterable(object a): """ - If numpy is supported, this function retuns true if the argument is a + If numpy is supported, this function retuns true if the argument is a numpy array or another iterable, otherwise just checks if list or tuple """ if _numpy_supported: @@ -37,77 +37,77 @@ cdef bint iterable(object a): cdef ndarray_or_iterable(object input): if _numpy_supported: - return np.array(input) + return np.squeeze(np.array(input)) else: return input include "HumidAirProp.pyx" include "AbstractState.pyx" - + def set_reference_state(string FluidName, *args): """ Accepts one of two signatures: - + Type #1 (A Python wrapper of :cpapi:`CoolProp::set_reference_stateS`): - - set_reference_state(FluidName,reference_state) - + + set_reference_state(FluidName,reference_state) + FluidName The name of the fluid - param reference_state The reference state to use, one of - + param reference_state The reference state to use, one of + ========== =========================================== ``IIR`` (h=200 kJ/kg, s=1 kJ/kg/K at 0C sat. liq.) ``ASHRAE`` (h=0,s=0 @ -40C sat liq) ``NBP`` (h=0,s=0 @ 1.0 bar sat liq.) ========== =========================================== - + Type #2 (A Python wrapper of :cpapi:`CoolProp::set_reference_stateD`): - + set_reference_state(FluidName,T0,rho0,h0,s0) - + ``FluidName`` The name of the fluid - + ``T0`` The temperature at the reference point [K] - + ``rho0`` The density at the reference point [kg/m^3] - + ``h0`` The enthalpy at the reference point [J/kg] - + ``s0`` The entropy at the reference point [J/kg] """ - + cdef bytes _param cdef int retval - + if len(args) == 1: _set_reference_stateS(FluidName, args[0]) elif len(args) == 4: _set_reference_stateD(FluidName, args[0], args[1], args[2], args[3]) else: raise ValueError('Invalid number of inputs') - + # cpdef long get_Fluid_index(string_like Fluid): # """ # Gets the integer index of the given CoolProp fluid (primarily for use in ``IProps`` function) # """ # return _get_Fluid_index(Fluid) -# +# # cpdef double IProps(long iOutput, long iInput1, double Input1, long iInput2, double Input2, long iFluid) except *: # """ # This is a more computationally efficient version of the Props() function as it uses integer keys for the input and output codes as well as the fluid index for the fluid. It can only be used with CoolProp fluids. An example of how it should be used:: -# +# # # These should be run once in the header of your file # from CoolProp.CoolProp import IProps, get_Fluid_index # from CoolProp import param_constants # iPropane = get_Fluid_index('Propane') -# +# # # This should be run using the cached values - much faster ! # IProps(param_constants.iP,param_constants.iT,0.8*Tc,param_constants.iQ,1,iPropane) -# +# # The reason that this function is significantly faster than Props is that it skips all the string comparisons which slows down the Props function quite a lot. At the C++ level, IProps doesn't use any strings and operates on integers and floating point values # """ # cdef double val = _IProps(iOutput, iInput1, Input1, iInput2, Input2, iFluid) -# +# # if math.isinf(val) or math.isnan(val): # err_string = _get_global_param_string('errstring') # if not len(err_string) == 0: @@ -129,7 +129,7 @@ cpdef tuple generate_update_pair(constants_header.parameters key1, double value1 cpdef string get_config_as_json_string(): """ Obtain a json formulation of the internal configuration in CoolProp - + Values can be set by passing a modified json library (converted to string) to set_config_as_json_string """ return _get_config_as_json_string() @@ -137,36 +137,36 @@ cpdef string get_config_as_json_string(): cpdef set_config_as_json_string(string s): """ Set the internal configuration in CoolProp from a json data string - + Current state can be obtained by calling get_config_as_json_string """ _set_config_as_json_string(s) - + cpdef int get_parameter_index(string key): return _get_parameter_index(key) - + cpdef int get_phase_index(string key): return _get_phase_index(key) cpdef string get_parameter_information(int key, string info): return _get_parameter_information(key, info) - + cpdef string get_mixture_binary_pair_data(CAS1, CAS2, key) except *: return _get_mixture_binary_pair_data(CAS1, CAS2, key) cpdef get_global_param_string(string param): return _get_global_param_string(param) - + cpdef get_fluid_param_string(string fluid, string param): return _get_fluid_param_string(fluid, param) - + cpdef __Props_err1(fcn, in1,in2): errstr = _get_global_param_string('errstring') if not len(errstr) == 0: raise ValueError("{err:s} :: inputs were :\"{in1:s}\",\"{in2:s}\"".format(err= errstr,in1=in1,in2=in2)) else: raise ValueError("{fcn:s} failed ungracefully with inputs:\"{in1:s}\",\"{in2:s}\"; please file a ticket at https://github.com/CoolProp/CoolProp/issues".format(fcn=fcn, in1=in1,in2=in2)) - + cpdef __Props_err2(fcn, in1, in2, in3, in4, in5, in6): errstr = _get_global_param_string('errstring') if not len(errstr) == 0: @@ -177,13 +177,13 @@ cpdef __Props_err2(fcn, in1, in2, in3, in4, in5, in6): cpdef Props(in1, in2, in3 = None, in4 = None, in5 = None, in6 = None): """ A Python wrapper of :cpapi:`CoolProp::Props`. This function is deprecated, use PropsSI instead - """ + """ import warnings dep_warning = "Props() function is deprecated; Use the PropsSI() function" warnings.warn_explicit(dep_warning, category=UserWarning, filename='CoolProp.pyx', lineno = -1) - if len(in2) != 1: + if len(in2) != 1: raise ValueError('Length of input name #1 must be 1 character') - if len(in4) != 1: + if len(in4) != 1: raise ValueError('Length of input name #2 must be 1 character') cdef char* c1 = (in2) cdef char* c2 = (in4) @@ -196,7 +196,7 @@ cpdef Props(in1, in2, in3 = None, in4 = None, in5 = None, in6 = None): cpdef PhaseSI(in1, in2, in3, in4, in5): """ A Python wrapper of C++ function :cpapi:`CoolProp::PhaseSI` - + Does not support vectorization of the inputs like PropsSI """ return _PhaseSI(in1, in2, in3, in4, in5) @@ -204,13 +204,13 @@ cpdef PhaseSI(in1, in2, in3, in4, in5): cpdef PropsSI(in1, in2, in3 = None, in4 = None, in5 = None, in6 = None, in7 = None): """ A Python wrapper of C++ function :cpapi:`CoolProp::PropsSI` . - """ + """ cdef vector[string] vin1 cdef vector[double] fractions, vval1, vval2 cdef double val cdef string backend, fluid, delimitedfluids cdef bool is_iterable1, is_iterable3, is_iterable5 - + # Two parameter inputs if in3 is None and in4 is None and in5 is None and in6 is None and in7 is None: val = _Props1SI(in1, in2) @@ -252,24 +252,24 @@ cpdef PropsSI(in1, in2, in3 = None, in4 = None, in5 = None, in6 = None, in7 = No vval1[0] = in3 vval1.resize(1) vval2[0] = in5 - + # Extract the backend and the fluid from the input string _extract_backend(in6, backend, fluid) - + # Extract the fractions fractions.push_back(1.0) delimitedfluids = _extract_fractions(fluid, fractions) - + # Extract the fluids fluids = delimitedfluids.split('&') # Call the function - this version takes iterables outmat = _PropsSImulti(vin1, in2, vval1, in4, vval2, backend, fluids, fractions) - + # Check that we got some output if outmat.empty(): raise ValueError(_get_global_param_string('errstring')) - + return ndarray_or_iterable(outmat) else: # This version takes doubles @@ -282,22 +282,22 @@ cpdef PropsSI(in1, in2, in3 = None, in4 = None, in5 = None, in6 = None, in7 = No cpdef list FluidsList(): """ Return a list of strings of all fluid names - + Returns ------- FluidsList : list of strings of fluid names All the fluids that are included in CoolProp - + Notes ----- - + Here is an example:: - + In [0]: from CoolProp.CoolProp import FluidsList - + In [1]: FluidsList() - - """ + + """ return _get_global_param_string("FluidsList").split(',') cpdef get_aliases(string Fluid): @@ -310,17 +310,17 @@ cpdef get_aliases(string Fluid): cpdef string get_REFPROPname(string Fluid): """ Return the REFPROP compatible name for the fluid - - Some fluids do not use the REFPROP name. For instance, + + Some fluids do not use the REFPROP name. For instance, ammonia is R717, and propane is R290. You can still can still call CoolProp using the name ammonia or R717, but REFPROP requires that you use a limited subset of names. Therefore, this function that returns the REFPROP compatible name. To then use this to call REFPROP, you would do something like:: - + In [0]: from CoolProp.CoolProp import get_REFPROPname, PropsSI - + In [1]: get_REFPROPname('R290') - + In [2]: PropsSI('D', 'T', 300, 'P', 300, Fluid) """ return _get_fluid_param_string(Fluid,'REFPROP_name') @@ -328,9 +328,9 @@ cpdef string get_REFPROPname(string Fluid): cpdef string get_BibTeXKey(string Fluid, string key): """ Return the BibTeX key for the given fluid. - + The possible keys are - + * ``EOS`` * ``CP0`` * ``VISCOSITY`` @@ -339,9 +339,9 @@ cpdef string get_BibTeXKey(string Fluid, string key): * ``ECS_FITS`` * ``SURFACE_TENSION`` * ``MELTING_LINE`` - + BibTeX keys refer to the BibTeX file in the trunk/CoolProp folder - + Returns ------- key, string @@ -354,16 +354,16 @@ cpdef string get_errstr(): Return the current error string """ return _get_global_param_string("errstring") - + cpdef set_debug_level(int level): """ Set the current debug level as integer in the range [0,10] - + Parameters ---------- level : int - If level is 0, no output will be written to screen, if >0, - some output will be written to screen. The larger level is, + If level is 0, no output will be written to screen, if >0, + some output will be written to screen. The larger level is, the more verbose the output will be """ _set_debug_level(level) @@ -371,12 +371,12 @@ cpdef set_debug_level(int level): cpdef int get_debug_level(): """ Return the current debug level as integer - + Returns ------- level : int - If level is 0, no output will be written to screen, if >0, - some output will be written to screen. The larger level is, + If level is 0, no output will be written to screen, if >0, + some output will be written to screen. The larger level is, the more verbose the output will be """ return _get_debug_level() @@ -384,9 +384,9 @@ cpdef int get_debug_level(): # cpdef bint IsFluidType(string Fluid, string Type): # """ # Check if a fluid is of a given type -# +# # Valid types are: -# +# # * ``Brine`` # * ``PseudoPure`` (or equivalently ``PseudoPureFluid``) # * ``PureFluid`` @@ -397,7 +397,7 @@ cpdef int get_debug_level(): # return True # else: # return False -# +# cdef toSI(constants_header.parameters key, double val): """ @@ -432,34 +432,34 @@ cdef dict paras_inverse = {v:k for k,v in paras.iteritems()} cdef class State: """ A class that contains all the code that represents a thermodynamic state - + .. warning:: - + This class is deprecated. You should use :py:class:`CoolProp.AbstractState` instead - + The motivation for this class is that it is useful to be able to define the state once using whatever state inputs you like and then be able to calculate other thermodynamic properties with the minimum of computational work. - + Let's suppose that you have inputs of pressure and temperature and you want to calculate the enthalpy and pressure. Since the Equations of State are all explicit in temperature and density, each time you call something like:: - + h = PropsSI('H','T',T','P',P,Fluid) s = PropsSI('S','T',T','P',P,Fluid) - + the solver is used to carry out the T-P flash calculation. And if you wanted entropy as well you could either intermediately calculate ``T``, ``rho`` and then use ``T``, ``rho`` in the EOS in a manner like:: - + rho = PropsSI('D','T',T','P',P,Fluid) h = PropsSI('H','T',T','D',rho,Fluid) s = PropsSI('S','T',T','D',rho,Fluid) - + Instead in this class all that is handled internally. So the call to update sets the internal variables in the most computationally efficient way possible """ - + def __init__(self, object Fluid, dict StateDict, object phase = None, backend = None): """ Parameters @@ -473,7 +473,7 @@ cdef class State: The CoolProp backend that should be used, one of "HEOS" (default), "REFPROP", "INCOMP", "BRINE", etc. """ cdef string _Fluid = Fluid - + if _Fluid == 'none': return else: @@ -481,23 +481,23 @@ cdef class State: backend, Fluid = Fluid.split(u'::',1) elif backend is None: backend = u'?' - + self.set_Fluid(Fluid, backend) self.Fluid = _Fluid - + # Parse the inputs provided self.update(StateDict) - + self.phase = phase if phase is None: self.phase = u'??'.encode('ascii') - + # Set the phase flag if self.phase.lower() == 'gas': self.pAS.specify_phase(constants_header.iphase_gas) elif self.phase.lower() == 'liquid': self.pAS.specify_phase(constants_header.iphase_liquid) - + # def __reduce__(self): # d={} # d['Fluid']=self.Fluid @@ -505,9 +505,9 @@ cdef class State: # d['rho']=self.rho_ # d['phase'] = self.phase # return rebuildState,(d,) - + cpdef set_Fluid(self, string Fluid, string backend): - + cdef object _Fluid = Fluid cdef object _backend = backend new_fluid = [] @@ -523,11 +523,11 @@ cdef class State: fracs = [1] self.pAS = AbstractState(_backend, _Fluid) self.pAS.set_mole_fractions(fracs) - + cpdef update_ph(self, double p, double h): """ Use the pressure and enthalpy directly - + Parameters ---------- p: float @@ -538,11 +538,11 @@ cdef class State: self.pAS.update(HmassP_INPUTS, h*1000, p*1000) self.T_ = self.pAS.T() self.rho_ = self.pAS.rhomass() - + cpdef update_Trho(self, double T, double rho): """ Just use the temperature and density directly for speed - + Parameters ---------- T: float @@ -553,22 +553,22 @@ cdef class State: self.T_ = T self.rho_ = rho self.pAS.update(DmassT_INPUTS, rho, T) - + cpdef update(self, dict params): """ Parameters - params, dictionary + params, dictionary A dictionary of terms to be updated, with keys equal to single-char inputs to the Props function, for instance ``dict(T=298, P = 101.325)`` would be one standard atmosphere """ - + # Convert to integer_pair input - + cdef double p, val1, val2, o1 = 0, o2 = 0 cdef long iInput1, iInput2 cdef bytes errstr cdef constants_header.input_pairs input_pair - + # Convert inputs to input pair items = list(params.items()) key1 = paras_inverse[items[0][0]] @@ -576,33 +576,33 @@ cdef class State: # Convert to SI units val1 = toSI(key1, items[0][1]) val2 = toSI(key2, items[1][1]) - + input_pair = _generate_update_pair(key1, val1, key2, val2, o1, o2) self.pAS.update(input_pair, o1, o2); - + self.T_ = self.pAS.T() self.p_ = self.pAS.p()/1000; self.rho_ = self.pAS.rhomass() - + cpdef long Phase(self) except *: """ Returns an integer flag for the phase of the fluid, where the flag value is one of iLiquid, iSupercritical, iGas, iTwoPhase - + These constants are defined in the phase_constants module, and are imported into this module """ - + if self.is_CPFluid: return self.pAS.phase() else: raise NotImplementedError("Phase not defined for fluids other than CoolProp fluids") - - cpdef double Props(self, constants_header.parameters iOutput) except *: + + cpdef double Props(self, constants_header.parameters iOutput) except *: if iOutput<0: - raise ValueError('Your output is invalid') + raise ValueError('Your output is invalid') return self.pAS.keyed_output(iOutput) - + cpdef double get_Q(self) except *: """ Get the quality [-] """ return self.Props(iQ) @@ -610,7 +610,7 @@ cdef class State: """ The quality [-] """ def __get__(self): return self.get_Q() - + cpdef double get_MM(self) except *: """ Get the mole mass [kg/kmol] or [g/mol] """ return self.Props(imolar_mass)*1000 @@ -618,55 +618,55 @@ cdef class State: """ The molar mass [kg/kmol] or [g/mol] """ def __get__(self): return self.get_MM() - + cpdef double get_rho(self) except *: - """ Get the density [kg/m^3] """ + """ Get the density [kg/m^3] """ return self.Props(iDmass) property rho: """ The density [kg/m^3] """ def __get__(self): return self.Props(iDmass) - + cpdef double get_p(self) except *: - """ Get the pressure [kPa] """ + """ Get the pressure [kPa] """ return self.Props(iP)/1000 property p: """ The pressure [kPa] """ def __get__(self): return self.get_p() - - cpdef double get_T(self) except *: + + cpdef double get_T(self) except *: """ Get the temperature [K] """ return self.Props(iT) property T: """ The temperature [K] """ def __get__(self): return self.get_T() - - cpdef double get_h(self) except *: + + cpdef double get_h(self) except *: """ Get the specific enthalpy [kJ/kg] """ return self.Props(iHmass)/1000 property h: """ The specific enthalpy [kJ/kg] """ def __get__(self): return self.get_h() - - cpdef double get_u(self) except *: + + cpdef double get_u(self) except *: """ Get the specific internal energy [kJ/kg] """ return self.Props(iUmass)/1000 property u: """ The internal energy [kJ/kg] """ def __get__(self): return self.get_u() - - cpdef double get_s(self) except *: + + cpdef double get_s(self) except *: """ Get the specific enthalpy [kJ/kg/K] """ return self.Props(iSmass)/1000 property s: """ The specific enthalpy [kJ/kg/K] """ def __get__(self): return self.get_s() - + cpdef double get_cp0(self) except *: """ Get the specific heat at constant pressure for the ideal gas [kJ/kg/K] """ return self.Props(iCp0mass)/1000 @@ -674,27 +674,27 @@ cdef class State: """ The ideal-gas specific heat at constant pressure [kJ/kg/K] """ def __get__(self): return self.get_cp0() - - cpdef double get_cp(self) except *: + + cpdef double get_cp(self) except *: """ Get the specific heat at constant pressure [kJ/kg/K] """ return self.Props(iCpmass)/1000 property cp: """ The specific heat at constant pressure [kJ/kg/K] """ def __get__(self): return self.get_cp() - - cpdef double get_cv(self) except *: + + cpdef double get_cv(self) except *: """ Get the specific heat at constant volume [kJ/kg/K] """ return self.Props(iCvmass)/1000 property cv: """ The specific heat at constant volume [kJ/kg/K] """ def __get__(self): return self.get_cv() - - cpdef double get_speed_sound(self) except *: + + cpdef double get_speed_sound(self) except *: """ Get the speed of sound [m/s] """ return self.Props(ispeed_sound) - + cpdef double get_visc(self) except *: """ Get the viscosity, in [Pa-s]""" return self.Props(iviscosity) @@ -710,77 +710,77 @@ cdef class State: """ The thermal conductivity, in [kW/m/K]""" def __get__(self): return self.get_cond() - + cpdef get_Tsat(self, double Q = 1): - """ + """ Get the saturation temperature, in [K] - - Returns ``None`` if pressure is not within the two-phase pressure range + + Returns ``None`` if pressure is not within the two-phase pressure range """ if self.p_ > _Props('pcrit','T',0,'P',0,self.Fluid) or self.p_ < _Props('ptriple','T',0,'P',0, self.Fluid): - return None + return None else: return _Props('T', 'P', self.p_, 'Q', Q, self.Fluid) property Tsat: """ The saturation temperature (dew) for the given pressure, in [K]""" def __get__(self): return self.get_Tsat(1.0) - + cpdef get_superheat(self): - """ + """ Get the amount of superheat above the saturation temperature corresponding to the pressure, in [K] - - Returns ``None`` if pressure is not within the two-phase pressure range + + Returns ``None`` if pressure is not within the two-phase pressure range """ - + Tsat = self.get_Tsat(1) #dewpoint temp - + if Tsat is not None: return self.T_-Tsat else: return None property superheat: - """ + """ The amount of superheat above the saturation temperature corresponding to the pressure, in [K] - - Returns ``None`` if pressure is not within the two-phase pressure range + + Returns ``None`` if pressure is not within the two-phase pressure range """ - def __get__(self): + def __get__(self): return self.get_superheat() - + cpdef get_subcooling(self): - """ + """ Get the amount of subcooling below the saturation temperature corresponding to the pressure, in [K] - - Returns ``None`` if pressure is not within the two-phase pressure range + + Returns ``None`` if pressure is not within the two-phase pressure range """ - + Tsat = self.get_Tsat(0) #bubblepoint temp - + if Tsat is not None: return Tsat - self.T_ else: return None property subcooling: - """ + """ The amount of subcooling below the saturation temperature corresponding to the pressure, in [K] - - Returns ``None`` if pressure is not within the two-phase pressure range + + Returns ``None`` if pressure is not within the two-phase pressure range """ - def __get__(self): + def __get__(self): return self.get_subcooling() - + property Prandtl: """ The Prandtl number (cp*mu/k) [-] """ def __get__(self): return self.cp * self.visc / self.k - + cpdef double get_dpdT(self) except *: return self.pAS.first_partial_deriv(iP, iT, iDmolar)/1000; property dpdT: def __get__(self): return self.get_dpdT() - + cpdef speed_test(self, int N): from time import clock cdef int i @@ -790,7 +790,7 @@ cdef class State: cdef long IT = 'T' cdef long ID = 'D' import CoolProp as CP - + print 'Call to the Python call layer (CoolProp.CoolProp.Props)' print "'M' involves basically no computational effort and is a good measure of the function call overhead" keys = ['H','P','S','U','C','O','V','L','M','d(P)/d(T)|Dmolar'] @@ -800,7 +800,7 @@ cdef class State: CP.PropsSI(key,'T',self.T_,'D',self.rho_,Fluid) t2=clock() print 'Elapsed time for {0:d} calls for "{1:s}" at {2:g} us/call'.format(N,key,(t2-t1)/N*1e6) - + print 'Direct c++ call to CoolProp without the Python call layer (_Props function)' print "'M' involves basically no computational effort and is a good measure of the function call overhead" keys = ['H','P','S','U','C','O','V','L','M','C0','d(P)/d(T)|Dmolar'] @@ -810,7 +810,7 @@ cdef class State: _PropsSI(key,'T',self.T_,'D',self.rho_,Fluid) t2=clock() print 'Elapsed time for {0:d} calls for "{1:s}" at {2:g} us/call'.format(N,key,(t2-t1)/N*1e6) - + print 'Call to the c++ layer using integers' keys = [iHmass, iP,iSmass,iUmass] for key in keys: @@ -820,15 +820,15 @@ cdef class State: self.pAS.keyed_output(key) t2=clock() print 'Elapsed time for {0:d} calls for "{1:s}" at {2:g} us/call'.format(N,paras[key],(t2-t1)/N*1e6) - + print 'Call to the AbstractState for molar mass (fast)' t1=clock() for i in range(N): self.pAS.keyed_output(imolar_mass) t2=clock() print 'Elapsed time for {0:d} calls at {1:g} us/call'.format(N, (t2-t1)/N*1e6) - -# + +# # print 'Call using TTSE with T,rho' # print "'M' involves basically no computational effort and is a good measure of the function call overhead" # for ikey in keys: @@ -838,7 +838,7 @@ cdef class State: # self.CPS.keyed_output(ikey) # t2=clock() # print 'Elapsed time for {0:d} calls for "{1:s}" at {2:g} us/call'.format(N,paras[ikey],(t2-t1)/N*1e6) -# +# # print 'Call using TTSE with p,h' # print "'M' involves basically no computational effort and is a good measure of the function call overhead" # cdef double hh = self.h @@ -849,7 +849,7 @@ cdef class State: # self.CPS.keyed_output(ikey) # t2=clock() # print 'Elapsed time for {0:d} calls for "{1:s}" at {2:g} us/call'.format(N,paras[ikey],(t2-t1)/N*1e6) -# +# # print 'Using CoolPropStateClass with T,rho with LUT' # keys = [iH,iP,iC,iO,iDpdT] # t1=clock() @@ -859,16 +859,16 @@ cdef class State: # self.CPS.keyed_output(ikey) # t2=clock() # print 'Elapsed time for {0:d} calls of iH,iP,iC,iO,iDpdT takes {1:g} us/call'.format(N,(t2-t1)/N*1e6) -# +# # if not isenabled: # _disable_TTSE_LUT(Fluid) -# +# def __str__(self): """ Return a string representation of the state """ - units={'T': 'K', - 'p': 'kPa', + units={'T': 'K', + 'p': 'kPa', 'rho': 'kg/m^3', 'Q':'kg/kg', 'h':'kJ/kg', @@ -892,7 +892,7 @@ cdef class State: else: s+=k+' = '+str(getattr(self,k))+' NO UNITS'+'\n' return s.rstrip() - + cpdef State copy(self): """ Make a copy of this State class @@ -900,8 +900,8 @@ cdef class State: cdef State S = State(self.Fluid,dict(T=self.T_,D=self.rho_)) S.phase = self.phase return S - + def rebuildState(d): S=State(d['Fluid'],{'T':d['T'],'D':d['rho']},phase=d['phase']) return S - +