Calculating dissolved volatile concentrations

The VESIcal.calculate_dissolved_volatiles() function calcutions the concentration of dissolved H2O and CO2 in the liquid at a given pressure-temperature condition and with a given H2O-CO2 fluid composition, defined as the mole fraction of H2O in an H2O-CO2 fluid (XH2Ofluid). The default MagmaSat model relies on the underlying functionatlity of MELTS, whose basic function is to calculate the equilibrium phase assemblage given the bulk composition of the system and pressure-temperature conditions. To calculate dissolved volatile concentrations thus requires computing the equilibrium state of a system at fixed pressure and temperature over a range of bulk volatile concentrations until a solution is found that satisfies the user defined fluid composition.

First, the function makes an initial guess at the appropriate bulk volatile concentrations by finding the minimum dissolved volatile concentrations in the liquid at saturation, while asserting that the weight fraction of H2O/(total volatiles) in the system is equal to the user input mole fraction of H2O/(total volatiles) in the fluid. This is done by increasing the H2O and CO2 concentrations appropriately until a fluid phase is stable. Once fluid saturation is determined, the code then performs directional, iterative, and progressively more refined searches, increasing the proportion of H2O or CO2 in the system if the mole fraction of H2O calculated in the fluid is greater than or less than that defined by the user, respectively. Four iterative searches are performed; the precision of the match between the calculated and defined XH2Ofluid increases from 0.1 in the first iteration to 0.01, 0.001, and finally to 0.0001. Thus, the calculated dissolved volatile concentrations correspond to a system with XH2Ofluid within 0.0001 of the user defined value.

Method structure:

Single sample:

def calculate_dissolved_volatiles(self, sample, temperature, pressure, X_fluid=1, verbose=False).result

ExcelFile batch process:

def calculate_dissolved_volatiles(self, temperature, pressure, X_fluid=1, print_status=False)

Required inputs:

sample: Only for single-sample calculations. The composition of a sample. A single sample may be passed as a dictionary of values, with compositions of oxides in wt%.

temperature, pressure, and X_fluid: the temperature in degrees C, the pressure in bars, and the mole fraction of H2O in the H2O-CO2 fluid, XH2Ofluid. Temperature and pressure of the sample or samples must be passed unless an ExcelFile object with a column for temperature and/or pressure is passed to sample. XH2Ofluid is optional, with a default value of 1 (pure H2O fluid). If a numerical (float) value is passed for either temperature, pressure, or X_fluid, that will be the value used for one or all samples. If, alternatively, the user wishes to use temperature, pressure, and/or X_fluid information in their ExcelFile object, the title of the column containing temperature, pressure, or X_fluid data should be passed in quotes (as a string) to temperature, pressure, and/or X_fluid, respectively. Note for batch calculations that if temperature, pressure, or XH2Ofluid information exists in the ExcelFile but a single numerical value is defined for one or both of these variables, both the original information plus the values used for the calculations will be returned.

Optional inputs:

verbose: Only for single-sample calculations. Default value is False. If set to True, additional parameters are returned in a dictionary: H2O and CO2 concentrations in the fluid in mole fraction, temperature, pressure, and proportion of the fluid in the system in wt%.

print_status: Only for ExcelFile batch calcualtions. The default value is False. If True is passed, the progress of the calculation will be printed to the terminal. The user may desire to see the status of the calculation, as this particular function can be quite slow, averaging between 3-5 seconds per sample.

Calculated outputs: If a single sample is passed to sample, a dictionary with keys ‘H2O’ and ‘CO2’ corresponding to the calculated dissolved H2O and CO2 concentrations in the liquid is returned (plus additional variables ‘temperature’ in degrees C, ‘pressure’ in bars, ‘XH2O_fl’, ‘XCO2_fl’, and ‘FluidProportion_wtper’ (the proportion of the fluid in the system in wt%) if verbose is set to True).

If mutliple samples are passed as an ExcelFile object, a pandas DataFrame is returned with sample information plus calculated dissolved H2O and CO2 concentrations in the liquid, the fluid composition in mole fraction, and the proportion of the fluid in the system in wt%. Pressure (in bars) and Temperature (in degrees C) columns are always returned.

For an entire dataset

