Batch calculations
Functions that join calculations together to enable them to be run for multiple conditions. This might be to create a degassing calculations (i.e., run over multiple P) or Pv sat for a whole spreadsheet of melt compositions. More details can be found in the Worked Examples section.
- VolFe.batch_calculations.calc_Pvsat(setup, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns], first_row=0, last_row=None, p_tol=0.1, nr_step=1.0, nr_tol=1e-09)[source]
Calculates the pressure of vapor saturation for multiple melt compositions given volatile-free melt composition, volatile content, temperature, and an fO2 estimate.
- Parameters:
setup (pandas.DataFrame) – Melt compositions to be used, requires following headers: Sample; T_C; DNNO or DFMQ or logfO2 or (Fe2O3 and FeO) or Fe3FeT or S6ST; SiO2, TiO2, Al2O3, (Fe2O3T or FeOT unless Fe2O3 and FeO given), MnO, MgO, CaO, Na2O, K2O, P2O5; H2O and/or CO2ppm and/or STppm and/or Xppm. Note: concentrations (unless otherwise stated) are in wt%
models (_type_pandas.DataFrame, optional) – Model options. Defaults to mdv.default_models.
first_row (int, optional) – Integer of the first row in the setup file to run (note the first row under the headers is row 0). Defaults to 0.
last_row (float, optional) – Integer of the last row in the setup file to run (note the first row under the headers is row 0). Defaults to None.
p_tol (float, optional) – Required tolerance for convergence of Pvsat in bars. Defaults to 1.0e-1.
nr_step (float, optional) – Step size for Newton-Raphson solver for melt speciation (this can be made smaller if there are problems with convergence.) Defaults to 1.0.
nr_tol (float, optional) – Tolerance for the Newton-Raphson solver for melt speciation in weight fraction (this can be made larger if there are problems with convergence.) Defaults to 1.0e-9.
- Returns:
Results of pressure of vapor saturation calculation
- Return type:
Outputs
results_saturation_pressures: csv file (if output csv = yes in models)
- VolFe.batch_calculations.calc_comp_error(setup, run, iterations=100, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns])[source]
Generates a specified number of random melt compositions given errors on the composition.
- Parameters:
setup (pandas.DataFrame) – Input data of melt compositions and 1sd uncertainties. Assumed 1sd uncertainties are absolute unless sd_type is specified (A = absolute, R = relative).
run (int) – Row number of input data
iterations (int, optional) – Number of compositions within error to produce. Defaults to 100
models (pandas.DataFrame, optional) – Model options. Defaults to mdv.default_models.
- Returns:
Results of Monte Carlo compositions
- Return type:
Outputs
‘random_compositions.csv’ if ‘output csv’ is True
- VolFe.batch_calculations.calc_comp_error_function(setup, function='calc_Pvsat', first_row=0, last_row=None, iterations=100, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns])[source]
Calculates Pvsat or fO2-from-melt-S and uncertainity based on uncertainty on inputted melt composition and T.
- Parameters:
setup (pandas.DataFrame) – Input data of melt compositions and 1sd uncertainties. Assumed 1sd uncertainties are absolute unless sd_type is specified (A = absolute, R = relative).
function (str, optional) – Which calculation - calc_pvsat or calc_melt_S_oxybarometer - to run. Defaults to “calc_pvsat”.
first_row (int, optional) – First row on input file to run. Defaults to 0.
last_row (int, optional) – Last row of input file to run. Defaults to None.
iterations (int, optional) – Number of random melt compositions to produce using Monte Carlo approach to run calculations on. Defaults to 100.
models (pandas.DataFrame, optional) – Model options. Defaults to mdv.default_models.
- VolFe.batch_calculations.calc_fugacity_coefficients(setup, first_row=0, last_row=None, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns])[source]
Calculates values of fugacity coefficients for given conditions.
- Parameters:
setup (pandas.DataFrame) – Input data
first_row (int, optional) – First row of input data to run calculation for. Defaults to 0.
last_row (int, optional) – Last row of input data to run calculation for. Defaults to None.
models (pandas.DataFrame, optional) – Model options. Defaults to mdv.default_models.
- Returns:
Values of fugacity coefficients
- Return type:
- Outputs:
‘results_fugacity_coefficients.csv’ is ‘output_csv’ is True
- VolFe.batch_calculations.calc_gassing(setup, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns], run=0, nr_step=1.0, nr_tol=1e-09, dp_step='auto', psat_tol=0.1, dwtg=1e-06, i_nr_step=0.1, i_nr_tol=1e-09, nr_step_eq=1.0, suppress_warnings=True)[source]
Calculates the pressure of vapor saturation for multiple melt compositions given volatile-free melt composition, volatile content, temperature, and an fO2 estimate.
- Parameters:
setup (pandas.DataFrame) – Melt composition to be used, requires following headers (notes in [] are not part of the headers): Sample; T_C; DNNO or DFMQ or logfO2 or (Fe2O3 and FeO) or Fe3FeT or S6ST [at initial pressure]; SiO2, TiO2, Al2O3, (Fe2O3T or FeOT unless Fe2O3 and FeO given), MnO, MgO, CaO, Na2O, K2O, P2O5 [concentrations are in wt%]; (H2O and/or CO2ppm and/or STppm and/or Xppm) [concentration of H2O in wt%]; final_P [IF regassing, pressure calculation stops at in bars]; wt_g [IF starting from given pressure and gas is present, can specifiy the gas present in wt%]; initial_CO2wtpc [IF starting from given pressure and gas is present, can specifiy initial composition using initial CO2 dissolved in the melt in wt%].
models (pandas.DataFrame, optional) – Model options. Defaults to mdv.default_models.
run (int, optional) – Integer of the row in the setup file to run (note the first row under the headers is row 0). Defaults to 0.
nr_step (float, optional) – Step size for Newton-Raphson solver for melt speciation (typically 1 is fine, but this can be made smaller if there are problems with convergence). Defaults to 1.0.
nr_tol (float, optional) – Tolerance for the Newton-Raphson solver for melt speciation in weight fraction (can be increased if there are problems with convergence). Defaults to 1.0e-9.
dp_step (float, optional) – Pressure step size for gassing calculation in bars. Defaults to “auto”.
psat_tol (float, optional) – Required tolerance for convergence of Pvsat in bars. Defaults to 0.1.
dwtg (float, optional) – Amount of gas to add at each step if regassing in an open-system in wt fraction total system. Defaults to 1.0e-6.
i_nr_step (float, optional) – Step-size for newton-raphson convergence for isotopes (can be increased if there are problems with convergence). Defaults to 1.0e-1.
i_nr_tol (float, optional) – Tolerance for newton-raphson convergence for isotopes (can be increased if there are problems with convergence). Defaults to 1.0-9.
nr_step_eq (float, optional) – Step-size for new-raphson solver for isotopes. Defaults to 1.0.
suppress_warnings (bool, optional) – Suppress runtime warnings. Defaults to True.
- Returns:
Results of degassing calculation.
- Return type:
Outputs
If output csv = yes in models results_gassing_chemistry: csv file
- VolFe.batch_calculations.calc_isobar(setup, run=0, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns], initial_P=1000.0, final_P=10000.0, step_P=1000.0)[source]
Calculates H2O-CO2-only isobars for given T, melt composition, initial/final P, and P step-size.
- Parameters:
setup (pandas.DataFrame) – Melt composition to be used, requires following headers (notes in [] are not part of the headers): Sample; T_C; DNNO or DFMQ or logfO2 or (Fe2O3 and FeO) or Fe3FeT or S6ST; SiO2, TiO2, Al2O3, (Fe2O3T or FeOT unless Fe2O3 and FeO given), MnO, MgO, CaO, Na2O, K2O, P2O5[concentrations are in wt%].
run (int, optional) – Integer of the row in the setup file to run (note the first row under the headers is row 0). Defaults to 0.
models (_type_, optional) – Model options. Defaults to mdv.default_models.
initial_P (float, optional) – Starting pressure in bar for isobar calculation. Defaults to 1000.0.
final_P (float, optional) – Final pressure in bar for isobar calculation. Defaults to 10000.0.
step_P (float, optional) – Pressure step in bar for calculating isobars between starting and final pressures. Defaults to 1000.0.
- Returns:
Results from isobar calculation
- Return type:
Outputs
If output csv = yes in models, results_isobars: csv file
- VolFe.batch_calculations.calc_isopleth(setup, run=0, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns], final_P=10000.0, step_XH2O=0.2)[source]
Calculates H2O-CO2-only isopleths for given T, melt composition, up to a final P, and XH2O step-size.
- Parameters:
setup (pandas.DataFrame) – Melt composition to be used, requires following headers (notes in [] are not part of the headers): Sample; T_C; DNNO or DFMQ or logfO2 or (Fe2O3 and FeO) or Fe3FeT or S6ST; SiO2, TiO2, Al2O3, (Fe2O3T or FeOT unless Fe2O3 and FeO given), MnO, MgO, CaO, Na2O, K2O, P2O5[concentrations are in wt%].
run (int, optional) – Integer of the row in the setup file to run (note the first row under the headers is row 0). Defaults to 0.
models (_type_, optional) – Model options. Defaults to mdv.default_models.
final_P (float, optional) – Final pressure in bar for isobar calculation. Defaults to 10000.0.
step_XH2O (float, optional) – XH2O step in mole fraction for calculating isopleths. Defaults to 0.20.
- Returns:
Results from isopleth calculation
- Return type:
Outputs
If output csv = yes in models, results_isopleth: csv file
- VolFe.batch_calculations.calc_isotopes_gassing(setup, R_i_d, first_row=0, last_row=None, nr_step=1.0, nr_tol=1e-09, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns])[source]
Calculates the isotopic ratio and delta value of all species and melt and vapor during degassing.
- Parameters:
setup (pandas.DataFrame) – Output from a degassing calculation.
R_i_d (dict) – Bulk isotope ratios as delta values.
first_row (int, optional) – First row in setup to run. Defaults to 0.
last_row (_type_, optional) – Last run in setup to run. Defaults to None.
nr_step (float, optional) – Step-size for Newton-Raphson solver. Defaults to 1.0.
nr_tol (float, optional) – Tolerance for Newton-Raphson solver. Defaults to 1.0e-9.
models (pandas.DataFrame, optional) – Model options. Defaults to mdv.default_models.
- Returns:
Results of isotopic fractionation during degassing.
- Return type:
- VolFe.batch_calculations.calc_melt_S_oxybarometer(setup, first_row=0, last_row=None, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns], p_tol=0.1, nr_step=1.0, nr_tol=1e-09)[source]
Calculates the range in oxygen fugacity based on the melt sulfur content for multiple melt compositions given volatile-free melt composition, volatile content, temperature, and either pressure or assumes Pvsat.
- Parameters:
setup (pandas.DataFrame) – Melt compositions to be used, requires following headers: Sample, T_C, SiO2, TiO2, Al2O3, (Fe2O3T or FeOT unless Fe2O3 and FeO given), MnO, MgO, CaO, Na2O, K2O, P2O5, H2O and/or CO2ppm and/or STppm and/or Xppm. Note: concentrations (unless otherwise stated) are in wt%. Optional: P_bar is pressure is given (otherwise calculation is at Pvsat). Fe3FeT if P_bar is specified.
models (pandas.DataFrame, optional) – Model options
first_row (int, optional) – First row in the setup file to run (note the first row under the headers is row 0). Default = 0
last_row – (int, optional): Last row in the setup file to run (note the first row under the headers is row 0). Default = None
p_tol (float, optional) – Required tolerance for convergence of Pvsat in bars. Default = 1.e-1
nr_step (float, optional) – Step size for Newton-Raphson solver for melt speciation (this can be made smaller if there are problems with convergence.). Default = 1
nr_tol (float, optional) – Tolerance for the Newton-Raphson solver for melt speciation in weight fraction (this can be made larger if there are problems with convergence). Default = 1.e-9
- Returns:
Results of fO2 range from melt sulfur content calculation
- Return type:
Outputs
fO2_range_from_S: csv file (if output csv = True in models)
- VolFe.batch_calculations.calc_pure_solubility(setup, run=0, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns], initial_P=5000.0)[source]
Calculates the solubility of pure H2O and pure CO2.
- Parameters:
setup (pandas.DataFrame) – Melt compositions to be used, requires following headers: Sample; T_C; SiO2, TiO2, Al2O3, (Fe2O3T or FeOT unless Fe2O3 and FeO given), MnO, MgO, CaO, Na2O, K2O, P2O5, H2O; Note: concentrations (unless otherwise stated) are in wt%.
run (int, optional) – Row number of input data
models (pandas.DataFrame) – Model options
initial_P (float, optional) – Highest pressure in bar for solubility calculation. Default = 5000.0
- Returns:
Results of pure solubility calculation.
- Return type:
Outputs
results_pure_solubility.csv: csv file (if output csv = yes in models)
- VolFe.batch_calculations.calc_sol_consts(setup, first_row=0, last_row=None, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns])[source]
Calculate solubility functions for given melt composition and conditions.
- Parameters:
setup (pandas.DataFrame) – Input data
first_row (int, optional) – First row of input data to run calculation for. Defaults to 0.
last_row (int, optional) – Last row of input data to run calculation for. Defaults to None.
models (pandas.DataFrame, optional) – Model options. Defaults to mdv.default_models.
- Returns:
Values of solubility functions
- Return type:
- Outputs:
‘capacities.csv’ is ‘output_csv’ is True
- VolFe.batch_calculations.calc_sulfur_vcomp(setup, models= option type COH_species yes_H2_CO_CH4_melt H2S_m True species X Ar Hspeciation none fO2 Kress91A ... ... error 0.1 print status False output csv True setup False high precision False [78 rows x 1 columns])[source]
Calculates SCAS, SCSS, Csulfide and Csulfate for multiple melt compositions
- Parameters:
setup (pandas.DataFrame) – Input data
models (pandas.DataFrame, optional) – Model options. Defaults to mdv.default_models.
- Returns:
SCAS, SCSS, Csulfide and Csulfate for multiple melt compositions
- Return type:
- VolFe.batch_calculations.options_from_setup(run, models, setup)[source]
# WORK IN PROGRESS # Allows model options to be read from the setup file rather than models file.
- Parameters:
run (int) – Integer of the row in the setup file to read from (note the first row under the headers is row 0).
models (pandas.DataFrame) – Model options
setup (pandas.DataFrame) – Melt compositions to be used, require header using the same labels as row labels from models file if you want to use that option.
- Returns:
Models options with the options updated from the setup file.
- Return type:
- VolFe.batch_calculations.results_isotopes_gas_melt(comp, run)[source]
Outputs headers and values for melt and vapor composition for isotope fractionation calculations.
- Parameters:
comp (pandas.DataFrame) – Composition of the melt and vapor by species, including weight fraction of vapor.
run (float) – Index of interest.
- Returns:
Headers. Values.
- Return type:
- VolFe.batch_calculations.results_isotopes_model_options(models)[source]
Outputs headers and values for model options related to isotopic fractionation.
- Parameters:
models (pandas.DataFrame) – Model options.
- Returns:
Headers. Values.
- Return type:
- VolFe.batch_calculations.results_table_f_p_xg_y_M_C_K_d(PT, melt_wf, models)[source]
Creates DataFrames with headers and values for fO2, fugacities, partial pressures, vapor mole fractions, fugacity coefficients, molecular masses, solubility constants, equilibrium constants, and melt density
- Parameters:
PT (dict) – Pressure (bars) as “P” and temperature (‘C) as “T”
melt_wf (dict:) – Melt composition
models (pandas.DataFrame) – Model options used in calculations
- Returns:
Headers and values for for fO2, fugacities, partial pressures, vapor mole fractions, fugacity coefficients, molecular masses, solubility constants, equilibrium constants, and melt density
- Return type:
- VolFe.batch_calculations.results_table_isotopes(PT, R_all_species_S, R_m_g_S, R_all_species_C, R_m_g_C, R_all_species_H, R_m_g_H)[source]
Outputs headers and values for isotope ratios for all species and melt and vapor for all elements.
- Parameters:
PT (dict) – Pressure (bars) as “P” and temperature (‘C) as “T”.
R_all_species_S (dict) – S isotope ratios of all S-bearing species.
R_m_g_S (dict) – S isotope ratio of melt and vapor.
R_all_species_C (dict) – C isotope ratios of all C-bearing species.
R_m_g_C (dict) – C isotope ratio of melt and vapor.
R_all_species_H (dict) – H isotope ratios of all H-bearing species.
R_m_g_H (dict) – H isotope ratio of melt and vapor.
- Returns:
Headers. Values.
- Return type:
- VolFe.batch_calculations.results_table_isotopes_d(R_all_species_S, R_m_g_S, R_all_species_C, R_m_g_C, R_all_species_H, R_m_g_H)[source]
Outputs headers and values for isotope ratios for all species and melt and vapor for all elements as delta-values.
- Parameters:
R_all_species_S (dict) – S isotope ratios of all S-bearing species.
R_m_g_S (dict) – S isotope ratio of melt and vapor.
R_all_species_C (dict) – C isotope ratios of all C-bearing species.
R_m_g_C (dict) – C isotope ratio of melt and vapor.
R_all_species_H (dict) – H isotope ratios of all H-bearing species.
R_m_g_H (dict) – H isotope ratio of melt and vapor.
- Returns:
Headers. Values.
- Return type:
- VolFe.batch_calculations.results_table_melt_comp_etc(PT, melt_comp, conc, frac, melt_wf)[source]
Creates DataFrames with headers and values for pressure, temperature, and melt composition (concentration and ratios)
- Parameters:
PT (dict) – Pressure (bars) as “P” and temperature (‘C) as “T”
melt_comp (dict) – Melt composition in weight fraction (major and minor elements)
conc (dict) – Volatile concentrations in the melt in weight fraction
frac (dict) – Ratios of each species over volatile element
melt_wf (dict) – Melt composition (specifically for sulfide composition)
- Returns:
Headers and values for pressure, temperature, and melt composition (concentration and ratios)
- Return type:
- VolFe.batch_calculations.results_table_melt_vol()[source]
Creates DataFrame with headers for volatile concentrations in melt
- Returns:
Headers for volatile concentrations in melt
- Return type:
- VolFe.batch_calculations.results_table_model_options(models)[source]
Creates DataFrames with headers and values for options used in calculations and datetime of calculations
- Parameters:
models (pandas.DataFrame) – Model options used in calculations
- Returns:
Headers and values for model options used in calculations and datetime of calculation
- Return type:
- VolFe.batch_calculations.results_table_open_all_gas()[source]
Creates DataFrame of headers for cumulative gas composition
- Returns:
Headers for cumulative gas composition
- Return type:
- VolFe.batch_calculations.results_table_sample_name(setup, run)[source]
Creates DataFrames with headers and values for Sample name
- Parameters:
setup (pandas.DataFrame) – DataFrame with melt compositions to be used.
run (int) – Row number to be read from DataFrame
- Returns:
Header and value for sample name
- Return type:
- VolFe.batch_calculations.results_table_sat(sulf_sat_result, PT, melt_wf, models)[source]
Creates DataFrame of headers and values for sulfur and graphite saturation results.
- Parameters:
sulf_sat_result (dict) – Sulfur saturation results
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:
Headers and values for sulfur and graphite saturation results
- Return type: