Skip to content

Commit

Permalink
Reverted to v2.1.10 era call signatures for the deprecated inverse ro…
Browse files Browse the repository at this point in the history
…utines T_s, T_h, etc...
  • Loading branch information
chmarti1 committed Oct 26, 2022
1 parent 073e394 commit d7ca5db
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 65 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,20 @@ The version increments between 2.0.1 and 2.0.4 were primarily spent correcting i
- Added O2, R1234ze to the multiphase collection
- Corrected a number of minor bugs reported since the last release. These are documented on the PYroMat github issues page.

# Version 2.2.1
## Version 2.2.1
- Issued bugfixes for github issues 41, 42, 43
- Corrected a boneheaded typo in igmix that should have been caught in testing.
- Reverted to `_tditer()` in `mp1._T()`
- Eliminated the upper 1% grace range in `Ts()` to prevent imaginary values past Tc.

# Version 2.2.2
## Version 2.2.2
- Changed the call signature for `T_s`, `T_h` functions to address issue 52
*NOTE* inverse methods like `T_s` and `T_h` are now depricated.
- Reassessed all multiphase `dlim` values in the core data. This addresses issues 44, 45, and 46.

## Version 2.2.3
- Updated the README to adopt recommendations made by the JOSS community - specifically to include recommendations for community involvement.
- Added the optional `pip install pyromat[dev]` option, which requires the `pytest` package.

## Version 2.2.4
- Corrected a bug reported in issue 64 where inverse routines were not returning the correct units.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Thermodynamic tools for Python

