Skip to content

Commit c60b621

Browse files
authored
MAGEMin_v1.6.1
- Added frac_M_vol, frac_F_vol and frac_S_vol output for MAGEMin_C - Corrected wrong set of W's for spinel in the metapelite and metapelite extended database - Added molar mass of CO2 for MAGEMin_C (which was leading to failed mpe bulk loading in the App)
2 parents e2ec98a + 93b22ec commit c60b621

24 files changed

+355
-116
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MAGEMin_C"
22
uuid = "e5d170eb-415a-4524-987b-12f1bce1ddab"
33
authors = ["Boris Kaus <[email protected]> & Nicolas Riel <[email protected]>"]
4-
version = "1.6.0"
4+
version = "1.6.1"
55

66
[deps]
77
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"

doc_raw/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
|
1212
13-
**MAGEMin v1.6.0**
13+
**MAGEMin v1.6.1**
1414
==================
1515

1616
MAGEMin (Mineral Assemblage Gibbs Energy Minimization) is a parallel C library callable from any petrological/geodynamic tool. For a given set of pressure, temperature and bulk-rock composition MAGEMin uses a combination of linear programming, extended Partitioning Gibbs free Energy and gradient-based local minimization to compute the most stable mineral assemblage

docs/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
55

66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>MAGEMin v1.6.0 &mdash; MAGEMin 2022 documentation</title>
7+
<title>MAGEMin v1.6.1 &mdash; MAGEMin 2022 documentation</title>
88
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
99
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
1010
<link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
@@ -247,7 +247,7 @@
247247
<div role="navigation" aria-label="Page navigation">
248248
<ul class="wy-breadcrumbs">
249249
<li><a href="#" class="icon icon-home"></a> &raquo;</li>
250-
<li><strong>MAGEMin v1.6.0</strong></li>
250+
<li><strong>MAGEMin v1.6.1</strong></li>
251251
<li class="wy-breadcrumbs-aside">
252252
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
253253
</li>
@@ -263,7 +263,7 @@
263263
<div class="line"><br /></div>
264264
</div>
265265
<section id="magemin-v1-5-0">
266-
<h1><strong>MAGEMin v1.6.0</strong><a class="headerlink" href="#magemin-v1-5-0" title="Permalink to this headline"></a></h1>
266+
<h1><strong>MAGEMin v1.6.1</strong><a class="headerlink" href="#magemin-v1-5-0" title="Permalink to this headline"></a></h1>
267267
<p>MAGEMin (Mineral Assemblage Gibbs Energy Minimization) is a parallel C library callable from any petrological/geodynamic tool. For a given set of pressure, temperature and bulk-rock composition MAGEMin uses a combination of linear programming, extended Partitioning Gibbs free Energy and gradient-based local minimization to compute the most stable mineral assemblage</p>
268268
<p>A full description of the minimization approach used in MAGEMin is given in:</p>
269269
<p>Riel, N., Kaus, B. J. P., Green, E. C. R., &amp; Berlie, N. (2022). MAGEMin, an efficient Gibbs energy minimizer: Application to igneous systems. Geochemistry, Geophysics, Geosystems, 23, e2022GC010427. <a class="reference external" href="https://doi.org/10.1029/2022GC010427">https://doi.org/10.1029/2022GC010427</a></p>

docs/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/stp.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<link rel="index" title="Index" href="genindex.html" />
2121
<link rel="search" title="Search" href="search.html" />
2222
<link rel="next" title="External libraries" href="stp/Linux.html" />
23-
<link rel="prev" title="MAGEMin v1.6.0" href="index.html" />
23+
<link rel="prev" title="MAGEMin v1.6.1" href="index.html" />
2424
</head>
2525

2626
<body class="wy-body-for-nav">
@@ -292,7 +292,7 @@ <h1>Optional (developers)<a class="headerlink" href="#optional-developers" title
292292
</div>
293293
</div>
294294
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
295-
<a href="index.html" class="btn btn-neutral float-left" title="MAGEMin v1.6.0" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
295+
<a href="index.html" class="btn btn-neutral float-left" title="MAGEMin v1.6.1" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
296296
<a href="stp/Linux.html" class="btn btn-neutral float-right" title="External libraries" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
297297
</div>
298298

gen/magemin_library.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,10 +1177,13 @@ struct stb_systems
11771177
rho_F::Cdouble
11781178
bulk_S_wt::Ptr{Cdouble}
11791179
frac_S_wt::Cdouble
1180+
frac_S_vol::Cdouble
11801181
bulk_M_wt::Ptr{Cdouble}
11811182
frac_M_wt::Cdouble
1183+
frac_M_vol::Cdouble
11821184
bulk_F_wt::Ptr{Cdouble}
11831185
frac_F_wt::Cdouble
1186+
frac_F_vol::Cdouble
11841187
n_ph::Cint
11851188
n_PP::Cint
11861189
n_SS::Cint
@@ -1323,7 +1326,7 @@ mutable struct metapelite_datasets
13231326
n_pp::Cint
13241327
n_ss::Cint
13251328
ox::NTuple{11, NTuple{20, Cchar}}
1326-
PP::NTuple{23, NTuple{20, Cchar}}
1329+
PP::NTuple{24, NTuple{20, Cchar}}
13271330
SS::NTuple{18, NTuple{20, Cchar}}
13281331
verifyPC::NTuple{18, Cint}
13291332
n_SS_PC::NTuple{18, Cint}
@@ -1349,7 +1352,7 @@ mutable struct metabasite_datasets
13491352
n_pp::Cint
13501353
n_ss::Cint
13511354
ox::NTuple{10, NTuple{20, Cchar}}
1352-
PP::NTuple{23, NTuple{20, Cchar}}
1355+
PP::NTuple{24, NTuple{20, Cchar}}
13531356
SS::NTuple{17, NTuple{20, Cchar}}
13541357
verifyPC::NTuple{17, Cint}
13551358
n_SS_PC::NTuple{17, Cint}
@@ -1505,7 +1508,7 @@ mutable struct metapelite_datasets_ext
15051508
n_pp::Cint
15061509
n_ss::Cint
15071510
ox::NTuple{13, NTuple{20, Cchar}}
1508-
PP::NTuple{25, NTuple{20, Cchar}}
1511+
PP::NTuple{26, NTuple{20, Cchar}}
15091512
SS::NTuple{23, NTuple{20, Cchar}}
15101513
verifyPC::NTuple{23, Cint}
15111514
n_SS_PC::NTuple{23, Cint}

