[cig-commits] [commit] inversion, master, validate_MT_params: Added test for small numbers (f000648)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Dec 12 18:28:33 PST 2014


Repository : https://github.com/geodynamics/burnman

On branches: inversion,master,validate_MT_params
Link       : https://github.com/geodynamics/burnman/compare/80c2a295c42dfdb38f83f6c1334bf7d8f97a8463...409647ff05dfad6a686198cac1481bd46b5e2e62

>---------------------------------------------------------------

commit f0006485da9a4099028260fcf5a79d9c509610e9
Author: I <kmanunterborn at gmail.com>
Date:   Fri Dec 12 12:16:28 2014 -0800

    Added test for small numbers
    
    Small numbers test, possible problem, ask Timo


>---------------------------------------------------------------

f0006485da9a4099028260fcf5a79d9c509610e9
 tests/test_debye.py | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/tests/test_debye.py b/tests/test_debye.py
index b1e2556..170fb18 100644
--- a/tests/test_debye.py
+++ b/tests/test_debye.py
@@ -32,16 +32,32 @@ class mypericlase(burnman.Mineral):
 
 
 class Debye(BurnManTest):
-    def test_temperature(self):
-        #rock = mypericlase()
-        pressure = 0.
-        temperature = 300.
-        eoses = [burnman.slb.SLB2(), burnman.slb.SLB3(), burnman.birch_murnaghan.BM2(), burnman.birch_murnaghan.BM3()]
-
-        test_debye = burnman.debye.debye_fn(temperature)
-        test_debye_cheb = burnman.debye.debye_fn_cheb(temperature)
+
+    def test_same_debye(self):
+        x = 300.
+        test_debye = burnman.debye.debye_fn(x)
+        test_debye_cheb = burnman.debye.debye_fn_cheb(x)
         self.assertFloatEqual(test_debye, test_debye_cheb)
 
+    def test_return_zero(self):
+        rock = mypericlase()
+        x = 0.
+        test_helmholtz = burnman.debye.helmholtz_free_energy(x,rock.params['Debye_0'],rock.params['n'])
+        self.assertFloatEqual(test_helmholtz,0.)
+        test_heat_capacity_v = burnman.debye.heat_capacity_v(x,rock.params['Debye_0'],rock.params['n'])
+        self.assertFloatEqual(test_heat_capacity_v,0.)
+        test_thermal_energy = burnman.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.debye.helmholtz_free_energy(x,rock.params['Debye_0'],rock.params['n'])
+        self.assertFloatEqual(test_helmholtz,0.)
+        test_heat_capacity_v = burnman.debye.heat_capacity_v(x,rock.params['Debye_0'],rock.params['n'])
+        self.assertFloatEqual(test_heat_capacity_v,0.)
+        test_thermal_energy = burnman.debye.thermal_energy(x,rock.params['Debye_0'],rock.params['n'])
+        self.assertFloatEqual(test_thermal_energy,0.)
 
 if __name__ == '__main__':
     unittest.main()



More information about the CIG-COMMITS mailing list