"Multicomponent" critical point calculation immediately hits NaN #254
Replies: 3 comments 2 replies
-
Actually, I found a workaround to my main issue. Adding a small non-zero value to the zeros causes
I suppose something is being divided by zero when a mole fraction is exactly zero. |
Beta Was this translation helpful? Give feedback.
-
Hi, thank you for using FeOs and the positive feedback. Often we get to hear what doesn't work, so it's nice to hear that the framework has been useful to you. Regarding the problem with the critical points: I think you are on point with the issue arising from the 0 in the composition. I thought, I had tried it out for binary mixtures over the entire composition range, but I'll need to recheck that. If it converges with a small value instead of 0 that means it should be somewhat easy to fix (hopefully). Multicomponent mixtures at a fixed temperature: that is actually not straightforward, you need to specify N-1 intensive degrees of freedom to uniquely determine the critical point of an N-component mixture. For a pure component there are no dofs to specify, for a binary mixture you could chose the composition, the temperature or the pressure, but for a multicomponent mixture the only generic specification you can make is the composition of all the components. Other cases like the temperature plus some ratios of certain components are valid but very specific to a certain application. Finally, if you are familiar with DGT, you know that for pure components it reduces to a simple integration, whereas for mixtures we need to solve for the composition of the mixture along the interface. Because the kind of equations that is being solved is somewhat different to what we are doing in DFT, and none of the developers or contributors is currently actively working on DGT, we only included the simplest (pure component) case. It could be a nice standalone application built on top of feos, but I'm not aware of any efforts going in that direction. |
Beta Was this translation helpful? Give feedback.
-
Regarding DGT/surface tensions: Are you interested in DGT in particular or in surface tensions for multi-component mixtures in general? If you "just" need surface tensions for mixtures - that's possible using DFT. There are several examples here. |
Beta Was this translation helpful? Give feedback.
-
Hi there,
First of all, I'm very impressed with FeOs so far! I've found it to be very functional and convenient to use in what I've tried with it so far. However, I am having an issue with calculating a multicomponent mixture critical point.
The mixture technically has four components (N2, C1, nC4, nC14), but the feed composition is actually a binary ([0.934, 0, 0, 0.066]).
I am calling
critical_point
as follow:where
pcsaft
is a typically configureddft.HelmholtzEnergyFunctional
(used successfully with many other systems),z_SI = [0.934, 0, 0, 0.066] mol
, andT_crit_est = 163.6088 K
(which is admittedly not a great estimate in this case, but it doesn't seem to matter for this issue).When I attempt to run this, I get a RuntimeError stating the critical point calculation failed to converge. Running it with iteration-level verbosity produces the following:
(some spacing missing in the temperature column when
T = NaN K
, btw)I admit I may be making some sort of mistake here since this is my first time working with a multicomponent mixture in FeOs, but in any case,
State.critical_point_binary
seems to find critical composition at the given T/P, whileState.critical_point
seems to find the Tc/Pc at the given composition (which is what I want in this case).(On this topic, is there an easy way to calculate the critical composition (à la
critical_point_binary
) for a multicomponent mixture at a fixed T? I haven't found built-in functionality like this yet.)Anyway, when running the exact same critical point calculation with
pcsaft
configured as a true binary (with the zero-mole fraction components removed from the system) andz_SI = [0.934, 0.066] mol
, the calculation is successful, with the following iteration history:The initial estimate of Tc does not seem to matter for the failure of the multicomponent call; even copying the converged binary Tc and initializing the multicomponent with that yields the same behavior (the density values are even the same).
Any help/guidance here would be greatly appreciated! :)
A second unrelated question while I'm here:
Is there any sort of build of FeOs that is capable of using DGT to compute surface tension for a planar interface? I know that is not a trivial problem to solve reliably, but I've seen at least one paper by Prof. Gross's group (doi: 10.1016/j.fluid.2017.11.032) that compares DFT with DGT for many mixtures including multicomponent ones. However, I can't seem to find any such functionality in FeOs (or any other publicly-available thermo package, besides one, which unfortunately had a lot of other issues). At one point I tried
PlanarInterface.from_pdgt
, but if I recall correctly, that that did not support multicomponent mixtures.Beta Was this translation helpful? Give feedback.
All reactions