Search is not available for this dataset
text stringlengths 75 104k |
|---|
def K_value(P=None, Psat=None, phi_l=None, phi_g=None, gamma=None, Poynting=1):
r'''Calculates the equilibrium K-value assuming Raoult's law,
or an equation of state model, or an activity coefficient model,
or a combined equation of state-activity model.
The calculation procedure will use the most adva... |
def Rachford_Rice_flash_error(V_over_F, zs, Ks):
r'''Calculates the objective function of the Rachford-Rice flash equation.
This function should be called by a solver seeking a solution to a flash
calculation. The unknown variable is `V_over_F`, for which a solution
must be between 0 and 1.
.. math... |
def Rachford_Rice_solution(zs, Ks):
r'''Solves the objective function of the Rachford-Rice flash equation.
Uses the method proposed in [2]_ to obtain an initial guess.
.. math::
\sum_i \frac{z_i(K_i-1)}{1 + \frac{V}{F}(K_i-1)} = 0
Parameters
----------
zs : list[float]
Overall ... |
def Li_Johns_Ahmadi_solution(zs, Ks):
r'''Solves the objective function of the Li-Johns-Ahmadi flash equation.
Uses the method proposed in [1]_ to obtain an initial guess.
.. math::
0 = 1 + \left(\frac{K_{max}-K_{min}}{K_{min}-1}\right)x_1
+ \sum_{i=2}^{n-1}\frac{K_i-K_{min}}{K_{min}-1}\lef... |
def flash_inner_loop(zs, Ks, AvailableMethods=False, Method=None):
r'''This function handles the solution of the inner loop of a flash
calculation, solving for liquid and gas mole fractions and vapor fraction
based on specified overall mole fractions and K values. As K values are
weak functions of compo... |
def NRTL(xs, taus, alphas):
r'''Calculates the activity coefficients of each species in a mixture
using the Non-Random Two-Liquid (NRTL) method, given their mole fractions,
dimensionless interaction parameters, and nonrandomness constants. Those
are normally correlated with temperature in some form, and... |
def Wilson(xs, params):
r'''Calculates the activity coefficients of each species in a mixture
using the Wilson method, given their mole fractions, and
dimensionless interaction parameters. Those are normally correlated with
temperature, and need to be calculated separately.
.. math::
\ln \g... |
def UNIQUAC(xs, rs, qs, taus):
r'''Calculates the activity coefficients of each species in a mixture
using the Universal quasi-chemical (UNIQUAC) equation, given their mole
fractions, `rs`, `qs`, and dimensionless interaction parameters. The
interaction parameters are normally correlated with temperatur... |
def bubble_at_T(zs, Psats, fugacities=None, gammas=None):
'''
>>> bubble_at_T([0.5, 0.5], [1400, 7000])
4200.0
>>> bubble_at_T([0.5, 0.5], [1400, 7000], gammas=[1.1, .75])
3395.0
>>> bubble_at_T([0.5, 0.5], [1400, 7000], gammas=[1.1, .75], fugacities=[.995, 0.98])
3452.440775305097
'''
... |
def identify_phase(T, P, Tm=None, Tb=None, Tc=None, Psat=None):
r'''Determines the phase of a one-species chemical system according to
basic rules, using whatever information is available. Considers only the
phases liquid, solid, and gas; does not consider two-phase
scenarios, as should occurs between p... |
def identify_phase_mixture(T=None, P=None, zs=None, Tcs=None, Pcs=None,
Psats=None, CASRNs=None,
AvailableMethods=False, Method=None): # pragma: no cover
'''
>>> identify_phase_mixture(T=280, P=5000., zs=[0.5, 0.5], Psats=[1400, 7000])
('l', [0.5, 0.5],... |
def Pbubble_mixture(T=None, zs=None, Psats=None, CASRNs=None,
AvailableMethods=False, Method=None): # pragma: no cover
'''
>>> Pbubble_mixture(zs=[0.5, 0.5], Psats=[1400, 7000])
4200.0
'''
def list_methods():
methods = []
if none_and_length_check((Psats, zs)):
... |
def bubble_at_P(P, zs, vapor_pressure_eqns, fugacities=None, gammas=None):
'''Calculates bubble point for a given pressure
Parameters
----------
P : float
Pressure, [Pa]
zs : list[float]
Overall mole fractions of all species, [-]
vapor_pressure_eqns : list[functions]
Tem... |
def Pdew_mixture(T=None, zs=None, Psats=None, CASRNs=None,
AvailableMethods=False, Method=None): # pragma: no cover
'''
>>> Pdew_mixture(zs=[0.5, 0.5], Psats=[1400, 7000])
2333.3333333333335
'''
def list_methods():
methods = []
if none_and_length_check((Psats, zs)):... |
def draw_2d(self, width=300, height=300, Hs=False): # pragma: no cover
r'''Interface for drawing a 2D image of the molecule.
Requires an HTML5 browser, and the libraries RDKit and
IPython. An exception is raised if either of these libraries is
absent.
Parameters
--------... |
def draw_3d(self, width=300, height=500, style='stick', Hs=True): # pragma: no cover
r'''Interface for drawing an interactive 3D view of the molecule.
Requires an HTML5 browser, and the libraries RDKit, pymol3D, and
IPython. An exception is raised if all three of these libraries are
not ... |
def Um(self):
r'''Internal energy of the chemical at its current temperature and
pressure, in units of [J/mol].
This property requires that :obj:`thermo.chemical.set_thermo` ran
successfully to be accurate.
It also depends on the molar volume of the chemical at its current
... |
def Am(self):
r'''Helmholtz energy of the chemical at its current temperature and
pressure, in units of [J/mol].
This property requires that :obj:`thermo.chemical.set_thermo` ran
successfully to be accurate.
It also depends on the molar volume of the chemical at its current
... |
def A(self):
r'''Helmholtz energy of the chemical at its current temperature and
pressure, in units of [J/kg].
This property requires that :obj:`thermo.chemical.set_thermo` ran
successfully to be accurate.
It also depends on the molar volume of the chemical at its current
... |
def charge(self):
r'''Charge of a chemical, computed with RDKit from a chemical's SMILES.
If RDKit is not available, holds None.
Examples
--------
>>> Chemical('sodium ion').charge
1
'''
try:
if not self.rdkitmol:
return charge... |
def rdkitmol(self):
r'''RDKit object of the chemical, without hydrogen. If RDKit is not
available, holds None.
For examples of what can be done with RDKit, see
`their website <http://www.rdkit.org/docs/GettingStartedInPython.html>`_.
'''
if self.__rdkitmol:
r... |
def rdkitmol_Hs(self):
r'''RDKit object of the chemical, with hydrogen. If RDKit is not
available, holds None.
For examples of what can be done with RDKit, see
`their website <http://www.rdkit.org/docs/GettingStartedInPython.html>`_.
'''
if self.__rdkitmol_Hs:
... |
def Hill(self):
r'''Hill formula of a compound. For a description of the Hill system,
see :obj:`thermo.elements.atoms_to_Hill`.
Examples
--------
>>> Chemical('furfuryl alcohol').Hill
'C5H6O2'
'''
if self.__Hill:
return self.__Hill
els... |
def atom_fractions(self):
r'''Dictionary of atom:fractional occurence of the elements in a
chemical. Useful when performing element balances. For mass-fraction
occurences, see :obj:`mass_fractions`.
Examples
--------
>>> Chemical('Ammonium aluminium sulfate').atom_fracti... |
def mass_fractions(self):
r'''Dictionary of atom:mass-weighted fractional occurence of elements.
Useful when performing mass balances. For atom-fraction occurences, see
:obj:`atom_fractions`.
Examples
--------
>>> Chemical('water').mass_fractions
{'H': 0.11189834... |
def legal_status(self):
r'''Dictionary of legal status indicators for the chemical.
Examples
--------
>>> pprint(Chemical('benzene').legal_status)
{'DSL': 'LISTED',
'EINECS': 'LISTED',
'NLP': 'UNLISTED',
'SPIN': 'LISTED',
'TSCA': 'LISTED'}
... |
def economic_status(self):
r'''Dictionary of economic status indicators for the chemical.
Examples
--------
>>> pprint(Chemical('benzene').economic_status)
["US public: {'Manufactured': 6165232.1, 'Imported': 463146.474, 'Exported': 271908.252}",
u'1,000,000 - 10,000,00... |
def UNIFAC_groups(self):
r'''Dictionary of UNIFAC subgroup: count groups for the original
UNIFAC subgroups, as determined by `DDBST's online service <http://www.ddbst.com/unifacga.html>`_.
Examples
--------
>>> pprint(Chemical('Cumene').UNIFAC_groups)
{1: 2, 9: 5, 13: 1}... |
def UNIFAC_Dortmund_groups(self):
r'''Dictionary of Dortmund UNIFAC subgroup: count groups for the
Dortmund UNIFAC subgroups, as determined by `DDBST's online service <http://www.ddbst.com/unifacga.html>`_.
Examples
--------
>>> pprint(Chemical('Cumene').UNIFAC_Dortmund_groups)
... |
def PSRK_groups(self):
r'''Dictionary of PSRK subgroup: count groups for the PSRK subgroups,
as determined by `DDBST's online service <http://www.ddbst.com/unifacga.html>`_.
Examples
--------
>>> pprint(Chemical('Cumene').PSRK_groups)
{1: 2, 9: 5, 13: 1}
'''
... |
def Hvap(self):
r'''Enthalpy of vaporization of the chemical at its current temperature,
in units of [J/kg].
This property uses the object-oriented interface
:obj:`thermo.phase_change.EnthalpyVaporization`, but converts its
results from molar to mass units.
Examples
... |
def Cps(self):
r'''Solid-phase heat capacity of the chemical at its current temperature,
in units of [J/kg/K]. 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:`thermo... |
def Cpl(self):
r'''Liquid-phase heat capacity of the chemical at its current temperature,
in units of [J/kg/K]. 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:`therm... |
def Cpg(self):
r'''Gas-phase heat capacity of the chemical at its current temperature,
in units of [J/kg/K]. 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:`thermo.h... |
def Cvgm(self):
r'''Gas-phase ideal-gas contant-volume heat capacity of the chemical at
its current temperature, 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
--------
... |
def Cvg(self):
r'''Gas-phase ideal-gas contant-volume heat capacity of the chemical at
its current temperature, in units of [J/kg/K]. Subtracts R from
the ideal-gas heat capacity; does not include pressure-compensation
from an equation of state.
Examples
--------
... |
def isentropic_exponent(self):
r'''Gas-phase ideal-gas isentropic exponent of the chemical at its
current temperature, [dimensionless]. Does not include
pressure-compensation from an equation of state.
Examples
--------
>>> Chemical('hydrogen').isentropic_exponent
... |
def rhos(self):
r'''Solid-phase mass density of the chemical at its current temperature,
in units of [kg/m^3]. 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:`thermo... |
def rhol(self):
r'''Liquid-phase mass density of the chemical at its current
temperature and pressure, in units of [kg/m^3]. For calculation of this
property at other temperatures and pressures, or specifying manually
the method used to calculate it, and more - see the object oriented
... |
def rhog(self):
r'''Gas-phase mass density of the chemical at its current temperature
and pressure, in units of [kg/m^3]. For calculation of this property at
other temperatures or pressures, or specifying manually the method used
to calculate it, and more - see the object oriented interf... |
def Zs(self):
r'''Compressibility factor of the chemical in the solid phase at the
current temperature and pressure, [dimensionless].
Utilizes the object oriented interface and
:obj:`thermo.volume.VolumeSolid` to perform the actual calculation of
molar volume.
Examples
... |
def Zl(self):
r'''Compressibility factor of the chemical in the liquid phase at the
current temperature and pressure, [dimensionless].
Utilizes the object oriented interface and
:obj:`thermo.volume.VolumeLiquid` to perform the actual calculation of
molar volume.
Example... |
def Zg(self):
r'''Compressibility factor of the chemical in the gas phase at the
current temperature and pressure, [dimensionless].
Utilizes the object oriented interface and
:obj:`thermo.volume.VolumeGas` to perform the actual calculation of
molar volume.
Examples
... |
def SGg(self):
r'''Specific gravity of the gas phase of the chemical, [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 chemical both at the reference
... |
def API(self):
r'''API gravity of the liquid phase of the chemical, [degrees].
The reference condition is water at 15.6 °C (60 °F) and 1 atm
(rho=999.016 kg/m^3, standardized).
Examples
--------
>>> Chemical('water').API
9.999752435378895
'''... |
def Bvirial(self):
r'''Second virial coefficient of the gas phase of the chemical at its
current temperature and pressure, in units of [mol/m^3].
This property uses the object-oriented interface
:obj:`thermo.volume.VolumeGas`, converting its result with
:obj:`thermo.utils.B_from... |
def isobaric_expansion_l(self):
r'''Isobaric (constant-pressure) expansion of the liquid phase of the
chemical at its current temperature and pressure, in units of [1/K].
.. math::
\beta = \frac{1}{V}\left(\frac{\partial V}{\partial T} \right)_P
Utilizes the temperature-der... |
def isobaric_expansion_g(self):
r'''Isobaric (constant-pressure) expansion of the gas phase of the
chemical at its current temperature and pressure, in units of [1/K].
.. math::
\beta = \frac{1}{V}\left(\frac{\partial V}{\partial T} \right)_P
Utilizes the temperature-deriva... |
def JTl(self):
r'''Joule Thomson coefficient of the chemical in the liquid phase at
its current temperature and pressure, in units of [K/Pa].
.. math::
\mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
\left[T \left(\frac{\partial V}{\partial T}\rig... |
def JTg(self):
r'''Joule Thomson coefficient of the chemical in the gas phase at
its current temperature and pressure, in units of [K/Pa].
.. math::
\mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
\left[T \left(\frac{\partial V}{\partial T}\right)... |
def nul(self):
r'''Kinematic viscosity of the liquid phase of the chemical at its
current temperature and pressure, in units of [m^2/s].
.. math::
\nu = \frac{\mu}{\rho}
Utilizes the temperature and pressure dependent object oriented
interfaces :obj:`thermo.volume.V... |
def nug(self):
r'''Kinematic viscosity of the gas phase of the chemical at its
current temperature and pressure, in units of [m^2/s].
.. math::
\nu = \frac{\mu}{\rho}
Utilizes the temperature and pressure dependent object oriented
interfaces :obj:`thermo.volume.Volu... |
def alphal(self):
r'''Thermal diffusivity of the liquid phase of the chemical at its
current temperature and pressure, in units of [m^2/s].
.. math::
\alpha = \frac{k}{\rho Cp}
Utilizes the temperature and pressure dependent object oriented
interfaces :obj:`thermo.v... |
def alphag(self):
r'''Thermal diffusivity of the gas phase of the chemical at its
current temperature and pressure, in units of [m^2/s].
.. math::
\alpha = \frac{k}{\rho Cp}
Utilizes the temperature and pressure dependent object oriented
interfaces :obj:`thermo.volu... |
def Prl(self):
r'''Prandtl number of the liquid phase of the chemical at its
current temperature and pressure, [dimensionless].
.. math::
Pr = \frac{C_p \mu}{k}
Utilizes the temperature and pressure dependent object oriented
interfaces :obj:`thermo.viscosity.Viscosi... |
def Prg(self):
r'''Prandtl number of the gas phase of the chemical at its
current temperature and pressure, [dimensionless].
.. math::
Pr = \frac{C_p \mu}{k}
Utilizes the temperature and pressure dependent object oriented
interfaces :obj:`thermo.viscosity.ViscosityG... |
def solubility_parameter(self):
r'''Solubility parameter of the chemical at its
current temperature and pressure, in units of [Pa^0.5].
.. math::
\delta = \sqrt{\frac{\Delta H_{vap} - RT}{V_m}}
Calculated based on enthalpy of vaporization and molar volume.
Normally ... |
def Parachor(self):
r'''Parachor of the chemical at its
current temperature and pressure, in units of [N^0.25*m^2.75/mol].
.. math::
P = \frac{\sigma^{0.25} MW}{\rho_L - \rho_V}
Calculated based on surface tension, density of the liquid and gas
phase, and molecular ... |
def Cp(self):
r'''Mass heat capacity of the chemical at its current phase and
temperature, in units of [J/kg/K].
Utilizes the object oriented interfaces
:obj:`thermo.heat_capacity.HeatCapacitySolid`,
:obj:`thermo.heat_capacity.HeatCapacityLiquid`,
and :obj:`thermo.heat_c... |
def Cpm(self):
r'''Molar heat capacity of the chemical at its current phase and
temperature, in units of [J/mol/K].
Utilizes the object oriented interfaces
:obj:`thermo.heat_capacity.HeatCapacitySolid`,
:obj:`thermo.heat_capacity.HeatCapacityLiquid`,
and :obj:`thermo.hea... |
def Vm(self):
r'''Molar volume of the chemical at its current phase and
temperature and pressure, in units of [m^3/mol].
Utilizes the object oriented interfaces
:obj:`thermo.volume.VolumeSolid`,
:obj:`thermo.volume.VolumeLiquid`,
and :obj:`thermo.volume.VolumeGas` to per... |
def rho(self):
r'''Mass density of the chemical at its current phase and
temperature and pressure, in units of [kg/m^3].
Utilizes the object oriented interfaces
:obj:`thermo.volume.VolumeSolid`,
:obj:`thermo.volume.VolumeLiquid`,
and :obj:`thermo.volume.VolumeGas` to per... |
def Z(self):
r'''Compressibility factor of the chemical at its current phase and
temperature and pressure, [dimensionless].
Examples
--------
>>> Chemical('MTBE', T=900, P=1E-2).Z
0.9999999999079768
'''
Vm = self.Vm
if Vm:
return Z(sel... |
def SG(self):
r'''Specific gravity of the chemical, [dimensionless].
For gas-phase conditions, this is calculated at 15.6 °C (60 °F) and 1
atm for the chemical and the reference fluid, air.
For liquid and solid phase conditions, this is calculated based on a
referenc... |
def isobaric_expansion(self):
r'''Isobaric (constant-pressure) expansion of the chemical at its
current phase and temperature, in units of [1/K].
.. math::
\beta = \frac{1}{V}\left(\frac{\partial V}{\partial T} \right)_P
Examples
--------
Radical change in ... |
def JT(self):
r'''Joule Thomson coefficient of the chemical at its
current phase and temperature, in units of [K/Pa].
.. math::
\mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
\left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
... |
def mu(self):
r'''Viscosity of the chemical at its current phase, temperature, and
pressure in units of [Pa*s].
Utilizes the object oriented interfaces
:obj:`thermo.viscosity.ViscosityLiquid` and
:obj:`thermo.viscosity.ViscosityGas` to perform the
actual calculation of e... |
def k(self):
r'''Thermal conductivity of the chemical at its current phase,
temperature, and pressure in units of [W/m/K].
Utilizes the object oriented interfaces
:obj:`thermo.thermal_conductivity.ThermalConductivityLiquid` and
:obj:`thermo.thermal_conductivity.ThermalConductivi... |
def nu(self):
r'''Kinematic viscosity of the the chemical at its current temperature,
pressure, and phase in units of [m^2/s].
.. math::
\nu = \frac{\mu}{\rho}
Examples
--------
>>> Chemical('argon').nu
1.3846930410865003e-05
'''
retu... |
def alpha(self):
r'''Thermal diffusivity of the chemical at its current temperature,
pressure, and phase in units of [m^2/s].
.. math::
\alpha = \frac{k}{\rho Cp}
Examples
--------
>>> Chemical('furfural').alpha
8.696537158635412e-08
'''
... |
def Pr(self):
r'''Prandtl number of the chemical at its current temperature,
pressure, and phase; [dimensionless].
.. math::
Pr = \frac{C_p \mu}{k}
Examples
--------
>>> Chemical('acetone').Pr
4.183039103542709
'''
return phase_select... |
def Poynting(self):
r'''Poynting correction factor [dimensionless] for use in phase
equilibria methods based on activity coefficients or other reference
states. Performs the shortcut calculation assuming molar volume is
independent of pressure.
.. math::
\text{Poy... |
def ITS90_68_difference(T):
r'''Calculates the difference between ITS-90 and ITS-68 scales using a
series of models listed in [1]_, [2]_, and [3]_.
The temperature difference is given by the following equations:
From 13.8 K to 73.15 K:
.. math::
T_{90} - T_{68} = a_0 + \sum_{i=1}^{12} a_i... |
def T_converter(T, current, desired):
r'''Converts the a temperature reading made in any of the scales
'ITS-90', 'ITS-68','ITS-48', 'ITS-76', or 'ITS-27' to any of the other
scales. Not all temperature ranges can be converted to other ranges; for
instance, 'ITS-76' is purely for low temperatures, and 5 ... |
def GWP(CASRN, AvailableMethods=False, Method=None):
r'''This function handles the retrieval of a chemical's Global Warming
Potential, relative to CO2. 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.
Retu... |
def ODP(CASRN, AvailableMethods=False, Method=None):
r'''This function handles the retrieval of a chemical's Ozone Depletion
Potential, relative to CFC-11 (trichlorofluoromethane). Lookup is based on
CASRNs. Will automatically select a data source to use if no Method is
provided; returns None if the dat... |
def logP(CASRN, AvailableMethods=False, Method=None):
r'''This function handles the retrieval of a chemical's octanol-water
partition coefficient. 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.
Parameter... |
def Antoine(T, A, B, C, base=10.0):
r'''Calculates vapor pressure of a chemical using the Antoine equation.
Parameters `A`, `B`, and `C` are chemical-dependent. Parameters can be
found in numerous sources; however units of the coefficients used vary.
Originally proposed by Antoine (1888) [2]_.
.. ... |
def TRC_Antoine_extended(T, Tc, to, A, B, C, n, E, F):
r'''Calculates vapor pressure of a chemical using the TRC Extended Antoine
equation. Parameters are chemical dependent, and said to be from the
Thermodynamics Research Center (TRC) at Texas A&M. Coefficients for various
chemicals can be found in [1... |
def Wagner_original(T, Tc, Pc, a, b, c, d):
r'''Calculates vapor pressure using the Wagner equation (3, 6 form).
Requires critical temperature and pressure as well as four coefficients
specific to each chemical.
.. math::
\ln P^{sat}= \ln P_c + \frac{a\tau + b \tau^{1.5} + c\tau^3 + d\tau^6}
... |
def boiling_critical_relation(T, Tb, Tc, Pc):
r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
CSP relationship as in [1]_; requires a chemical's critical temperature
and pressure as well as boiling point.
The vapor pressure is given by:
.. math::
\ln P^{sat}_r = ... |
def Lee_Kesler(T, Tc, Pc, omega):
r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
CSP relationship by [1]_; requires a chemical's critical temperature and
acentric factor.
The vapor pressure is given by:
.. math::
\ln P^{sat}_r = f^{(0)} + \omega f^{(1)}
... |
def Ambrose_Walton(T, Tc, Pc, omega):
r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
CSP relationship by [1]_; requires a chemical's critical temperature and
acentric factor.
The vapor pressure is given by:
.. math::
\ln P_r=f^{(0)}+\omega f^{(1)}+\omega^2f^{(2)... |
def Sanjari(T, Tc, Pc, omega):
r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
CSP relationship by [1]_. Requires a chemical's critical temperature,
pressure, and acentric factor. Although developed for refrigerants,
this model should have some general predictive ability.
... |
def Edalat(T, Tc, Pc, omega):
r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
CSP relationship by [1]_. Requires a chemical's critical temperature,
pressure, and acentric factor. Claimed to have a higher accuracy than the
Lee-Kesler CSP relationship.
The vapor pressure of... |
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`,
and :obj:`all_methods` as a set of methods for which t... |
def calculate(self, T, method):
r'''Method to calculate vapor pressure of a fluid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at calcu... |
def TWU_a_alpha_common(T, Tc, omega, a, full=True, quick=True, method='PR'):
r'''Function to calculate `a_alpha` and optionally its first and second
derivatives for the TWUPR or TWUSRK EOS. Returns 'a_alpha', and
optionally 'da_alpha_dT' and 'd2a_alpha_dT2'.
Used by `TWUPR` and `TWUSRK`; has little pur... |
def check_sufficient_inputs(self):
'''Method to an exception if none of the pairs (T, P), (T, V), or
(P, V) are given. '''
if not ((self.T and self.P) or (self.T and self.V) or (self.P and self.V)):
raise Exception('Either T and P, or T and V, or P and V are required') |
def solve(self):
'''First EOS-generic method; should be called by all specific EOSs.
For solving for `T`, the EOS must provide the method `solve_T`.
For all cases, the EOS must provide `a_alpha_and_derivatives`.
Calls `set_from_PT` once done.
'''
self.check_sufficient_inp... |
def set_from_PT(self, Vs):
'''Counts the number of real volumes in `Vs`, and determines what to do.
If there is only one real volume, the method
`set_properties_from_solution` is called with it. If there are
two real volumes, `set_properties_from_solution` is called once with
... |
def set_properties_from_solution(self, T, P, V, b, delta, epsilon, a_alpha,
da_alpha_dT, d2a_alpha_dT2, quick=True):
r'''Sets all interesting properties which can be calculated from an
EOS alone. Determines which phase the fluid is on its own; for details,
s... |
def solve_T(self, P, V, quick=True):
'''Generic method to calculate `T` from a specified `P` and `V`.
Provides SciPy's `newton` solver, and iterates to solve the general
equation for `P`, recalculating `a_alpha` as a function of temperature
using `a_alpha_and_derivatives` each iteration.... |
def volume_solutions(T, P, b, delta, epsilon, a_alpha, quick=True):
r'''Solution of this form of the cubic EOS in terms of volumes. Returns
three values, all with some complex part.
Parameters
----------
T : float
Temperature, [K]
P : float
Pres... |
def Psat(self, T, polish=False):
r'''Generic method to calculate vapor pressure for a specified `T`.
From Tc to 0.32Tc, uses a 10th order polynomial of the following form:
.. math::
\ln\frac{P_r}{T_r} = \sum_{k=0}^{10} C_k\left(\frac{\alpha}{T_r}
-1\righ... |
def dPsat_dT(self, T):
r'''Generic method to calculate the temperature derivative of vapor
pressure for a specified `T`. Implements the analytical derivative
of the two polynomials described in `Psat`.
As with `Psat`, results above the critical temperature are meaningless.
... |
def V_l_sat(self, T):
r'''Method to calculate molar volume of the liquid phase along the
saturation line.
Parameters
----------
T : float
Temperature, [K]
Returns
-------
V_l_sat : float
Liquid molar volume along the satur... |
def V_g_sat(self, T):
r'''Method to calculate molar volume of the vapor phase along the
saturation line.
Parameters
----------
T : float
Temperature, [K]
Returns
-------
V_g_sat : float
Gas molar volume along the saturatio... |
def Hvap(self, T):
r'''Method to calculate enthalpy of vaporization for a pure fluid from
an equation of state, without iteration.
.. math::
\frac{dP^{sat}}{dT}=\frac{\Delta H_{vap}}{T(V_g - V_l)}
Results above the critical temperature are meaningless. A fir... |
def Heyen(self, T, full=True, quick=True):
r'''Method to calculate `a_alpha` and its first and second
derivatives according to Heyen (1980) [1]_. Returns `a_alpha`, `da_alpha_dT`,
and `d2a_alpha_dT2`. See `GCEOS.a_alpha_and_derivatives` for more
documentation. Two coefficients needed.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.