Cleanup explicit flash of implicit 2p2c model
The volumevariables of the 2p2c model have an explicit flash directly implemented in the volumevariables itself.
- In general I like the idea of a specialized 2p2c flash that is easy to understand and fast, but it shouldn't be included in the volumevariables. I would propose implementing it as a separate class in a separate header, like the other constraintsolvers.
- The flash is only used if
useConstraintSolveris false and the default is true. For the 2p2c model I would make the flash the default, since it is a faster calculation than using the more general
MiscibleMultiPhaseCompositionconstraintsolver which solves a linear system of equations. Maybe we should even completely delete
useConstraintSolverbecause in my opinion the solver has no benefit here, it solves the same equations, just less efficiently.
- For the case of one phase we may use the
ComputeFromReferencePhaseconstraintsolver since it does exactly what the flash does.
- I don't think the flash is currently tested, so this should be added. It should have the same result as the other constraintsolvers.
What do you think? Another solution could be to delete the flash code and always use the solvers that we already have, but as mentioned above, I prefer having a 2p2c-specific flash.
There are a few points that I'm not sure of, maybe @holle can comment on this:
- In my opinion this flash is not as correct as it could be because it uses the assumption that vapor pressure of the liquid component and partial pressure of the liquid component in the gas phase are the same. This is only the case if we neglect the presence of other components in the gas phase. There is an equally quick method to calculate the mass fractions without using this assumption, see the 2p2c flash of the sequential models.
- It seems that the flash assumes that we deal with one liquid and one gas phase and that the liquid phase is the first phase. I think the 2p2c flash of the sequential models doesn't have this constraint.
- There seems to be a bug in the case that only the first phase is present, in the calculation of the mole fraction of the first component in the second phase. A multiplication with the mole fraction of the first component in the first phase is probably missing.