Calculations
Functions for calculating properties about the system and calculation types that do not necessarily have independent variables of P, T, and bulk composition (as in equilibrium_equations.py).
- VolFe.calculations.P_VSA(PT, melt_wf, models, nr_step, nr_tol, Ptol)[source]
P of vapor+sulfide+anhydrite saturation for given melt composition and T.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
nr_step (float) – Step-size for Newton-Raphson solver
nr_tol (float) – Tolerance for Newton-Raphson solver
Ptol (float) – Tolerance for total pressure convergence
- Returns:
Pressure of vapor-saturation, Concentration of melt species in weight fraction, Ratios of melt species
- Return type:
- VolFe.calculations.P_sat(PT, melt_wf, models, Ptol, nr_step, nr_tol)[source]
Calculate the pressure of vapor saturation for a given P, T, and melt composition (including volatiles).
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
Ptol (float) – Tolerance for total pressure convergence
nr_step (float) – Step-size for Newton-Raphson solver
nr_tol (float) – Tolerance for Newton-Raphson solver
- Returns:
Pressure of vapor-saturation; Concentration of melt species; Ratios of melt species
- Return type:
- VolFe.calculations.P_sat_H2O_CO2(PT, melt_wf, models, Ptol, nr_step, nr_tol)[source]
Calculate the pressure of vapor saturation for a given P, T, and melt composition (including volatiles) for H2O-CO2 only.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
Ptol (float) – Tolerance for total pressure convergence
nr_step (float) – Step-size for Newton-Raphson solver
nr_tol (float) – Tolerance for Newton-Raphson solver
- Returns:
Pressure of vapor-saturation; Gas and melt composition
- Return type:
- VolFe.calculations.P_sat_sulf_anh(PT, melt_wf, models, Ptol, nr_step, nr_tol)[source]
Calculates the conditions (P, fO2) of sulfide and anhydrite saturation (if possible) for a given melt composition (particularly S)
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
Ptol (float) – Tolerance for total pressure convergence
nr_step (float) – Step-size for Newton-Raphson solver
nr_tol (float) – Tolerance for Newton-Raphson solver
- Returns:
Results of conditions of sulfide and anhydrite saturation
- Return type:
- VolFe.calculations.S_given_T_P_fO2_C_H(PT, melt_wf, models, nr_step, nr_tol)[source]
Calculates the sulfur content of a melt of given CO2, H2O, P and T to cause vapor saturation (no H2S in the melt).
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
nr_step (float) – Step-size for Newton-Raphson solver
nr_tol (float) – Tolerance for Newton-Raphson solver
- Returns:
Concentration of melt species, volatile ratios of melt species
- Return type:
- VolFe.calculations.bulk_composition(run, PT, melt_wf, setup, models)[source]
Calculate bulk composition of the system from given melt composition and information about co-existing gas.
- Parameters:
run (float) – Row number of input data
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
setup (pandas.DataFrame) – Input data
models (pandas.DataFrame) – Model options
- Returns:
Bulk composition of the system
- Return type:
- VolFe.calculations.calc_isobar_CO2H2O(PT, melt_wf, models)[source]
Calculates CO2-H2O isobar at given P and T assuming only CO2-H2O in the melt and vapor.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
- Returns:
H2O-CO2 concentrations for vapor saturation at given P and T
- Return type:
- VolFe.calculations.calc_isopleth_CO2H2O(XH2O, PT, melt_wf, models)[source]
Calculates CO2-H2O isopleth at given XH2O and T, and up to a maximum P, assuming only CO2-H2O in the melt and vapor.
- Parameters:
XH2O (float) – mole fraction of H2O in the vapor
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
- Returns:
H2O-CO2 concentrations for vapor saturation at given P, T, and XH2O
- Return type:
- VolFe.calculations.calc_isotopes(PT, comp, R, models, nr_step, nr_tol, run=0.0)[source]
Calculates the isotope ratio for all species and melt and vapor for H, S, and C for a single melt-vapor composition.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
comp (pandas.DataFrame) – Composition of the melt and vapor by species, including weight fraction of vapor.
R (dict) – Bulk isotope ratio of the system.
models (pandas.DataFrame) – Model options
nr_step (float) – Step-size for Newton-Raphson solver.
nr_tol (float) – Tolerance for Newton-Raphson solver.
run (float, optional) – Row number in file to run. Defaults to 0.0.
- Returns:
Isotope ratios for all species in S, C, and H. Isotope ratios for melt and vapor in S, C, and H.
- Return type:
- VolFe.calculations.calc_pure_solubility(PT, melt_wf, models)[source]
Calculates pure solubility of H2O and CO2 at given P and T and melt composition.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
- Returns:
Solubility of H2O and CO2 at given P and T
- Return type:
- VolFe.calculations.check_mass_balance(xg, melt, melt_and_gas)[source]
Checks the mass balance by comparing melt and gas composition to bulk composition given masses of the phases.
- VolFe.calculations.compositions_within_error(run, setup)[source]
Calculates a random composition within error of the given composition assuming Guassian distribution of uncertainty.
- Parameters:
run (int) – Row number of input data
setup (pandas.DataFrame) – Input data
- Returns:
Random composition within error of given composition
- Return type:
- VolFe.calculations.conc_insolubles(PT, melt_wf, models)[source]
Calculates the concentration of H2, CO, CH4, and H2S in a melt at the given conditions and the melt species ratios.
- VolFe.calculations.fO2_P_VSA(PT, melt_wf, models, nr_step, nr_tol, Ptol)[source]
fO2 and P of vapor+sulfide+anhydrite saturation for given melt composition and T.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
nr_step (float) – Step-size for Newton-Raphson solver
nr_tol (float) – Tolerance for Newton-Raphson solver
Ptol (float) – Tolerance for total pressure convergence
- Results:
tuple(float,dict,dict): Pressure of vapor-saturation, Concentration of melt species in weight fraction, Ratios of melt species
- VolFe.calculations.fO2_range_from_S(PT, melt_wf, models)[source]
Calculated range in fO2 assuming sulfide and anhydrite saturation (if possible) for given melt composition (particularly S).
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
- Returns:
Results of range in fO2 calculation from sulfur content of melt
- Return type:
- VolFe.calculations.fO2_silm_sulf_anh(PT, melt_wf, models)[source]
Calculates the fO2 and sulfur content for melt saturated with both sulfide and anhydrite.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
- Returns:
fO2, S6+/ST, total S, SCAS, SCSS
- Return type:
- VolFe.calculations.gas_comp_all_open(xg, xg_all, models)[source]
Cumulated gas composition during open-system degassing.
- Parameters:
xg (dict) – Gas composition in mole fraction at given conditions
xg_all (dict) – Cumulative gas composition in mole fraction to this point
models (pandas.DataFrame) – Model options
- Returns:
New cumulative gas composition in mole fraction
- Return type:
- VolFe.calculations.graphite_saturation(PT, melt_wf, models)[source]
Evaluates if the system is graphite saturated.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
- Returns:
whether or not the system is graphite saturated
- Return type:
- VolFe.calculations.mass_vol_rho(PT, melt_wf, gas_mf, bulk_wf, models)[source]
Calculates mass, volume, and density of melt, gas, and bulk system.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
gas_mf (dict) – Gas composition in molefraction
bulk_wf (dict) – Bulk composition in weight fraction
models (pandas.DataFrame) – Model options
- Returns:
Melt, gas, and bulk density and volume
- Return type:
- VolFe.calculations.mf_C_species(comp)[source]
Calculates weight fraction of C in each carbon-bearing species in the melt and vapor wrt to total carbon in the system.
- Parameters:
comp (pandas.DataFrame) – Weight fraction by species in the melt and mole fraction in vapor including the wt% of vapor
- Returns:
weight fraction (equivalent to mole fraction) of C in each species relative to total C
- Return type:
- VolFe.calculations.mf_H_species(comp)[source]
Calculates weight fraction of H in each hydrogen-bearing species in the melt and vapor wrt to total hydrogen in the system.
- Parameters:
comp (pandas.DataFrame) – Weight fraction by species in the melt and mole fraction in vapor including the wt% of vapor
- Returns:
weight fraction (equivalent to mole fraction) of H in each species relative to total H
- Return type:
- VolFe.calculations.mf_S_species(comp)[source]
Calculates weight fraction of S in each sulfur-bearing species in the melt and vapor wrt to total sulfur in the system.
- Parameters:
comp (pandas.DataFrame) – Weight fraction by species in the melt and mole fraction in vapor including the wt% of vapor
- Returns:
weight fraction (equivalent to mole fraction) of S in each species relative to total S
- Return type:
- VolFe.calculations.mf_S_species_old(melt_wf, gas_mf)[source]
Calculates weight fraction of each sulfur species in the melt and vapor wrt to total sulfur in the system.
- VolFe.calculations.new_bulk_regas_open(PT, melt_wf, bulk_wf, gas_mf, dwtg, models)[source]
New bulk composition of the system when regassing.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
bulk_wf (dict) – Bulk composition of the system in weight fraction
gas_mf (dict) – Gas composition in mole fraction
dwtg (float) – Weight fraction of gas to add into the system
models (pandas.DataFrame) – Model options
- Returns:
New bulk composition of the system
- Return type:
- VolFe.calculations.sulfur_saturation(PT, melt_wf, models)[source]
Check if melt is saturated with immiscible sulfide or anhydrite.
- Parameters:
PT (dict) – Pressure in bars as “P” and temperature in ‘C as “T”
melt_wf (dict) – Melt composition (SiO2, TiO2, etc. including volatiles)
models (pandas.DataFrame) – Model options
- Returns:
Values of SCSS, STCSS, SCAS, STCAS, ST, and whether the melt is sulfide and/or anhydrite saturated
- Return type: