Critical point calculations, initializations, and hyperdual numbers in Python #297
Replies: 3 comments
-
Thanks for the questions and for sharing the results you have. It is always good to see the specific cases where calculations don't work. Some things come to mind:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the reply! I should say that the liquid-liquid critical point solution is my main interest here; my 2nd and 3rd questions are more curiosities than actual feature requests as they are rather niche problems. But to address your points:
I also just noticed that the figure title is incorrect; this is indeed carbon dioxide and n-butane, not methane.
where This sounds to me like a bit of a headache to implement, so it's probably not worth it for such a niche use case.
where: and:
The binary case requires The further down the phase diagram rabbit hole you go, though, the worse the derivatives get, so technically there are even higher derivatives of interest. For example, the tricritical point (occurring only at very specific combinations of EOS parameters) requires the 1st- through 6th-order mole fraction derivatives. Though that's not something I think most people are interested in calculating. So, basically, you don't worry about all these situations. I was just curious if there happened to be any procedures in place for them. Besides the fact that the flash/critical point algorithms in FeOs can sometimes have convergence issues near these points, routines that solve for them are more "would be nice to have" features for phase diagram generation only. |
Beta Was this translation helpful? Give feedback.
-
To come back to the issue of the algorithm for LL critical points, I think this CO2 - n-Butane system might be a good test case for troubleshooting. I know that this is a type II system, so it should have a continuous VL critical line connecting the two PC critical points, and a separate LL critical line at lower temperatures). Because of the weird shape of this particular VL critical line, the following regions of critical point multiplicity exist (Peng-Robinson values, but qualitatively the same for PC-SAFT):
As a quick numerical example with FeOs, I ran a coarse scan down from 100 bar in increments of 1 bar. I am simply calling I also have an alternate algorithm that simply performs repeated I don't know if this is helpful for the FeOs algorithm, but D&K write the following:
I also don't know the details of the FeOs binary critical point algorithm, so I don't know if the issue is T init., density init, step size restriction, or something else entirely, but I should point out that the particular LL critical line I am trying to solve for is at lower temperature than the VL line, though this need not necessarily be the case for different phase diagram types; in some cases, a VL and LL critical line may even cross in P,T-space, differing only in composition. This is probably only worth pursuing if you want FeOs to be completely robust for phase diagram generation, which is a herculean task. But if you are interested, I'll note some papers here that I've found useful in understanding the situation: 10.1016/j.cherd.2013.06.026, 10.1016/j.fluid.2008.08.017, 10.1016/j.fluid.2008.08.018, 10.1021/acs.iecr.1c04703, 10.1016/j.supflu.2006.03.011. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been able to generate some nice diagrams with FeOs (see below), and I want to express again how useful this project is (and your replies to my previous questions)! I've used it quite a bit in my work/dissertation. Though I am experiencing a few difficulties with critical points and near-critical phase equilibrium, and so I have a few questions.
(the above two diagrams calculated with FeOs, using Peng-Robinson since accuracy of critical properties are important; a volume-translated version of SAFT would've been interesting to try too)
As I'm sure you're aware (#236), critical point calculations can sometimes find the "wrong" critical point at given T or P. Specifically, I've had a lot of trouble generating the liquid-liquid critical line (blue) in particular. I've simply been picking a high P and stepping down to ~zero, and the calculation often fails (sometimes a trivial solution, and sometimes an error something like
Unexpected T=NaN in validation
) or finds the vapor-liquid critical line (red) instead. Usingcritical_point_binary
with bothinitial_temperature
andinitial_molefracs
from the previous successful point, I can usually extend the convergence range, but it still seems to be extremely sensitive to the initialization and doesn't always extend all the way down to the UCEP.In creating the Txy diagram above, despite my best efforts, I could not get FeOs to find the LL critical point at P = 73 bar; it would always find one of the other three, no matter the T init (somewhat understandably though, since this is an exceptional case with four isobaric critical points!). I ended up crudely approximating it with a series of bubble-point flashes, making micro-steps in T (𝒪(10-8) K), until even that would not converge anymore. The VLE envelopes also had lots of holes that needed manual recalculation to patch.
I also tried implementing my own naïve approach for the LL critical line which simply performs repeated bubble-point calculations, and averages L and V compositions until they stop changing, but that usually finds the azeotropic line, if it exists (although, it also starts failing near the VL critical azeotrope).
So, with that context, my questions are:
I totally understand if there is no current solution to any of this, since this is a hard topic with no perfect approach.
Beta Was this translation helpful? Give feedback.
All reactions