Introduction
The medium is designed for substance mixtures in liquid, gas or biphasic (VL) state. It uses external C functions for the calculations, and it follows, when possible, the masterlines of Modelica. Media.Interfaces.PartialTwoPhaseMedium.The implementation is based in a static object created in the C code, as it has been impossible to make it work, at least in OpenModelica, using the Modelica external object feature.
The data for the pure, or pseudo pure, substances are in the Resources/Fluids directory.
At the moment the implementation is still in development and few testing has been done, nevertheless bubble and dew calculations and the pTX, phX and psX flashes are already working.
For the thermodynamic models, you can use cubic (Peng-Robinson or SRK) or PCSAFT EOS. For PCSAFT the Wolbach and Sandler mixing rule is always used, but you can choose to use induced association by selecting induced association as mixrule. For cubics you can choose between Van der Waals, HV, MHV1, MHV2, LCVM, UMR and PSRK mixing rules. When using gE mixing rules you can choose between UNIFAC (standard, PSRK, or Dortmund, implementations), UNIQUAC, and NRTL, for the activity model.
Media configuration
It is very easy. You extend the the ExternalMixMedium package and reconfigure it as follows:
mediumName: A string containing the medium name. In a simulation with more than one mediums you can't repeat the name.
subsNames: Is a string containing the names of the substances in the mix separated by ,. These names must match the name of files in the Resources/Fluids folder, but without the .sd extension. For the creation of these files, with the aid of the FreeFluidsGui program, look at the ExternalPure package information.
eosType: A string. You can use PR, SRK or PCSAFT.
mixRule: A string. If a cubic EOS has been selected, you can use VdW, VdWnoInt, HV, MHV1, MHV2, LCVM, UMR, PSRK. Where VdWnoInt means Van der Waals without using BIPs. If PCSAFT is selected as EOS, the mixing rule used will be always that of Berthelot-Lorentz modified by Wolbach and Sandler, but by selecting IndAssoc as mixing rule you will allow the use of induced association for not self associating polar molecules.
activityModel: A string. If a gE mixing rule is used, you can use UNIFACstd, UNIFACpsrk UNIFACdort, NRTL or UNIQUAC
viscMixRule: A string where you can use: Teja, Grunberg or Andrade
EOS
Only Peng--Robinson and Soave-Redlich-Kwong cubic EOS are supported, but with many different alpha term calculations. You can use Van der Waals mixing rule, or gE ones, using an activity model.
For SAFT only PCSAFT is supported. Association and polar terms are implemented, the last one according to Gross and Vrabeck model. The Berthelot-Lorentz, as modified by Wolbach and Sandler, mixing rule is used. By making mixRue="IndAssoc" you will allow the use of induced association between self associating and polar molecules, according to the methodology of Kleiner et alt.
Binary interaction parameters for EOS or activity
BIPs are read from text files (space delimited) placed in the Resources/Interactions folder. A lot of BIPs are supplied. Those for NRTL and UNIQUAC come mainly from the PychemQt open source program. For Van der Waals mixing rule, there are separate files for Peng-Robinson and SRK.
It is recommended that you create your own BIP files, containing only the needed parameters, because if a big file is used you loose speed and, as the program search all the file, you can finish using undesired BIPs. You can rename the supplied files and create new ones containing just the needed BIPs.
CAS numbers are used in order to seek the needed line inside the files.
For Van der Waals mixing rule there are 4 parameters, the first 3 are for the calculation of Kij in the form Kij=a+b*T+c/T. the last one is for Lij. As Kij=Kji and Lij=Lji just one entry for a substances pair is needed.
For PCSAFT we have the same situation, just without the Lij parameter. For this EOS it is very important to check that the BIPs are for the variation of the EOS used. They are not the same for a non-associating EOS that for a associating one, or a polar one.
For NRTL and UNIQUAC, prior to the BIPs there is the information of the equation that will be used with these parameters. The alternatives are Pol1K, Pol1J, Pol1C, Pol2K, Pol2J, Pol2C, Pol3K, Pol3J, Pol3K. the last letter identifies the units of energy used (K, J/mol or cal/mol). Pol1 will use the equation a+b*T+c*T^2, Pol2 a+b*T+c/T^2, and Pol3 a+b/T+c*T. As the BIPs are not simetrical the line contains both ij and ji parameters. In NRTL the fith BIP is for alphaij. There is a limitation in the type of BIPs used for activity models: all the BIPs used in a mixture must use the same equation. I hope to achive more freedom in the future.
Transport properties
At the momment only viscosity and thermal conductivity calculations are supported. No BIPs are used except for liquid viscosity.
For liquid viscosity you can choose between Grunberg-Nissan, Teja-Rice and Andrade methods. BIPs are read from the corresponding file in the Resources/Interactions folder. If no BIPs are found in the file a less acurate value will be calculated.
Grunberg-Nissan and Teja-Rice use just one BIP, that is calculated according to a+b/T, being a and b the two first numbers following the CAS numbers of the substances in the row. Nevertheless you must fill with 0 the following four numbers.
Andrade use two BIPs, calculated as a+b/T and c+d/T, being c and d the next numbers in the row.
I expect to implement in the future McAllister 3 and 4 body method. This is the reason for the need of 6 numbers in each row.
For gas viscosity the Lucas method is used.
For liquid thermal conductivity the Li method.
For gas thermal conductivity that of Mason and Saxena
Contents
Generated at 2025-01-21T19:25:52Z
by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos