Methods in the MieType class
KineticGas - Latest (beta)
The MieType
class, found in pykingas/MieType.py
, inherrits from the py_KineticGas class, and is the interface to the
Mie-Type Model. This class implements utility methods to access mixing parameters etc.
Table of contents
Constructor
Methods to initialise Mie-Type model.
Table of contents
__init__(self, comps, potential, mole_weights=None, sigma=None, eps_div_k=None, la=None, lr=None, lij=0, kij=0, N=4, is_idealgas=False, parameter_ref='default')
If optional parameters are supplied, these are used instead of the parameters found in the database. To supply specific parameters for only some components, give None
for the components that should use the database
value
Args:
comps (str) :
Comma-separated list of components
mole_weights (optional, 1D array) :
Molar masses [g/mol]
sigma (optional, 1D array) :
hard-sphere diameters [m]
eps_div_k (optional, 1D array) :
epsilon parameter / Boltzmann constant [-]
la, lr (optional, 1D array) :
attractive and repulsive exponent of the pure components [-]
lij (optional, float) :
Mixing parameter for sigma (lij > 0 => smaller sigma_12, lij < 0 => larger sigma_12)
kij (optional, float) :
Mixing parameter for epsilon (kij > 0 => favours mixing, kij < 0 => favours separation)
Utility methods
Set- and get methods for interaction parameters, mixing parameters …
Table of contents
get_BH_diameters(self, T)
Compute Barker-Henderson diameters
Args: T (float) : Temperature [K]
Returns: 2d array : Barker-Henderson Diameters, indexed by component pair [m]
get_epsilon_matrix(self, eps_div_k, kij)
Compute matrix of well-depths, given well depth of each component Warning: Use of mixing parameters is not thouroughly tested.
Args:
eps_div_k (1d array) :
Well depth parameter of each component
kij (2d array) :
Not in use, internal parameter self.kij
is used for mixing.
Returns:
2d array :
Well depth for each interaction pair.
get_lambda_matrix(self, lambdas, lij)
Compute pair-interaction $\lambda_r$ parameters, apply mixing parameter.
Args:
lambdas (1d array) :
Repulsive exponents for each pure-component interaction potential
lij (1d array) :
Mixing parameters
Returns:
2d array :
Repulsive exponent for each pair-interaction.
get_sigma_matrix(self, sigma)
Compute interaction parameter $\sigma$ for each particle pair, applying mixing parameters given by self.lij
.
Warning: Use of mixing parameters is not thouroughly tested.
Args:
sigma (1D array) :
sigma-parameters [m]
Retunrs:
2d array :
N x N matrix of sigma parameters, where sigma_ij = 0.5 * (sigma_i + sigma_j), if self.lij = 0.
Warning:
Use of mixing parameters is not thouroughly tested.
potential(self, i, j, r)
Evaluate the interaction potential between types i and j at distance r
Args: i, j (int) : Component indices r (float) : Distance [m] Returns: float : Interaction potential [J]
potential_r(self, i, j, r)
Evaluate the derivative of the interaction potential between types i and j at distance r
Args: i, j (int) : Component indices r (float) : Distance [m] Returns: float : First derivative of interaction potential [N]
potential_rr(self, i, j, r)
Evaluate the second derivative of the interaction potential between types i and j at distance r
Args: i, j (int) : Component indices r (float) : Distance [m] Returns: float : Second derivative of interaction potential [N / m]
set_eps_div_k(self, eps_div_k, update_eos=True)
Set the well depth parameter. Note: Running with update_eos=False
will result in a model using
different parameters for collision integrals and the RDF than for the equation of state.
Args:
eps_div_k (list[float or None]) : Well depth parameter for each pure component. Use None
for default values. Unit (K).
update_eos (bool) : If True (default) also update the eos.
set_la(self, la, update_eos=True)
Set the attractive exponent. Note: Running with update_eos=False
will result in a model using
different parameters for collision integrals and the RDF than for the equation of state.
Args:
la (list[float or None]) : Attractive exponent for each pure component. Use None
for default values.
update_eos (bool) : If True (default) also update the eos.
set_lr(self, lr, update_eos=True)
Set the repulsive exponent. Note: Running with update_eos=False
will result in a model using
different parameters for collision integrals and the RDF than for the equation of state.
Args:
lr (list[float or None]) : Repulsive exponent for each pure component. Use None
for default values.
update_eos (bool) : If True (default) also update the eos.
set_sigma(self, sigma, update_eos=True)
Set the size parameter. Note: Running with update_eos=False
will result in a model using
different parameters for collision integrals and the RDF than for the equation of state.
Args:
sigma (list[float or None]) : Size parameter for each pure component. Use None
for default values. Unit (m).
update_eos (bool) : If True (default) also update the eos.
Interfaces to C++ methods
Lightweight wrappers for the most commonly used C++ side methods.
Table of contents
saft_rdf(self, T, Vm, x, order=2, g2_correction=True)
Compute the radial distribution function at contact
Args:
T (float) :
Temperature [K]
Vm (float) :
Molar volume [m3/mol]
x (list[float]) :
Molar composition [-]
order (int) :
Pertubation order
g2_correction (bool) :
Use correction factor for g2?
Returns:
2d array :
RDF at contact, indexed by component pair.
Internal methods
Internal methods are not intended for use by end-users.
Table of contents
__update_cpp_kingas_param__(self)
Re-Initialize the C++ module with the current parameters in this model. Inheriting classes are responsible for initializing the correct model.
__update_eos_param__(self)
Update the EoS model to use the same parameters as this model is currently set with.
Raises: AttributeError : If the EoS object does not support setting parameters Warning : If the EoS object is using segment numbers different from 1.