Utilities and Base Classes (thermo.utils)¶
This module contains base classes for temperature T, pressure P, and composition zs dependent properties. These power the various interfaces for each property.
For reporting bugs, adding feature requests, or submitting pull requests, please use the GitHub issue tracker.
Temperature Dependent¶
- class thermo.utils.TDependentProperty(extrapolation, **kwargs)[source]¶
Class for calculating temperature-dependent chemical properties.
On creation, a
TDependentProperty
examines all the possible methods implemented for calculating the property, loads whichever coefficients it needs (unless load_data is set to False), examines its input parameters, and selects the method it prefers. This method will continue to be used for all calculations until the method is changed by setting a new method to the tomethod
attribute.The default list of preferred method orderings is at
ranked_methods
for all properties; the order can be modified there in-place, and this will take effect on all newTDependentProperty
instances created but NOT on existing instances.All methods have defined criteria for determining if they are valid before calculation, i.e. a minimum and maximum temperature for coefficients to be valid. For constant property values used due to lack of temperature-dependent data, a short range is normally specified as valid.
It is not assumed that a specified method will succeed; for example many expressions are not mathematically valid past the critical point, and in some cases there is no easy way to determine the temperature where a property stops being reasonable.
Accordingly, all properties calculated are checked by a sanity function
test_property_validity
, which has basic sanity checks. If the property is not reasonable, None is returned.This framework also supports tabular data, which is interpolated from if specified. Interpolation is cubic-spline based if 5 or more points are given, and linearly interpolated with if few points are given. A transform may be applied so that a property such as vapor pressure can be interpolated non-linearly. These are functions or lambda expressions which are set for the variables
interpolation_T
,interpolation_property
, andinterpolation_property_inv
.In order to calculate properties outside of the range of their correlations, a number of extrapolation method are available. Extrapolation is used by default on some properties but not all. The extrapolation methods available are as follows:
‘constant’ - returns the model values as calculated at the temperature limits
‘linear’ - fits the model at its temperature limits to a linear model
‘nolimit’ - attempt to evaluate the model outside of its limits; this will error in most cases and return None
‘interp1d’ - SciPy’s
interp1d
is used to extrapolate‘AntoineAB’ - fits the model to
Antoine
’s equation at the temperature limits using only the A and B coefficient‘DIPPR101_ABC’ - fits the model at its temperature limits to the
EQ101
equation‘Watson’ - fits the model to the Heat of Vaporization model
Watson
‘EXP_POLY_LN_TAU2’ - uses the models’s critical temperature and derivative to fit the model linearly in the equation $\text{prop} = \exp(a + b\cdot\ln\tau)$, so that it is always zero at the critical point; suitable for surface tension.
‘DIPPR106_AB’ - uses the models’s critical temperature and derivative to fit the model linearly in the equation
EQ106
’s equation at the temperature limits using only the A and B coefficient‘DIPPR106_ABC’ - uses the models’s critical temperature and first two derivatives to fit the model quadratically in the equation
EQ106
’s equation at the temperature limits using only the A, B, and C coefficient.
It is possible to use different extrapolation methods for the low-temperature and the high-temperature region. Specify the extrapolation parameter with the ‘|’ symbols between the two methods; the first method is used for low-temperature, and the second for the high-temperature.
- Attributes
- name
str
The name of the property being calculated, [-]
- units
str
The units of the property, [-]
method
str
Method used to set a specific property method or to obtain the name of the method in use.
- interpolation_T
callable
orNone
A function or lambda expression to transform the temperatures of tabular data for interpolation; e.g. ‘lambda self, T: 1./T’
- interpolation_T_inv
callable
orNone
A function or lambda expression to invert the transform of temperatures of tabular data for interpolation; e.g. ‘lambda self, x: self.Tc*(1 - x)’
- interpolation_property
callable
orNone
A function or lambda expression to transform tabular property values prior to interpolation; e.g. ‘lambda self, P: log(P)’
- interpolation_property_inv
callable
orNone
A function or property expression to transform interpolated property values from the transform performed by
interpolation_property
back to their actual form, e.g. ‘lambda self, P: exp(P)’Tmin
float
Minimum temperature (K) at which the current method can calculate the property.
Tmax
float
Maximum temperature (K) at which the current method can calculate the property.
- property_min
float
Lowest value expected for a property while still being valid; this is a criteria used by
test_method_validity
.- property_max
float
Highest value expected for a property while still being valid; this is a criteria used by
test_method_validity
.- ranked_methods
list
Constant list of ranked methods by default
- tabular_data
dict
Stores all user-supplied property data for interpolation in format {name: (Ts, properties)}, [-]
- tabular_data_interpolators
dict
Stores all interpolation objects, idexed by name and property transform methods with the format {(name, interpolation_T, interpolation_property, interpolation_property_inv): (extrapolator, spline)}, [-]
- all_methods
set
Set of all methods available for a given CASRN and set of properties, [-]
- name
Methods
Method to calculate the property with sanity checking and using the selected
method
.T_dependent_property_derivative
(T[, order])Method to obtain a derivative of a property with respect to temperature, of a given order.
T_dependent_property_integral
(T1, T2)Method to calculate the integral of a property with respect to temperature, using the selected method.
Method to calculate the integral of a property over temperature with respect to temperature, using the selected method.
__call__
(T)Convenience method to calculate the property; calls
T_dependent_property
.add_correlation
(name, model, Tmin, Tmax, ...)Method to add a new set of emperical fit equation coefficients to the object and select it for future property calculations.
add_method
(f[, Tmin, Tmax, f_der, f_der2, ...])Define a new method and select it for future property calculations.
add_tabular_data
(Ts, properties[, name, ...])Method to set tabular data to be used for interpolation.
as_json
([references])Method to create a JSON serialization of the property model which can be stored, and reloaded later.
calculate
(T, method)Method to calculate a property with a specified method, with no validity checking or error handling.
calculate_derivative
(T, method[, order])Method to calculate a derivative of a property with respect to temperature, of a given order using a specified method.
calculate_integral
(T1, T2, method)Method to calculate the integral of a property with respect to temperature, using a specified method.
calculate_integral_over_T
(T1, T2, method)Method to calculate the integral of a property over temperature with respect to temperature, using a specified method.
extrapolate
(T, method[, in_range])Method to perform extrapolation on a given method according to the
extrapolation
setting.fit_add_model
(name, model, Ts, data, **kwargs)Method to add a new emperical fit equation to the object by fitting its coefficients to specified data.
fit_data_to_model
(Ts, data, model[, ...])Method to fit T-dependent property data to one of the available model correlations.
from_json
(json_repr)Method to create a property model from a JSON serialization of another property model.
interpolate
(T, name)Method to perform interpolation on a given tabular data set previously added via
add_tabular_data
.plot_T_dependent_property
([Tmin, Tmax, ...])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.
polynomial_from_method
(method[, n, start_n, ...])Method to fit a T-dependent property to a polynomial.
solve_property
(goal)Method to solve for the temperature at which a property is at a specified value.
test_method_validity
(T, method)Method to test the validity of a specified method for a given temperature.
test_property_validity
(prop)Method to test the validity of a calculated property.
valid_methods
([T])Method to obtain a sorted list of methods that have data available to be used.
- T_dependent_property(T)[source]¶
Method to calculate the property with sanity checking and using the selected
method
.In the unlikely event the calculation of the property fails, None is returned.
The calculated result is checked with
test_property_validity
and None is returned if the calculated value is nonsensical.
- T_dependent_property_derivative(T, order=1)[source]¶
Method to obtain a derivative of a property with respect to temperature, of a given order.
Calls
calculate_derivative
internally to perform the actual calculation.$\text{derivative} = \frac{d (\text{property})}{d T}$
- T_dependent_property_integral(T1, T2)[source]¶
Method to calculate the integral of a property with respect to temperature, using the selected method.
Calls
calculate_integral
internally to perform the actual calculation.$\text{integral} = \int_{T_1}^{T_2} \text{property} \; dT$
- T_dependent_property_integral_over_T(T1, T2)[source]¶
Method to calculate the integral of a property over temperature with respect to temperature, using the selected method.
Calls
calculate_integral_over_T
internally to perform the actual calculation.$\text{integral} = \int_{T_1}^{T_2} \frac{\text{property}}{T} \; dT$
- T_limits = {}¶
Dictionary containing method: (Tmin, Tmax) pairs for all methods applicable to the chemical
- __call__(T)[source]¶
Convenience method to calculate the property; calls
T_dependent_property
. Caches previously calculated value, which is an overhead when calculating many different values of a property. SeeT_dependent_property
for more details as to the calculation procedure.
- __repr__()[source]¶
Create and return a string representation of the object. The design of the return string is such that it can be
eval
’d into itself. This is very convinient for creating tests. Note that several methods are not compatible with theeval
’ing principle.- Returns
- repr
str
String representation, [-]
- repr
- add_correlation(name, model, Tmin, Tmax, **kwargs)[source]¶
Method to add a new set of emperical fit equation coefficients to the object and select it for future property calculations.
A number of hardcoded model names are implemented; other models are not supported.
- Parameters
Notes
The correlation models and links to their functions, describing their parameters, are as follows:
- add_method(f, Tmin=None, Tmax=None, f_der=None, f_der2=None, f_der3=None, f_int=None, f_int_over_T=None, name=None)[source]¶
Define a new method and select it for future property calculations.
- Parameters
- f
callable
Object which calculates the property given the temperature in K, [-]
- Tmin
float
,optional
Minimum temperature to use the method at, [K]
- Tmax
float
,optional
Maximum temperature to use the method at, [K]
- f_der
callable
,optional
If specified, should take as an argument the temperature and return the first derivative of the property, [-]
- f_der2
callable
,optional
If specified, should take as an argument the temperature and return the second derivative of the property, [-]
- f_der3
callable
,optional
If specified, should take as an argument the temperature and return the third derivative of the property, [-]
- f_int
callable
,optional
If specified, should take T1 and T2 and return the integral of the property from T1 to T2, [-]
- f_int_over_T
callable
,optional
If specified, should take T1 and T2 and return the integral of the property over T from T1 to T2, [-]
- name
str
,optional
Name of method.
- f
Notes
Once a custom method has been added to an object, that object can no longer be serialized to json and the
TDependentProperty.__repr__
method can no longer be used to reconstruct the object completely.
- add_tabular_data(Ts, properties, name=None, check_properties=True)[source]¶
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.
After adding the data, this method becomes the selected method.
- Parameters
- Tsarray_like
Increasing array of temperatures at which properties are specified, [K]
- propertiesarray_like
List of properties at Ts, [units]
- name
str
,optional
Name assigned to the data
- check_propertiesbool
If True, the properties will be checked for validity with
test_property_validity
and raise an exception if any are not valid
- as_json(references=1)[source]¶
Method to create a JSON serialization of the property model which can be stored, and reloaded later.
- calculate(T, method)[source]¶
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.
- calculate_derivative(T, method, order=1)[source]¶
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.
This method can be overwritten by subclasses who may perfer to add analytical methods for some or all methods as this is much faster.
If the calculation does not succeed, returns the actual error encountered.
- calculate_integral(T1, T2, method)[source]¶
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.
If the calculation does not succeed, returns the actual error encountered.
- calculate_integral_over_T(T1, T2, method)[source]¶
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.
If the calculation does not succeed, returns the actual error encountered.
- critical_zero = False¶
Whether or not the property is declining and reaching zero at the critical point. This is used by numerical solvers.
- extrapolate(T, method, in_range='error')[source]¶
Method to perform extrapolation on a given method according to the
extrapolation
setting.- Parameters
- T
float
Temperature at which to extrapolate the property, [K]
- method
str
The method to use, [-]
- in_range
str
How to handle inputs which are not outside the temperature limits; set to ‘low’ to use the low T extrapolation, ‘high’ to use the high T extrapolation, ‘nearest’ to use the nearest value, and ‘error’ or anything else to raise an error in those cases, [-]
- T
- Returns
- prop
float
Calculated property, [units]
- prop
- property extrapolation¶
The string setting of the current extrapolation settings. This can be set to a new value to change which extrapolation setting is used.
- fit_add_model(name, model, Ts, data, **kwargs)[source]¶
Method to add a new emperical fit equation to the object by fitting its coefficients to specified data. Once added, the new method is set as the default.
A number of hardcoded model names are implemented; other models are not supported.
This is a wrapper around
TDependentProperty.fit_data_to_model
andTDependentProperty.add_correlation
.The data is also stored in the object as a tabular method with the name name`+’_data’, through :obj:`TDependentProperty.add_tabular_data.
- classmethod fit_data_to_model(Ts, data, model, model_kwargs=None, fit_method='lm', sigma=None, use_numba=False, do_statistics=False, guesses=None, solver_kwargs=None, objective='MeanSquareErr', multiple_tries=False, multiple_tries_max_err=1e-05, multiple_tries_max_objective='MeanRelErr', params_points_max=0, model_selection=None)[source]¶
Method to fit T-dependent property data to one of the available model correlations.
- Parameters
- Ts
list
[float
] Temperatures of the data points, [K]
- data
list
[float
] Data points, [units]
- model
str
A string representing the supported models, [-]
- model_kwargs
dict
,optional
Various keyword arguments accepted by the model; not necessary for most models. Parameters which are normally fit, can be specified here as well with a constant value and then that fixed value will be used instead of fitting the parameter. [-]
- fit_method
str
,optional
The fit method to use; one of {lm, trf, dogbox, differential_evolution}, [-]
- sigma
None
orlist
[float
] Uncertainty parameters used by curve_fit, [-]
- use_numbabool,
optional
Whether or not to try to use numba to speed up the computation, [-]
- do_statisticsbool,
optional
Whether or not to compute statistical measures on the outputs, [-]
- guesses
dict
[str:float
],optional
Parameter guesses, by name; any number of parameters can be specified, [-]
- solver_kwargs
dict
Extra parameters to be passed to the solver chosen, [-]
- objective
str
The minimimization criteria; supported by differential_evolution. One of:
‘MeanAbsErr’: Mean absolute error
‘MeanRelErr’: Mean relative error
‘MeanSquareErr’: Mean squared absolute error
‘MeanSquareRelErr’: Mean squared relative error
‘MaxAbsErr’: Maximum absolute error
‘MaxRelErr’: Maximum relative error
‘MaxSquareErr’: Maximum squared absolute error
‘MaxSquareRelErr’: Maximum squared relative error
- multiple_triesbool or
int
For most solvers, multiple initial guesses are available and the best guess is normally tried. When this is set to True, all guesses are tried until one is found with an error lower than multiple_tries_max_err. If an int is supplied, the best multiple_tries guesses are tried only. [-]
- multiple_tries_max_err
float
Only used when multiple_tries is true; if a solution is found with lower error than this, no further guesses are tried, [-]
- multiple_tries_max_objective
str
The error criteria to use for minimization, [-]
- params_points_max
int
When this is 0, a fit can be performed to a correlation with as many points as correlation parameters. If this is 1, a correlation can only be fit with points-1 parameters, and so on, [-]
- model_selection
None
orstr
One of (None, ‘AICc’, ‘BIC’, or ‘min(BIC, AICc)’). If set fits with different numbers of parameters will be tried (if applicable to the model) and the best statistical fit will be chosen [-]
- Ts
- Returns
- classmethod from_json(json_repr)[source]¶
Method to create a property model from a JSON serialization of another property model.
- Parameters
- json_repr
dict
JSON-friendly representation, [-]
- json_repr
- Returns
- model
TDependentProperty
orTPDependentProperty
Newly created object from the json serialization, [-]
- model
Notes
It is important that the input string be in the same format as that created by
TDependentProperty.as_json
.
- interpolate(T, name)[source]¶
Method to perform interpolation on a given tabular data set previously added via
add_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 is cubic-spline based if 5 or more points are available, and linearly interpolated if not. Extrapolation is always performed linearly. This function uses the transforms
interpolation_T
,interpolation_property
, andinterpolation_property_inv
if set. If any of these are changed after the interpolators were first created, new interpolators are created with the new transforms. All interpolation is performed via the interp1d function.
- interpolation_T = None¶
- interpolation_T_inv = None¶
- interpolation_property = None¶
- interpolation_property_inv = None¶
- property method¶
Method used to set a specific property method or to obtain the name of the method in use.
When setting a method, an exception is raised if the method specified isnt’t available for the chemical with the provided information.
If method is None, no calculations can be performed.
- Parameters
- method
str
Method to use, [-]
- method
- name = 'Property name'¶
- plot_T_dependent_property(Tmin=None, Tmax=None, methods=[], pts=250, only_valid=True, order=0, show=True, tabular_points=True, axes='semilogy')[source]¶
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,:obj:test_method_validity will be used to check if each temperature in the specified range is valid, and
test_property_validity
will be used to test the answer, and the method is allowed to fail; only the valid points will be plotted. Otherwise, the result will be calculated and displayed as-is. This will not suceed if the method fails.- Parameters
- Tmin
float
Minimum temperature, to begin calculating the property, [K]
- Tmax
float
Maximum temperature, to stop calculating the property, [K]
- methods
list
,optional
List of methods to consider
- pts
int
,optional
A list of points to calculate the property at; if Tmin to Tmax covers a wide range of method validities, only a few points may end up calculated for a given method so this may need to be large
- only_validbool
If True, only plot successful methods and calculated properties, and handle errors; if False, attempt calculation without any checking and use methods outside their bounds
- showbool
If True, displays the plot; otherwise, returns it
- tabular_pointsbool,
optional
If True, tabular data will only be shows as the original points; otherwise interpolated values are shown, [-]
- Tmin
- polynomial_from_method(method, n=None, start_n=3, max_n=30, eval_pts=100, fit_form='POLY_FIT', fit_method=None)[source]¶
Method to fit a T-dependent property to a polynomial. The degree of the polynomial can be specified with the n parameter, or it will be automatically selected for maximum accuracy.
- Parameters
- method
str
Method name to fit, [-]
- n
int
,optional
The degree of the polynomial, if specified
- start_n
int
If n is not specified, all polynomials of degree start_n to max_n will be tried and the highest-accuracy will be selected; [-]
- max_n
int
If n is not specified, all polynomials of degree start_n to max_n will be tried and the highest-accuracy will be selected; [-]
- eval_pts
int
The number of points to evaluate the fitted functions at to check for accuracy; more is better but slower, [-]
- fit_form
str
The shape of the polynomial; options are ‘POLY_FIT’, ‘EXP_POLY_FIT’, ‘EXP_POLY_FIT_LN_TAU’, and ‘POLY_FIT_LN_TAU’ [-]
- method
- Returns
- coeffs
list
[float
] Fit coefficients, [-]
- Tmin
float
The minimum temperature used for the fitting, [K]
- Tmax
float
The maximum temperature used for the fitting, [K]
- err_avg
float
Mean error in the evaluated points, [-]
- err_std
float
Standard deviation of errors in the evaluated points, [-]
- min_ratio
float
Lowest ratio of calc/actual in any found points, [-]
- max_ratio
float
Highest ratio of calc/actual in any found points, [-]
- coeffs
- property_max = 10000.0¶
- property_min = 0¶
- ranked_methods = []¶
- solve_property(goal)[source]¶
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.Checks the given property value with
test_property_validity
first and raises an exception if it is not valid.
- test_method_validity(T, method)[source]¶
Method to test the validity of a specified method for a given temperature. Demo function for testing only; must be implemented according to the methods available for each individual method. Include the interpolation check here.
- classmethod test_property_validity(prop)[source]¶
Method to test the validity of a calculated property. Normally, this method is used by a given property class, and has maximum and minimum limits controlled by the variables
property_min
andproperty_max
.
- units = 'Property units'¶
- valid_methods(T=None)[source]¶
Method to obtain a sorted list of methods that have data available to be used. The methods are ranked in the following order:
The currently selected method is first (if one is selected)
Other available methods are ranked by the attribute
ranked_methods
If T is provided, the methods will be checked against the temperature limits of the correlations as well.
- Parameters
- Returns
- sorted_valid_methods
list
Sorted lists of methods valid at T according to
test_method_validity
, [-]
- sorted_valid_methods
Temperature and Pressure Dependent¶
- class thermo.utils.TPDependentProperty(extrapolation, **kwargs)[source]¶
Bases:
thermo.utils.t_dependent_property.TDependentProperty
Class for calculating temperature and pressure dependent chemical properties.
On creation, a
TPDependentProperty
examines all the possible methods implemented for calculating the property, loads whichever coefficients it needs (unless load_data is set to False), examines its input parameters, and selects the method it prefers. This method will continue to be used for all calculations until the method is changed by setting a new method to the tomethod
attribute.Because many pressure dependent property methods are implemented as a low-pressure correlation and a high-pressure correlation, this class works essentially the same as
TDependentProperty
but with extra methods that accept pressure as a parameter.The object also selects the pressure-dependent method it prefers. This method will continue to be used for all pressure-dependent calculations until the pressure-dependent method is changed by setting a new method_P to the to
method_P
attribute.The default list of preferred pressure-dependent method orderings is at
ranked_methods_P
for all properties; the order can be modified there in-place, and this will take effect on all newTPDependentProperty
instances created but NOT on existing instances.Tabular data can be provided as either temperature-dependent or pressure-dependent data. The same extrapolation settings as in
TDependentProperty
are implemented here for the low-pressure correlations.In addition to the methods and attributes shown here, all those from
TPDependentProperty
are also available.- Attributes
Methods
TP_dependent_property
(T, P)Method to calculate the property given a temperature and pressure according to the selected
method_P
andmethod
.TP_dependent_property_derivative_P
(T, P[, order])Method to calculate a derivative of a temperature and pressure dependent property with respect to pressure at constant temperature, of a given order, according to the selected
method_P
.TP_dependent_property_derivative_T
(T, P[, order])Method to calculate a derivative of a temperature and pressure dependent property with respect to temperature at constant pressure, of a given order, according to the selected
method_P
.Method to calculate the property given a temperature and pressure according to the selected
method_P
andmethod
.__call__
(T, P)Convenience method to calculate the property; calls
TP_dependent_property
.add_method
(f[, Tmin, Tmax, f_der, f_der2, ...])Define a new method and select it for future property calculations.
add_tabular_data
(Ts, properties[, name, ...])Method to set tabular data to be used for interpolation.
add_tabular_data_P
(Ts, Ps, properties[, ...])Method to set tabular data to be used for interpolation.
calculate
(T, method)Method to calculate a property with a specified method, with no validity checking or error handling.
calculate_derivative_P
(P, T, method[, order])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.
calculate_derivative_T
(T, P, method[, order])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.
extrapolate
(T, method[, in_range])Method to perform extrapolation on a given method according to the
extrapolation
setting.plot_TP_dependent_property
([Tmin, Tmax, ...])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.
plot_isobar
(P[, Tmin, Tmax, methods_P, pts, ...])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.
plot_isotherm
(T[, Pmin, Pmax, methods_P, ...])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.
solve_property
(goal)Method to solve for the temperature at which a property is at a specified value.
test_method_validity
(T, method)Method to test the validity of a specified method for a given temperature.
test_property_validity
(prop)Method to test the validity of a calculated property.
valid_methods
([T])Method to obtain a sorted list of methods that have data available to be used.
valid_methods_P
([T, P])Method to obtain a sorted list of high-pressure methods that have data available to be used.
- TP_dependent_property(T, P)[source]¶
Method to calculate the property given a temperature and pressure according to the selected
method_P
andmethod
. The pressure-dependent method is always used and required to succeed. The result is checked withtest_property_validity
.If the method does not succeed, returns None.
- TP_dependent_property_derivative_P(T, P, order=1)[source]¶
Method to calculate a derivative of a temperature and pressure dependent property with respect to pressure at constant temperature, of a given order, according to the selected
method_P
.Calls
calculate_derivative_P
internally to perform the actual calculation.$\text{derivative} = \frac{d (\text{property})}{d P}|_{T}$
- TP_dependent_property_derivative_T(T, P, order=1)[source]¶
Method to calculate a derivative of a temperature and pressure dependent property with respect to temperature at constant pressure, of a given order, according to the selected
method_P
.Calls
calculate_derivative_T
internally to perform the actual calculation.$\text{derivative} = \frac{d (\text{property})}{d T}|_{P}$
- TP_or_T_dependent_property(T, P)[source]¶
Method to calculate the property given a temperature and pressure according to the selected
method_P
andmethod
. The pressure-dependent method is always tried. The result is checked withtest_property_validity
.If the pressure-dependent method does not succeed, the low-pressure method is tried and its result is returned.
Warning
It can seem like a good idea to switch between a low-pressure and a high-pressure method if the high pressure method is not working, however it can cause discontinuities and prevent numerical methods from converging
- T_limits = {}¶
Dictionary containing method: (Tmin, Tmax) pairs for all methods applicable to the chemical
- __call__(T, P)[source]¶
Convenience method to calculate the property; calls
TP_dependent_property
. Caches previously calculated value, which is an overhead when calculating many different values of a property. SeeTP_dependent_property
for more details as to the calculation procedure.
- add_method(f, Tmin=None, Tmax=None, f_der=None, f_der2=None, f_der3=None, f_int=None, f_int_over_T=None, name=None)¶
Define a new method and select it for future property calculations.
- Parameters
- f
callable
Object which calculates the property given the temperature in K, [-]
- Tmin
float
,optional
Minimum temperature to use the method at, [K]
- Tmax
float
,optional
Maximum temperature to use the method at, [K]
- f_der
callable
,optional
If specified, should take as an argument the temperature and return the first derivative of the property, [-]
- f_der2
callable
,optional
If specified, should take as an argument the temperature and return the second derivative of the property, [-]
- f_der3
callable
,optional
If specified, should take as an argument the temperature and return the third derivative of the property, [-]
- f_int
callable
,optional
If specified, should take T1 and T2 and return the integral of the property from T1 to T2, [-]
- f_int_over_T
callable
,optional
If specified, should take T1 and T2 and return the integral of the property over T from T1 to T2, [-]
- name
str
,optional
Name of method.
- f
Notes
Once a custom method has been added to an object, that object can no longer be serialized to json and the
TDependentProperty.__repr__
method can no longer be used to reconstruct the object completely.
- add_tabular_data(Ts, properties, name=None, check_properties=True)¶
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.
After adding the data, this method becomes the selected method.
- Parameters
- Tsarray_like
Increasing array of temperatures at which properties are specified, [K]
- propertiesarray_like
List of properties at Ts, [units]
- name
str
,optional
Name assigned to the data
- check_propertiesbool
If True, the properties will be checked for validity with
test_property_validity
and raise an exception if any are not valid
- add_tabular_data_P(Ts, Ps, properties, name=None, check_properties=True)[source]¶
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.
After adding the data, this method becomes the selected high-pressure method.
- Parameters
- Tsarray_like
Increasing array of temperatures at which properties are specified, [K]
- Psarray_like
Increasing array of pressures at which properties are specified, [Pa]
- propertiesarray_like
List of properties at Ts and Ps; the data should be indexed [P][T], [units]
- name
str
,optional
Name assigned to the data
- check_propertiesbool
If True, the properties will be checked for validity with
test_property_validity
and raise an exception if any are not valid
- calculate(T, method)¶
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.
- calculate_derivative_P(P, T, method, order=1)[source]¶
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.
This method can be overwritten by subclasses who may perfer to add analytical methods for some or all methods as this is much faster.
If the calculation does not succeed, returns the actual error encountered.
- Parameters
- Returns
- dprop_dP_T
float
Calculated derivative property at constant temperature, [units/Pa^order]
- dprop_dP_T
- calculate_derivative_T(T, P, method, order=1)[source]¶
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.
This method can be overwritten by subclasses who may perfer to add analytical methods for some or all methods as this is much faster.
If the calculation does not succeed, returns the actual error encountered.
- Parameters
- Returns
- dprop_dT_P
float
Calculated derivative property at constant pressure, [units/K^order]
- dprop_dT_P
- extrapolate(T, method, in_range='error')¶
Method to perform extrapolation on a given method according to the
extrapolation
setting.- Parameters
- T
float
Temperature at which to extrapolate the property, [K]
- method
str
The method to use, [-]
- in_range
str
How to handle inputs which are not outside the temperature limits; set to ‘low’ to use the low T extrapolation, ‘high’ to use the high T extrapolation, ‘nearest’ to use the nearest value, and ‘error’ or anything else to raise an error in those cases, [-]
- T
- Returns
- prop
float
Calculated property, [units]
- prop
- property extrapolation¶
The string setting of the current extrapolation settings. This can be set to a new value to change which extrapolation setting is used.
- interpolation_T = None¶
- interpolation_T_inv = None¶
- interpolation_property = None¶
- interpolation_property_inv = None¶
- property method¶
Method used to set a specific property method or to obtain the name of the method in use.
When setting a method, an exception is raised if the method specified isnt’t available for the chemical with the provided information.
If method is None, no calculations can be performed.
- Parameters
- method
str
Method to use, [-]
- method
- property method_P¶
Method used to set or get a specific property method.
An exception is raised if the method specified isnt’t available for the chemical with the provided information.
- name = 'Property name'¶
- plot_TP_dependent_property(Tmin=None, Tmax=None, Pmin=None, Pmax=None, methods_P=[], pts=15, only_valid=True)[source]¶
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,:obj:test_method_validity_P will be used to check if each condition in the specified range is valid, and
test_property_validity
will be used to test the answer, and the method is allowed to fail; only the valid points will be plotted. Otherwise, the result will be calculated and displayed as-is. This will not suceed if the any method fails for any point.- Parameters
- Tmin
float
Minimum temperature, to begin calculating the property, [K]
- Tmax
float
Maximum temperature, to stop calculating the property, [K]
- Pmin
float
Minimum pressure, to begin calculating the property, [Pa]
- Pmax
float
Maximum pressure, to stop calculating the property, [Pa]
- methods_P
list
,optional
List of methods to plot
- pts
int
,optional
A list of points to calculate the property at for both temperature and pressure; pts^2 points will be calculated.
- only_validbool
If True, only plot successful methods and calculated properties, and handle errors; if False, attempt calculation without any checking and use methods outside their bounds
- Tmin
- plot_isobar(P, Tmin=None, Tmax=None, methods_P=[], pts=50, only_valid=True, show=True)[source]¶
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,:obj:test_method_validity_P will be used to check if each condition in the specified range is valid, and
test_property_validity
will be used to test the answer, and the method is allowed to fail; only the valid points will be plotted. Otherwise, the result will be calculated and displayed as-is. This will not suceed if the method fails.- Parameters
- P
float
Pressure for the isobar, [Pa]
- Tmin
float
Minimum temperature, to begin calculating the property, [K]
- Tmax
float
Maximum temperature, to stop calculating the property, [K]
- methods_P
list
,optional
List of methods to consider
- pts
int
,optional
A list of points to calculate the property at; if Tmin to Tmax covers a wide range of method validities, only a few points may end up calculated for a given method so this may need to be large
- only_validbool
If True, only plot successful methods and calculated properties, and handle errors; if False, attempt calculation without any checking and use methods outside their bounds
- P
- plot_isotherm(T, Pmin=None, Pmax=None, methods_P=[], pts=50, only_valid=True, show=True)[source]¶
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 the specified range is valid, andtest_property_validity
will be used to test the answer, and the method is allowed to fail; only the valid points will be plotted. Otherwise, the result will be calculated and displayed as-is. This will not suceed if the method fails.- Parameters
- T
float
Temperature at which to create the plot, [K]
- Pmin
float
Minimum pressure, to begin calculating the property, [Pa]
- Pmax
float
Maximum pressure, to stop calculating the property, [Pa]
- methods_P
list
,optional
List of methods to consider
- pts
int
,optional
A list of points to calculate the property at; if Pmin to Pmax covers a wide range of method validities, only a few points may end up calculated for a given method so this may need to be large
- only_validbool
If True, only plot successful methods and calculated properties, and handle errors; if False, attempt calculation without any checking and use methods outside their bounds
- showbool
If True, displays the plot; otherwise, returns it
- T
- property_max = 10000.0¶
- property_min = 0¶
- ranked_methods = []¶
- solve_property(goal)¶
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.Checks the given property value with
test_property_validity
first and raises an exception if it is not valid.
- test_method_validity(T, method)¶
Method to test the validity of a specified method for a given temperature. Demo function for testing only; must be implemented according to the methods available for each individual method. Include the interpolation check here.
- classmethod test_property_validity(prop)¶
Method to test the validity of a calculated property. Normally, this method is used by a given property class, and has maximum and minimum limits controlled by the variables
property_min
andproperty_max
.
- units = 'Property units'¶
- valid_methods(T=None)¶
Method to obtain a sorted list of methods that have data available to be used. The methods are ranked in the following order:
The currently selected method is first (if one is selected)
Other available methods are ranked by the attribute
ranked_methods
If T is provided, the methods will be checked against the temperature limits of the correlations as well.
- Parameters
- Returns
- sorted_valid_methods
list
Sorted lists of methods valid at T according to
test_method_validity
, [-]
- sorted_valid_methods
- valid_methods_P(T=None, P=None)[source]¶
Method to obtain a sorted list of high-pressure methods that have data available to be used. The methods are ranked in the following order:
The currently selected
method_P
is first (if one is selected)Other available pressure-depenent methods are ranked by the attribute
ranked_methods_P
If T and P are provided, the methods will be checked against the temperature and pressure limits of the correlations as well.
Temperature, Pressure, and Composition Dependent¶
- class thermo.utils.MixtureProperty(**kwargs)[source]¶
Bases:
object
- Attributes
correct_pressure_pure
Method to set the pressure-dependence of the model; if set to False, only temperature dependence is used, and if True, temperature and pressure dependence are used.
method
Method to set the T, P, and composition dependent property method desired.
- prop_cached
Methods
__call__
(T, P[, zs, ws])Convenience method to calculate the property; calls
mixture_property
.as_json
([references])Method to create a JSON serialization of the mixture property which can be stored, and reloaded later.
calculate_derivative_P
(P, T, zs, ws, method)Method to calculate a derivative of a mixture property with respect to pressure at constant temperature and composition of a given order using a specified method.
calculate_derivative_T
(T, P, zs, ws, method)Method to calculate a derivative of a mixture property with respect to temperature at constant pressure and composition of a given order using a specified method.
excess_property
(T, P[, zs, ws])Method to calculate the excess property with sanity checking and without specifying a specific method.
from_json
(string)Method to create a MixtureProperty from a JSON serialization of another MixtureProperty.
mixture_property
(T, P[, zs, ws])Method to calculate the property with sanity checking and without specifying a specific method.
partial_property
(T, P, i[, zs, ws])Method to calculate the partial molar property with sanity checking and without specifying a specific method for the specified compound index and composition.
plot_isobar
(P[, zs, ws, Tmin, Tmax, ...])Method to create a plot of the property vs temperature at a specific pressure and composition according to either a specified list of methods, or the selected method.
plot_isotherm
(T[, zs, ws, Pmin, Pmax, ...])Method to create a plot of the property vs pressure at a specified temperature and composition according to either a specified list of methods, or the set method.
plot_property
([zs, ws, Tmin, Tmax, Pmin, ...])Method to create a plot of the property vs temperature and pressure according to either a specified list of methods, or the selected method.
property_derivative_P
(T, P[, zs, ws, order])Method to calculate a derivative of a mixture property with respect to pressure at constant temperature and composition, of a given order.
property_derivative_T
(T, P[, zs, ws, order])Method to calculate a derivative of a mixture property with respect to temperature at constant pressure and composition, of a given order.
test_method_validity
(T, P, zs, ws, method)Method to test the validity of a specified method for the given conditions.
test_property_validity
(prop)Method to test the validity of a calculated property.
add_excess_correlation
calculate
calculate_excess_property
calculate_pures
calculate_pures_P
calculate_pures_corrected
plot_binary
plot_isobaric_isothermal
pure_objs
- RAISE_PROPERTY_CALCULATION_ERROR = False¶
- TP_zs_ws_cached = (None, None, None, None)¶
- Tmax¶
Maximum temperature at which no method can calculate the property above.
- Tmin¶
Minimum temperature at which no method can calculate the property under.
- all_methods¶
Set of all methods available for a given set of information; filled by
load_all_methods
.
- as_json(references=1)[source]¶
Method to create a JSON serialization of the mixture property which can be stored, and reloaded later.
- calculate_derivative_P(P, T, zs, ws, method, order=1)[source]¶
Method to calculate a derivative of a mixture property with respect to pressure at constant temperature and composition 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.
This method can be overwritten by subclasses who may perfer to add analytical methods for some or all methods as this is much faster.
If the calculation does not succeed, returns the actual error encountered.
- Parameters
- P
float
Pressure at which to calculate the derivative, [Pa]
- T
float
Temperature at which to calculate the derivative, [K]
- zs
list
[float
] Mole fractions of all species in the mixture, [-]
- ws
list
[float
] Weight fractions of all species in the mixture, [-]
- method
str
Method for which to find the derivative
- order
int
Order of the derivative, >= 1
- P
- Returns
- d_prop_d_P_at_T
float
Calculated derivative property at constant temperature, [units/Pa^order]
- d_prop_d_P_at_T
- calculate_derivative_T(T, P, zs, ws, method, order=1)[source]¶
Method to calculate a derivative of a mixture property with respect to temperature at constant pressure and composition 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.
This method can be overwritten by subclasses who may perfer to add analytical methods for some or all methods as this is much faster.
If the calculation does not succeed, returns the actual error encountered.
- Parameters
- T
float
Temperature at which to calculate the derivative, [K]
- P
float
Pressure at which to calculate the derivative, [Pa]
- zs
list
[float
] Mole fractions of all species in the mixture, [-]
- ws
list
[float
] Weight fractions of all species in the mixture, [-]
- method
str
Method for which to find the derivative
- order
int
Order of the derivative, >= 1
- T
- Returns
- d_prop_d_T_at_P
float
Calculated derivative property at constant pressure, [units/K^order]
- d_prop_d_T_at_P
- property correct_pressure_pure¶
Method to set the pressure-dependence of the model; if set to False, only temperature dependence is used, and if True, temperature and pressure dependence are used.
- excess_property(T, P, zs=None, ws=None)[source]¶
Method to calculate the excess property with sanity checking and without specifying a specific method. This requires the calculation of the property as a function of composition at the limiting concentration of each component. One or both of zs and ws are required.
$m^E = m_{mixing} = m - \sum_i m_{i, pure}\cdot z_i$- Parameters
- Returns
- excess_prop
float
Calculated excess property, [units]
- excess_prop
- classmethod from_json(string)[source]¶
Method to create a MixtureProperty from a JSON serialization of another MixtureProperty.
- Parameters
- json_repr
dict
JSON-friendly representation, [-]
- json_repr
- Returns
- constants
MixtureProperty
Newly created object from the json serialization, [-]
- constants
Notes
It is important that the input string be in the same format as that created by
MixtureProperty.as_json
.
- property method¶
Method to set the T, P, and composition dependent property method desired. See the
all_methods
attribute for a list of methods valid for the specified chemicals and inputs.
- mixture_correlations¶
Dictionary containing lookups for coefficient-based mixture excess models.
- mixture_property(T, P, zs=None, ws=None)[source]¶
Method to calculate the property with sanity checking and without specifying a specific method.
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 withtest_property_validity
. On success, the used method is stored in the variablemethod
.If
method
is set, this method is first checked for validity withtest_method_validity
for the specified temperature, and if it is valid, it is then used to calculate the property. The result is checked for validity, and returned if it is valid. If either of the checks fail, the function retrieves a full list of valid methods withvalid_methods
and attempts them as described above.If no methods are found which succeed, returns None. One or both of zs and ws are required.
- Parameters
- Returns
- prop
float
Calculated property, [units]
- prop
- name = 'Test'¶
- partial_property(T, P, i, zs=None, ws=None)[source]¶
Method to calculate the partial molar property with sanity checking and without specifying a specific method for the specified compound index and composition.
$\bar m_i = \left( \frac{\partial (n_T m)} {\partial n_i} \right)_{T, P, n_{j\ne i}}$- Parameters
- T
float
Temperature at which to calculate the partial property, [K]
- P
float
Pressure at which to calculate the partial property, [Pa]
- i
int
Compound index, [-]
- zs
list
[float
],optional
Mole fractions of all species in the mixture, [-]
- ws
list
[float
],optional
Weight fractions of all species in the mixture, [-]
- T
- Returns
- partial_prop
float
Calculated partial property, [units]
- partial_prop
- plot_binary(P=None, T=None, pts=30, Tmin=None, Tmax=None, Pmin=100000.0, Pmax=1000000.0, methods=[], only_valid=True)[source]¶
- plot_isobar(P, zs=None, ws=None, Tmin=None, Tmax=None, methods=[], pts=50, only_valid=True)[source]¶
Method to create a plot of the property vs temperature at a specific pressure and composition according to either a specified list of methods, or the selected method. User-selectable number of points, and temperature range. If only_valid is set,:obj:test_method_validity will be used to check if each condition in the specified range is valid, and
test_property_validity
will be used to test the answer, and the method is allowed to fail; only the valid points will be plotted. Otherwise, the result will be calculated and displayed as-is. This will not suceed if the method fails. One or both of zs and ws are required.- Parameters
- P
float
Pressure for the isobar, [Pa]
- zs
list
[float
],optional
Mole fractions of all species in the mixture, [-]
- ws
list
[float
],optional
Weight fractions of all species in the mixture, [-]
- Tmin
float
Minimum temperature, to begin calculating the property, [K]
- Tmax
float
Maximum temperature, to stop calculating the property, [K]
- methods
list
,optional
List of methods to consider
- pts
int
,optional
A list of points to calculate the property at; if Tmin to Tmax covers a wide range of method validities, only a few points may end up calculated for a given method so this may need to be large
- only_validbool
If True, only plot successful methods and calculated properties, and handle errors; if False, attempt calculation without any checking and use methods outside their bounds
- P
- plot_isotherm(T, zs=None, ws=None, Pmin=None, Pmax=None, methods=[], pts=50, only_valid=True)[source]¶
Method to create a plot of the property vs pressure at a specified temperature and composition according to either a specified list of methods, or the set method. User-selectable number of points, and pressure range. If only_valid is set,
test_method_validity
will be used to check if each condition in the specified range is valid, andtest_property_validity
will be used to test the answer, and the method is allowed to fail; only the valid points will be plotted. Otherwise, the result will be calculated and displayed as-is. This will not suceed if the method fails. One or both of zs and ws are required.- Parameters
- T
float
Temperature at which to create the plot, [K]
- zs
list
[float
],optional
Mole fractions of all species in the mixture, [-]
- ws
list
[float
],optional
Weight fractions of all species in the mixture, [-]
- Pmin
float
Minimum pressure, to begin calculating the property, [Pa]
- Pmax
float
Maximum pressure, to stop calculating the property, [Pa]
- methods
list
,optional
List of methods to consider
- pts
int
,optional
A list of points to calculate the property at; if Pmin to Pmax covers a wide range of method validities, only a few points may end up calculated for a given method so this may need to be large
- only_validbool
If True, only plot successful methods and calculated properties, and handle errors; if False, attempt calculation without any checking and use methods outside their bounds
- T
- plot_property(zs=None, ws=None, Tmin=None, Tmax=None, Pmin=100000.0, Pmax=1000000.0, methods=[], pts=15, only_valid=True)[source]¶
Method to create a plot of the property vs temperature and pressure according to either a specified list of methods, or the selected method. User-selectable number of points for each variable. If only_valid is set,:obj:test_method_validity will be used to check if each condition in the specified range is valid, and
test_property_validity
will be used to test the answer, and the method is allowed to fail; only the valid points will be plotted. Otherwise, the result will be calculated and displayed as-is. This will not suceed if the any method fails for any point. One or both of zs and ws are required.- Parameters
- zs
list
[float
],optional
Mole fractions of all species in the mixture, [-]
- ws
list
[float
],optional
Weight fractions of all species in the mixture, [-]
- Tmin
float
Minimum temperature, to begin calculating the property, [K]
- Tmax
float
Maximum temperature, to stop calculating the property, [K]
- Pmin
float
Minimum pressure, to begin calculating the property, [Pa]
- Pmax
float
Maximum pressure, to stop calculating the property, [Pa]
- methods
list
,optional
List of methods to consider
- pts
int
,optional
A list of points to calculate the property at for both temperature and pressure; pts^2 points will be calculated.
- only_validbool
If True, only plot successful methods and calculated properties, and handle errors; if False, attempt calculation without any checking and use methods outside their bounds
- zs
- prop_cached = None¶
- property_derivative_P(T, P, zs=None, ws=None, order=1)[source]¶
Method to calculate a derivative of a mixture property with respect to pressure at constant temperature and composition, of a given order. Methods found valid by
valid_methods
are attempted until a method succeeds. If no methods are valid and succeed, None is returned.Calls
calculate_derivative_P
internally to perform the actual calculation.$\text{derivative} = \frac{d (\text{property})}{d P}|_{T, z}$- Parameters
- T
float
Temperature at which to calculate the derivative, [K]
- P
float
Pressure at which to calculate the derivative, [Pa]
- zs
list
[float
],optional
Mole fractions of all species in the mixture, [-]
- ws
list
[float
],optional
Weight fractions of all species in the mixture, [-]
- order
int
Order of the derivative, >= 1
- T
- Returns
- d_prop_d_P_at_T
float
Calculated derivative property, [units/Pa^order]
- d_prop_d_P_at_T
- property_derivative_T(T, P, zs=None, ws=None, order=1)[source]¶
Method to calculate a derivative of a mixture property with respect to temperature at constant pressure and composition, of a given order. Methods found valid by
valid_methods
are attempted until a method succeeds. If no methods are valid and succeed, None is returned.Calls
calculate_derivative_T
internally to perform the actual calculation.$\text{derivative} = \frac{d (\text{property})}{d T}|_{P, z}$One or both of zs and ws are required.
- Parameters
- T
float
Temperature at which to calculate the derivative, [K]
- P
float
Pressure at which to calculate the derivative, [Pa]
- zs
list
[float
],optional
Mole fractions of all species in the mixture, [-]
- ws
list
[float
],optional
Weight fractions of all species in the mixture, [-]
- order
int
Order of the derivative, >= 1
- T
- Returns
- d_prop_d_T_at_P
float
Calculated derivative property, [units/K^order]
- d_prop_d_T_at_P
- property_max = 10.0¶
- property_min = 0.0¶
- pure_reference_types = ()¶
- pure_references = ()¶
- ranked_methods = []¶
- skip_method_validity_check = False¶
Flag to disable checking the validity of the method at the specified conditions. Saves a little time.
- skip_prop_validity_check = False¶
Flag to disable checking the output of the value. Saves a little time.
- test_method_validity(T, P, zs, ws, method)[source]¶
Method to test the validity of a specified method for the given conditions.
- Parameters
- Returns
- validitybool
Whether or not a specifid method is valid
- classmethod test_property_validity(prop)[source]¶
Method to test the validity of a calculated property. Normally, this method is used by a given property class, and has maximum and minimum limits controlled by the variables
property_min
andproperty_max
.
- units = 'test units'¶