Skip to content

Commit

Permalink
Removed one unnecessary eos call in the excess enthalpy/entropy terms
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebBell committed Feb 9, 2017
1 parent d2b0123 commit 3a0b141
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions thermo/chemical.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,13 +847,13 @@ def calc_H_excess(self, T, P):

elif self.phase_ref == 'l' and self.phase == 'l':
try:
H_dep += self.eos.to_TP(T, P).H_dep_l - self.eos.to_TP(T, 101325).H_dep_l
H_dep += self.eos.to_TP(T, P).H_dep_l - self._eos_T_101325.H_dep_l
except:
H_dep += 0

elif self.phase_ref == 'g' and self.phase == 'l':
H_dep += self.H_dep_Tb_Pb_g - self.H_dep_Tb_P_ref_g
H_dep += (self.eos.to_TP(T, P).H_dep_l - self.eos.to_TP(T, 101325).H_dep_l)
H_dep += (self.eos.to_TP(T, P).H_dep_l - self._eos_T_101325.H_dep_l)

elif self.phase_ref == 'l' and self.phase == 'g':
H_dep += self.H_dep_T_ref_Pb - self.H_dep_ref_l
Expand All @@ -867,13 +867,13 @@ def calc_S_excess(self, T, P):

elif self.phase_ref == 'l' and self.phase == 'l':
try:
S_dep += self.eos.to_TP(T, P).S_dep_l - self.eos.to_TP(T, 101325).S_dep_l
S_dep += self.eos.to_TP(T, P).S_dep_l - self._eos_T_101325.S_dep_l
except:
S_dep += 0

elif self.phase_ref == 'g' and self.phase == 'l':
S_dep += self.S_dep_Tb_Pb_g - self.S_dep_Tb_P_ref_g
S_dep += (self.eos.to_TP(T, P).S_dep_l - self.eos.to_TP(T, 101325).S_dep_l)
S_dep += (self.eos.to_TP(T, P).S_dep_l - self._eos_T_101325.S_dep_l)

elif self.phase_ref == 'l' and self.phase == 'g':
S_dep += self.S_dep_T_ref_Pb - self.S_dep_ref_l
Expand Down Expand Up @@ -942,6 +942,9 @@ def to_solve(T):

def set_thermo(self):
try:
self._eos_T_101325 = self.eos.to_TP(self.T, 101325)


self.Hm = self.calc_H(self.T, self.P)
self.Hm += self.calc_H_excess(self.T, self.P)
self.H = property_molar_to_mass(self.Hm, self.MW) if (self.Hm is not None) else None
Expand Down

0 comments on commit 3a0b141

Please sign in to comment.