Skip to content

Commit

Permalink
Merge with remote
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebBell committed Nov 15, 2023
2 parents 174b5fb + 4170171 commit d8b8d9b
Show file tree
Hide file tree
Showing 10 changed files with 902 additions and 1,015 deletions.
4 changes: 2 additions & 2 deletions thermo/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ class GCEOS:

N = 1
"""The number of components in the EOS"""
scalar = True
vectorized = False

multicomponent = False
"""Whether or not the EOS is multicomponent or not"""
Expand Down Expand Up @@ -1028,7 +1028,7 @@ def as_json(self):
'''
# vaguely jsonpickle compatible
d = object_data(self)
if not self.scalar:
if self.vectorized:
d = serialize.arrays_to_lists(d)
# TODO: delete kwargs and reconstruct it
# Need to add all kwargs attributes
Expand Down
36 changes: 18 additions & 18 deletions thermo/eos_alpha_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2007,9 +2007,9 @@ def a_alphas_vectorized(self, T):
Tr = T/Tcs[i]
a_alpha = ais[i]*(Tr**(coeffs[2]*(coeffs[1] - 1.0))*exp(coeffs[0]*(1.0 - (Tr)**(coeffs[1]*coeffs[2]))))
a_alphas.append(a_alpha)
if self.scalar:
return a_alphas
return array(a_alphas)
if self.vectorized:
return array(a_alphas)
return a_alphas

def a_alpha_and_derivatives_vectorized(self, T):
r'''Method to calculate the pure-component `a_alphas` and their first
Expand Down Expand Up @@ -2064,9 +2064,9 @@ def a_alpha_and_derivatives_vectorized(self, T):
da_alpha_dTs[i] = x8*(x1 - x7)*T_inv
d2a_alpha_dT2s[i] = d2a_alpha_dT2

if self.scalar:
return a_alphas, da_alpha_dTs, d2a_alpha_dT2s
return array(a_alphas), array(da_alpha_dTs), array(d2a_alpha_dT2s)
if self.vectorized:
return array(a_alphas), array(da_alpha_dTs), array(d2a_alpha_dT2s)
return a_alphas, da_alpha_dTs, d2a_alpha_dT2s


class Soave_1993_a_alpha(a_alpha_base):
Expand Down Expand Up @@ -2350,9 +2350,9 @@ def a_alphas_vectorized(self, T):
Tcs, omegas, ais = self.Tcs, self.omegas, self.ais
a_alphas = [TWU_a_alpha_common(T, Tcs[i], omegas[i], ais[i], full=False, method='SRK')
for i in range(self.N)]
if self.scalar:
return a_alphas
return array(a_alphas)
if self.vectorized:
return array(a_alphas)
return a_alphas

def a_alpha_and_derivatives_vectorized(self, T):
Tcs, omegas, ais = self.Tcs, self.omegas, self.ais
Expand All @@ -2362,9 +2362,9 @@ def a_alpha_and_derivatives_vectorized(self, T):
r0.append(v0)
r1.append(v1)
r2.append(v2)
if self.scalar:
return r0, r1, r2
return array(r0), array(r1), array(r2)
if self.vectorized:
return array(r0), array(r1), array(r2)
return r0, r1, r2



Expand Down Expand Up @@ -2473,9 +2473,9 @@ def a_alphas_vectorized(self, T):
Tcs, omegas, ais = self.Tcs, self.omegas, self.ais
a_alphas = [TWU_a_alpha_common(T, Tcs[i], omegas[i], ais[i], full=False, method='PR')
for i in range(self.N)]
if self.scalar:
return a_alphas
return array(a_alphas)
if self.vectorized:
return array(a_alphas)
return a_alphas

def a_alpha_and_derivatives_vectorized(self, T):
Tcs, omegas, ais = self.Tcs, self.omegas, self.ais
Expand All @@ -2485,9 +2485,9 @@ def a_alpha_and_derivatives_vectorized(self, T):
r0.append(v0)
r1.append(v1)
r2.append(v2)
if self.scalar:
return r0, r1, r2
return array(r0), array(r1), array(r2)
if self.vectorized:
return array(r0), array(r1), array(r2)
return r0, r1, r2


class Soave_1979_a_alpha(a_alpha_base):
Expand Down
Loading

0 comments on commit d8b8d9b

Please sign in to comment.