SorptionModels.jl
Get more out of your sorption data
SorptionModels.jl provides a number of models and which describe solubility in polymers, as well as various analyses you can perform to extract information from your models once they are fit to experimental data.
Using this package
Most methods are designed to operate on isotherms. This is accessed, computationally speaking, through IsothermData
structs, defined in MemrbaneBase.
Some models have convenience methods that circumvent the need to wrap data in an isotherm, but you are more likely to encounter user mistakes by doing so. For example, when fitting Dual Mode models for use in a PartialImmobilizationModel
analysis, you must be careful to ensure you're using fugacity instead of pressure. Ensuring that you're fitting with fugacities is as easy as setting the keyword use_fugacity=true
when using IsothermData structs.
Models are broken down into three categories, each serving a particular range of purposes with some overlap:
Empirical Sorption Models
Models which do not require state parameters. The parameters you fit from these models will typically have physical meaning which can be useful in understanding how sorption behaves in the polymer, but the models themselves are generally not incredibly predictive unless heavily leveraged against carefully taken experimental data (such as multiple isotherms at distinct temperatures). These models can also serve as accurate interpolation (and possibly extrapolation / noise suppression) tools.
Fundamental Sorption Models
Models which are described by an equation of state such as Sanchez Lacombe or PC-SAFT. These models, in stark contrast to empirical models, are predictive by nature. That is to say, they will generally not align perfectly to experimental data, but will generate values without much (if any) experimental data to go off of. They are also useful for predicting the solubility of mixed systems.
To learn how to set up the equations of state that act as the engine of these models, see SorptionModels.jl.
Transient Sorption Models
Special models which describe time-dependent sorption into a flat polymer sheet (termed "slab") geometry. Useful for estimating diffusivity using measurements of sorption over time (termed "sorption kinetics"), if such data is available.
Obviously, all sorption models share the common aim to predict penetrant-polymer solubility. Therefore, every sorption model will have a few shared functions that can be understood without knowing individual model details.
All models are fit via fit_model
and generate data through predict_sorption
. Generally, you can hand an isotherm (from MembraneBase) and the right supplementary information (if needed) over to...
SorptionModels.fit_model
— Methodfit_model(model, ::IsothermData)
Fit a sorption model to an isotherm. If the data required for the model is not in the isotherm, an error message will be returned.
Any keyword arguments get passed on to the specific model.
...then immediately get the fitted isotherm back through one of two methods...
SorptionModels.predict_concentration
— Functionpredict_concentration(model::SorptionModel, args...)
Predict concentration with a sorption model. Predictions are generally returned in the format of a vector of values corresponding to an input of a vector of pressures. If the model typically uses activity, it must have an activity conversion function attached to it.
predict_concentration(::DualModeModel, pressure_mpa::Number)
Predict the concentration of a penetrant given a dual mode model and pressure (MPa).
predict_concentration(::DualModeModel, pressures_mpa::AbstractVector)
Predict a vector of concentrations for a pure dual mode model given a corresponding vector of pressures. Mixed dual mode models aren't implemented yet # todo
predict_concentration(::AbstractVector{<:DualModeModel}, partial_pressures_mpa::AbstractVector{<:Number})
Predict mixed gas concentrations using the dual mode mixing rule (langmuir-type competitive sorption) given a set of fit models and corresponding partial pressures. e.g., predict_concentration([gas_1_model, gas_2_model, ...], [gas_1_pressure, gas_2_pressure, ...])
partial_pressures_mpa
is a bit of a misnomer. If the model was fit to fugacities, then fugacities should, of course, be specified (in MPa).
predict_concentration(gm::GABModel, pressure::Number)
Predict a concentration given a pressure. Note that GAB is fit to activity, so you will need to specify a pressure_conversion_function(pressure::Number) -> activity::Number
when fitting the model. See fit_gab_model
predict_concentration(::HenryModel, pressure_mpa::Number)
Predict the concentration of a penetrant given a henry model and pressure (MPa).
SorptionModels.a_predict_concentration
— Functiona_predict_concentration(model::SorptionModel, args...)
Predict concentration with a sorption model that implements activity based methods. Predictions are generally returned in the format of a vector of values corresponding to an input of a vector of activities.
a_predict_concentration(gm::GABModel, activity::Number)
Predict concentration based on a GAB model and given activity. Mixed GAB models aren't implemented due to the empirical nature of the model (and it's lack of predictivity)
a_predict_concentration(gm::GABModel, activities::AbstractVector)
Returns a vector of concentrations predicted by the GAB model for a corresponding vector of activities.
a_predict_concentration(::FloryHugginsDualModeModel, activity::Number)
Predict the concentration of a penetrant given a flory huggins dual mode model and activity.