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.It is mandatory to switch to the gcc compilers, as the C code is incompatible with the clang compilers. 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 just beginning and few testing has been done, nevertheless bubble and dew calculations and the pTX and phX 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.
For the future I plan the addition of pressure-entropy flash and more transport properties calculation.
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 ,. This 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-Laurent 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
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.
In PCSAFT you can use just one acid in the mixture.
Binary interaction parameters
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 calculation is supported. No BIPs are used but I plan to add them in the future. Due to the lack of BIPs the Teja-Rice model has been choosen for the liquid phase, as it gives quite good results, at least for binary mixtures. For gas viscosity the Lucas method is used.
Contents
Generated at 2024-12-21T19:25:56Z
by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos