zmeri / PC-SAFT

Functions implementing the PC-SAFT equation of state, including association, electrolyte and dipole terms
GNU General Public License v3.0
46 stars 18 forks source link

Flash calculation of polymer system #95

Closed Jackxi1024 closed 2 years ago

Jackxi1024 commented 2 years ago

Hello, I'm confused about the application of PC-SAFT model to polymer system. It is said in the literature that the polymer usually does not give the number of segments “m”, but gives the parameter "r" (the number of segments "m" divided by the number average molecular weight "Mn"), that is m = rMn. I tested a flash case and found that the results were different from those of Aspen. The components include propylene, propane, hydrogen, nitrogen, polypropylene (r = 0.02528, Mn = 119735), TEA and TiCl4. The following figure shows the feed and outlet composition of Aspen. 8cbaa683420eab78b8849a05eecb942 The following is my code, which is used to calculate the fugacity coefficient of each component in gas phase and liquid phase, and judge whether the formula x fugcoef (x) = y * fugcoef (y) is valid.

import numpy as np import pcsaft print(50"") print("Liquid phase includes:C3H6、C3H8、H2、 N2、PP、TICL4、TEA") m = np.array([1.9597, 2.002, 0.9846, 1.2053, 3026.9008, 20, 20]) s = np.array([3.5356, 3.6184, 2.8263, 3.313, 4.1473, 3.54, 3.54]) e = np.array([207.19, 208.11, 20.893, 90.96, 298.6392, 210, 210]) pyargs = {"m":m, "s":s, "e":e} x = np.array([0.79335, 0.1757286, 6.67921E-05, 3.38975E-05, 0.0308073, 2.06873E-06, 1.13976E-05]) T1 = 223.15
P1 = 100000 pcsaft_den = pcsaft.pcsaft_den(T1, P1, x, pyargs, "liq") print(pcsaft_den) pcsaft_fugcoef_l = pcsaft.pcsaft_fugcoef(T1, pcsaft_den, x, pyargs) print(pcsaft_fugcoef_l)

print(50"") print("Gas phase includes:C3H6、C3H8、H2、 N2、PP、TICL4、TEA") y = np.asarray([0.7476531, 0.1295614, 0.1124775, 0.010308, 8.2231E-75, 1.0051E-32, 5.5377E-32]) T1 = 223.15 P1 = 100000 pcsaft_den = pcsaft.pcsaft_den(T1, P1, y, pyargs, "vap") print(pcsaft_den) pcsaft_fugcoef_v = pcsaft.pcsaft_fugcoef(T1, pcsaft_den, y, pyargs) print(pcsaft_fugcoef_v)

print(50"") print("xf(x): ", xpcsaft_fugcoef_l) print("yf(y): ", ypcsaft_fugcoef_v)

zmeri commented 2 years ago

Hello! I have never modeled polymer systems before and I was not able to quickly see exactly what the issue is. One possibility might be that the density solver is not finding the correct root. When I run your code I see that it gives 244 mol/m^3 as the liquid density, which seems too low. The aspen screenshot shows a liquid density of 14446 mol/m^3. Because I have never run tests on polymer systems, the solver might not be tuned properly for them.

I don't have the bandwidth to be able to look into your specific system in detail. If you would like to look into it yourself, you could download the source code and build it using Cython. Then you can output some of the variables in the density solver (here is the function) and see what might be the problem. Another option is to cycle over a range of densities at a specific temperature and calculate the pressure. Then you can calculate how much the calculated pressure deviates from the actual pressure, similar to the cost function here used to find density roots. Then that would give you an idea of where the roots are located and if the shape of the curve is somehow making it difficult for the solver to find the correct root. If you have more questions that come up as you are going through that you can reply here, but you'll need to do the investigative work yourself.

Jackxi1024 commented 2 years ago

Thank you very much. I've solved this problem. The polymers in Aspen are defined by segments, so the mole fraction of the polymer and the molar density of the system need to be converted according to the degree of polymerization. This package can be applied to polymer modeling.