Skip to content

Commit

Permalink
fix bug with side draws distillation
Browse files Browse the repository at this point in the history
  • Loading branch information
cortespea committed Oct 30, 2023
1 parent 99e32f3 commit a5ae7ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion biosteam/units/distillation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
.. autoclass:: biosteam.units.distillation.BinaryDistillation
.. autoclass:: biosteam.units.distillation.ShortcutColumn
.. autoclass:: biosteam.units.distillation.MESHDistillation
.. autocalss:: biosteam.units.distillation.AdiabaticMultiStageVLEColumn
References
----------
Expand Down Expand Up @@ -2443,7 +2444,7 @@ def _actual_stages(self):
eff = self.stage_efficiency
if eff is None:
# Calculate Murphree Efficiency
vapor, liquid = self.outs
vapor, liquid, *others = self.outs
mu = liquid.get_property('mu', 'mPa*s')
alpha = self._get_relative_volatilities()
L_Rmol = liquid.F_mol
Expand Down Expand Up @@ -2476,6 +2477,7 @@ def _design(self):
diameters = []
for i in self.stages:
vapor, liquid = i.partition.outs
if liquid.isempty() or vapor.isempty(): continue
rho_L = liquid.rho
V = vapor.F_mass
V_vol = vapor.get_total_flow('m^3/s')
Expand Down
13 changes: 7 additions & 6 deletions biosteam/units/phase_equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,6 @@ def hot_start_collapsed_stages(self, all_stages):
partition.T = collapsed_partition.T
partition.phi = collapsed_partition.phi
for i in partition.outs: i.T = collapsed_partition.T
partition.IDs = collapsed_partition.IDs
partition.K = collapsed_partition.K

def hot_start(self):
Expand Down Expand Up @@ -792,9 +791,7 @@ def hot_start(self):
partition.T = T
partition.phi = phi
for i in partition.outs: i.T = T
for i in partitions:
i.IDs = IDs
i.K = K
for i in partitions: i.K = K
N_chemicals = len(index)
if data:
if top_chemicals:
Expand Down Expand Up @@ -835,6 +832,7 @@ def hot_start(self):
partition.outs[1].imol[bottom_chemicals] = b
for i in bottom_side_draws:
for s in stages[i].splitters: s._run()
for i in partitions: i.IDs = IDs
top_flow_rates = self._get_top_flow_rates(False)
return top_flow_rates

Expand All @@ -861,7 +859,8 @@ def get_vle_phase_ratios(self):
N_stages = self.N_stages
phase_ratios = np.zeros(N_stages)
last_stage = vapor_last = liquid_last = B_last = None
B_max = 100
B_max = 1e3
B_min = 0
for i in range(N_stages - 1, -1, -1):
stage = stages[i]
partition = stage.partition
Expand All @@ -884,7 +883,9 @@ def get_vle_phase_ratios(self):
if liquid.isempty():
B = B_max
else:
B = min(B_max, Q / (vapor.h * liquid.F_mol))
B = Q / (vapor.h * liquid.F_mol)
if B > B_max: B = B_max
elif B < B_min: B = B_min
vapor_last = vapor
liquid_last = liquid
phase_ratios[i] = B_last = B
Expand Down

0 comments on commit a5ae7ee

Please sign in to comment.