Skip to content

Commit df4c968

Browse files
authored
Merge pull request geodynamics#667 from bobmyhill/E_to_F
Enhancement: Isothermal equations of state now require F_0, not E_0
2 parents be601ca + 594e02e commit df4c968

20 files changed

+186
-86
lines changed

burnman/calibrants/Dorogokupets_2007.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
_materials_data = {
1717
"Ag": {
18-
"E_0": 0.0,
18+
"F_0": 0.0,
1919
"P_0": 0.0,
2020
"T_0": 298.15,
2121
"n": 1.0,
@@ -45,7 +45,7 @@
4545
"S": 0.732,
4646
},
4747
"Al": {
48-
"E_0": 0.0,
48+
"F_0": 0.0,
4949
"P_0": 0.0,
5050
"T_0": 298.15,
5151
"n": 1.0,
@@ -75,7 +75,7 @@
7575
"S": 0.998,
7676
},
7777
"Au": {
78-
"E_0": 0.0,
78+
"F_0": 0.0,
7979
"P_0": 0.0,
8080
"T_0": 298.15,
8181
"n": 1.0,
@@ -105,7 +105,7 @@
105105
"S": 1.067,
106106
},
107107
"Cu": {
108-
"E_0": 0.0,
108+
"F_0": 0.0,
109109
"P_0": 0.0,
110110
"T_0": 298.15,
111111
"n": 1.0,
@@ -135,7 +135,7 @@
135135
"S": 1.407,
136136
},
137137
"Pt": {
138-
"E_0": 0.0,
138+
"F_0": 0.0,
139139
"P_0": 0.0,
140140
"T_0": 298.15,
141141
"n": 1.0,
@@ -165,7 +165,7 @@
165165
"S": 0.631,
166166
},
167167
"Ta": {
168-
"E_0": 0.0,
168+
"F_0": 0.0,
169169
"P_0": 0.0,
170170
"T_0": 298.15,
171171
"n": 1.0,
@@ -195,7 +195,7 @@
195195
"S": 4.910,
196196
},
197197
"W": {
198-
"E_0": 0.0,
198+
"F_0": 0.0,
199199
"P_0": 0.0,
200200
"T_0": 298.15,
201201
"n": 1.0,
@@ -225,7 +225,7 @@
225225
"S": 0.672,
226226
},
227227
"MgO": {
228-
"E_0": 0.0,
228+
"F_0": 0.0,
229229
"P_0": 0.0,
230230
"T_0": 298.15,
231231
"n": 2.0,
@@ -255,7 +255,7 @@
255255
"S": 0,
256256
},
257257
"Diamond": {
258-
"E_0": 0.0,
258+
"F_0": 0.0,
259259
"P_0": 0.0,
260260
"T_0": 298.15,
261261
"n": 1.0,

burnman/eos/birch_murnaghan.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ def shear_modulus(self, pressure, temperature, volume, params):
276276
elif self.order == 3:
277277
return shear_modulus_third_order(volume, params)
278278

279-
def _molar_internal_energy(self, pressure, temperature, volume, params):
279+
def _molar_helmholtz_energy(self, pressure, temperature, volume, params):
280280
"""
281-
Returns the internal energy :math:`\\mathcal{E}`
281+
Returns the Helmholtz energy :math:`\\mathcal{F}`
282282
of the mineral. :math:`[J/mol]`
283283
"""
284284
x = np.power(volume / params["V_0"], -1.0 / 3.0)
@@ -299,7 +299,7 @@ def _molar_internal_energy(self, pressure, temperature, volume, params):
299299
)
300300
)
301301

302-
return -intPdV + params["E_0"]
302+
return -intPdV + params["F_0"]
303303