Import a data file

myfile = v.BatchFile('example_data.xlsx')
myfile.get_data()
Output
Label SiO2 TiO2 Al2O3 Fe2O3 Cr2O3 FeO MnO MgO NiO CoO CaO Na2O K2O P2O5 H2O CO2 Press Temp
BT-ex 77.5 0.08 12.5 0.207 0 0.473 0 0.03 0 0 0.43 3.98 4.88 0 5.5 0.05 500 900
TVZMa-ex 78.37 0.13 11.94 0 0 0.99 0.04 0.05 0 0 0.53 3.8 4.14 0 4.06 0.005 600 800
TVZOh-ex 77.9 0.08 12.15 0 0 0.95 0.05 0.06 0 0 0.55 4.05 4.12 0 4.63 0.005 50 900
Oh48-FTIR1-MI1-a 78.27 0.0298 12.02 0 0 0.9828 0.0336 0.0515 0 0 0.4772 4.05 4.09 0 4.214912406 0.004565932 250 950
Oh48-FTIR1-MI1-b 78.27 0.0298 12.02 0 0 0.9828 0.0336 0.0515 0 0 0.4772 4.05 4.09 0 4.005815793 0.004447963 500 1025
Oh48-FTIR1-MI1-IRc 78.27 0.0298 12.02 0 0 0.9828 0.0336 0.0515 0 0 0.4772 4.05 4.09 0 3.885649341 0.004654367 5000 925
Oh50-4.1 77.91 0.0984 12.07 0 0 1.0556 0.0257 0.0999 0 0 0.5216 4.04 4.18 0 4.641842879 0.004565932 1000 862
Oh50-4.2 77.91 0.0984 12.07 0 0 1.0556 0.0257 0.0999 0 0 0.5216 4.04 4.18 0 4.402133476 0.004447963 100 770
Oh49-4.1 77.92 0.0099 12.11 0 0 1.002 0.0672 0.0546 0 0 0.5346 4.01 4.3 0 4.283934433 0.004565932 1000 855
Oh49-4.2 77.92 0.0099 12.11 0 0 1.002 0.0672 0.0546 0 0 0.5346 4.01 4.3 0 4.230532593 0.004447963 500 1000
Ma55-5a.1 77.68 0.0096 12.27 0 0 1.0272 0.0628 0.0342 0 0 0.6064 3.97 4.35 0 4.459767403 0.004654367 5000 1010
Ma57-3b.2 77.9 0.0498 12.07 0 0 1.0844 0.0748 0.0355 0 0 0.4759 4.1 4.21 0 3.712506046 0.004447963 1000 1012
Ma57-3c.1 77.65 0.159 12.28 0 0 0.9769 0.0597 0.0577 0 0 0.5598 4.08 4.18 0.0064 4.443973024 0.004654367 100 885
Ma57-3c.2 77.65 0.159 12.28 0 0 0.9769 0.0597 0.0577 0 0 0.5598 4.08 4.18 0.0064 4.283171078 0.004644523 1000 885

Do the calculation