julia/MAGEMin_wrappers.jl

Lines changed: 14 additions & 6 deletions
Large diffs are not rendered by default.

ref_database/.DS_Store

0 Bytes
Binary file not shown.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#=
2+
3+
Test for Aqueous minimizer
4+
5+
=#
6+
7+
species = ["H2O", "Al(OH)2+", "Al(OH)3@", "Al(OH)4-", "Al+3", "AlH3SiO4+2", "AlOH+2", "Ca+2", "CaHSiO3+", "CaOH+", "CaSiO3@", "HSiO3-", "K+", "KAlO2@", "KOH@", "Mg+2", "MgHSiO3+", "MgOH+", "MgSiO3@", "Na+", "NaAl(OH)4@", "NaHSiO3@", "NaOH@", "OH-", "SiO2@"]
8+
G0s = [-378.991999, -1012.553295, -1405.559155, -1669.882646, -260.382070, -2061.778806, -641.559594, -536.589068, -1772.464205, -761.449349, -1705.193764, -1154.160844, -375.639412, -1280.307808, -585.973831, -400.958279, -1617.254393, -701.376817, -1567.329979, -350.424257, -2035.360551, -1485.410150, -563.302949, -179.482769, -970.840788]
9+
10+
oxide_names = ["SiO2", "Al2O3", "CaO", "MgO", "FeO", "K2O", "Na2O", "TiO2", "O", "MnO", "H2O"]
11+
gamma_pc = [-966.661516, -1766.267094, -808.803681, -688.195348, -369.432486, -936.439987, -876.096639, -1018.881760, -238.219822, -526.537851, -379.011475]
12+
13+
matrix = [ 0.0 0.0 0.0 0.0 0.0 0.0 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0.0 0.0 0.0 0.5;
35+
0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.5;
36+
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.0 0.5;
37+
1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
38+
39+
40+
41+
# id_OHm = findfirst(species .== "OH-")
42+
# id_H2O = findfirst(species .== "H2O")
43+
# id_O2 = findfirst(oxide_names .== "O")
44+
45+
# gO2 = gamma_pc[id_O2]
46+
# gO = gO2/2.0
47+
48+
49+
gH2 = G0s[id_H2O] - gO
50+
gH = gH2/2.0
51+
52+
G_H2 = (G0s[id_H2O] - G0s[id_OHm])
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Aqueous species formulation, using Miron et al., 2017 database.
2+
3+
4+
```math
5+
G_{aq} = \sum_{i=1}^{n^{em}} n_i \mu_i
6+
```
7+
8+
where $n_i$ the molar fraction and $\mu_i$ is the chemical potential of the species $i$.
9+
10+
```math
11+
\mu_i = G_i^0 + RT ln(\gamma_i m_i)
12+
```
13+
14+
where $m_i$ is the molal fraction (!?)
15+
16+
And then develops into:
17+
18+
19+
20+
```math
21+
\mu_i = G_i^0 + RT( ln(\gamma_i) + ln(m_i))
22+
```
23+
24+
```math
25+
\mu_i = G_i^0 + RT( ln(\gamma_i) + ln(\frac{n_i}{n_{H2O} M_{H2O}}))
26+
```
27+
28+
```math
29+
\mu_i = G_i^0 + RT( ln(\gamma_i) + ln(\frac{n_i}{18.015 * n_{H2O}}))
30+
```
31+
32+
33+
---
34+
35+
For solute (aqueous species, excluding water), and assuming $\gamma_i$ = 1 (for now)
36+
37+
```math
38+
\mu_i = G_i^0 + RT ln(m_i)
39+
```
40+
41+
where
42+
43+
```math
44+
m_i = \frac{n_i}{m_{H2O}}
45+
```
46+
47+
so here $n_i$ is again the molar fraction and $m_{H2O}$ is mass of water? Should it be water density?
48+
49+
I could find the following definition:
50+
51+
```math
52+
m_i = \frac{n_i}{n_{H2O} M_{H2O}}
53+
```
54+
and here $n_i$ is the molarity and $M_{H2O}$ is the Molar mass of water (18.015). However, here density of water like we discussed is not appearing, is that right?
55+
56+
Should it simply be:
57+
58+
```math
59+
m_i = \frac{n_i}{\rho_{H2O}}
60+
```
61+
62+
---
63+
64+
For solvant (water):
65+
66+
```math
67+
\mu_{H2O} = G_{H2O }^0 + RT ln(\frac{1}{M_{H2O}})
68+
```
69+
70+
!?

0 commit comments

Comments
 (0)