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

SiO2

TiO2

Al2O3

Fe2O3

Cr2O3

FeO

MnO

MgO

NiO

CoO

CaO

Na2O

K2O

P2O5

H2O

CO2

Press

Temp

H2O_liq_VESIcal

CO2_liq_VESIcal

Temperature_C_VESIcal

Pressure_bars_VESIcal

X_fluid_input_VESIcal

Model

Warnings

BT-ex

77.5

0.08

12.5

0.207

0.0

0.473

0.0

0.03

0.0

0.0

0.43

3.98

4.88

0.0

5.5

0.05

500

900

2.38456836637105

0.0324561587842498

900.0

1000.0

0.5

MagmaSat

TVZMa-ex

78.37

0.13

11.94

0.0

0.0

0.99

0.04

0.05

0.0

0.0

0.53

3.8

4.14

0.0

4.06

0.005

600

800

2.40406756580507

0.0346020890084509

900.0

1000.0

0.5

MagmaSat

TVZOh-ex

77.9

0.08

12.15

0.0

0.0

0.95

0.05

0.06

0.0

0.0

0.55

4.05

4.12

0.0

4.63

0.005

50

900

2.407664343585

0.033439332410493

900.0

1000.0

0.5

MagmaSat

Oh48-FTIR1-MI1-a

78.27

0.0298

12.02

0.0

0.0

0.9828

0.0336

0.0515

0.0

0.0

0.4772

4.05

4.09

0.0

4.214912

0.004566

250

950

2.41247069630685

0.0336703062821496

900.0

1000.0

0.5

MagmaSat

Oh48-FTIR1-MI1-b

78.27

0.0298

12.02

0.0

0.0

0.9828

0.0336

0.0515

0.0

0.0

0.4772

4.05

4.09

0.0

4.005816

0.004448

500

1025

2.41248461063309

0.0336700698826834

900.0

1000.0

0.5

MagmaSat

Oh48-FTIR1-MI1-IRc

78.27

0.0298

12.02

0.0

0.0

0.9828

0.0336

0.0515

0.0

0.0

0.4772

4.05

4.09

0.0

3.885649

0.004654

5000

925

2.41248347096408

0.0336700892484881

900.0

1000.0

0.5

MagmaSat

Oh50-4.1

77.91

0.0984

12.07

0.0

0.0

1.0556

0.0257

0.0999

0.0

0.0

0.5216

4.04

4.18

0.0

4.641843

0.004566

1000

862

2.40528235346431

0.0336124894475238

900.0

1000.0

0.5

MagmaSat

Oh50-4.2

77.91

0.0984

12.07

0.0

0.0

1.0556

0.0257

0.0999

0.0

0.0

0.5216

4.04

4.18

0.0

4.402133

0.004448

100

770

2.40511507798533

0.0336153340309696

900.0

1000.0

0.5

MagmaSat

Oh49-4.1

77.92

0.0099

12.11

0.0

0.0

1.002

0.0672

0.0546

0.0

0.0

0.5346

4.01

4.3

0.0

4.283934

0.004566

1000

855

2.41012062635274

0.0333975335720628

900.0

1000.0

0.5

MagmaSat

Oh49-4.2

77.92

0.0099

12.11

0.0

0.0

1.002

0.0672

0.0546

0.0

0.0

0.5346

4.01

4.3

0.0

4.230533

0.004448

500

1000

2.41041007702296

0.0333926594920974

900.0

1000.0

0.5

MagmaSat

Ma55-5a.1

77.68

0.0096

12.27

0.0

0.0

1.0272

0.0628

0.0342

0.0

0.0

0.6064

3.97

4.35

0.0

4.459767

0.004654

5000

1010

2.40532217182395

0.0332048486638506

900.0

1000.0

0.5

MagmaSat

Ma57-3b.2

77.9

0.0498

12.07

0.0

0.0

1.0844

0.0748

0.0355

0.0

0.0

0.4759

4.1

4.21

0.0

3.712506

0.004448

1000

1012

2.41114701125906

0.0333588155749618

900.0

1000.0

0.5

MagmaSat

Ma57-3c.1

77.65

0.159

12.28

0.0

0.0

0.9769

0.0597

0.0577

0.0

0.0

0.5598

4.08

4.18

0.0064

4.443973

0.004654

100

885

2.40092440230964

0.0332507437951284

900.0

1000.0

0.5

MagmaSat

Ma57-3c.2

77.65

0.159

12.28

0.0

0.0

0.9769

0.0597

0.0577

0.0

0.0

0.5598

4.08

4.18

0.0064

4.283171

0.004645

1000

885

2.40090910847844

0.0332510013760127

900.0

1000.0

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
{'CO2': 0.0704089917125897, 'H2O': 3.40549411877139}