304304
def gibbs_energy(self, pressure, temperature, volume, params):
305305
"""
@@ -309,7 +309,7 @@ def gibbs_energy(self, pressure, temperature, volume, params):
309309
# G = int VdP = [PV] - int PdV = E + PV
310310

311311
return (
312-
self._molar_internal_energy(pressure, temperature, volume, params)
312+
self._molar_helmholtz_energy(pressure, temperature, volume, params)
313313
+ volume * pressure
314314
)
315315

@@ -318,11 +318,18 @@ def validate_parameters(self, params):
318318
Check for existence and validity of the parameters
319319
"""
320320

321-
if "E_0" not in params:
322-
params["E_0"] = 0.0
321+
if "F_0" not in params:
322+
params["F_0"] = 0.0
323323
if "P_0" not in params:
324324
params["P_0"] = 0.0
325325

326+
if "E_0" in params:
327+
raise KeyError(
328+
"Isothermal equations of state should be "
329+
"defined in terms of Helmholtz free energy "
330+
"F_0, not internal energy E_0."
331+
)
332+
326333
# If G and Gprime are not included this is presumably deliberate,
327334
# as we can model density and bulk modulus just fine without them,
328335
# so just add them to the dictionary as nans
@@ -400,9 +407,9 @@ def shear_modulus(self, pressure, temperature, volume, params):
400407
"""
401408
return 0.0
402409

403-
def _molar_internal_energy(self, pressure, temperature, volume, params):
410+
def _molar_helmholtz_energy(self, pressure, temperature, volume, params):
404411
"""
405-
Returns the internal energy :math:`\\mathcal{E}` of the mineral. :math:`[J/mol]`
412+
Returns the Helmholtz free energy :math:`\\mathcal{F}` of the mineral. :math:`[J/mol]`
406413
"""
407414
x = np.power(volume / params["V_0"], -1.0 / 3.0)
408415
x2 = x * x
@@ -433,7 +440,7 @@ def _molar_internal_energy(self, pressure, temperature, volume, params):
433440
)
434441
)
435442

436-
return -intPdV + params["E_0"]
443+
return -intPdV + params["F_0"]
437444

438445
def validate_parameters(self, params):
439446
"""

burnman/eos/dks_solid.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,17 @@ def validate_parameters(self, params):
294294
if "E_0" not in params:
295295
params["E_0"] = float("nan")
296296

297-
# First, let's check the EoS parameters for Tref
298-
bm.BirchMurnaghanBase.validate_parameters(bm.BirchMurnaghanBase(), params)
299-
300297
# Now check all the required keys for the
301298
# thermal part of the EoS are in the dictionary
302-
expected_keys = ["Cv", "grueneisen_0", "q_0", "eta_s_0"]
299+
expected_keys = [
300+
"V_0",
301+
"K_0",
302+
"Kprime_0",
303+
"Cv",
304+
"grueneisen_0",
305+
"q_0",
306+
"eta_s_0",
307+
]
303308
for k in expected_keys:
304309
if k not in params:
305310
raise KeyError("params object missing parameter : " + k)

burnman/eos/macaw.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ def pressure(self, temperature, volume, params):
9292
term3 = C * np.power(Vrel, 1.5) + B
9393
return term1 * term2 * term3 - A * (B + C) + params["P_0"]
9494

95-
def _molar_internal_energy(self, pressure, temperature, volume, params):
95+
def _molar_helmholtz_energy(self, pressure, temperature, volume, params):
9696
"""
97-
Returns the internal energy :math:`\\mathcal{E}` of the mineral. :math:`[J/mol]`
97+
Returns the Helmholtz energy :math:`\\mathcal{F}` of the mineral. :math:`[J/mol]`
9898
"""
9999
A, B, C = make_params(params["K_0"], params["Kprime_0"], params["Kprime_inf"])
100100
Vrel = volume / params["V_0"]
@@ -103,14 +103,14 @@ def _molar_internal_energy(self, pressure, temperature, volume, params):
103103
- 1.0
104104
)
105105
I0 = (-A * (B + C) + params["P_0"]) * params["V_0"] * (Vrel - 1.0)
106-
return -A * I1 - I0
106+
return params["F_0"] - A * I1 - I0
107107

