From a5ae7eedc76e883137215a7503d4806f802e0a12 Mon Sep 17 00:00:00 2001 From: cortespea Date: Mon, 30 Oct 2023 18:00:39 -0500 Subject: [PATCH] fix bug with side draws distillation --- biosteam/units/distillation.py | 4 +++- biosteam/units/phase_equilibrium.py | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/biosteam/units/distillation.py b/biosteam/units/distillation.py index 7e9badc4..e83174ad 100644 --- a/biosteam/units/distillation.py +++ b/biosteam/units/distillation.py @@ -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 ---------- @@ -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 @@ -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') diff --git a/biosteam/units/phase_equilibrium.py b/biosteam/units/phase_equilibrium.py index 0205dd1a..39280d7c 100644 --- a/biosteam/units/phase_equilibrium.py +++ b/biosteam/units/phase_equilibrium.py @@ -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): @@ -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: @@ -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 @@ -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 @@ -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