/
test_debye.py
69 lines (56 loc) · 2.15 KB
/
test_debye.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from __future__ import absolute_import
import unittest
from util import BurnManTest
import burnman_path
import burnman
assert burnman_path # silence pyflakes warning
class mypericlase(burnman.Mineral):
"""
Stixrude & Lithgow-Bertelloni 2005 and references therein
"""
def __init__(self):
self.params = {
'equation_of_state': 'slb3',
'V_0': 11.24e-6,
'K_0': 161.0e9,
'Kprime_0': 3.8,
'G_0': 131.0e9,
'Gprime_0': 2.1,
'molar_mass': .0403,
'n': 2,
'Debye_0': 773.,
'grueneisen_0': 1.5,
'q_0': 1.5,
'eta_s_0': 2.8}
class Debye(BurnManTest):
def test_same_debye(self):
x = 300.
test_debye = burnman.eos.debye.debye_fn(x)
test_debye_cheb = burnman.eos.debye.debye_fn_cheb(x)
self.assertFloatEqual(test_debye, test_debye_cheb)
def test_return_zero(self):
rock = mypericlase()
x = 0.
test_helmholtz = burnman.eos.debye.helmholtz_free_energy(
x, rock.params['Debye_0'], rock.params['n'])
self.assertFloatEqual(test_helmholtz, 0.)
test_heat_capacity_v = burnman.eos.debye.molar_heat_capacity_v(
x, rock.params['Debye_0'], rock.params['n'])
self.assertFloatEqual(test_heat_capacity_v, 0.)
test_thermal_energy = burnman.eos.debye.thermal_energy(
x, rock.params['Debye_0'], rock.params['n'])
self.assertFloatEqual(test_thermal_energy, 0.)
def test_small(self):
rock = mypericlase()
x = 1e-16
test_helmholtz = burnman.eos.debye.helmholtz_free_energy(
x, rock.params['Debye_0'], rock.params['n'])
self.assertFloatEqual(test_helmholtz, 0.)
test_heat_capacity_v = burnman.eos.debye.molar_heat_capacity_v(
x, rock.params['Debye_0'], rock.params['n'])
self.assertFloatEqual(test_heat_capacity_v, 0.)
test_thermal_energy = burnman.eos.debye.thermal_energy(
x, rock.params['Debye_0'], rock.params['n'])
self.assertFloatEqual(test_thermal_energy, 0.)
if __name__ == '__main__':
unittest.main()