[cig-commits] [commit] add_thermodynamic_potentials: Documented and changed name of sample_pressure (now eos_pressure) (e4a5ba1)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Tue Dec 9 09:54:50 PST 2014
Repository : https://github.com/geodynamics/burnman
On branch : add_thermodynamic_potentials
Link : https://github.com/geodynamics/burnman/compare/2e5646d93cedbbf8eae54cc37cffc14e0aa85180...d5ddad03ff9f30f5a4efaddb4e3ec585ea1a7c51
>---------------------------------------------------------------
commit e4a5ba12e8bc8082933b6684637c71344b456b5e
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)
>---------------------------------------------------------------
e4a5ba12e8bc8082933b6684637c71344b456b5e
burnman/material.py | 19 +++++++++++++++++++
burnman/mineral.py | 4 ++--
burnman/slb.py | 2 +-
burnman/P-V_test.py => tests/test_P-V.py | 2 +-
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/burnman/material.py b/burnman/material.py
index dd4391d..97f6078 100644
--- a/burnman/material.py
+++ b/burnman/material.py
@@ -116,3 +116,22 @@ class Material:
"""
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 3ef69c8..093aa3e 100644
--- a/burnman/mineral.py
+++ b/burnman/mineral.py
@@ -97,8 +97,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 85d0a1a..6eb9f74 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)
diff --git a/burnman/P-V_test.py b/tests/test_P-V.py
similarity index 95%
rename from burnman/P-V_test.py
rename to tests/test_P-V.py
index a31e6e9..c17e116 100644
--- a/burnman/P-V_test.py
+++ b/tests/test_P-V.py
@@ -20,7 +20,7 @@ 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)
+P1=wad.eos_pressure(T,V)
print 'Retrieved pressure:', P1, 'Pa'
print 'Pressure difference:', P1-P0, 'Pa'
print 'Fractional difference:', (P1-P0)/P0
More information about the CIG-COMMITS
mailing list