def load_all_methods(self, load_data=True): r'''Method which picks out coefficients for the specified chemical from the various dictionaries and DataFrames storing it. All data is stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`, and :obj:`all_methods` as a set of methods for which the data exists for. Called on initialization only. See the source code for the variables at which the coefficients are stored. The coefficients can safely be altered once the class is initialized. This method can be called again to reset the parameters. ''' self.T_limits = T_limits = {} methods = [] Tmins, Tmaxs = [], [] if load_data: if self.CASRN in vapor_pressure.Psat_data_WagnerMcGarry.index: methods.append(WAGNER_MCGARRY) A, B, C, D, self.WAGNER_MCGARRY_Pc, self.WAGNER_MCGARRY_Tc, self.WAGNER_MCGARRY_Tmin = vapor_pressure.Psat_values_WagnerMcGarry[ vapor_pressure.Psat_data_WagnerMcGarry.index.get_loc( self.CASRN)].tolist() self.WAGNER_MCGARRY_coefs = [A, B, C, D] Tmins.append(self.WAGNER_MCGARRY_Tmin) Tmaxs.append(self.WAGNER_MCGARRY_Tc) T_limits[WAGNER_MCGARRY] = (self.WAGNER_MCGARRY_Tmin, self.WAGNER_MCGARRY_Tc) if self.CASRN in vapor_pressure.Psat_data_WagnerPoling.index: methods.append(WAGNER_POLING) A, B, C, D, self.WAGNER_POLING_Tc, self.WAGNER_POLING_Pc, Tmin, self.WAGNER_POLING_Tmax = vapor_pressure.Psat_values_WagnerPoling[ vapor_pressure.Psat_data_WagnerPoling.index.get_loc( self.CASRN)].tolist() # Some Tmin values are missing; Arbitrary choice of 0.1 lower limit self.WAGNER_POLING_Tmin = Tmin if not isnan( Tmin) else self.WAGNER_POLING_Tmax * 0.1 self.WAGNER_POLING_coefs = [A, B, C, D] Tmins.append(Tmin) Tmaxs.append(self.WAGNER_POLING_Tmax) T_limits[WAGNER_POLING] = (self.WAGNER_POLING_Tmin, self.WAGNER_POLING_Tmax) if self.CASRN in vapor_pressure.Psat_data_AntoineExtended.index: methods.append(ANTOINE_EXTENDED_POLING) A, B, C, Tc, to, n, E, F, self.ANTOINE_EXTENDED_POLING_Tmin, self.ANTOINE_EXTENDED_POLING_Tmax = vapor_pressure.Psat_values_AntoineExtended[ vapor_pressure.Psat_data_AntoineExtended.index.get_loc( self.CASRN)].tolist() self.ANTOINE_EXTENDED_POLING_coefs = [Tc, to, A, B, C, n, E, F] Tmins.append(self.ANTOINE_EXTENDED_POLING_Tmin) Tmaxs.append(self.ANTOINE_EXTENDED_POLING_Tmax) T_limits[ANTOINE_EXTENDED_POLING] = ( self.ANTOINE_EXTENDED_POLING_Tmin, self.ANTOINE_EXTENDED_POLING_Tmax) if self.CASRN in vapor_pressure.Psat_data_AntoinePoling.index: methods.append(ANTOINE_POLING) A, B, C, self.ANTOINE_POLING_Tmin, self.ANTOINE_POLING_Tmax = vapor_pressure.Psat_values_AntoinePoling[ vapor_pressure.Psat_data_AntoinePoling.index.get_loc( self.CASRN)].tolist() self.ANTOINE_POLING_coefs = [A, B, C] Tmins.append(self.ANTOINE_POLING_Tmin) Tmaxs.append(self.ANTOINE_POLING_Tmax) T_limits[ANTOINE_POLING] = (self.ANTOINE_POLING_Tmin, self.ANTOINE_POLING_Tmax) if self.CASRN in vapor_pressure.Psat_data_Perrys2_8.index: methods.append(DIPPR_PERRY_8E) C1, C2, C3, C4, C5, self.Perrys2_8_Tmin, self.Perrys2_8_Tmax = vapor_pressure.Psat_values_Perrys2_8[ vapor_pressure.Psat_data_Perrys2_8.index.get_loc( self.CASRN)].tolist() self.Perrys2_8_coeffs = [C1, C2, C3, C4, C5] Tmins.append(self.Perrys2_8_Tmin) Tmaxs.append(self.Perrys2_8_Tmax) T_limits[DIPPR_PERRY_8E] = (self.Perrys2_8_Tmin, self.Perrys2_8_Tmax) if has_CoolProp() and self.CASRN in coolprop_dict: methods.append(COOLPROP) self.CP_f = coolprop_fluids[self.CASRN] Tmins.append(self.CP_f.Tmin) Tmaxs.append(self.CP_f.Tc) T_limits[COOLPROP] = (self.CP_f.Tmin, self.CP_f.Tc) if self.CASRN in miscdata.VDI_saturation_dict: methods.append(VDI_TABULAR) Ts, props = lookup_VDI_tabular_data(self.CASRN, 'P') self.VDI_Tmin = Ts[0] self.VDI_Tmax = Ts[-1] self.tabular_data[VDI_TABULAR] = (Ts, props) Tmins.append(self.VDI_Tmin) Tmaxs.append(self.VDI_Tmax) T_limits[VDI_TABULAR] = (self.VDI_Tmin, self.VDI_Tmax) if self.CASRN in vapor_pressure.Psat_data_VDI_PPDS_3.index: Tm, Tc, Pc, A, B, C, D = vapor_pressure.Psat_values_VDI_PPDS_3[ vapor_pressure.Psat_data_VDI_PPDS_3.index.get_loc( self.CASRN)].tolist() self.VDI_PPDS_coeffs = [A, B, C, D] self.VDI_PPDS_Tc = Tc self.VDI_PPDS_Tm = Tm self.VDI_PPDS_Pc = Pc methods.append(VDI_PPDS) Tmins.append(self.VDI_PPDS_Tm) Tmaxs.append(self.VDI_PPDS_Tc) T_limits[VDI_PPDS] = (self.VDI_PPDS_Tm, self.VDI_PPDS_Tc) if all((self.Tb, self.Tc, self.Pc)): methods.append(BOILING_CRITICAL) Tmins.append(0.01) Tmaxs.append(self.Tc) T_limits[BOILING_CRITICAL] = (0.01, self.Tc) if all((self.Tc, self.Pc, self.omega)): methods.append(LEE_KESLER_PSAT) methods.append(AMBROSE_WALTON) methods.append(SANJARI) methods.append(EDALAT) if self.eos: methods.append(EOS) T_limits[EOS] = (0.1 * self.Tc, self.Tc) Tmins.append(0.01) Tmaxs.append(self.Tc) T_limits[LEE_KESLER_PSAT] = T_limits[AMBROSE_WALTON] = T_limits[ SANJARI] = T_limits[EDALAT] = (0.01, self.Tc) self.all_methods = set(methods) if Tmins and Tmaxs: self.Tmin = min(Tmins) self.Tmax = max(Tmaxs)
def load_all_methods(self, load_data): r'''Method which picks out coefficients for the specified chemical from the various dictionaries and DataFrames storing it. All data is stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`, and :obj:`all_methods` as a set of methods for which the data exists for. Called on initialization only. See the source code for the variables at which the coefficients are stored. The coefficients can safely be altered once the class is initialized. This method can be called again to reset the parameters. ''' methods = [] self.T_limits = T_limits = {} if load_data: if self.CASRN in interface.sigma_data_Mulero_Cachadina.index: methods.append(STREFPROP) sigma0, n0, sigma1, n1, sigma2, n2, Tc, self.STREFPROP_Tmin, self.STREFPROP_Tmax = interface.sigma_values_Mulero_Cachadina[ interface.sigma_data_Mulero_Cachadina.index.get_loc( self.CASRN)].tolist() self.STREFPROP_coeffs = [ sigma0, n0, sigma1, n1, sigma2, n2, Tc ] T_limits[STREFPROP] = (self.STREFPROP_Tmin, self.STREFPROP_Tmax) if self.CASRN in interface.sigma_data_Somayajulu2.index: methods.append(SOMAYAJULU2) self.SOMAYAJULU2_Tt, self.SOMAYAJULU2_Tc, A, B, C = interface.sigma_values_Somayajulu2[ interface.sigma_data_Somayajulu2.index.get_loc( self.CASRN)].tolist() self.SOMAYAJULU2_coeffs = [A, B, C] T_limits[SOMAYAJULU2] = (self.SOMAYAJULU2_Tt, self.SOMAYAJULU2_Tc) if self.CASRN in interface.sigma_data_Somayajulu.index: methods.append(SOMAYAJULU) self.SOMAYAJULU_Tt, self.SOMAYAJULU_Tc, A, B, C = interface.sigma_values_Somayajulu[ interface.sigma_data_Somayajulu.index.get_loc( self.CASRN)].tolist() self.SOMAYAJULU_coeffs = [A, B, C] T_limits[SOMAYAJULU] = (self.SOMAYAJULU_Tt, self.SOMAYAJULU_Tc) if self.CASRN in miscdata.VDI_saturation_dict: methods.append(VDI_TABULAR) Ts, props = lookup_VDI_tabular_data(self.CASRN, 'sigma') self.VDI_Tmin = Ts[0] self.VDI_Tmax = Ts[-1] self.tabular_data[VDI_TABULAR] = (Ts, props) T_limits[VDI_TABULAR] = (self.VDI_Tmin, self.VDI_Tmax) if self.CASRN in interface.sigma_data_Jasper_Lange.index: methods.append(JASPER) a, b, self.JASPER_Tmin, self.JASPER_Tmax = interface.sigma_values_Jasper_Lange[ interface.sigma_data_Jasper_Lange.index.get_loc( self.CASRN)].tolist() if isnan(self.JASPER_Tmax ) or self.JASPER_Tmax == self.JASPER_Tmin: # Some data is missing; and some is on a above the limit basis self.JASPER_Tmax = a / b + 273.15 if isnan(self.JASPER_Tmin): self.JASPER_Tmin = 0.0 self.JASPER_coeffs = [a, b] T_limits[JASPER] = (self.JASPER_Tmin, self.JASPER_Tmax) if self.CASRN in interface.sigma_data_VDI_PPDS_11.index: Tm, Tc, A, B, C, D, E = interface.sigma_values_VDI_PPDS_11[ interface.sigma_data_VDI_PPDS_11.index.get_loc( self.CASRN)].tolist() self.VDI_PPDS_coeffs = [A, B, C, D, E] self.VDI_PPDS_Tc = Tc self.VDI_PPDS_Tm = Tm methods.append(VDI_PPDS) T_limits[VDI_PPDS] = (self.VDI_PPDS_Tm, self.VDI_PPDS_Tc) if all((self.Tc, self.Vc, self.omega)): methods.append(MIQUEU) T_limits[MIQUEU] = (0.0, self.Tc) if all((self.Tb, self.Tc, self.Pc)): methods.append(BROCK_BIRD) methods.append(SASTRI_RAO) T_limits[BROCK_BIRD] = T_limits[SASTRI_RAO] = (0.0, self.Tc) if all((self.Tc, self.Pc, self.omega)): methods.append(PITZER) methods.append(ZUO_STENBY) T_limits[PITZER] = T_limits[ZUO_STENBY] = (1e-10, self.Tc) if all((self.Tb, self.Hvap_Tb, self.MW)): # Cache Cpl at Tb for ease of calculation of Tmax self.Cpl_Tb = self.Cpl(self.Tb) if hasattr( self.Cpl, '__call__') else self.Cpl if self.Cpl_Tb: self.Cpl_Tb = property_molar_to_mass(self.Cpl_Tb, self.MW) methods.append(ALEEM) # Tmin and Tmax for this method is known Tmax_possible = self.Tb + self.Hvap_Tb / self.Cpl_Tb # This method will ruin solve_property as it is typically valid # well above Tc. If Tc is available, limit it to that. if self.Tc: Tmax_possible = min(self.Tc, Tmax_possible) T_limits[ALEEM] = (0.0, Tmax_possible) self.all_methods = set(methods)
def load_all_methods(self, load_data=True): r'''Method which picks out coefficients for the specified chemical from the various dictionaries and DataFrames storing it. All data is stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`, and :obj:`all_methods` as a set of methods for which the data exists for. Called on initialization only. See the source code for the variables at which the coefficients are stored. The coefficients can safely be altered once the class is initialized. This method can be called again to reset the parameters. ''' methods = [] self.T_limits = T_limits = {} if load_data: if has_CoolProp() and self.CASRN in coolprop_dict: methods.append(COOLPROP) self.CP_f = coolprop_fluids[self.CASRN] T_limits[COOLPROP] = (self.CP_f.Tt, self.CP_f.Tc * .9999) if self.CASRN in miscdata.VDI_saturation_dict: methods.append(VDI_TABULAR) Ts, props = lookup_VDI_tabular_data(self.CASRN, 'Hvap') self.VDI_Tmin = Ts[0] self.VDI_Tmax = Ts[-1] self.tabular_data[VDI_TABULAR] = (Ts, props) T_limits[VDI_TABULAR] = (self.VDI_Tmin, self.VDI_Tmax) if self.CASRN in phase_change.phase_change_data_Alibakhshi_Cs.index and self.Tc is not None: methods.append(ALIBAKHSHI) self.Alibakhshi_C = float( phase_change.phase_change_data_Alibakhshi_Cs.at[self.CASRN, 'C']) T_limits[ALIBAKHSHI] = (self.Tc * .3, max(self.Tc - 100., 0)) if self.CASRN in phase_change.Hvap_data_CRC.index and not isnan( phase_change.Hvap_data_CRC.at[self.CASRN, 'HvapTb']): methods.append(CRC_HVAP_TB) self.CRC_HVAP_TB_Tb = float( phase_change.Hvap_data_CRC.at[self.CASRN, 'Tb']) self.CRC_HVAP_TB_Hvap = float( phase_change.Hvap_data_CRC.at[self.CASRN, 'HvapTb']) if self.Tc is not None: T_limits[CRC_HVAP_TB] = (self.Tc * .001, self.Tc) else: T_limits[CRC_HVAP_TB] = (self.CRC_HVAP_TB_Tb, self.CRC_HVAP_TB_Tb) if self.CASRN in phase_change.Hvap_data_CRC.index and not isnan( phase_change.Hvap_data_CRC.at[self.CASRN, 'Hvap298']): methods.append(CRC_HVAP_298) self.CRC_HVAP_298 = float( phase_change.Hvap_data_CRC.at[self.CASRN, 'Hvap298']) if self.Tc is not None: T_limits[CRC_HVAP_298] = (self.Tc * .001, self.Tc) else: T_limits[CRC_HVAP_298] = (298.15, 298.15) if self.CASRN in phase_change.Hvap_data_Gharagheizi.index: methods.append(GHARAGHEIZI_HVAP_298) self.GHARAGHEIZI_HVAP_298_Hvap = float( phase_change.Hvap_data_Gharagheizi.at[self.CASRN, 'Hvap298']) if self.Tc is not None: T_limits[GHARAGHEIZI_HVAP_298] = (self.Tc * .001, self.Tc) else: T_limits[GHARAGHEIZI_HVAP_298] = (298.15, 298.15) if self.CASRN in phase_change.phase_change_data_Perrys2_150.index: methods.append(DIPPR_PERRY_8E) Tc, C1, C2, C3, C4, self.Perrys2_150_Tmin, self.Perrys2_150_Tmax = phase_change.phase_change_values_Perrys2_150[ phase_change.phase_change_data_Perrys2_150.index.get_loc( self.CASRN)].tolist() self.Perrys2_150_coeffs = [Tc, C1, C2, C3, C4] T_limits[DIPPR_PERRY_8E] = (self.Perrys2_150_Tmin, self.Perrys2_150_Tmax) if self.CASRN in phase_change.phase_change_data_VDI_PPDS_4.index: Tc, A, B, C, D, E = phase_change.phase_change_values_VDI_PPDS_4[ phase_change.phase_change_data_VDI_PPDS_4.index.get_loc( self.CASRN)].tolist() self.VDI_PPDS_coeffs = [A, B, C, D, E] self.VDI_PPDS_Tc = Tc methods.append(VDI_PPDS) T_limits[VDI_PPDS] = (0.1 * self.VDI_PPDS_Tc, self.VDI_PPDS_Tc) if all((self.Tc, self.omega)): methods.extend(self.CSP_methods) for m in self.CSP_methods: T_limits[m] = (1e-4, self.Tc) if all((self.Tc, self.Pc)): methods.append(CLAPEYRON) T_limits[CLAPEYRON] = (1e-4, self.Tc) if all((self.Tb, self.Tc, self.Pc)): methods.extend(self.boiling_methods) for m in self.boiling_methods: T_limits[m] = (1e-4, self.Tc) self.all_methods = set(methods)