INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
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: obj: all_methods and obj: all_methods_P as a set of methods for which the data exists for.
def load_all_methods(self): 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`, :obj:`all_methods` and obj:`all_methods_P` as a set of...
r Method to calculate low - pressure gas viscosity at tempearture T with a given method.
def calculate(self, T, method): r'''Method to calculate low-pressure gas viscosity at tempearture `T` with a given method. This method has no exception handling; see `T_dependent_property` for that. Parameters ---------- T : float Temperature of the ...
r Method to calculate pressure - dependent gas viscosity at temperature T and pressure P with a given method.
def calculate_P(self, T, P, method): r'''Method to calculate pressure-dependent gas viscosity at temperature `T` and pressure `P` with a given method. This method has no exception handling; see `TP_dependent_property` for that. Parameters ---------- T : float ...
r Method to initialize the object by precomputing any values which may be used repeatedly and by retrieving mixture - specific variables. All data are stored as attributes. This method also sets: obj: Tmin: obj: Tmax and: obj: all_methods as a set of methods which should work to calculate the property.
def load_all_methods(self): r'''Method to initialize the object by precomputing any values which may be used repeatedly and by retrieving mixture-specific variables. All data are stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`, and :obj:`all_methods` as a set of met...
r Method to calculate viscosity of a gas mixture at temperature T pressure P mole fractions zs and weight fractions ws with a given method.
def calculate(self, T, P, zs, ws, method): r'''Method to calculate viscosity of a gas mixture at temperature `T`, pressure `P`, mole fractions `zs` and weight fractions `ws` with a given method. This method has no exception handling; see `mixture_property` for that. Pa...
r Converts a concentration in ppmv to units of mg/ m^3. Used in industrial toxicology.
def ppmv_to_mgm3(ppmv, MW, T=298.15, P=101325.): r'''Converts a concentration in ppmv to units of mg/m^3. Used in industrial toxicology. .. math:: \frac{mg}{m^3} = \frac{ppmv\cdot P}{RT}\cdot \frac{MW}{1000} Parameters ---------- ppmv : float Concentratoin of a component in a g...
r Converts a concentration in mg/ m^3 to units of ppmv. Used in industrial toxicology.
def mgm3_to_ppmv(mgm3, MW, T=298.15, P=101325.): r'''Converts a concentration in mg/m^3 to units of ppmv. Used in industrial toxicology. .. math:: ppmv = \frac{1000RT}{MW\cdot P} \cdot \frac{mg}{m^3} Parameters ---------- mgm3 : float Concentration of a substance in an ideal g...
This function handles the retrieval of Time - Weighted Average limits on worker exposure to dangerous chemicals.
def TWA(CASRN, AvailableMethods=False, Method=None): # pragma: no cover '''This function handles the retrieval of Time-Weighted Average limits on worker exposure to dangerous chemicals. This API is considered experimental, and is expected to be removed in a future release in favor of a more complete o...
This function handles the retrieval of Short - term Exposure Limit on worker exposure to dangerous chemicals.
def STEL(CASRN, AvailableMethods=False, Method=None): # pragma: no cover '''This function handles the retrieval of Short-term Exposure Limit on worker exposure to dangerous chemicals. This API is considered experimental, and is expected to be removed in a future release in favor of a more complete obj...
This function handles the retrieval of Ceiling limits on worker exposure to dangerous chemicals.
def Ceiling(CASRN, AvailableMethods=False, Method=None): # pragma: no cover '''This function handles the retrieval of Ceiling limits on worker exposure to dangerous chemicals. This API is considered experimental, and is expected to be removed in a future release in favor of a more complete object-orie...
This function handles the retrieval of whether or not a chemical can be absorbed through the skin relevant to chemical safety calculations.
def Skin(CASRN, AvailableMethods=False, Method=None): # pragma: no cover '''This function handles the retrieval of whether or not a chemical can be absorbed through the skin, relevant to chemical safety calculations. This API is considered experimental, and is expected to be removed in a future releas...
r Looks up if a chemical is listed as a carcinogen or not according to either a specifc method or with all methods.
def Carcinogen(CASRN, AvailableMethods=False, Method=None): r'''Looks up if a chemical is listed as a carcinogen or not according to either a specifc method or with all methods. Returns either the status as a string for a specified method, or the status of the chemical in all available data sources, in...
r This function handles the retrieval or calculation of a chemical s autoifnition temperature. Lookup is based on CASRNs. No predictive methods are currently implemented. Will automatically select a data source to use if no Method is provided ; returns None if the data is not available.
def Tautoignition(CASRN, AvailableMethods=False, Method=None): r'''This function handles the retrieval or calculation of a chemical's autoifnition temperature. Lookup is based on CASRNs. No predictive methods are currently implemented. Will automatically select a data source to use if no Method is provi...
r This function handles the retrieval or calculation of a chemical s Lower Flammability Limit. Lookup is based on CASRNs. Two predictive methods are currently implemented. Will automatically select a data source to use if no Method is provided ; returns None if the data is not available.
def LFL(Hc=None, atoms={}, CASRN='', AvailableMethods=False, Method=None): r'''This function handles the retrieval or calculation of a chemical's Lower Flammability Limit. Lookup is based on CASRNs. Two predictive methods are currently implemented. Will automatically select a data source to use if no Me...
r This function handles the retrieval or calculation of a chemical s Upper Flammability Limit. Lookup is based on CASRNs. Two predictive methods are currently implemented. Will automatically select a data source to use if no Method is provided ; returns None if the data is not available.
def UFL(Hc=None, atoms={}, CASRN='', AvailableMethods=False, Method=None): r'''This function handles the retrieval or calculation of a chemical's Upper Flammability Limit. Lookup is based on CASRNs. Two predictive methods are currently implemented. Will automatically select a data source to use if no Me...
Crowl Daniel A. and Joseph F. Louvar. Chemical Process Safety: Fundamentals with Applications. 2E. Upper Saddle River N. J: Prentice Hall 2001.
def fire_mixing(ys=None, FLs=None): # pragma: no cover ''' Crowl, Daniel A., and Joseph F. Louvar. Chemical Process Safety: Fundamentals with Applications. 2E. Upper Saddle River, N.J: Prentice Hall, 2001. >>> fire_mixing(ys=normalize([0.0024, 0.0061, 0.0015]), FLs=[.012, .053, .031]) 0.02751...
Inert gases are ignored.
def LFL_mixture(ys=None, LFLs=None, CASRNs=None, AvailableMethods=False, Method=None): # pragma: no cover '''Inert gases are ignored. This API is considered experimental, and is expected to be removed in a future release in favor of a more complete object-oriented interface. >>> LFL_m...
Inert gases are ignored.
def UFL_mixture(ys=None, UFLs=None, CASRNs=None, AvailableMethods=False, Method=None): # pragma: no cover '''Inert gases are ignored. This API is considered experimental, and is expected to be removed in a future release in favor of a more complete object-oriented interface. >>> UFL_m...
r Calculates lower flammability limit using the Suzuki [ 1 ] _ correlation. Uses heat of combustion only.
def Suzuki_LFL(Hc=None): r'''Calculates lower flammability limit, using the Suzuki [1]_ correlation. Uses heat of combustion only. The lower flammability limit of a gas is air is: .. math:: \text{LFL} = \frac{-3.42}{\Delta H_c^{\circ}} + 0.569 \Delta H_c^{\circ} + 0.0538\Delta H_c^{\ci...
r Calculates lower flammability limit using the Crowl - Louvar [ 1 ] _ correlation. Uses molecular formula only.
def Crowl_Louvar_LFL(atoms): r'''Calculates lower flammability limit, using the Crowl-Louvar [1]_ correlation. Uses molecular formula only. The lower flammability limit of a gas is air is: .. math:: C_mH_xO_y + zO_2 \to mCO_2 + \frac{x}{2}H_2O \text{LFL} = \frac{0.55}{4.76m + 1.19x - ...
r Calculates upper flammability limit using the Crowl - Louvar [ 1 ] _ correlation. Uses molecular formula only.
def Crowl_Louvar_UFL(atoms): r'''Calculates upper flammability limit, using the Crowl-Louvar [1]_ correlation. Uses molecular formula only. The upper flammability limit of a gas is air is: .. math:: C_mH_xO_y + zO_2 \to mCO_2 + \frac{x}{2}H_2O \text{UFL} = \frac{3.5}{4.76m + 1.19x - 2...
r Volume fractions of all species in a hypothetical pure - liquid phase at the current or specified temperature and pressure. If temperature or pressure are specified the non - specified property is assumed to be that of the mixture. Note this is a method not a property. Volume fractions are calculated based on ** pure...
def Vfls(self, T=None, P=None): r'''Volume fractions of all species in a hypothetical pure-liquid phase at the current or specified temperature and pressure. If temperature or pressure are specified, the non-specified property is assumed to be that of the mixture. Note this is a metho...
r Volume fractions of all species in a hypothetical pure - gas phase at the current or specified temperature and pressure. If temperature or pressure are specified the non - specified property is assumed to be that of the mixture. Note this is a method not a property. Volume fractions are calculated based on ** pure sp...
def Vfgs(self, T=None, P=None): r'''Volume fractions of all species in a hypothetical pure-gas phase at the current or specified temperature and pressure. If temperature or pressure are specified, the non-specified property is assumed to be that of the mixture. Note this is a method, ...
r Dictionary of atomic fractions for each atom in the mixture.
def atom_fractions(self): r'''Dictionary of atomic fractions for each atom in the mixture. Examples -------- >>> Mixture(['CO2', 'O2'], zs=[0.5, 0.5]).atom_fractions {'C': 0.2, 'O': 0.8} ''' things = dict() for zi, atoms in zip(self.zs, self.atomss): ...
r Dictionary of mass fractions for each atom in the mixture.
def mass_fractions(self): r'''Dictionary of mass fractions for each atom in the mixture. Examples -------- >>> Mixture(['CO2', 'O2'], zs=[0.5, 0.5]).mass_fractions {'C': 0.15801826905745822, 'O': 0.8419817309425419} ''' things = dict() for zi, atoms in zi...
r Charge imbalance of the mixture in units of [ faraday ]. Mixtures meeting the electroneutrality condition will have an imbalance of 0.
def charge_balance(self): r'''Charge imbalance of the mixture, in units of [faraday]. Mixtures meeting the electroneutrality condition will have an imbalance of 0. Examples -------- >>> Mixture(['Na+', 'Cl-', 'water'], zs=[.01, .01, .98]).charge_balance 0.0 ...
r Solid - phase heat capacity of the mixture at its current temperature and composition in units of [ J/ mol/ K ]. For calculation of this property at other temperatures or compositions or specifying manually the method used to calculate it and more - see the object oriented interface: obj: thermo. heat_capacity. HeatC...
def Cpsm(self): r'''Solid-phase heat capacity of the mixture at its current temperature and composition, in units of [J/mol/K]. For calculation of this property at other temperatures or compositions, or specifying manually the method used to calculate it, and more - see the object orient...
r Liquid - phase heat capacity of the mixture at its current temperature and composition in units of [ J/ mol/ K ]. For calculation of this property at other temperatures or compositions or specifying manually the method used to calculate it and more - see the object oriented interface: obj: thermo. heat_capacity. Heat...
def Cplm(self): r'''Liquid-phase heat capacity of the mixture at its current temperature and composition, in units of [J/mol/K]. For calculation of this property at other temperatures or compositions, or specifying manually the method used to calculate it, and more - see the object ...
r Gas - phase heat capacity of the mixture at its current temperature and composition in units of [ J/ mol/ K ]. For calculation of this property at other temperatures or compositions or specifying manually the method used to calculate it and more - see the object oriented interface: obj: thermo. heat_capacity. HeatCap...
def Cpgm(self): r'''Gas-phase heat capacity of the mixture at its current temperature and composition, in units of [J/mol/K]. For calculation of this property at other temperatures or compositions, or specifying manually the method used to calculate it, and more - see the object oriented...
r Solid - phase heat capacity of the mixture at its current temperature and composition in units of [ J/ kg/ K ]. For calculation of this property at other temperatures or compositions or specifying manually the method used to calculate it and more - see the object oriented interface: obj: thermo. heat_capacity. HeatCa...
def Cps(self): r'''Solid-phase heat capacity of the mixture at its current temperature and composition, in units of [J/kg/K]. For calculation of this property at other temperatures or compositions, or specifying manually the method used to calculate it, and more - see the object oriente...
r Liquid - phase heat capacity of the mixture at its current temperature and composition in units of [ J/ kg/ K ]. For calculation of this property at other temperatures or compositions or specifying manually the method used to calculate it and more - see the object oriented interface: obj: thermo. heat_capacity. HeatC...
def Cpl(self): r'''Liquid-phase heat capacity of the mixture at its current temperature and composition, in units of [J/kg/K]. For calculation of this property at other temperatures or compositions, or specifying manually the method used to calculate it, and more - see the object ...
r Gas - phase heat capacity of the mixture at its current temperature and composition in units of [ J/ kg/ K ]. For calculation of this property at other temperatures or compositions or specifying manually the method used to calculate it and more - see the object oriented interface: obj: thermo. heat_capacity. HeatCapa...
def Cpg(self): r'''Gas-phase heat capacity of the mixture at its current temperature , and composition in units of [J/kg/K]. For calculation of this property at other temperatures or compositions, or specifying manually the method used to calculate it, and more - see the object oriented ...
r Gas - phase ideal - gas contant - volume heat capacity of the mixture at its current temperature and composition in units of [ J/ mol/ K ]. Subtracts R from the ideal - gas heat capacity ; does not include pressure - compensation from an equation of state.
def Cvgm(self): r'''Gas-phase ideal-gas contant-volume heat capacity of the mixture at its current temperature and composition, in units of [J/mol/K]. Subtracts R from the ideal-gas heat capacity; does not include pressure-compensation from an equation of state. Examples ...
r Liquid - phase molar volume of the mixture at its current temperature pressure and composition in units of [ m^3/ mol ]. For calculation of this property at other temperatures or pressures or compositions or specifying manually the method used to calculate it and more - see the object oriented interface: obj: thermo....
def Vml(self): r'''Liquid-phase molar volume of the mixture at its current temperature, pressure, and composition in units of [m^3/mol]. For calculation of this property at other temperatures or pressures or compositions, or specifying manually the method used to calculate it, an...
r Gas - phase molar volume of the mixture at its current temperature pressure and composition in units of [ m^3/ mol ]. For calculation of this property at other temperatures or pressures or compositions or specifying manually the method used to calculate it and more - see the object oriented interface: obj: thermo. vo...
def Vmg(self): r'''Gas-phase molar volume of the mixture at its current temperature, pressure, and composition in units of [m^3/mol]. For calculation of this property at other temperatures or pressures or compositions, or specifying manually the method used to calculate it, and m...
r Specific gravity of a hypothetical gas phase of the mixture. [ dimensionless ]. The reference condition is air at 15. 6 °C ( 60 °F ) and 1 atm ( rho = 1. 223 kg/ m^3 ). The definition for gases uses the compressibility factor of the reference gas and the mixture both at the reference conditions not the conditions of ...
def SGg(self): r'''Specific gravity of a hypothetical gas phase of the mixture, . [dimensionless]. The reference condition is air at 15.6 °C (60 °F) and 1 atm (rho=1.223 kg/m^3). The definition for gases uses the compressibility factor of the reference gas and the mixture both at the ...
r Viscosity of the mixture in the liquid phase at its current temperature pressure and composition in units of [ Pa * s ].
def mul(self): r'''Viscosity of the mixture in the liquid phase at its current temperature, pressure, and composition in units of [Pa*s]. For calculation of this property at other temperatures and pressures, or specifying manually the method used to calculate it, and more - see ...
r Viscosity of the mixture in the gas phase at its current temperature pressure and composition in units of [ Pa * s ].
def mug(self): r'''Viscosity of the mixture in the gas phase at its current temperature, pressure, and composition in units of [Pa*s]. For calculation of this property at other temperatures and pressures, or specifying manually the method used to calculate it, and more - see the...
r Surface tension of the mixture at its current temperature and composition in units of [ N/ m ].
def sigma(self): r'''Surface tension of the mixture at its current temperature and composition, in units of [N/m]. For calculation of this property at other temperatures, or specifying manually the method used to calculate it, and more - see the object oriented interface :obj:`t...
r Thermal conductivity of the mixture in the liquid phase at its current temperature pressure and composition in units of [ Pa * s ].
def kl(self): r'''Thermal conductivity of the mixture in the liquid phase at its current temperature, pressure, and composition in units of [Pa*s]. For calculation of this property at other temperatures and pressures, or specifying manually the method used to calculate it, and more - se...
r Thermal conductivity of the mixture in the gas phase at its current temperature pressure and composition in units of [ Pa * s ].
def kg(self): r'''Thermal conductivity of the mixture in the gas phase at its current temperature, pressure, and composition in units of [Pa*s]. For calculation of this property at other temperatures and pressures, or specifying manually the method used to calculate it, and more - see ...
r Molar density of the mixture at its current phase and temperature and pressure in units of [ mol/ m^3 ]. Available only if single phase.
def rhom(self): r'''Molar density of the mixture at its current phase and temperature and pressure, in units of [mol/m^3]. Available only if single phase. Examples -------- >>> Mixture(['1-hexanol'], ws=[1]).rhom 7983.414573003429 ''' return phase...
r Specific gravity of the mixture [ dimensionless ]. For gas - phase conditions this is calculated at 15. 6 °C ( 60 °F ) and 1 atm for the mixture and the reference fluid air. For liquid and solid phase conditions this is calculated based on a reference fluid of water at 4°C at 1 atm but the with the liquid or solid mi...
def SG(self): r'''Specific gravity of the mixture, [dimensionless]. For gas-phase conditions, this is calculated at 15.6 °C (60 °F) and 1 atm for the mixture and the reference fluid, air. For liquid and solid phase conditions, this is calculated based on a reference ...
r Liquid - phase molar volume of the mixture at 298. 15 K and 101. 325 kPa and the current composition in units of [ m^3/ mol ].
def Vml_STP(self): r'''Liquid-phase molar volume of the mixture at 298.15 K and 101.325 kPa, and the current composition in units of [m^3/mol]. Examples -------- >>> Mixture(['cyclobutane'], ws=[1]).Vml_STP 8.143327329133706e-05 ''' return self.VolumeLiqu...
r Gas - phase molar volume of the mixture at 298. 15 K and 101. 325 kPa and the current composition in units of [ m^3/ mol ].
def Vmg_STP(self): r'''Gas-phase molar volume of the mixture at 298.15 K and 101.325 kPa, and the current composition in units of [m^3/mol]. Examples -------- >>> Mixture(['nitrogen'], ws=[1]).Vmg_STP 0.02445443688838904 ''' return self.VolumeGasMixture(T...
r Liquid - phase mass density of the mixture at 298. 15 K and 101. 325 kPa and the current composition in units of [ kg/ m^3 ].
def rhol_STP(self): r'''Liquid-phase mass density of the mixture at 298.15 K and 101.325 kPa, and the current composition in units of [kg/m^3]. Examples -------- >>> Mixture(['cyclobutane'], ws=[1]).rhol_STP 688.9851989526821 ''' Vml = self.Vml_STP ...
r Gas - phase mass density of the mixture at 298. 15 K and 101. 325 kPa and the current composition in units of [ kg/ m^3 ].
def rhog_STP(self): r'''Gas-phase mass density of the mixture at 298.15 K and 101.325 kPa, and the current composition in units of [kg/m^3]. Examples -------- >>> Mixture(['nitrogen'], ws=[1]).rhog_STP 1.145534453639403 ''' Vmg = self.Vmg_STP if V...
r Liquid - phase compressibility factor of the mixture at 298. 15 K and 101. 325 kPa and the current composition [ dimensionless ].
def Zl_STP(self): r'''Liquid-phase compressibility factor of the mixture at 298.15 K and 101.325 kPa, and the current composition, [dimensionless]. Examples -------- >>> Mixture(['cyclobutane'], ws=[1]).Zl_STP 0.0033285083663950068 ''' Vml = self.Vml ...
r Gas - phase compressibility factor of the mixture at 298. 15 K and 101. 325 kPa and the current composition [ dimensionless ].
def Zg_STP(self): r'''Gas-phase compressibility factor of the mixture at 298.15 K and 101.325 kPa, and the current composition, [dimensionless]. Examples -------- >>> Mixture(['nitrogen'], ws=[1]).Zg_STP 0.9995520809691023 ''' Vmg = self.Vmg if Vm...
r API gravity of the hypothetical liquid phase of the mixture [ degrees ]. The reference condition is water at 15. 6 °C ( 60 °F ) and 1 atm ( rho = 999. 016 kg/ m^3 standardized ). Examples -------- >>> Mixture ( [ hexane decane ] ws = [ 0. 5 0. 5 ] ). API 71. 34707841728181
def API(self): r'''API gravity of the hypothetical liquid phase of the mixture, [degrees]. The reference condition is water at 15.6 °C (60 °F) and 1 atm (rho=999.016 kg/m^3, standardized). Examples -------- >>> Mixture(['hexane', 'decane'], ws=[0.5, 0.5]).A...
r Interface for drawing a 2D image of all the molecules in the mixture. Requires an HTML5 browser and the libraries RDKit and IPython. An exception is raised if either of these libraries is absent.
def draw_2d(self, Hs=False): # pragma: no cover r'''Interface for drawing a 2D image of all the molecules in the mixture. Requires an HTML5 browser, and the libraries RDKit and IPython. An exception is raised if either of these libraries is absent. Parameters ----------...
r This function handles the retrieval of a chemical s triple temperature. Lookup is based on CASRNs. Will automatically select a data source to use if no Method is provided ; returns None if the data is not available.
def Tt(CASRN, AvailableMethods=False, Method=None): r'''This function handles the retrieval of a chemical's triple temperature. Lookup is based on CASRNs. Will automatically select a data source to use if no Method is provided; returns None if the data is not available. Returns data from [1]_, or a che...
r This function handles the retrieval of a chemical s triple pressure. Lookup is based on CASRNs. Will automatically select a data source to use if no Method is provided ; returns None if the data is not available.
def Pt(CASRN, AvailableMethods=False, Method=None): r'''This function handles the retrieval of a chemical's triple pressure. Lookup is based on CASRNs. Will automatically select a data source to use if no Method is provided; returns None if the data is not available. Returns data from [1]_, or attempts...
r Legacy function to turn a list of strings into either floats ( if numeric ) stripped strings ( if not ) or None if the string is empty. Accepts any numeric formatting the float function does.
def to_num(values): r'''Legacy function to turn a list of strings into either floats (if numeric), stripped strings (if not) or None if the string is empty. Accepts any numeric formatting the float function does. Parameters ---------- values : list list of strings Returns -----...
r Calculate Parachor for a pure species using its density in the liquid and gas phases surface tension and molecular weight.
def Parachor(MW, rhol, rhog, sigma): r'''Calculate Parachor for a pure species, using its density in the liquid and gas phases, surface tension, and molecular weight. .. math:: P = \frac{\sigma^{0.25} MW}{\rho_L - \rho_V} Parameters ---------- MW : float Molecular weight, [...
r Calculate the Phase Identification Parameter developed in [ 1 ] _ for the accurate and efficient determination of whether a fluid is a liquid or a gas based on the results of an equation of state. For supercritical conditions this provides a good method for choosing which property correlations to use... math:: \ Pi =...
def phase_identification_parameter(V, dP_dT, dP_dV, d2P_dV2, d2P_dVdT): r'''Calculate the Phase Identification Parameter developed in [1]_ for the accurate and efficient determination of whether a fluid is a liquid or a gas based on the results of an equation of state. For supercritical conditions, thi...
r Uses the Phase Identification Parameter concept developed in [ 1 ] _ and [ 2 ] _ to determine if a chemical is a solid liquid or vapor given the appropriate thermodynamic conditions.
def phase_identification_parameter_phase(d2P_dVdT, V=None, dP_dT=None, dP_dV=None, d2P_dV2=None): r'''Uses the Phase Identification Parameter concept developed in [1]_ and [2]_ to determine if a chemical is a solid, liquid, or vapor given the appropriate thermodynamic conditions. The criteria for liq...
r Calculate a real fluid s speed of sound. The required derivatives should be calculated with an equation of state and Cp and Cv are both the real fluid versions. Expression is given in [ 1 ] _ and [ 2 ] _ ; a unit conversion is further performed to obtain a result in m/ s. If MW is not provided the result is returned ...
def speed_of_sound(V, dP_dV, Cp, Cv, MW=None): r'''Calculate a real fluid's speed of sound. The required derivatives should be calculated with an equation of state, and `Cp` and `Cv` are both the real fluid versions. Expression is given in [1]_ and [2]_; a unit conversion is further performed to obtain...
r Calculate a real fluid s Joule Thomson coefficient. The required derivative should be calculated with an equation of state and Cp is the real fluid versions. This can either be calculated with dV_dT directly or with beta if it is already known.
def Joule_Thomson(T, V, Cp, dV_dT=None, beta=None): r'''Calculate a real fluid's Joule Thomson coefficient. The required derivative should be calculated with an equation of state, and `Cp` is the real fluid versions. This can either be calculated with `dV_dT` directly, or with `beta` if it is already ...
r Calculates the compressibility factor of a gas given its temperature pressure and molar density - form virial coefficients. Any number of coefficients is supported.
def Z_from_virial_density_form(T, P, *args): r'''Calculates the compressibility factor of a gas given its temperature, pressure, and molar density-form virial coefficients. Any number of coefficients is supported. .. math:: Z = \frac{PV}{RT} = 1 + \frac{B}{V} + \frac{C}{V^2} + \frac{D}{V^3} ...
r Calculates the compressibility factor of a gas given its pressure and pressure - form virial coefficients. Any number of coefficients is supported.
def Z_from_virial_pressure_form(P, *args): r'''Calculates the compressibility factor of a gas given its pressure, and pressure-form virial coefficients. Any number of coefficients is supported. .. math:: Z = \frac{Pv}{RT} = 1 + B'P + C'P^2 + D'P^3 + E'P^4 \dots Parameters ---------- P...
r Converts a list of mole fractions to mass fractions. Requires molecular weights for all species.
def zs_to_ws(zs, MWs): r'''Converts a list of mole fractions to mass fractions. Requires molecular weights for all species. .. math:: w_i = \frac{z_i MW_i}{MW_{avg}} MW_{avg} = \sum_i z_i MW_i Parameters ---------- zs : iterable Mole fractions [-] MWs : iterable ...
r Converts a list of mass fractions to mole fractions. Requires molecular weights for all species.
def ws_to_zs(ws, MWs): r'''Converts a list of mass fractions to mole fractions. Requires molecular weights for all species. .. math:: z_i = \frac{\frac{w_i}{MW_i}}{\sum_i \frac{w_i}{MW_i}} Parameters ---------- ws : iterable Mass fractions [-] MWs : iterable Molecul...
r Converts a list of mole fractions to volume fractions. Requires molar volumes for all species.
def zs_to_Vfs(zs, Vms): r'''Converts a list of mole fractions to volume fractions. Requires molar volumes for all species. .. math:: \text{Vf}_i = \frac{z_i V_{m,i}}{\sum_i z_i V_{m,i}} Parameters ---------- zs : iterable Mole fractions [-] VMs : iterable Molar volu...
r Converts a list of mass fractions to mole fractions. Requires molecular weights for all species.
def Vfs_to_zs(Vfs, Vms): r'''Converts a list of mass fractions to mole fractions. Requires molecular weights for all species. .. math:: z_i = \frac{\frac{\text{Vf}_i}{V_{m,i}}}{\sum_i \frac{\text{Vf}_i}{V_{m,i}}} Parameters ---------- Vfs : iterable Molar volume fractio...
r Checks inputs for suitability of use by a mixing rule which requires all inputs to be of the same length and non - None. A number of variations were attempted for this function ; this was found to be the quickest.
def none_and_length_check(all_inputs, length=None): r'''Checks inputs for suitability of use by a mixing rule which requires all inputs to be of the same length and non-None. A number of variations were attempted for this function; this was found to be the quickest. Parameters ---------- all_in...
Returns True if two arrays are element - wise equal within several different tolerances. Tolerance values are always positive usually very small. Based on numpy s allclose function. Only atols or rtols needs to be specified ; both are used if given. Parameters ---------- a b: array_like Input arrays to compare. limits:...
def allclose_variable(a, b, limits, rtols=None, atols=None): '''Returns True if two arrays are element-wise equal within several different tolerances. Tolerance values are always positive, usually very small. Based on numpy's allclose function. Only atols or rtols needs to be specified; both are u...
r Simple function to calculate PolyLog ( 2 x ) from ranges 0 < = x < = 1 with relative error guaranteed to be < 1E - 7 from 0 to 0. 99999. This is a Pade approximation with three coefficient sets with splits at 0. 7 and 0. 99. An exception is raised if x is under 0 or above 1.
def polylog2(x): r'''Simple function to calculate PolyLog(2, x) from ranges 0 <= x <= 1, with relative error guaranteed to be < 1E-7 from 0 to 0.99999. This is a Pade approximation, with three coefficient sets with splits at 0.7 and 0.99. An exception is raised if x is under 0 or above 1. Pa...
r Simple function calculates a property based on weighted averages of properties. Weights could be mole fractions volume fractions mass fractions or anything else.
def mixing_simple(fracs, props): r'''Simple function calculates a property based on weighted averages of properties. Weights could be mole fractions, volume fractions, mass fractions, or anything else. .. math:: y = \sum_i \text{frac}_i \cdot \text{prop}_i Parameters ---------- fra...
r Simple function calculates a property based on weighted averages of logarithmic properties.
def mixing_logarithmic(fracs, props): r'''Simple function calculates a property based on weighted averages of logarithmic properties. .. math:: y = \sum_i \text{frac}_i \cdot \log(\text{prop}_i) Parameters ---------- fracs : array-like Fractions of a mixture props: array-li...
r Determines which phase s property should be set as a default given the phase a chemical is and the property values of various phases. For the case of liquid - gas phase returns None. If the property is not available for the current phase or if the current phase is not known returns None.
def phase_select_property(phase=None, s=None, l=None, g=None, V_over_F=None): r'''Determines which phase's property should be set as a default, given the phase a chemical is, and the property values of various phases. For the case of liquid-gas phase, returns None. If the property is not available for t...
r Method used to select certain property methods as having a higher priority than were set by default. If forced is true then methods which were not specified are excluded from consideration.
def set_user_methods(self, user_methods, forced=False): r'''Method used to select certain property methods as having a higher priority than were set by default. If `forced` is true, then methods which were not specified are excluded from consideration. As a side effect, `method` is remo...
r Method to obtain a sorted list of methods which are valid at T according to test_method_validity. Considers either only user methods if forced is True or all methods. User methods are first tested according to their listed order and unless forced is True then all methods are tested and sorted by their order in ranked...
def select_valid_methods(self, T): r'''Method to obtain a sorted list of methods which are valid at `T` according to `test_method_validity`. Considers either only user methods if forced is True, or all methods. User methods are first tested according to their listed order, and unless for...
r Method to calculate the property with sanity checking and without specifying a specific method. select_valid_methods is used to obtain a sorted list of methods to try. Methods are then tried in order until one succeeds. The methods are allowed to fail and their results are checked with test_property_validity. On succ...
def T_dependent_property(self, T): r'''Method to calculate the property with sanity checking and without specifying a specific method. `select_valid_methods` is used to obtain a sorted list of methods to try. Methods are then tried in order until one succeeds. The methods are allowed to ...
r Method to create a plot of the property vs temperature according to either a specified list of methods or user methods ( if set ) or all methods. User - selectable number of points and temperature range. If only_valid is set test_method_validity will be used to check if each temperature in the specified range is vali...
def plot_T_dependent_property(self, Tmin=None, Tmax=None, methods=[], pts=50, only_valid=True, order=0): # pragma: no cover r'''Method to create a plot of the property vs temperature according to either a specified list of methods, or user methods (if set), or all ...
r Method to perform interpolation on a given tabular data set previously added via: obj: set_tabular_data. This method will create the interpolators the first time it is used on a property set and store them for quick future use.
def interpolate(self, T, name): r'''Method to perform interpolation on a given tabular data set previously added via :obj:`set_tabular_data`. This method will create the interpolators the first time it is used on a property set, and store them for quick future use. Interpolation...
r Method to set tabular data to be used for interpolation. Ts must be in increasing order. If no name is given data will be assigned the name Tabular data series #x where x is the number of previously added tabular data series. The name is added to all methods and iserted at the start of user methods
def set_tabular_data(self, Ts, properties, name=None, check_properties=True): r'''Method to set tabular data to be used for interpolation. Ts must be in increasing order. If no name is given, data will be assigned the name 'Tabular data series #x', where x is the number of previously add...
r Method to solve for the temperature at which a property is at a specified value. T_dependent_property is used to calculate the value of the property as a function of temperature ; if reset_method is True the best method is used at each temperature as the solver seeks a solution. This slows the solution moderately.
def solve_prop(self, goal, reset_method=True): r'''Method to solve for the temperature at which a property is at a specified value. `T_dependent_property` is used to calculate the value of the property as a function of temperature; if `reset_method` is True, the best method is used at ea...
r Method to calculate a derivative of a property with respect to temperature of a given order using a specified method. Uses SciPy s derivative function with a delta of 1E - 6 K and a number of points equal to 2 * order + 1.
def calculate_derivative(self, T, method, order=1): r'''Method to calculate a derivative of a property with respect to temperature, of a given order using a specified method. Uses SciPy's derivative function, with a delta of 1E-6 K and a number of points equal to 2*order + 1. ...
r Method to obtain a derivative of a property with respect to temperature of a given order. Methods found valid by select_valid_methods are attempted until a method succeeds. If no methods are valid and succeed None is returned.
def T_dependent_property_derivative(self, T, order=1): r'''Method to obtain a derivative of a property with respect to temperature, of a given order. Methods found valid by `select_valid_methods` are attempted until a method succeeds. If no methods are valid and succeed, None is retur...
r Method to calculate the integral of a property with respect to temperature using a specified method. Uses SciPy s quad function to perform the integral with no options. This method can be overwritten by subclasses who may perfer to add analytical methods for some or all methods as this is much faster.
def calculate_integral(self, T1, T2, method): r'''Method to calculate the integral of a property with respect to temperature, using a specified method. Uses SciPy's `quad` function to perform the integral, with no options. This method can be overwritten by subclasses who may per...
r Method to calculate the integral of a property with respect to temperature using a specified method. Methods found valid by select_valid_methods are attempted until a method succeeds. If no methods are valid and succeed None is returned. Calls calculate_integral internally to perform the actual calculation.
def T_dependent_property_integral(self, T1, T2): r'''Method to calculate the integral of a property with respect to temperature, using a specified method. Methods found valid by `select_valid_methods` are attempted until a method succeeds. If no methods are valid and succeed, None is r...
r Method to calculate the integral of a property over temperature with respect to temperature using a specified method. Uses SciPy s quad function to perform the integral with no options. This method can be overwritten by subclasses who may perfer to add analytical methods for some or all methods as this is much faster...
def calculate_integral_over_T(self, T1, T2, method): r'''Method to calculate the integral of a property over temperature with respect to temperature, using a specified method. Uses SciPy's `quad` function to perform the integral, with no options. This method can be overwritten ...
r Method to calculate the integral of a property over temperature with respect to temperature using a specified method. Methods found valid by select_valid_methods are attempted until a method succeeds. If no methods are valid and succeed None is returned. Calls calculate_integral_over_T internally to perform the actua...
def T_dependent_property_integral_over_T(self, T1, T2): r'''Method to calculate the integral of a property over temperature with respect to temperature, using a specified method. Methods found valid by `select_valid_methods` are attempted until a method succeeds. If no methods are vali...
r Method to load all data and set all_methods based on the available data and properties. Demo function for testing only ; must be implemented according to the methods available for each individual method.
def load_all_methods(self): r'''Method to load all data, and set all_methods based on the available data and properties. Demo function for testing only; must be implemented according to the methods available for each individual method. ''' methods = [] Tmins, Tmax...
r Method to calculate a property with a specified method with no validity checking or error handling. Demo function for testing only ; must be implemented according to the methods available for each individual method. Include the interpolation call here.
def calculate(self, T, method): r'''Method to calculate a property with a specified method, with no validity checking or error handling. Demo function for testing only; must be implemented according to the methods available for each individual method. Include the interpolation call here....
r Method to set the pressure - dependent property methods desired for consideration by the user. Can be used to exclude certain methods which might have unacceptable accuracy.
def set_user_methods_P(self, user_methods_P, forced_P=False): r'''Method to set the pressure-dependent property methods desired for consideration by the user. Can be used to exclude certain methods which might have unacceptable accuracy. As a side effect, the previously selected method ...
r Method to obtain a sorted list methods which are valid at T according to test_method_validity. Considers either only user methods if forced is True or all methods. User methods are first tested according to their listed order and unless forced is True then all methods are tested and sorted by their order in ranked_me...
def select_valid_methods_P(self, T, P): r'''Method to obtain a sorted list methods which are valid at `T` according to `test_method_validity`. Considers either only user methods if forced is True, or all methods. User methods are first tested according to their listed order, and unless f...
r Method to calculate the property with sanity checking and without specifying a specific method. select_valid_methods_P is used to obtain a sorted list of methods to try. Methods are then tried in order until one succeeds. The methods are allowed to fail and their results are checked with test_property_validity. On su...
def TP_dependent_property(self, T, P): r'''Method to calculate the property with sanity checking and without specifying a specific method. `select_valid_methods_P` is used to obtain a sorted list of methods to try. Methods are then tried in order until one succeeds. The methods are allow...
r Method to set tabular data to be used for interpolation. Ts and Psmust be in increasing order. If no name is given data will be assigned the name Tabular data series #x where x is the number of previously added tabular data series. The name is added to all methods and is inserted at the start of user methods
def set_tabular_data_P(self, Ts, Ps, properties, name=None, check_properties=True): r'''Method to set tabular data to be used for interpolation. Ts and Psmust be in increasing order. If no name is given, data will be assigned the name 'Tabular data series #x', where x is the number of pr...
r Method to perform interpolation on a given tabular data set previously added via set_tabular_data_P. This method will create the interpolators the first time it is used on a property set and store them for quick future use.
def interpolate_P(self, T, P, name): r'''Method to perform interpolation on a given tabular data set previously added via `set_tabular_data_P`. This method will create the interpolators the first time it is used on a property set, and store them for quick future use. Interpolati...
r Method to create a plot of the property vs pressure at a specified temperature according to either a specified list of methods or the user methods ( if set ) or all methods. User - selectable number of points and pressure range. If only_valid is set test_method_validity_P will be used to check if each condition in th...
def plot_isotherm(self, T, Pmin=None, Pmax=None, methods_P=[], pts=50, only_valid=True): # pragma: no cover r'''Method to create a plot of the property vs pressure at a specified temperature according to either a specified list of methods, or the user methods (if set), or...
r Method to create a plot of the property vs temperature at a specific pressure according to either a specified list of methods or user methods ( if set ) or all methods. User - selectable number of points and temperature range. If only_valid is set test_method_validity_P will be used to check if each condition in the ...
def plot_isobar(self, P, Tmin=None, Tmax=None, methods_P=[], pts=50, only_valid=True): # pragma: no cover r'''Method to create a plot of the property vs temperature at a specific pressure according to either a specified list of methods, or user methods (if set), or all ...
r Method to create a plot of the property vs temperature and pressure according to either a specified list of methods or user methods ( if set ) or all methods. User - selectable number of points for each variable. If only_valid is set test_method_validity_P will be used to check if each condition in the specified rang...
def plot_TP_dependent_property(self, Tmin=None, Tmax=None, Pmin=None, Pmax=None, methods_P=[], pts=15, only_valid=True): # pragma: no cover r'''Method to create a plot of the property vs temperature and pressure according to eithe...
r Method to calculate a derivative of a temperature and pressure dependent property with respect to temperature at constant pressure of a given order using a specified method. Uses SciPy s derivative function with a delta of 1E - 6 K and a number of points equal to 2 * order + 1.
def calculate_derivative_T(self, T, P, method, order=1): r'''Method to calculate a derivative of a temperature and pressure dependent property with respect to temperature at constant pressure, of a given order using a specified method. Uses SciPy's derivative function, with a delta o...
r Method to calculate a derivative of a temperature and pressure dependent property with respect to pressure at constant temperature of a given order using a specified method. Uses SciPy s derivative function with a delta of 0. 01 Pa and a number of points equal to 2 * order + 1.
def calculate_derivative_P(self, P, T, method, order=1): r'''Method to calculate a derivative of a temperature and pressure dependent property with respect to pressure at constant temperature, of a given order using a specified method. Uses SciPy's derivative function, with a delta of 0...
r Method to calculate a derivative of a temperature and pressure dependent property with respect to temperature at constant pressure of a given order. Methods found valid by select_valid_methods_P are attempted until a method succeeds. If no methods are valid and succeed None is returned.
def TP_dependent_property_derivative_T(self, T, P, order=1): r'''Method to calculate a derivative of a temperature and pressure dependent property with respect to temperature at constant pressure, of a given order. Methods found valid by `select_valid_methods_P` are attempted until a me...
r Method to calculate a derivative of a temperature and pressure dependent property with respect to pressure at constant temperature of a given order. Methods found valid by select_valid_methods_P are attempted until a method succeeds. If no methods are valid and succeed None is returned.
def TP_dependent_property_derivative_P(self, T, P, order=1): r'''Method to calculate a derivative of a temperature and pressure dependent property with respect to pressure at constant temperature, of a given order. Methods found valid by `select_valid_methods_P` are attempted until a me...
r Method to set the T P and composition dependent property methods desired for consideration by the user. Can be used to exclude certain methods which might have unacceptable accuracy.
def set_user_method(self, user_methods, forced=False): r'''Method to set the T, P, and composition dependent property methods desired for consideration by the user. Can be used to exclude certain methods which might have unacceptable accuracy. As a side effect, the previously selected...
r Method to calculate the property with sanity checking and without specifying a specific method. select_valid_methods is used to obtain a sorted list of methods to try. Methods are then tried in order until one succeeds. The methods are allowed to fail and their results are checked with test_property_validity. On succ...
def mixture_property(self, T, P, zs, ws): r'''Method to calculate the property with sanity checking and without specifying a specific method. `select_valid_methods` is used to obtain a sorted list of methods to try. Methods are then tried in order until one succeeds. The methods are allo...