olm.general.solution¶
-
class
olm.general.solution(constituents, concentrations, units, T=25.0, T_units='C', cond=None, pH=None)[source]¶ A solution class, that is used for calculations related to chemical solutions.
Parameters: constituents : array like
a list (or array) of strings with ion names
concentrations : array like
a list (or array) of ion concentrations
units : string or list
a string or list of strings containing concentration units (‘mg/L’, ‘mol/L’, or ‘mmol/L’)
T : float
temperature in degrees Celsius (default=25)
T_units : str
temperature units ‘C’ or ‘K’ (default=’C’)
cond : float
specific conductance (default=None)
pH : float
pH of solution (default=None)
Attributes
ions (dict) A dictionary containing ion activities and concentrations. The values for a given ion are accessed using a the name of the ion as a key. Then, the additional keys ‘activity’, ‘conc_mg’, ‘conc_mol’, ‘conc_mmol’, and ‘meq’ access the ion activity (in units of mol/L), concentration in mg/L, concentration in mol/L, concentration in mmol/L and meq/L, respectively. T_C (float) temperature of solution in degrees C T_K (float) temperature of solution in degrees K Methods
I()Function to calculate ionic strength of the solution object from full equation using known ion properties. __init__(constituents, concentrations, units)activity(ion)Retrieve the activity of a given ion in the solution in mol/L. activity_coef(ion[, I])Calculate activity coefficient, gamma, for a given ion in the solution. approxI()Function to calculate approximate ionic strength of solution metal concentration. charge_balance([units])Calculate the charge balance error for this solution. meq(ion)Retrieve meq for a given ion in the solution. mg(ion)Retrieve the concentration of a given ion in the solution in mg/L. mmol(ion)Retrieve the molar concentration of a given ion in the solution in mol/L. mol(ion)Retrieve the molar concentration of a given ion in the solution in mol/L. -
I()[source]¶ Function to calculate ionic strength of the solution object from full equation using known ion properties.
Returns: I - float
ionic strength
-
activity(ion)[source]¶ Retrieve the activity of a given ion in the solution in mol/L.
Parameters: ion : str
string containing ion name for which to calculate activity coefficient
Returns
——-
activity : float
Activity of the specified ion in mol/L.
-
activity_coef(ion, I=None)[source]¶ Calculate activity coefficient, gamma, for a given ion in the solution.
Parameters: ion : str
string containing ion name for which to calculate activity coefficient
I : float
Ionic strength of solution. If None, it will be approximated from metal concentration. (default=None)
Returns
——-
gamma : float
Activity coefficient for the ion specified.
-
approxI()[source]¶ Function to calculate approximate ionic strength of solution metal concentration.
Returns: I : float
ionic strength
-
charge_balance(units='%')[source]¶ Calculate the charge balance error for this solution.
Parameters: units : str (optional)
If set to ‘%’ (default) then the function will return the percent charge balance error. If set to ‘meq’, then the function will return the difference in cation and anion balance in meq/L.
Returns
——-
balance : float
The charge balance error for the solution.
-
meq(ion)[source]¶ Retrieve meq for a given ion in the solution.
Parameters: ion : str
string containing ion name for which to calculate activity coefficient
Returns
——-
meqL : float
Concentration of the specified ion in meq/L.
-
mg(ion)[source]¶ Retrieve the concentration of a given ion in the solution in mg/L.
Parameters: ion : str
string containing ion name for which to calculate activity coefficient
Returns
——-
mgL : float
Concentration of the specified ion in mg/L.
-