108108
def gibbs_energy(self, pressure, temperature, volume, params):
109109
"""
110110
Returns the Gibbs free energy :math:`\\mathcal{G}` of the mineral. :math:`[J/mol]`
111111
"""
112112
return (
113-
self._molar_internal_energy(pressure, temperature, volume, params)
113+
self._molar_helmholtz_energy(pressure, temperature, volume, params)
114114
+ pressure * volume
115115
)
116116

@@ -127,11 +127,18 @@ def validate_parameters(self, params):
127127
between 5/3 and :math:`K'_0` :cite:`StaceyDavis2004`.
128128
"""
129129

130-
if "E_0" not in params:
131-
params["E_0"] = 0.0
130+
if "F_0" not in params:
131+
params["F_0"] = 0.0
132132
if "P_0" not in params:
133133
params["P_0"] = 1.0e5
134134

135+
if "E_0" in params:
136+
raise KeyError(
137+
"Isothermal equations of state should be "
138+
"defined in terms of Helmholtz free energy "
139+
"F_0, not internal energy E_0."
140+
)
141+
135142
# Check that all the required keys are in the dictionary
136143
expected_keys = ["V_0", "K_0", "Kprime_0", "Kprime_inf"]
137144
for k in expected_keys:

burnman/eos/modified_tait.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,25 @@ def gibbs_energy(self, pressure, temperature, volume, params):
148148
+ (1.0 - a) * (pressure - params["P_0"])
149149
)
150150

151-
return intVdP + params["E_0"] + params["V_0"] * params["P_0"]
151+
return intVdP + params["F_0"] + params["V_0"] * params["P_0"]
152152

153153
def validate_parameters(self, params):
154154
"""
155155
Check for existence and validity of the parameters
156156
"""
157157

158-
if "E_0" not in params:
159-
params["E_0"] = 0.0
158+
if "F_0" not in params:
159+
params["F_0"] = 0.0
160160
if "P_0" not in params:
161161
params["P_0"] = 1.0e5
162162

163+
if "E_0" in params:
164+
raise KeyError(
165+
"Isothermal equations of state should be "
166+
"defined in terms of Helmholtz free energy "
167+
"F_0, not internal energy E_0."
168+
)
169+
163170
# G and Gprime are not defined in this equation of state,
164171
# We can model density and bulk modulus just fine without them,
165172
# so just add them to the dictionary as nans

burnman/eos/morse_potential.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ def shear_modulus(self, pressure, temperature, volume, params):
105105
"""
106106
return shear_modulus(volume, params)
107107

108-
def _molar_internal_energy(self, pressure, temperature, volume, params):
108+
def _molar_helmholtz_energy(self, pressure, temperature, volume, params):
109109
"""
110-
Returns the internal energy :math:`\\mathcal{E}` of the mineral. :math:`[J/mol]`
110+
Returns the Helmholtz energy :math:`\\mathcal{F}` of the mineral. :math:`[J/mol]`
111111
"""
112112

113113
x = (params["Kprime_0"] - 1) * (1 - np.power(volume / params["V_0"], 1.0 / 3.0))
@@ -120,14 +120,14 @@ def _molar_internal_energy(self, pressure, temperature, volume, params):
120120
* (2.0 * np.exp(x) - np.exp(2.0 * x) - 1.0)
121121
)
122122

123-
return -intPdV + params["E_0"]
123+
return -intPdV + params["F_0"]
124124

125125
def gibbs_energy(self, pressure, temperature, volume, params):
126126
"""
127127
Returns the Gibbs free energy :math:`\\mathcal{G}` of the mineral. :math:`[J/mol]`
128128
"""
129129
return (
130-
self._molar_internal_energy(pressure, temperature, volume, params)
130+
self._molar_helmholtz_energy(pressure, temperature, volume, params)
131131
+ volume * pressure
132132
)
133133

