Isotherms
Interpolator Isotherms
- class pyrast.isotherms.CubicIsotherm(df: DataFrame, loading_key: str, pressure_key: str, *, grid_points: int = 200, force_monotonic: bool = True, extrap_method: str | None = None, extrap_p: float = 1e+40, extrap_points: int = 100, optimization_options: dict | None = None)[source]
Interpolates isotherm with monotonic cubic spline.
- __init__(df: DataFrame, loading_key: str, pressure_key: str, *, grid_points: int = 200, force_monotonic: bool = True, extrap_method: str | None = None, extrap_p: float = 1e+40, extrap_points: int = 100, optimization_options: dict | None = None)[source]
Initializes CubicIsotherm utilizing PCHIP interpolators.
This class uses the scipy.interpolate.PchipInterpolator, which is a monotonic cubic spline interpolation method. This ensures that the interpolated isotherm is monotonic between the points in the original data. For speed, the spreading pressure and p0 are calculated ahead of time on a grid and interpolated with Pchip as well. Extrapolation can be done with a linear fit to the last two points or with an analytical model fit to the data. Extrapolation can be dangerous but might be necessary for calculations at high bulk pressures.
By default, the isotherm is forced to be monotonically increasing by neglecting any points where loading decreases with increasing pressure. This protects against non-physical isotherms and exceptions thrown by the Pchip interpolator. If your data is very noisy, this might result in a sparse isotherm. In this case, you can disable this feature or consider fitting an analytical model.
Extrapolation is handled by adding extrapolated points to the original data and shifting the loading to ensure a continuous isotherm. The original dataframe is preserved for plotting while the extrapolation is saved in the interpolators.
- Parameters:
df (pd.DataFrame) – Dataframe containing isotherm data.
loading_key (str) – Column name in df corresponding to loading data.
pressure_key (str) – Column name in df corresponding to pressure data.
grid_points (int, optional) – Number of points to use in the spreading pressure and p0 interpolation grids. Default is 200, which provides a smooth isotherm in most cases.
force_monotonic (bool, optional) – Forces the isotherm to be monotonically increasing. Disable this if your data is very noisy
extrap_method (str, optional) – Method to extrapolate isotherm beyond max pressure. Choose from ‘linear’ or any implemented analytical model.
extrap_p (float, optional) – Pressure up to which to extrapolate the isotherm if extrap_method is not None.
extrap_points (int, optional) – Number of points to use in extrapolation if extrap_method is not None. Default is 100, which provides a smooth extrapolation in most cases.
optimization_options (dict, optional) – Options for the least-squares optimization when fitting an analytical isotherm as the extrapolation method. This is passed directly to scipy.optimize.least_squares, so you can specify any options available there. Default is None.
- Raises:
ValueError – If loading_key or pressure_key are not in df or if extrap_method is not recognized.
- loading(pressure)[source]
Interpolates loading at given pressure with Henry’s law behavior enforced.
Handles scalar operations in calculation modules and vectorized operations for plotting.
- Parameters:
pressure (float, np.ndarray) – Pressure at which to interpolate loading.
- class pyrast.isotherms.InterpolatorIsotherm(df: DataFrame, loading_key: str, pressure_key: str, *, fill_value: float | None = None, extrap_method: str | None = None, extrap_p: float = 1e+40, extrap_points: int = 100, optimization_options: dict | None = None)[source]
Interpolates isotherm with linear interpolation.
- __init__(df: DataFrame, loading_key: str, pressure_key: str, *, fill_value: float | None = None, extrap_method: str | None = None, extrap_p: float = 1e+40, extrap_points: int = 100, optimization_options: dict | None = None)[source]
Initializes InterpolatorIsotherm utilizing linear interpolator.
This class uses the scipy.interpolate.interp1d, which is a linear interpolation method. Extrapolation can be done with a fill value, linear fit to the last two points, or with an analytical model fit to the data. Extrapolation can be dangerous but might be necessary for calculations at high bulk pressures. See the paper discussion for guidance on extrapolation.
Extrapolation is handled by adding extrapolated points to the original data and shifting the loading to ensure a continuous isotherm. The original dataframe is preserved for plotting while the extrapolation is saved in the interpolators.
- Parameters:
df (pd.DataFrame) – Dataframe containing isotherm data.
loading_key (str) – Column name in df corresponding to loading data.
pressure_key (str) – Column name in df corresponding to pressure data.
fill_value (float, optional) – If provided, this value is used as the loading beyond the highest pressure in the data.
grid_points (int, optional) – Number of points to use in the spreading pressure and p0 interpolation grids. Default is 200, which provides a smooth isotherm in most cases.
extrap_method (str, optional) – Method to extrapolate isotherm beyond max pressure. Choose from ‘linear’ or any implemented analytical model.
extrap_p (float, optional) – Pressure up to which to extrapolate the isotherm if extrap_method is not None.
extrap_points (int, optional) – Number of points to use in extrapolation if extrap_method is not None. Default is 100, which provides a smooth extrapolation in most cases.
fit_options (optional) – Additional keyword arguments to pass to the fit of the analytical extrapolation model if desired. Follows syntax of optimization_options in ModelIsotherm.
- Raises:
ValueError – If loading_key or pressure_key are not in df or if extrap_method is not recognized.
- p0(target_phi: float)[source]
Interpolates p0 at given spreading pressure with Henry’s law enforced.
- Returns:
p0 at given spreading pressure
- Return type:
float
- Raises:
RuntimeError – if extrapolation is required.
- spreading_pressure(pressure: float)[source]
Calculates reduced spreading pressure at a bulk gas pressure P.
Use numerical quadrature on isotherm data points to compute the reduced spreading pressure via the integral:
\[\Pi(p) = \int_0^p \frac{q(\hat{p})}{ \hat{p}} d\hat{p}.\]In this integral, the isotherm \(q(\hat{p})\) is represented by a linear interpolation of the data.
See C. Simon, B. Smit, M. Haranczyk. pyIAST: Ideal Adsorbed Solution Theory (IAST) Python Package. Computer Physics Communications.
- Parameters:
pressure (float) – Pressure at which to calculate spreading pressure.
- Returns:
Spreading pressure at given pressure.
- Return type:
float
- Raises:
RuntimeError – if extrapolation is required.
Analytical Isotherms
Base Class
- class pyrast.isotherms.ModelIsotherm(*args, **kwargs)[source]
Parent class for all model isotherms.
Check the __init__ method for details on how to create an instance.
- __init__(df: DataFrame, loading_key: str, pressure_key: str, model: str, *, model_parameters: dict | None = None, param_guess: dict | None = None, param_bounds: dict | None = None, optimization_options: dict | None = None, vst_n: int | None = None, vst_p: tuple | None = None, vst_root_options: dict | None = None)[source]
Initializes instances of analytical model isotherms.
- Parameters:
df (pd.DataFrame) – Dataframe containing isotherm data.
loading_key (str) – Column name in df corresponding to loading data.
pressure_key (str) – Column name in df corresponding to pressure data.
model (str) – Name of model to fit.
model_parameters (dict, optional) – Dictionary of model parameters. If provided, these parameters will be used instead of fitting to data. Keys must match self.param_names.
param_guess (dict, optional) – Dictionary of initial guess for fitting model parameters. Keys must match self.param_names. Only needed if the default initial guess is not sufficient for fitting.
param_bounds (dict, optional) – Dictionary of bounds for fitting model parameters. Keys must match self.param_names. Only needed if the default bounds are not sufficient for fitting.
optimization_options (dict, optional) – Dictionary of options to pass to scipy.optimize.least_squares. Only needed if the default optimization options are not sufficient for fitting.
vst_n (int, optional) – Number of points to interpolate between. A high number of points will use more memory but more accurately represent the isotherm. Default is 300 points.
vst_p (tuple, optional) – Tuple of the lowest and highest pressures to interpolate between. The lowest number should be a small number, but nonzero. Default is (1e-6, 1e40)
vst_root_options (dict, optional) – Dictionary of options to pass to scipy.optimize.root for solving loading from pressure. This will override the default options used by pyRAST. The default guess is the maximum loading in the input data. All options accepted by scipy.optimize.root are valid here.
- Raises:
ValueError – If model is not valid, loading or pressure keys not in df, model_parameters keys do not match self.param_names, or param_guess keys do not match self.param_names.
- enforce_parameter_bounds(guess)[source]
Enforces parameter bounds on the initial guess.
- Parameters:
guess (dict) – Initial guess for model parameters.
- Returns:
Guess with parameters enforced within bounds.
- Return type:
dict
- initial_guess()[source]
Returns initial guess for model parameters.
The default implementation provides a guess for the Langmuir model. Subclasses use this default guess as a starting point for their own initial guesses.
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
This method contains a root solving scheme for VST isotherms to use during fitting. All other implemented isotherms have analytical expressions for loading.
- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- Raises:
RuntimeError – If the root solving routine fails.
- p0(target_phi)[source]
Returns p0 at given spreading pressure if not implemented by subclass.
This method works for any model without a closed form solution for p0 by using root finding. Root finding will be slower than a closed form solution.
Langmuir
- class pyrast.isotherms.Langmuir(*args, **kwargs)[source]
-
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
Loading in the Langmuir model is given as:
\[q(P) = M\frac{KP}{1+KP}\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- p0(target_phi: float)[source]
Returns P0 as a function of spreading pressure.
As the Langmuir model has an analytical form for P0, we can calculate it directly here. Activity coefficient fitting will be fastest using this model. There are additional safeguards to ensure numerical stability at high spreading pressures. P0 in the Langmuir model is given as:
\[P^0(\phi) = \frac{e^{\phi/M} - 1}{K}\]- Parameters:
target_phi (float) – Spreading pressure to calculate P0
- Returns:
P0 value
- Return type:
float
- spreading_pressure(pressure)[source]
Returns spreading pressure as a function of pressure (or fugacity).
Spreading pressure in the Langmuir model is given as:
\[\phi(P) = M\ln(1+KP)\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray
Dual Site Langmuir
- class pyrast.isotherms.DSLangmuir(*args, **kwargs)[source]
- initial_guess()[source]
Provides initial guess for model parameters.
For the Dual Site Langmuir isotherm, we follow the scheme of pyIAST and assume parameter values based on the Langmuir model.
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
Loading in the Dual Site Langmuir model is given as:
\[q(P) = M_1\frac{K_1P}{1+K_1P} + M_2\frac{K_2P}{1+K_2P}\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- spreading_pressure(pressure)[source]
Returns spreading pressure as a function of pressure (or fugacity).
Spreading pressure in the Dual Site Langmuir model is given as:
\[\phi(P) = M_1\ln(1+K_1P) + M_2\ln(1+K_2P)\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray
Quadratic
- class pyrast.isotherms.Quadratic(*args, **kwargs)[source]
- initial_guess()[source]
Provides initial guess for model parameters.
For the Quadratic isotherm, we follow the scheme of pyIAST and assume parameter values based on the Langmuir model.
- loading(pressure: float)[source]
Returns loading as a function of pressure (or fugacity).
Loading in the Quadratic model is given as:
\[q(P) = M\frac{(K_a + 2 K_b P)P}{1+K_aP+K_bP^2}\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- spreading_pressure(pressure: float)[source]
Returns spreading pressure as a function of pressure (or fugacity).
Spreading pressure in the Quadratic model is given as:
\[\phi(P) = M\ln(1+K_aP+K_bP^2)\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray
Temkin Approximation
- class pyrast.isotherms.TemkinApprox(*args, **kwargs)[source]
- initial_guess()[source]
Provides initial guess for model parameters.
For the Temkin Approximation isotherm, we follow the scheme of pyIAST and assume parameter values based on the Langmuir model.
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
Loading in the Temkin Approximation model is given as:
\[q(P) = M\frac{KP}{1+KP} + M\theta(\frac{KP}{1+KP})^2 (\frac{KP}{1+KP} -1)\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- spreading_pressure(pressure)[source]
Returns spreading pressure as a function of pressure (or fugacity).
Spreading pressure in the Temkin Approximation model is given as:
\[\phi(P) = M\ln(1+KP) + M\theta\frac{2KP+1}{2(1+KP)^2}\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray
BET
- class pyrast.isotherms.BET(*args, **kwargs)[source]
- initial_guess()[source]
Provides initial guess for model parameters.
For the BET isotherm, we follow the scheme of pyIAST and assume parameter values based on the Langmuir model.
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
Loading in the BET model is given as:
\[q(P) = M\frac{K_A P}{(1-K_B P)(1-K_B P+ K_A P)}\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- spreading_pressure(pressure)[source]
Returns spreading pressure as a function of pressure (or fugacity).
Spreading pressure in the BET model is given as:
\[\phi(P) = M\ln(\frac{1+K_AP-K_BP}{1-K_BP})\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray
Henry
- class pyrast.isotherms.Henry(*args, **kwargs)[source]
- initial_guess()[source]
Provides initial guess for model parameters.
For the Henry isotherm, we follow the scheme of pyIAST and assume parameter values based on the Langmuir model.
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
Loading in the Henry model is given as:
\[q(P) = K_HP\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- p0(target_phi)[source]
Returns P0 as a function of spreading pressure.
As the Henry model has an analytical form for P0, we can calculate it directly here. Activity coefficient fitting will be fastest using this model. P0 in the Henry model is given as:
\[P^0(\phi) = \frac{\phi}{K_H}\]- Parameters:
target_phi (float or np.ndarray) – Spreading pressure to calculate P0
- Returns:
P0 as same variable type as input
- Return type:
float or np.ndarray
- spreading_pressure(pressure)[source]
Returns spreading pressure as a function of pressure (or fugacity).
Spreading pressure in the Henry model is given as:
\[\phi(P) = K_HP\]- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray
Wilson VST
- class pyrast.isotherms.WVST(*args, **kwargs)[source]
- initial_guess()[source]
Provides initial guess for model parameters.
For the Wilson Vacancy Solution Theory isotherm, we assume the case of a Langmuir isotherm with activity coefficient of 1.
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, loading is calculated as a function of pressure using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which uses root solving to determine loading from the pressure function specific to VST.
- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- p0(phi)[source]
Returns P0 as a function of spreading pressure.
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, p0 is calculated as a function of phi using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which uses root solving.
- Parameters:
target_phi (float) – Spreading pressure to calculate P0
- Returns:
P0 value
- Return type:
float
- pressure(loading)[source]
Calculates pressure as a function of loading.
Vacancy Solution Theory (VST) models are defined as functions of pressure. Unfortunately, there is no analytical function for loading, spreading pressure, or p0 as a result. This function is used in combination with root solving to support fitting the VST isotherm with the Wilson activity coefficient model. The Wilson VST isotherm has four parameters, two from the Langmuir isotherm and two from the activity coefficient model.
Pressure in the Wilson VST isotherm is given as:
\[P(q) = \left[\frac{M}{K} \frac{\theta}{1-\theta}\right] \left[\Lambda_{1v}\frac{1-(1-\Lambda_{v1})\theta} {\Lambda_{1v}+(1-\Lambda_{1v})\theta}\right] \exp\left[-\frac{\Lambda_{v1}(1-\Lambda_{v1})\theta} {1-(1-\Lambda_{v1})\theta} - \frac{(1-\Lambda_{1v})\theta}{\Lambda_{1v} +(1-\Lambda_{1v})\theta} \right]\]Source: Suwanayuen, S. & Danner, R. P. A gas adsorption isotherm equation based on vacancy solution theory. AIChE Journal 26, 68-76 (1980).
- Parameters:
Loading (float or np.ndarray) – loadings(s) at which to calculate pressure
- Returns:
pressure as same variable type as input
- Return type:
float or np.ndarray
- spreading_pressure(pressure)[source]
Returns spreading pressure as a function of pressure (or fugacity).
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, spreading pressure is calculated as a function of phi using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which will raise an exception. The spreading pressure interpolator should always be built after model fitting.
- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray
Flory-Huggins VST
- class pyrast.isotherms.FHVST(*args, **kwargs)[source]
- initial_guess()[source]
Provides initial guess for model parameters.
For the Flory-Huggins Vacancy Solution Theory isotherm, we assume the case of a Langmuir isotherm with activity coefficient of 1.
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, loading is calculated as a function of pressure using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which uses root solving to determine loading from the pressure function specific to VST.
- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- p0(phi)[source]
Returns P0 as a function of spreading pressure.
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, p0 is calculated as a function of phi using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which uses root solving.
- Parameters:
target_phi (float) – Spreading pressure to calculate P0
- Returns:
P0 value
- Return type:
float
- pressure(loading)[source]
Calculates pressure as a function of loading.
Vacancy Solution Theory (VST) models are defined as functions of pressure. Unfortunately, there is no analytical function for loading, spreading pressure, or p0 as a result. This function is used in combination with root solving to support fitting the VST isotherm with the Flory-Huggins activity coefficient model. The Flory-Huggins VST isotherm has four parameters, two from the Langmuir isotherm and one from the activity coefficient model.
Pressure in the Flory-Huggins VST isotherm is given as:
\[P(q) = \left[\frac{M}{K} \frac{\theta}{1-\theta}\right] \exp\left[\frac{\alpha_{1v}^2 \theta}{1 + \alpha_{1v} \theta}\right]\]Source: Cochran, T. W., Kabel, R. L. & Danner, R. P. Vacancy solution theory of adsorption using Flory-Huggins activity coefficient equations. AIChE Journal 31, 268-277 (1985).
- Parameters:
Loading (float or np.ndarray) – loadings(s) at which to calculate pressure
- Returns:
pressure as same variable type as input
- Return type:
float or np.ndarray
- spreading_pressure(pressure)[source]
Returns spreading pressure as a function of pressure (or fugacity).
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, spreading pressure is calculated as a function of phi using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which will raise an exception. The spreading pressure interpolator should always be built after model fitting.
- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray
Adsorption NRTL VST
- class pyrast.isotherms.ANRTLVST(*args, **kwargs)[source]
- initial_guess()[source]
Provides initial guess for model parameters.
For the Adsorption NRTL Vacancy Solution Theory isotherm, we assume the case of a Langmuir isotherm with activity coefficient of 1.
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, loading is calculated as a function of pressure using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which uses root solving to determine loading from the pressure function specific to VST.
- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- p0(phi)[source]
Returns P0 as a function of spreading pressure.
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, p0 is calculated as a function of phi using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which uses root solving.
- Parameters:
target_phi (float) – Spreading pressure to calculate P0
- Returns:
P0 value
- Return type:
float
- pressure(loading)[source]
Calculates pressure as a function of loading.
Vacancy Solution Theory (VST) models are defined as functions of pressure. Unfortunately, there is no analytical function for loading, spreading pressure, or p0 as a result. This function is used in combination with root solving to support fitting the VST isotherm with the Adsorption NRTL activity coefficient model. The Adsorption NRTL VST isotherm has three parameters, two from the Langmuir isotherm and one from the activity coefficient model.
Pressure in the Adsorption NRTL VST isotherm is given as:
\begin{gather*} P(q) = \left[\frac{M}{K} \frac{\theta}{1-\theta}\right] \frac{\gamma_{1}}{\gamma_{\phi}} \\ \ln \gamma_1 = (1-\theta)^2 \left[\tau_{1\phi}\frac{G_{1\phi}-1} {(1-\theta + \theta G_{1\phi})^2}\right] \\ \ln \gamma_\phi = \theta^2 \left[\tau_{\phi 1}\frac{G_{\phi 1}-1} {(\theta + (1-\theta) G_{\phi 1})^2}\right] \\ G_{1\phi} = \exp(-\alpha \tau_{1\phi}), \ G_{\phi 1} = \exp(-\alpha \tau_{\phi 1}), \ \alpha = 0.3, \ \tau_{1\phi} = -\tau_{\phi 1} \end{gather*}Source: Tun, H. & Chen, C.-C. Prediction of mixed-gas adsorption equilibria from pure component adsorption isotherms. AIChE Journal 66, e16243 (2020).
- Parameters:
Loading (float or np.ndarray) – loadings(s) at which to calculate pressure
- Returns:
pressure as same variable type as input
- Return type:
float or np.ndarray
- spreading_pressure(pressure)[source]
Returns spreading pressure as a function of pressure (or fugacity).
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, spreading pressure is calculated as a function of phi using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which will raise an exception. The spreading pressure interpolator should always be built after model fitting.
- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray
Symmetric NRTL VST
- class pyrast.isotherms.SNRTLVST(*args, **kwargs)[source]
- initial_guess()[source]
Provides initial guess for model parameters.
For the Symmetric NRTL Vacancy Solution Theory isotherm, we assume the case of a Langmuir isotherm with activity coefficient of 1.
- loading(pressure)[source]
Returns loading as a function of pressure (or fugacity).
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, loading is calculated as a function of pressure using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which uses root solving to determine loading from the pressure function specific to VST.
- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate loading
- Returns:
loading as same variable type as input
- Return type:
float or np.ndarray
- p0(phi)[source]
Returns P0 as a function of spreading pressure.
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, p0 is calculated as a function of phi using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which uses root solving.
- Parameters:
target_phi (float) – Spreading pressure to calculate P0
- Returns:
P0 value
- Return type:
float
- pressure(loading)[source]
Calculates pressure as a function of loading.
Vacancy Solution Theory (VST) models are defined as functions of pressure. Unfortunately, there is no analytical function for loading, spreading pressure, or p0 as a result. This function is used in combination with root solving to support fitting the VST isotherm with the Symmetric NRTL activity coefficient model. The Symmetric NRTL VST isotherm has three parameters, two from the Langmuir isotherm and one from the activity coefficient model.
Pressure in the Symmetric NRTL VST isotherm is given as:
\begin{gather*} P(q) = \left[\frac{M}{K} \frac{\theta}{1-\theta}\right] \frac{\gamma_{1}}{\gamma_{\phi}} \\ \ln \gamma_1 = (1-\theta)^2 \left[\tau_{1\phi}\frac{G_{1\phi}-1} {(1-\theta + \theta G_{1\phi})^2}\right] \\ \ln \gamma_\phi = \theta^2 \left[\tau_{\phi 1}\frac{G_{\phi 1}-1} {(\theta + (1-\theta) G_{\phi 1})^2}\right] \\ G_{1\phi} = \exp(-\alpha \tau_{1\phi}), \ G_{\phi 1} = \exp(-\alpha \tau_{\phi 1}), \ \alpha = 0.3, \ \tau_{1\phi} = \tau_{\phi 1} \end{gather*}Source: Tun, H. & Chen, C.-C. Prediction of mixed-gas adsorption equilibria from pure component adsorption isotherms. AIChE Journal 66, e16243 (2020).
- Parameters:
Loading (float or np.ndarray) – loadings(s) at which to calculate pressure
- Returns:
pressure as same variable type as input
- Return type:
float or np.ndarray
- spreading_pressure(pressure)[source]
Returns spreading pressure as a function of pressure (or fugacity).
As vacancy solution models have implicit functions for loading, we must use interpolated functions for loading, spreading pressure, and p0. Interpolants are built after fitting the models. Here, spreading pressure is calculated as a function of phi using an interpolator, if built, or it defaults to the ModelIsotherm parent class, which will raise an exception. The spreading pressure interpolator should always be built after model fitting.
- Parameters:
pressure (float or np.ndarray) – pressure(s) at which to calculate spreading pressure
- Returns:
spreading pressure as same variable type as input
- Return type:
float or np.ndarray