[cig-commits] [commit] add_gibbs_energy: Documented and changed name of sample_pressure (now eos_pressure) (8b38090)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Dec 11 17:11:00 PST 2014


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

On branch  : add_gibbs_energy
Link       : https://github.com/geodynamics/burnman/compare/0000000000000000000000000000000000000000...2148b324d3e8aa7b527f831eb397590942563008

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

commit 8b3809046a25e93d398eae0d30618f47db549b93
Author: Bob Myhill <myhill.bob at gmail.com>
Date:   Mon Sep 1 21:36:03 2014 +0200

    Documented and changed name of sample_pressure (now eos_pressure)


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

8b3809046a25e93d398eae0d30618f47db549b93
 burnman/P-V_test.py | 26 --------------------------
 burnman/material.py | 19 +++++++++++++++++++
 burnman/mineral.py  |  4 ++--
 burnman/slb.py      |  2 +-
 4 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/burnman/P-V_test.py b/burnman/P-V_test.py
deleted file mode 100644
index a31e6e9..0000000
--- a/burnman/P-V_test.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import os, sys
-if not os.path.exists('burnman') and os.path.exists('../burnman'):
-    sys.path.insert(1,os.path.abspath('..'))
-
-import burnman
-from   burnman import minerals
-
-P0=2.e10
-T=2273.15
-
-wad=minerals.other.Katsura_2009_wadsleyite()
-wad.set_method("slb3")
-
-# Here we find the volume at the P, T of interest
-wad.set_state(P0,T)
-print 'V @', T, 'K,', P0, 'Pa:'
-print wad.V, 'm^3/mol'
-print ''
-
-# Here we take the V from the previous step and calculate the pressure. Hopefully it's the same as our original input!!
-V=wad.V
-
-P1=wad.sample_pressure(T,V)
-print 'Retrieved pressure:', P1, 'Pa'
-print 'Pressure difference:', P1-P0, 'Pa'
-print 'Fractional difference:', (P1-P0)/P0
diff --git a/burnman/material.py b/burnman/material.py
index f49d9a9..d75bd10 100644
--- a/burnman/material.py
+++ b/burnman/material.py
@@ -116,3 +116,22 @@ class Material(object):
         """
         raise NotImplementedError("need to implement density() in derived class!")
         return None
+
+    def eos_pressure(self, temperature, volume):
+        """
+        Returns the pressure of this material given temperature and volume as input parameters. The return value of this function does not depend on the current
+        state (temperature, pressure).
+
+        Notes
+        -----
+        Needs to be implemented in derived classes.
+
+        Returns
+        -------
+        eos_pressure : float
+            The pressure experienced by this material in Pa
+
+        """
+        raise NotImplementedError("need to implement eos_pressure() in derived class!")
+        return None
+
diff --git a/burnman/mineral.py b/burnman/mineral.py
index 57bb0f0..e562779 100644
--- a/burnman/mineral.py
+++ b/burnman/mineral.py
@@ -110,8 +110,8 @@ class Mineral(Material):
     def unroll(self):
         return ([1.0],[self])
 
-    def sample_pressure(self, temperature, volume):
-        return self.method.sample_pressure(temperature, volume, self.params)
+    def eos_pressure(self, temperature, volume):
+        return self.method.pressure(temperature, volume, self.params)
 
     def set_state(self, pressure, temperature):
         """
diff --git a/burnman/slb.py b/burnman/slb.py
index c9cd627..8bfada2 100644
--- a/burnman/slb.py
+++ b/burnman/slb.py
@@ -54,7 +54,7 @@ class SLBBase(eos.EquationOfState):
         eta_s = - gr - (1./2. * pow(nu_o_nu0_sq,-1.) * pow((2.*f)+1.,2.)*a2_s) # EQ 46 NOTE the typo from Stixrude 2005
         return eta_s
 
-    def sample_pressure(self, temperature, volume, params):
+    def pressure(self, temperature, volume, params):
         return bm.birch_murnaghan(params['V_0']/volume, params) + \
                 self.__thermal_pressure(temperature,volume, params) - \
                 self.__thermal_pressure(300.,volume, params)



More information about the CIG-COMMITS mailing list