Skip to content

Commit

Permalink
add dippr107
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoMVale committed Oct 13, 2023
1 parent 1c70d26 commit 4b9589c
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 4 deletions.
69 changes: 68 additions & 1 deletion src/polykin/physprops/dippr.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
'DIPPR102',
'DIPPR104',
'DIPPR105',
'DIPPR106']
'DIPPR106',
'DIPPR107']


class DIPPR(PropertyEquationT):
Expand Down Expand Up @@ -454,3 +455,69 @@ def equation(T: FloatOrArray,
r"""DIPPR-106 equation."""
Tr = T/Tc
return A*(1-Tr)**(B + Tr*(C + Tr*(D + E*Tr)))


class DIPPR107(DIPPRP5):
r"""[DIPPR](https://de.wikipedia.org/wiki/DIPPR-Gleichungen)-107 equation.
This equation implements the following temperature dependence:
$$ Y=A+B\left[{\frac {C/T}{\sinh \left(C/T\right)}}\right]^2 + \\
D\left[{\frac {E/T}{\cosh \left(E/T\right)}}\right]^2 $$
where $A$ to $E$ are component-specific constants and $T$ is the absolute
temperature.
Parameters
----------
A : float
Parameter of equation.
B : float
Parameter of equation.
C : float
Parameter of equation.
D : float
Parameter of equation.
E : float
Parameter of equation.
Tmin : float
Lower temperature bound.
Unit = K.
Tmax : float
Upper temperature bound.
Unit = K.
unit : str
Unit of output variable $Y$.
symbol : str
Symbol of output variable $Y$.
name : str
Name.
"""

_punits = ('#', '#', 'K', '#', 'K')

def __init__(self,
A: float,
B: float,
C: float,
D: float,
E: float,
Tmin: float = 0.0,
Tmax: float = np.inf,
unit: str = '-',
symbol: str = 'Y',
name: str = ''
) -> None:

super().__init__(A, B, C, D, E, Tmin, Tmax, unit, symbol, name)

@staticmethod
def equation(T: FloatOrArray,
A: float,
B: float,
C: float,
D: float,
E: float
) -> FloatOrArray:
r"""DIPPR-107 equation."""
return A + B*(C/T/np.sinh(C/T))**2 + D*(E/T/np.cosh(E/T))**2
13 changes: 10 additions & 3 deletions tests/physprops/test_equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright Hugo Vale 2023

from polykin.physprops.dippr import \
DIPPR100, DIPPR101, DIPPR102, DIPPR104, DIPPR105, DIPPR106
DIPPR100, DIPPR101, DIPPR102, DIPPR104, DIPPR105, DIPPR106, DIPPR107
from polykin.physprops import Antoine, Wagner
from polykin import plotequations

Expand All @@ -21,7 +21,7 @@ def test_DIPPR100():

def test_DIPPR101():
"P* of water"
p = DIPPR101(73.649, -7258.2, -7.3037, 4.1653E-6, 2.)
p = DIPPR101(73.649, -7258.2, -7.3037, 4.1653E-6, 2., unit='Pa')
assert np.isclose(p(100., 'C'), 101325., rtol=1e-3)


Expand All @@ -39,7 +39,7 @@ def test_DIPPR104():

def test_DIPPR105():
"rhoL of water"
p = DIPPR105(0.14395, 0.0112, 649.727, 0.05107)
p = DIPPR105(0.14395, 0.0112, 649.727, 0.05107, unit='kg/m³')
assert np.isclose(p(25., 'C'), 998., rtol=1e-3)


Expand All @@ -48,6 +48,13 @@ def test_DIPPR106():
p = DIPPR106(647.096, 56600000., 0.612041, -0.625697, 0.398804)
assert np.isclose(p(273.16, 'K'), 4.498084e7, rtol=1e-6)


def test_DIPPR107():
"CpG of water"
p = DIPPR107(33363., 26790., 2610.5, 8896., 1169., Tmin=100.,
Tmax=2273., unit='J/kmol.K')
assert np.isclose(p(300., 'K'), 33585.904, rtol=1e-6)

# %% Vapor pressure equations


Expand Down

0 comments on commit 4b9589c

Please sign in to comment.