@@ -136,11 +136,18 @@ def validate_parameters(self, params):
136136
Check for existence and validity of the parameters
137137
"""
138138

139-
if "E_0" not in params:
140-
params["E_0"] = 0.0
139+
if "F_0" not in params:
140+
params["F_0"] = 0.0
141141
if "P_0" not in params:
142142
params["P_0"] = 0.0
143143

144+
if "E_0" in params:
145+
raise KeyError(
146+
"Isothermal equations of state should be "
147+
"defined in terms of Helmholtz free energy "
148+
"F_0, not internal energy E_0."
149+
)
150+
144151
# If G and Gprime are not included this is presumably deliberate,
145152
# as we can model density and bulk modulus just fine without them,
146153
# so just add them to the dictionary as nans

burnman/eos/murnaghan.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ def shear_modulus(self, pressure, temperature, volume, params):
6868
"""
6969
return 0.0
7070

71-
def _molar_internal_energy(self, pressure, temperature, volume, params):
71+
def _molar_helmholtz_energy(self, pressure, temperature, volume, params):
7272
"""
73-
Returns the internal energy :math:`\\mathcal{E}` of the mineral.
73+
Returns the Helmholtz energy :math:`\\mathcal{F}` of the mineral.
7474
:math:`[J/mol]`
7575
"""
7676
return energy(
77-
volume, params["E_0"], params["V_0"], params["K_0"], params["Kprime_0"]
77+
volume, params["F_0"], params["V_0"], params["K_0"], params["Kprime_0"]
7878
)
7979

8080
def gibbs_energy(self, pressure, temperature, volume, params):
@@ -84,7 +84,7 @@ def gibbs_energy(self, pressure, temperature, volume, params):
8484
"""
8585
# G = E + PV
8686
return (
87-
self._molar_internal_energy(pressure, temperature, volume, params)
87+
self._molar_helmholtz_energy(pressure, temperature, volume, params)
8888
+ volume * pressure
8989
)
9090

@@ -93,11 +93,18 @@ def validate_parameters(self, params):
9393
Check for existence and validity of the parameters
9494
"""
9595

96-
if "E_0" not in params:
97-
params["E_0"] = 0.0
96+
if "F_0" not in params:
97+
params["F_0"] = 0.0
9898
if "P_0" not in params:
9999
params["P_0"] = 0.0
100100

101+
if "E_0" in params:
102+
raise KeyError(
103+
"Isothermal equations of state should be "
104+
"defined in terms of Helmholtz free energy "
105+
"F_0, not internal energy E_0."
106+
)
107+
101108
# G is not included in the Murnaghan EOS so we shall set them to NaN's
102109
if "G_0" not in params:
103110
params["G_0"] = float("nan")

burnman/eos/reciprocal_kprime.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def gibbs_energy(self, pressure, temperature, volume, params):
221221
# G = E0 + int VdP (when S = 0)
222222
K = self.isothermal_bulk_modulus_reuss(pressure, temperature, volume, params)
223223
return (
224-
params["E_0"]
224+
params["F_0"]
225225
+ params["P_0"] * params["V_0"]
226226
+ self._intVdP((pressure - params["P_0"]) / K, params)
227227
- self._intVdP(0.0, params)
@@ -234,11 +234,18 @@ def validate_parameters(self, params):
234234
between 5/3 and :math:`K'_0` :cite:`StaceyDavis2004`.
235235
"""
236236

237-
if "E_0" not in params:
238-
params["E_0"] = 0.0
237+
if "F_0" not in params:
238+
params["F_0"] = 0.0
239239
if "P_0" not in params:
240240
params["P_0"] = 0.0
241241

242+
if "E_0" in params:
243+
raise KeyError(
244+
"Isothermal equations of state should be "
245+
"defined in terms of Helmholtz free energy "
246+
"F_0, not internal energy E_0."
247+
)
248+
242249
# If G and Gprime_inf are not included this is presumably deliberate,
243250
# as we can model density and bulk modulus just fine without them,
244251
# so just add them to the dictionary as nans

0 commit comments

Comments
 (0)