[cig-commits] [commit] validate_MT_params: Parameter validation for CORK (015bcd8)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Dec 12 18:23:57 PST 2014


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

On branch  : validate_MT_params
Link       : https://github.com/geodynamics/burnman/compare/357942f1f591773d43448484a9f8de2ba8078d98...564a6a9a1c97824b3c6f65cf4d8d6d70235a9599

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

commit 015bcd82fd4147069c3707311345662dad462197
Author: Bob Myhill <myhill.bob at gmail.com>
Date:   Fri Dec 12 17:38:01 2014 -0800

    Parameter validation for CORK


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

015bcd82fd4147069c3707311345662dad462197
 burnman/eos/cork.py | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/burnman/eos/cork.py b/burnman/eos/cork.py
index cbfe7d2..40aecfe 100644
--- a/burnman/eos/cork.py
+++ b/burnman/eos/cork.py
@@ -124,3 +124,42 @@ class CORK(eos.EquationOfState):
         """
         return 0.
                   
+    def validate_parameters(self, params):
+        """
+        Check for existence and validity of the parameters
+        """
+
+        #if G and Gprime are not included this is presumably deliberate,
+        #as we can model density and bulk modulus just fine without them,
+        #so just add them to the dictionary as nans
+        if 'H_0' not in params:
+            params['H_0'] = float('nan')
+        if 'S_0' not in params:
+            params['S_0'] = float('nan')
+  
+        #check that all the required keys are in the dictionary
+        expected_keys = ['cork_params', 'cork_T', 'cork_P', 'Cp']
+        for k in expected_keys:
+            if k not in params:
+                raise KeyError('params object missing parameter : ' + k)
+        
+        #now check that the values are reasonable.  I mostly just
+        #made up these values from experience, and we are only 
+        #raising a warning.  Better way to do this? [IR]
+
+        # no test for H_0
+        if params['S_0'] is not float('nan') and params['S_0'] < 0.:
+            warnings.warn( 'Unusual value for S_0', stacklevel=2 )
+
+
+        if params['cork_T'] < 0.:
+            warnings.warn( 'Unusual value for cork_T', stacklevel=2 )
+        if params['cork_P'] < 1.e6 or params['cork_P'] > 1.e8:
+            warnings.warn( 'Unusual value for cork_P', stacklevel=2 )
+
+
+        if self.heat_capacity_p0(T_0,params) < 0.:
+            warnings.warn( 'Negative heat capacity at T_0', stacklevel=2 )
+        if self.heat_capacity_p0(2000.,params) < 0.:
+            warnings.warn( 'Negative heat capacity at 2000K', stacklevel=2 )
+ 



More information about the CIG-COMMITS mailing list