dissolved = myfile.calculate_dissolved_volatiles(temperature=900.0, pressure=1000.0, X_fluid=0.5, print_status=True)
dissolved
Output
Label SiO2 TiO2 Al2O3 Fe2O3 Cr2O3 FeO MnO MgO NiO CoO CaO Na2O K2O P2O5 H2O CO2 Press Temp H2O_liq_VESIcal CO2_liq_VESIcal XH2O_fl_VESIcal XCO2_fl_VESIcal FluidProportion_wt_VESIcal Temperature_C_VESIcal Pressure_bars_VESIcal X_fluid_input_VESIcal Model
BT-ex 77.5 0.08 12.5 0.207 0 0.473 0 0.03 0 0 0.43 3.98 4.88 0 5.5 0.05 500 900 2.383792762 0.032468968 0.49969273 0.50030727 1.293601464 900 1000 0.5 MagmaSat
TVZMa-ex 78.37 0.13 11.94 0 0 0.99 0.04 0.05 0 0 0.53 3.8 4.14 0 4.06 0.005 600 800 2.401527449 0.034646711 0.499329402 0.500670598 1.29106678 900 1000 0.5 MagmaSat
TVZOh-ex 77.9 0.08 12.15 0 0 0.95 0.05 0.06 0 0 0.55 4.05 4.12 0 4.63 0.005 50 900 2.407038067 0.033449907 0.49977651 0.50022349 1.294306522 900 1000 0.5 MagmaSat
Oh48-FTIR1-MI1-a 78.27 0.0298 12.02 0 0 0.9828 0.0336 0.0515 0 0 0.4772 4.05 4.09 0 4.214912406 0.004565932 250 950 2.410222541 0.033708489 0.499414906 0.500585094 1.29214752 900 1000 0.5 MagmaSat
Oh48-FTIR1-MI1-b 78.27 0.0298 12.02 0 0 0.9828 0.0336 0.0515 0 0 0.4772 4.05 4.09 0 4.005815793 0.004447963 500 1025 2.410222541 0.033708489 0.499414906 0.500585094 1.29214752 900 1000 0.5 MagmaSat
Oh48-FTIR1-MI1-IRc 78.27 0.0298 12.02 0 0 0.9828 0.0336 0.0515 0 0 0.4772 4.05 4.09 0 3.885649341 0.004654367 5000 925 2.410222541 0.033708489 0.499414906 0.500585094 1.29214752 900 1000 0.5 MagmaSat
Oh50-4.1 77.91 0.0984 12.07 0 0 1.0556 0.0257 0.0999 0 0 0.5216 4.04 4.18 0 4.641842879 0.004565932 1000 862 2.404744476 0.033621636 0.499927738 0.500072262 1.293135843 900 1000 0.5 MagmaSat
Oh50-4.2 77.91 0.0984 12.07 0 0 1.0556 0.0257 0.0999 0 0 0.5216 4.04 4.18 0 4.402133476 0.004447963 100 770 2.404744476 0.033621636 0.499927738 0.500072262 1.293135843 900 1000 0.5 MagmaSat
Oh49-4.1 77.92 0.0099 12.11 0 0 1.002 0.0672 0.0546 0 0 0.5346 4.01 4.3 0 4.283934433 0.004565932 1000 855 2.40944163 0.033408966 0.499806853 0.500193147 1.293090797 900 1000 0.5 MagmaSat
Oh49-4.2 77.92 0.0099 12.11 0 0 1.002 0.0672 0.0546 0 0 0.5346 4.01 4.3 0 4.230532593 0.004447963 500 1000 2.40944163 0.033408966 0.499806853 0.500193147 1.293090797 900 1000 0.5 MagmaSat
Ma55-5a.1 77.68 0.0096 12.27 0 0 1.0272 0.0628 0.0342 0 0 0.6064 3.97 4.35 0 4.459767403 0.004654367 5000 1010 2.40450624 0.033218532 0.499845924 0.500154076 1.293446339 900 1000 0.5 MagmaSat
Ma57-3b.2 77.9 0.0498 12.07 0 0 1.0844 0.0748 0.0355 0 0 0.4759 4.1 4.21 0 3.712506046 0.004447963 1000 1012 2.409790921 0.033381618 0.49969063 0.50030937 1.293056126 900 1000 0.5 MagmaSat
Ma57-3c.1 77.65 0.159 12.28 0 0 0.9769 0.0597 0.0577 0 0 0.5598 4.08 4.18 0.0064 4.443973024 0.004654367 100 885 2.399876778 0.033268385 0.499781675 0.500218325 1.293356039 900 1000 0.5 MagmaSat
Ma57-3c.2 77.65 0.159 12.28 0 0 0.9769 0.0597 0.0577 0 0 0.5598 4.08 4.18 0.0064 4.283171078 0.004644523 1000 885 2.399876778 0.033268385 0.499781675 0.500218325 1.293356039 900 1000 0.5 MagmaSat

For a single sample

Extract a single sample from your dataset

SampleName = 'BT-ex'
extracted_bulk_comp = myfile.get_sample_composition(SampleName, asSampleClass=True)

Do the calculation

v.calculate_dissolved_volatiles(sample=extracted_bulk_comp, temperature=900.0, pressure=2000.0, X_fluid=0.5).result
{'H2O': 3.40549411877139, 'CO2': 0.0704089917125897}