Originally authored by [Chris Martin](https://sites.psu.edu/cmartin) [crm28@psu.edu](mailto:crm28@psu.edu)
Originally authored by [Chris Martin](https://sites.psu.edu/cmartin) [crm28@psu.edu](mailto:crm28@psu.edu)
Now co-authored by [Joe Ranalli](https://github.com/jranalli)

PYroMat is a flexible platform for conveniently working with thermodynamic data. The expanding collection of substances includes data for the properties people need most, exposed in an intuitively designed object interface [Come read more.](http://www.pyromat.org)
Expand Down
2 changes: 1 addition & 1 deletion src/pyromat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# utility.load_config() checks this value to establish the read-only version
# setup.py looks for this line to establish the version
# MUST be unindented
__version__ = "2.2.3"
__version__ = "2.2.4"


# loading the PYroMat utility functions
Expand Down
24 changes: 15 additions & 9 deletions src/pyromat/registry/ig.py
Original file line number Diff line number Diff line change
Expand Up @@ -1776,9 +1776,9 @@ def state(self, *varg, **kwarg):



def T_s(self,s,p=None, **kwarg):
def T_s(self,s,p=None, d=None):
"""Temperature as a function of entropy
** Depreciated - use T() **
** Deprecated - use T() **
T = T_s(s)
or
Expand All @@ -1791,12 +1791,14 @@ def T_s(self,s,p=None, **kwarg):
"""
if p is not None:
return self.T(s=s, p=p)
return self.T(s=s, **kwarg)
elif d is not None:
return self.T(s=s, d=d)
return self.T(s=s)


def T_h(self,h,p=None,**kwarg):
def T_h(self,h, p=None, d=None):
"""Temperature as a function of enthalpy
** Depreciated - use T() **
** Deprecated - use T() **
T = T_h(h)
or
Expand All @@ -1812,12 +1814,14 @@ def T_h(self,h,p=None,**kwarg):
"""
if p is not None:
return self.T(h=h, p=p)
return self.T(h=h, **kwarg)
elif d is not None:
return self.T(h=h, d=d)
return self.T(h=h)


def p_s(self,s,*varg, **kwarg):
def p_s(self,s,T=None):
"""Pressure as a function of entropy
** Depreciated - use p() **
** Deprecated - use p() **
p = ig_instance.p_s(s)
or
Expand All @@ -1829,4 +1833,6 @@ def p_s(self,s,*varg, **kwarg):
unit_temperature
Returns unit_pressure
"""
return self.p(*varg, s=s, **kwarg)
if T is not None:
return self.p(s=s,T=T)
return self.p(s=s)
26 changes: 16 additions & 10 deletions src/pyromat/registry/ig2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1245,11 +1245,11 @@ def state(self, *varg, **kwarg):
return out


def T_s(self,s,p=None, **kwarg):
def T_s(self,s,p=None, d=None):
"""Temperature as a function of entropy
** Depreciated - use T() **
** Deprecated - use T() **
T = T_s(s)
T = T_s(s)
or
T = T_s(s,p)
Expand All @@ -1260,12 +1260,14 @@ def T_s(self,s,p=None, **kwarg):
"""
if p is not None:
return self.T(s=s, p=p)
return self.T(s=s, **kwarg)
elif d is not None:
return self.T(s=s, d=d)
return self.T(s=s)


def T_h(self,h,p=None,**kwarg):
def T_h(self,h, p=None, d=None):
"""Temperature as a function of enthalpy
** Depreciated - use T() **
** Deprecated - use T() **
T = T_h(h)
or
Expand All @@ -1281,12 +1283,14 @@ def T_h(self,h,p=None,**kwarg):
"""
if p is not None:
return self.T(h=h, p=p)
return self.T(h=h, **kwarg)
elif d is not None:
return self.T(h=h, d=d)
return self.T(h=h)


def p_s(self,s,*varg, **kwarg):
def p_s(self,s,T=None):
"""Pressure as a function of entropy
** Depreciated - use p() **
** Deprecated - use p() **
p = ig_instance.p_s(s)
or
Expand All @@ -1298,4 +1302,6 @@ def p_s(self,s,*varg, **kwarg):
unit_temperature
Returns unit_pressure
"""
return self.p(*varg, s=s, **kwarg)
if T is not None:
return self.p(s=s,T=T)
return self.p(s=s)
46 changes: 28 additions & 18 deletions src/pyromat/registry/igmix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,10 +1031,10 @@ def Y(self):
# Return the dictionary
return self._y.copy()


def T_s(self,s,p=None,**kwarg):
def T_s(self,s,p=None, d=None):
"""Temperature as a function of entropy
** Depreciated - use T() **
** Deprecated - use T() **
T = T_s(s)
or
T = T_s(s,p)
Expand All @@ -1046,38 +1046,48 @@ def T_s(self,s,p=None,**kwarg):
"""
if p is not None:
return self.T(s=s, p=p)
return self.T(s=s, **kwarg)
elif d is not None:
return self.T(s=s, d=d)
return self.T(s=s)


def T_h(self,h, p=None, **kwarg):
def T_h(self,h, p=None, d=None):
"""Temperature as a function of enthalpy
** Depreciated - use T() **
** Deprecated - use T() **
T = T_h(h)
or
T = T_h(h,p)
T = T_h(h,...)
Returns the temperature as a function of enthalpy and pressure
Returns the temperature as a function of enthalpy and pressure. Ideal
gas enthalpy is not a function of pressure, so the p term is merely a
placeholder.
Accepts unit_energy / unit_matter
Accepts unit_energy / unit_matter / unit_temperature
unit_pressure
Returns unit_temperature
"""
if p is not None:
return self.T(h=h, p=p)
return self.T(h=h, **kwarg)


def p_s(self, s, *varg, **kwarg):
elif d is not None:
return self.T(h=h, d=d)
return self.T(h=h)


def p_s(self,s,T=None):
"""Pressure as a function of entropy
** Depreciated - use p() **
p = p_s(s)
OR
p = p_s(s,T)
** Deprecated - use p() **
p = ig_instance.p_s(s)
or
p = ig_instance.p_s(s,...)
Returns the pressure as a function of entropy and temperature.
Accepts unit_energy / unit_matter / unit_temperature
unit_temperature
Returns unit_pressure
"""
return self.p(s=s, *varg, **kwarg)
if T is not None:
return self.p(s=s,T=T)
return self.p(s=s)
43 changes: 19 additions & 24 deletions src/pyromat/registry/mp1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4138,9 +4138,9 @@ def gam(self, *varg, quality=False, **kwarg):
return cp/cv


def T_s(self, s, p=None, quality=False, **kwarg):
def T_s(self, s, p=None, d=None, quality=False, debug=False):
"""Temperature from entropy
** Depreciated - use T() **
** Deprecated - use T() **
T = T_s(s, p=p)
OR
Expand All @@ -4155,17 +4155,16 @@ def T_s(self, s, p=None, quality=False, **kwarg):
T,x = T_s(s, p=p, quality=True)
"""
if p is not None:
T,_,_,x,_ = self._argparse(s=s, p=p)
else:
T,_,_,x,_ = self._argparse(s=s, **kwarg)
if quality:
return T,x
return T
return self.T(s=s,p=p,quality=quality)
elif d is not None:
return self.T(s=s,d=d,quality=quality)
p = pm.config['def_p']
return self.T(s=s, p=p)


def d_s(self, s, *varg, quality=False, **kwarg):
def d_s(self, s, T=None, quality=False, debug=False):
"""Density from entropy
** Depreciated - use d() **
** Deprecated - use d() **
d = d_s(s,T=T)
Expand All @@ -4175,19 +4174,16 @@ def d_s(self, s, *varg, quality=False, **kwarg):
The optional keyword flag, quality, will cause quality to be returned along
with pressure.
"""
_,d1,d2,x,I = self._argparse(*varg, s=s, **kwarg)
d1[I] = 1./(x[I]/d2[I] + (1-x[I])/d1[I])

if quality:
return d1,x
return d1
if T is not None:
return self.d(s=s, T=T, quality=quality)
return self.d(s=s, quality=quality)




def T_h(self, h, p=None, quality=False, **kwarg):
def T_h(self, h, p=None, d=None, quality=False, debug=False):
"""Temperature from entropy
** Depreciated - use T() **
** Deprecated - use T() **
T = T_s(s, p=p)
OR
Expand All @@ -4202,9 +4198,8 @@ def T_h(self, h, p=None, quality=False, **kwarg):
T,x = T_s(s, p=p, quality=True)
"""
if p is not None:
T,_,_,x,_ = self._argparse(h=h, p=p)
else:
T,_,_,x,_ = self._argparse(h=h, **kwarg)
if quality:
return T,x
return T
return self.T(h=h,p=p,quality=quality)
elif d is not None:
return self.T(h=h,d=d,quality=quality)
p = pm.config['def_p']
return self.T(h=h, p=p)

0 comments on commit d7ca5db

Please sign in to comment.