Skip to content

Commit 3cc23ec

Browse files
committed
added anharmonic component to ModularMGD
1 parent 93303fd commit 3cc23ec

File tree

2 files changed

+70
-4
lines changed

2 files changed

+70
-4
lines changed

burnman/eos/modular_mie_grueneisen_debye.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def decorator(fn):
2424
from . import equation_of_state as eos
2525
from ..utils.math import bracket
2626
from . import bukowinski_electronic as el
27+
from .anharmonic_debye_pade import AnharmonicDebyePade as Anharmonic
2728

2829

2930
class ModularMGD(eos.EquationOfState):
@@ -91,6 +92,11 @@ def pressure(self, temperature, volume, params):
9192
* (temperature * temperature - T_0 * T_0)
9293
/ volume
9394
)
95+
96+
# If the material has an anharmonic component, add it
97+
if params["a_anh"] is not None:
98+
P += Anharmonic.pressure(temperature, volume, params)
99+
94100
return P
95101

96102
def isothermal_bulk_modulus_reuss(self, pressure, temperature, volume, params):
@@ -119,6 +125,7 @@ def isothermal_bulk_modulus_reuss(self, pressure, temperature, volume, params):
119125
)
120126

121127
KT = KT_ref + V * d2FthdV2
128+
122129
# If the material is conductive, add the electronic contribution
123130
if params["bel_0"] is not None:
124131
KT += volume * el.KToverV(
@@ -129,6 +136,11 @@ def isothermal_bulk_modulus_reuss(self, pressure, temperature, volume, params):
129136
params["bel_0"],
130137
params["gel"],
131138
)
139+
140+
# If the material has an anharmonic component, add it
141+
if params["a_anh"] is not None:
142+
KT += Anharmonic.isothermal_bulk_modulus(temperature, volume, params)
143+
132144
return KT
133145

134146
def _molar_heat_capacity_v(self, pressure, temperature, volume, params):
@@ -143,6 +155,11 @@ def _molar_heat_capacity_v(self, pressure, temperature, volume, params):
143155
bel_0 = params["bel_0"]
144156
gel = params["gel"]
145157
C_v += temperature * el.CVoverT(volume, params["V_0"], bel_0, gel)
158+
159+
# If the material has an anharmonic component, add it
160+
if params["a_anh"] is not None:
161+
C_v += Anharmonic.heat_capacity_v(temperature, volume, params)
162+
146163
return C_v
147164

148165
def thermal_expansivity(self, pressure, temperature, volume, params):
@@ -163,6 +180,10 @@ def thermal_expansivity(self, pressure, temperature, volume, params):
163180
gel = params["gel"]
164181
aKT += el.aKT(temperature, volume, params["V_0"], bel_0, gel)
165182

183+
# If the material has an anharmonic component, add it
184+
if params["a_anh"] is not None:
185+
aKT += Anharmonic.dSdV(temperature, volume, params)
186+
166187
KT = self.isothermal_bulk_modulus_reuss(pressure, temperature, volume, params)
167188

168189
return aKT / KT
@@ -180,6 +201,11 @@ def entropy(self, pressure, temperature, volume, params):
180201
S += el.entropy(
181202
temperature, volume, params["V_0"], params["bel_0"], params["gel"]
182203
)
204+
205+
# If the material has an anharmonic component, add it
206+
if params["a_anh"] is not None:
207+
S += Anharmonic.entropy(temperature, volume, params)
208+
183209
return S
184210

185211
def _helmholtz_energy(self, pressure, temperature, volume, params):
@@ -213,6 +239,10 @@ def _helmholtz_energy(self, pressure, temperature, volume, params):
213239
params["gel"],
214240
)
215241

242+
# If the material has an anharmonic component, add it
243+
if params["a_anh"] is not None:
244+
F += Anharmonic.helmholtz_energy(temperature, volume, params)
245+
216246
return F
217247

218248
# Derived properties from here
@@ -296,6 +326,11 @@ def validate_parameters(self, params):
296326
raise KeyError("params object missing parameter : " + k)
297327

298328
# Check if material is conductive
299-
if not hasattr(params, "bel_0"):
329+
if "bel_0" not in params:
300330
params["bel_0"] = None
301331
params["gel"] = None
332+
333+
# Check if material has an anharmonic component
334+
if "a_anh" not in params:
335+
params["a_anh"] = None
336+
params["m_anh"] = None

tests/test_modular_mgd.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,46 @@ def test_SLB_electronic_contribution(self):
204204
params["grueneisen_0"] = 1.2
205205
params["q_0"] = 1.1
206206
params["P_0"] = 1.0e5
207-
params["bel_0"] = 0.005
208-
params["gel"] = 1.5
207+
m_without_component = Mineral(params)
209208

210-
m = Mineral(params)
209+
params2 = params.copy()
210+
params2["bel_0"] = 0.005
211+
params2["gel"] = 1.5
212+
213+
m = Mineral(params2)
214+
consistent = check_eos_consistency(
215+
m, 2.0e9, 2000.0, including_shear_properties=False, tol=1.0e-4
216+
)
217+
self.assertTrue(consistent)
218+
219+
m.set_state(2.0e9, 2000.0)
220+
m_without_component.set_state(2.0e9, 2000.0)
221+
self.assertFalse(m_without_component.S == m.S)
222+
223+
def test_SLB_anharmonic_contribution(self):
224+
params = mineral_params.copy()
225+
params["reference_eos"] = create("bm3")
226+
params["debye_temperature_model"] = theta_SLB()
227+
params["Debye_0"] = 1000.0
228+
params["grueneisen_0"] = 1.2
229+
params["q_0"] = 1.1
230+
params["P_0"] = 1.0e5
231+
m_without_component = Mineral(params)
232+
233+
params2 = params.copy()
234+
params2["a_anh"] = 1000.0
235+
params2["m_anh"] = 3.0
236+
237+
m = Mineral(params2)
211238
consistent = check_eos_consistency(
212239
m, 2.0e9, 2000.0, including_shear_properties=False, tol=1.0e-4
213240
)
214241
self.assertTrue(consistent)
215242

243+
m.set_state(2.0e9, 2000.0)
244+
m_without_component.set_state(2.0e9, 2000.0)
245+
self.assertFalse(m_without_component.S == m.S)
246+
216247
def test_SPOCK_isothermal_contribution(self):
217248
params = mineral_params.copy()
218249
params["reference_eos"] = create("spock")

0 commit comments

Comments
 (0)