You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, Gustavo!
Your code has been helpful for my research, Thank you. However, I have encountered two major errors during LLE calculations:
In sgtpy\gammamie_mixtures\ares.py:491, while using Numpy's solve function to compute Xass, I encounter a "Singular matrix" error.
import numpy as np
from sgtpy import component, mixture, saftgammamie
from sgtpy.equilibrium import lle, tpd_minimas
def calculate_w_lle(amine_GC):
# Define components using group contributions
amine = amine_GC
water = component(GC={'H2O': 1})
# Create mixture and setup the SAFT-γ-Mie equation of state
mix = amine + water
mix.saftgammamie()
eos = saftgammamie(mix)
# Define molecular weights for mass fraction calculations (g/mol)
MW_amine = eos.Mw[0] # Molecular weight of TEA
MW_H2O = eos.Mw[1] # Molecular weight of water
# Operating conditions
T = 350.0 # temperature in K
P = 1.01325e5 # pressure in Pa
# Set up a range for z[0] values
z0_values = np.linspace(1e-4, 1-1e-4, 1000)
# Loop through z0_values to find the point where LLE starts to form
for z0 in z0_values:
z = np.array([z0, 1-z0])
x0s, tpd0s = tpd_minimas(2, z, T, P, eos, stateW='L', stateZ='L')
x0 = x0s[0]
w0 = x0s[1]
sol = lle(x0, w0, z, T, P, eos, full_output=True)
x1, x2 = sol.X
diff = np.abs(x1[0] - x2[0])
if diff > 1e-3:
# Calculate W_TEA at the first point where LLE is detected
W_lle = z0 * MW_amine / (z0 * MW_amine + (1 - z0) * MW_H2O)
return W_lle
# If no LLE is formed, return None
return 1
amine_1=component(GC={'NH2': 1, 'CH2': 2})
W_solvent_optimal = calculate_w_lle(amine_1)
In gammamie_mixtures\density_solver.py:91, within the density_topliss function, the value of rho_ub is calculated to be smaller than rho_lb, which causes an error.
Hello, Gustavo!
Your code has been helpful for my research, Thank you. However, I have encountered two major errors during LLE calculations:
In
sgtpy\gammamie_mixtures\ares.py:491
, while using Numpy's solve function to compute Xass, I encounter a "Singular matrix" error.The error messages are as follows:
In
gammamie_mixtures\density_solver.py:91
, within the density_topliss function, the value ofrho_ub
is calculated to be smaller thanrho_lb
, which causes an error.amine_2=component(GC={'CH3': 1, 'CH2': 4, 'CH': 1, 'C': 1, 'H2O': 1, 'NH': 1}) W_solvent_optimal = calculate_w_lle(amine_2)
The error messages are as follows:
Could you provide some advice on how to resolve these issues?
Thank as always for your help.
Best wish!
The text was updated successfully, but these errors were encountered: