Skip to content

Commit

Permalink
extend tests NRTL, UNIQUAC
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoMVale committed Mar 11, 2024
1 parent ce790a1 commit 8c8274f
Showing 1 changed file with 37 additions and 8 deletions.
45 changes: 37 additions & 8 deletions tests/thermo/test_acm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,22 @@ def test_IdealSolution():


def test_NRTL():
a = np.array([[0, -0.178], [1.963, 0]])
c = np.array([[0, 0.2974], [.2974, 0]])
m = NRTL(2, a=a, c=c)
T = 298.
x = np.array([0.252, 0.748])
# assert isclose(m.gE(T, x), 0.)
assert np.all(isclose(m.gamma(T, x), [1.93631838, 1.15376097], rtol=1e-6))
# water: 0
# ethanol: 1
N = 2
a = np.zeros((N, N))
b = np.zeros((N, N))
a[0, 1] = 3.4578
a[1, 0] = -0.8009
b[0, 1] = -586.0809
b[1, 0] = 246.18
m = NRTL(N, a, b)
T = 298.15
assert np.all(isclose(m.gamma(T, np.array([0., 1.])),
[2.660317, 1.], rtol=1e-6))
assert np.all(isclose(m.gamma(T, np.array([1., 0.])),
[1., 4.557085], rtol=1e-6))
assert isclose(m.Dgmix(T, np.array([0.5, 0.5])), -0.98183e3, rtol=1e-4)


def test_UNIQUAC():
Expand All @@ -35,5 +44,25 @@ def test_UNIQUAC():
m = UNIQUAC(N, q, r, b=b)
x = np.array([.1311, .0330, .8359])
T = 45 + 273.15
# assert isclose(m.gE(T, x), 0.)
assert np.all(isclose(m.gamma(T, x), [7.15, 1.25, 1.06], rtol=2e-3))


def test_UNIQUAC_2():
# water: 0
# ethanol: 1
N = 2
a = np.zeros((N, N))
b = np.zeros((N, N))
a[0, 1] = -2.4936
a[1, 0] = 2.0046
b[0, 1] = 756.9477
b[1, 0] = -728.9705
r = np.array([0.92, 2.1054])
q = np.array([1.3997, 1.9720])
m = UNIQUAC(N, q, r, a, b)
T = 298.15
assert np.all(isclose(m.gamma(T, np.array([0., 1.])),
[2.698527, 1.], rtol=1e-2))
assert np.all(isclose(m.gamma(T, np.array([1., 0.])),
[1., 4.604476], rtol=1e-2))
assert isclose(m.Dgmix(T, np.array([0.5, 0.5])), -0.98972e3, rtol=1e-2)

0 comments on commit 8c8274f

Please sign in to comment.