[cig-commits] [commit] inversion, master, validate_MT_params: fix constants (aa99411)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Dec 12 18:27:09 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 aa9941125e6e5310436ab90c3f3e95bcf593c870
Author: Timo Heister <timo.heister at gmail.com>
Date:   Thu Dec 11 16:19:59 2014 -0800

    fix constants


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

aa9941125e6e5310436ab90c3f3e95bcf593c870
 burnman/cork.py              | 2 +-
 burnman/debye.py             | 2 +-
 burnman/einstein.py          | 8 ++++----
 burnman/endmemberdisorder.py | 6 +++---
 burnman/modified_tait.py     | 2 +-
 burnman/solidsolution.py     | 2 +-
 burnman/solutionmodel.py     | 2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/burnman/cork.py b/burnman/cork.py
index 8d29a13..f98e2ba 100644
--- a/burnman/cork.py
+++ b/burnman/cork.py
@@ -9,7 +9,7 @@ import numpy as np
 import scipy.optimize as opt
 
 import burnman.equation_of_state as eos
-from burnman.constants import R
+import constants
 
 T_0=298.15 # Standard temperature = 25 C
 P_0=1.e5 # Standard pressure = 1.e5 Pa
diff --git a/burnman/debye.py b/burnman/debye.py
index 2eb8b6c..a513254 100644
--- a/burnman/debye.py
+++ b/burnman/debye.py
@@ -140,7 +140,7 @@ def helmholtz_free_energy(T, debye_T, n):
     if T ==0:
         return 0
     x = debye_T/T
-    F = n * R * T * ( 3.0 * np.log( 1.0 - np.exp(-x)) - debye_fn_cheb(x) )
+    F = n * constants.gas_constant * T * ( 3.0 * np.log( 1.0 - np.exp(-x)) - debye_fn_cheb(x) )
     return F
 
 
diff --git a/burnman/einstein.py b/burnman/einstein.py
index edc8dc1..b4053f8 100644
--- a/burnman/einstein.py
+++ b/burnman/einstein.py
@@ -3,7 +3,7 @@
 # Released under GPL v2 or later.
 
 import numpy as np
-from burnman.constants import R
+import constants
 
 """
 Functions for the Einstein model of a solid.
@@ -17,9 +17,9 @@ def thermal_energy(T, einstein_T, n):
     Returns thermal energy in J/mol
     """
     if T == 0:
-        return 3.*n*R*einstein_T*0.5 # zero point energy
+        return 3.*n*constants.gas_constant*einstein_T*0.5 # zero point energy
     x = einstein_T/T
-    E_th = 3.*n*R*einstein_T*( 0.5 + 1. / (np.exp( x ) - 1.0) ) # include the zero point energy
+    E_th = 3.*n*constants.gas_constant*einstein_T*( 0.5 + 1. / (np.exp( x ) - 1.0) ) # include the zero point energy
     return E_th
 
 def heat_capacity_v(T,einstein_T,n):
@@ -29,7 +29,7 @@ def heat_capacity_v(T,einstein_T,n):
     if T ==0:
         return 0
     x = einstein_T/T
-    C_v = 3.0*n*R* ( x * x * np.exp( x ) / np.power( np.exp( x ) - 1.0, 2.0 ) ) 
+    C_v = 3.0*n*constants.gas_constant* ( x * x * np.exp( x ) / np.power( np.exp( x ) - 1.0, 2.0 ) )
     return C_v
 
 
diff --git a/burnman/endmemberdisorder.py b/burnman/endmemberdisorder.py
index 25639d1..d7a6018 100644
--- a/burnman/endmemberdisorder.py
+++ b/burnman/endmemberdisorder.py
@@ -3,7 +3,7 @@
 # Released under GPL v2 or later.
 
 import numpy as np
-from burnman.constants import R
+import constants
 
 T_0=298.15 # Standard temperature = 25 C
 P_0=1.e5 # Standard pressure = 1.e5 Pa
@@ -119,7 +119,7 @@ def equilibrium_Q(Q, deltaS, P, T, params):
     W=params['BW_W'] + P*params['BW_Wv']
     if Q>1.0:
         Q=0.9 # A simple catch to make sure the optimisation doesn't fail
-    return params['BW_deltaH'] - params['BW_factor']*T*deltaS + P*params['BW_deltaV'] + params['BW_factor']*R*T*(lnxdisord(n,Q) - lnxord(n,Q)) + (2.*Q - 1.)*W
+    return params['BW_deltaH'] - params['BW_factor']*T*deltaS + P*params['BW_deltaV'] + params['BW_factor']*constants.gas_constant*T*(lnxdisord(n,Q) - lnxord(n,Q)) + (2.*Q - 1.)*W
 
 # Energy of disordering from Bragg-Williams symmetric model; see Holland and Powell, 1996
 def gibbs_disorder_BW(P, T, params):
@@ -127,7 +127,7 @@ def gibbs_disorder_BW(P, T, params):
     deltaS=entropydisorder(n)
     Q=opt.fsolve(equilibrium_Q, 0.999995, args=(deltaS, P, T, params))[0]
     W=params['BW_W'] + P*params['BW_Wv']
-    ideal=(1.-Q)*(params['BW_deltaH'] - params['BW_factor']*T*entropydisorder(n) + P*params['BW_deltaV'] + params['BW_factor']*R*T*lnxdisord(n,Q)) + params['BW_factor']*Q*(R*T*lnxord(n,Q))
+    ideal=(1.-Q)*(params['BW_deltaH'] - params['BW_factor']*T*entropydisorder(n) + P*params['BW_deltaV'] + params['BW_factor']*constants.gas_constant*T*lnxdisord(n,Q)) + params['BW_factor']*Q*(R*T*lnxord(n,Q))
     nonideal=(1.-Q)*Q*W
     Edisord=ideal+nonideal
     return Edisord
diff --git a/burnman/modified_tait.py b/burnman/modified_tait.py
index 36271cb..9426709 100644
--- a/burnman/modified_tait.py
+++ b/burnman/modified_tait.py
@@ -8,7 +8,7 @@ import scipy.optimize as opt
 import burnman.equation_of_state as eos
 import burnman.einstein as einstein
 from burnman.endmemberdisorder import *
-from burnman.constants import R
+import constants
 
 T_0=298.15 # Standard temperature = 25 C
 P_0=1.e5 # Standard pressure = 1.e5 Pa
diff --git a/burnman/solidsolution.py b/burnman/solidsolution.py
index b7778b9..cfd46e4 100644
--- a/burnman/solidsolution.py
+++ b/burnman/solidsolution.py
@@ -6,7 +6,7 @@ import numpy as np
 from burnman.mineral import Mineral
 from burnman.processchemistry import ProcessSolidSolutionChemistry
 from burnman.solutionmodel import SolutionModel
-from burnman.constants import R
+import constants
 import warnings
 
 kd = lambda x,y : 1 if x==y else 0
diff --git a/burnman/solutionmodel.py b/burnman/solutionmodel.py
index dde527c..f4992e8 100644
--- a/burnman/solutionmodel.py
+++ b/burnman/solutionmodel.py
@@ -6,7 +6,7 @@ import numpy as np
 import warnings
 import burnman
 from burnman.processchemistry import *
-from burnman.constants import R
+import constants
 
 kd = lambda x,y : 1 if x==y else 0
 class SolutionModel:



More information about the CIG-COMMITS mailing list