This extension of PartialMedium models a mixture of multiple components, several of which may or may not condense into liquid phase.This can be used to model e.g. condensing air in a fuel cell's cathode, the anodic loop of a PEM electrolyser and ammonia-air systems.
Note that condensation is inherently an extra calculation, and gas mixtures or pure liquids should be preferred when possible.
Derived classes
To implement your medium, you need to provide implementations for the following:
- Molar masses MMX, reference composition reference_X (note: mass fractions, not molar!), and component names substanceNames;
- invertedKs, a function providing the inverse of equilibrium constants Ki, i.e. the ratios of molar fraction in gas vs. in liquid. The reason why the function provides Ki-1 instead of Ki directly is that we want to allow modelling of incondensable gases, for which Ki=
∞; providing Ki-1=0 allows to avoid dealing with infinity in calculations and the headaches that come with it.
- (gas|liquid)SpecificHeatCapacityCp, (gas|liquid)SpecificEnthalpy, (gas|liquid)SpecificEntropy, (gas|liquid)Density: these thermodynamic functions provide the indicated quantities for either phase. Note that their argument is a ThermodynamicState already referring to the relevant phase, to reduce the times the equilibrium calculations are run.
Implementation
The model uses a
Rachford-Rice equation to calculate the equilibrium compositions for both phases (and whether there is one or both phases).
Rachford-Rice is an implicit equation and as such it is inherently computationally onerous; if your mixture has only one condensable component (e.g. water), it may be worth it to replace the implementation of flashVaporisation with a direct approach to achieve better computational performance.
Utilities
The model provides some useful functions:
- massToMoleFractions and moleToMassFractions, to convert composition arrays between the two systems; Modelica uses mostly mass internally, but data is typically available on a mole basis.
- antoine and clausiusClapeyron, to calculate vapour pressure with the respective equation.
Reference
Whitson, Curtis H., and Michael L. Michelsen.
"The negative flash." Fluid phase equilibria 53 (1989): 51-71.
Contents