[iapws] 01/06: new upstream 1.1.1
Alastair McKinstry
mckinstry at moszumanska.debian.org
Tue Jun 16 11:28:20 UTC 2015
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to tag debian_1.1.1-1
in repository iapws.
commit 5369c68d008479b839e6489201fb2ccb621386a7
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Fri May 1 12:11:36 2015 +0100
new upstream 1.1.1
---
PKG-INFO | 2 +-
iapws.egg-info/PKG-INFO | 2 +-
iapws/__init__.py | 28 +++++-----
iapws/iapws08.py | 2 +-
iapws/iapws95.py | 132 ++++++++++++++++++++++++++++++------------------
iapws/iapws97.py | 4 +-
6 files changed, 101 insertions(+), 69 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 4f2d9d7..a768f4b 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: iapws
-Version: 1.1
+Version: 1.1.1
Summary: Python implementation of standard from The International Association for the Properties of Water and Steam
Home-page: https://github.com/jjgomera/iapws
Author: jjgomera
diff --git a/iapws.egg-info/PKG-INFO b/iapws.egg-info/PKG-INFO
index 4f2d9d7..a768f4b 100644
--- a/iapws.egg-info/PKG-INFO
+++ b/iapws.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: iapws
-Version: 1.1
+Version: 1.1.1
Summary: Python implementation of standard from The International Association for the Properties of Water and Steam
Home-page: https://github.com/jjgomera/iapws
Author: jjgomera
diff --git a/iapws/__init__.py b/iapws/__init__.py
index 7047f7a..f506b81 100644
--- a/iapws/__init__.py
+++ b/iapws/__init__.py
@@ -1,23 +1,23 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-__version__ = "1.1"
+__version__ = "1.1.1"
import unittest
-from iapws97 import IAPWS97
-from iapws97 import (_Region1, _Region2, _Region3, _Region5,
- _Backward1_T_Ph, _Backward1_T_Ps, _Backward1_P_hs,
- _Backward2_T_Ph, _Backward2_T_Ps, _Backward2_P_hs,
- _h_3ab, _Backward3_T_Ph, _Backward3_v_Ph, _Backward3_T_Ps,
- _Backward3_v_Ps, _PSat_h, _PSat_s, _Backward3_P_hs, _h1_s,
- _h3a_s, _h2ab_s, _h2c3b_s, _PSat_T, _TSat_P, _h13_s,
- _t_hs, _Backward4_T_hs, _tab_P, _top_P, _twx_P, _tef_P,
- _txx_P, _Backward3_v_PT)
-from iapws95 import IAPWS95, D2O
-from iapws08 import SeaWater
-from _iapws import (_Ice, _Sublimation_Pressure, _Melting_Pressure,
- _Viscosity, _ThCond)
+from .iapws97 import IAPWS97
+from .iapws97 import (_Region1, _Region2, _Region3, _Region5,
+ _Backward1_T_Ph, _Backward1_T_Ps, _Backward1_P_hs,
+ _Backward2_T_Ph, _Backward2_T_Ps, _Backward2_P_hs,
+ _h_3ab, _Backward3_T_Ph, _Backward3_v_Ph, _Backward3_T_Ps,
+ _Backward3_v_Ps, _PSat_h, _PSat_s, _Backward3_P_hs, _h1_s,
+ _h3a_s, _h2ab_s, _h2c3b_s, _PSat_T, _TSat_P, _h13_s,
+ _t_hs, _Backward4_T_hs, _tab_P, _top_P, _twx_P, _tef_P,
+ _txx_P, _Backward3_v_PT)
+from .iapws95 import IAPWS95, D2O
+from .iapws08 import SeaWater
+from ._iapws import (_Ice, _Sublimation_Pressure, _Melting_Pressure,
+ _Viscosity, _ThCond)
# Test
diff --git a/iapws/iapws08.py b/iapws/iapws08.py
index 65b36e7..c2dbe2f 100644
--- a/iapws/iapws08.py
+++ b/iapws/iapws08.py
@@ -8,7 +8,7 @@
from __future__ import division
from math import log
-from iapws95 import IAPWS95
+from .iapws95 import IAPWS95
# Constants
diff --git a/iapws/iapws95.py b/iapws/iapws95.py
index b100104..6eeb2f9 100644
--- a/iapws/iapws95.py
+++ b/iapws/iapws95.py
@@ -12,9 +12,9 @@
from scipy import exp, log
from scipy.optimize import fsolve
-from _iapws import _fase
-from _iapws import _Viscosity, _ThCond, _Dielectric, _Refractive
-from iapws97 import _TSat_P
+from ._iapws import _fase
+from ._iapws import _Viscosity, _ThCond, _Dielectric, _Refractive
+from .iapws97 import _TSat_P
class MEoS(_fase):
@@ -151,7 +151,7 @@ class MEoS(_fase):
self._mode = ""
if self.kwargs["T"] and self.kwargs["P"]:
self._mode = "TP"
- elif self.kwargs["T"] and self.kwargs["rho"]:
+ elif self.kwargs["T"] and (self.kwargs["rho"] or self.kwargs["v"]):
self._mode = "Trho"
elif self.kwargs["T"] and self.kwargs["h"] is not None:
self._mode = "Th"
@@ -159,7 +159,7 @@ class MEoS(_fase):
self._mode = "Ts"
elif self.kwargs["T"] and self.kwargs["u"] is not None:
self._mode = "Tu"
- elif self.kwargs["P"] and self.kwargs["rho"]:
+ elif self.kwargs["P"] and (self.kwargs["rho"] or self.kwargs["v"]):
self._mode = "Prho"
elif self.kwargs["P"] and self.kwargs["h"] is not None:
self._mode = "Ph"
@@ -167,11 +167,11 @@ class MEoS(_fase):
self._mode = "Ps"
elif self.kwargs["P"] and self.kwargs["u"] is not None:
self._mode = "Pu"
- elif self.kwargs["rho"] and self.kwargs["h"] is not None:
+ elif (self.kwargs["rho"] or self.kwargs["v"]) and self.kwargs["h"] is not None:
self._mode = "rhoh"
- elif self.kwargs["rho"] and self.kwargs["s"] is not None:
+ elif (self.kwargs["rho"] or self.kwargs["v"]) and self.kwargs["s"] is not None:
self._mode = "rhos"
- elif self.kwargs["rho"] and self.kwargs["u"] is not None:
+ elif (self.kwargs["rho"] or self.kwargs["v"]) and self.kwargs["u"] is not None:
self._mode = "rhou"
elif self.kwargs["h"] is not None and self.kwargs["s"] is not None:
self._mode = "hs"
@@ -461,7 +461,6 @@ class MEoS(_fase):
elif self._mode == "Px":
# Iterate over saturation routine to get T
- # FIXME: Too slow, it need find any other algorithm
def funcion(T):
rhol, rhov, Ps = self._saturation(T)
return Ps/1000-P
@@ -603,53 +602,85 @@ class MEoS(_fase):
fase.epsilon = None
fase.n = None
- def _saturation(self, T):
- """Akasaka (2008) "A Reliable and Useful Method to Determine the
- Saturation State from Helmholtz Energy Equations of State", Journal of
- Thermal Science and Technology, 3, 442-451
- http://dx.doi.org/10.1299/jtst.3.442"""
-
- rhoL = self._Liquid_Density(T)
- rhoG = self._Vapor_Density(T)
- g = 500.
- erroro = 1e6
- rholo = rhoL
- rhogo = rhoG
- contador = 0
- while True:
- contador += 1
- deltaL = rhoL/self.rhoc
- deltaG = rhoG/self.rhoc
- liquido = self._Helmholtz(rhoL, T)
- vapor = self._Helmholtz(rhoG, T)
+ def _saturation(self, T=None):
+ """Saturation calculation for two phase search"""
+ if not T:
+ T = self.T
+
+ rhoLo = self._Liquid_Density(T)
+ rhoGo = self._Vapor_Density(T)
+
+ def f(parr):
+ rhol, rhog = parr
+ deltaL = rhol/self.rhoc
+ deltaG = rhog/self.rhoc
+ liquido = self._Helmholtz(rhol, T)
+ vapor = self._Helmholtz(rhog, T)
Jl = deltaL*(1+deltaL*liquido["fird"])
Jv = deltaG*(1+deltaG*vapor["fird"])
Kl = deltaL*liquido["fird"]+liquido["fir"]+log(deltaL)
Kv = deltaG*vapor["fird"]+vapor["fir"]+log(deltaG)
- Jdl = 1+2*deltaL*liquido["fird"]+deltaL**2*liquido["firdd"]
- Jdv = 1+2*deltaG*vapor["fird"]+deltaG**2*vapor["firdd"]
- Kdl = 2*liquido["fird"]+deltaL*liquido["firdd"]+1/deltaL
- Kdv = 2*vapor["fird"]+deltaG*vapor["firdd"]+1/deltaG
- Delta = Jdv*Kdl-Jdl*Kdv
- error = abs(Kv-Kl)+abs(Jv-Jl)
- if error < 1e-12 or contador > 100:
- break
- elif error > erroro:
- rhoL = rholo
- rhoG = rhogo
- g = g*0.5
- else:
- erroro = error
- rholo = rhoL
- rhogo = rhoG
- rhoL = rhoL+g/Delta*((Kv-Kl)*Jdv-(Jv-Jl)*Kdv)
- rhoG = rhoG+g/Delta*((Kv-Kl)*Jdl-(Jv-Jl)*Kdl)
- if error > 1e-3:
- print("Iteration don´t converge, residual error %g" % error)
-
- Ps = self.R*T*rhoL*rhoG/(rhoL-rhoG)*(liquido["fir"]-vapor["fir"]+log(deltaL/deltaG))
+ return Kv-Kl, Jv-Jl
+
+ rhoL, rhoG = fsolve(f, [rhoLo, rhoGo])
+ if rhoL == rhoG:
+ Ps = self.Pc
+ else:
+ liquido = self._Helmholtz(rhoL, T)
+ vapor = self._Helmholtz(rhoG, T)
+ deltaL = rhoL/self.rhoc
+ deltaG = rhoG/self.rhoc
+
+ Ps = self.R*T*rhoL*rhoG/(rhoL-rhoG)*(liquido["fir"]-vapor["fir"]+log(deltaL/deltaG))
return rhoL, rhoG, Ps
+# def _saturation(self, T):
+# """Akasaka (2008) "A Reliable and Useful Method to Determine the
+# Saturation State from Helmholtz Energy Equations of State", Journal of
+# Thermal Science and Technology, 3, 442-451
+# http://dx.doi.org/10.1299/jtst.3.442"""
+#
+# rhoL = self._Liquid_Density(T)
+# rhoG = self._Vapor_Density(T)
+# g = 500.
+# erroro = 1e6
+# rholo = rhoL
+# rhogo = rhoG
+# contador = 0
+# while True:
+# contador += 1
+# deltaL = rhoL/self.rhoc
+# deltaG = rhoG/self.rhoc
+# liquido = self._Helmholtz(rhoL, T)
+# vapor = self._Helmholtz(rhoG, T)
+# Jl = deltaL*(1+deltaL*liquido["fird"])
+# Jv = deltaG*(1+deltaG*vapor["fird"])
+# Kl = deltaL*liquido["fird"]+liquido["fir"]+log(deltaL)
+# Kv = deltaG*vapor["fird"]+vapor["fir"]+log(deltaG)
+# Jdl = 1+2*deltaL*liquido["fird"]+deltaL**2*liquido["firdd"]
+# Jdv = 1+2*deltaG*vapor["fird"]+deltaG**2*vapor["firdd"]
+# Kdl = 2*liquido["fird"]+deltaL*liquido["firdd"]+1/deltaL
+# Kdv = 2*vapor["fird"]+deltaG*vapor["firdd"]+1/deltaG
+# Delta = Jdv*Kdl-Jdl*Kdv
+# error = abs(Kv-Kl)+abs(Jv-Jl)
+# if error < 1e-12 or contador > 100:
+# break
+# elif error > erroro:
+# rhoL = rholo
+# rhoG = rhogo
+# g = g*0.5
+# else:
+# erroro = error
+# rholo = rhoL
+# rhogo = rhoG
+# rhoL = rhoL+g/Delta*((Kv-Kl)*Jdv-(Jv-Jl)*Kdv)
+# rhoG = rhoG+g/Delta*((Kv-Kl)*Jdl-(Jv-Jl)*Kdl)
+# if error > 1e-3:
+# print("Iteration don´t converge, residual error %g" % error)
+#
+# Ps = self.R*T*rhoL*rhoG/(rhoL-rhoG)*(liquido["fir"]-vapor["fir"]+log(deltaL/deltaG))
+# return rhoL, rhoG, Ps
+
def _Helmholtz(self, rho, T):
"""Calculated properties, table 3 pag 10"""
rhoc = self._constants.get("rhoref", self.rhoc)
@@ -1315,3 +1346,4 @@ class D2O(MEoS):
if __name__ == "__main__":
import doctest
doctest.testmod()
+
diff --git a/iapws/iapws97.py b/iapws/iapws97.py
index 36c03df..8e6eece 100644
--- a/iapws/iapws97.py
+++ b/iapws/iapws97.py
@@ -8,8 +8,8 @@ from math import sqrt, log, exp
from scipy.optimize import fsolve
-from _iapws import M, R, Tc, Pc, rhoc, Tt, Pt, Tb, Dipole, f_acent, _fase
-from _iapws import _Viscosity, _ThCond, _Tension, _Dielectric, _Refractive
+from ._iapws import M, R, Tc, Pc, rhoc, Tt, Pt, Tb, Dipole, f_acent, _fase
+from ._iapws import _Viscosity, _ThCond, _Tension, _Dielectric, _Refractive
sc = 4.41202148223476 # Critic entropy
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/iapws.git
More information about the debian-science-commits
mailing list