OLI-MSE Data Regression Additional course materials can be found at: http://support.olisystems.com/ MSE fundamentals: P. Wang, A. Anderko, R. D. Young; Fluid Phase Equilbria, 2002, 203, 141-176 P. Wang, R. D. Spinger, A. Anderko, R. D. Young; Fluid Phase Equilbria, 2004, 222-223, 11-17 P. Wang, A. Anderko, R. D. Spinger, R. D. Young; Journal of Molecular Liquids, 2006, 125,37-44 OLI-MSE Data Regression Objectives • To create new model parameters • To obtain improved model parameters • To reevaluate model parameters using new or proprietary data To accurately reproduce experimental results OLI-MSE Data Regression Steps • Collecting relevant literature data • Customizing chemistry model • Preparing regression input file • Running the regression • Reviewing regression output Types of thermophysical data used in MSE regression • • • • • • • • Water activity or osmotic coefficients Vapor pressure (VLE) Solubility (SLE) Solubility (LLE) Speciation (pH, dissociation degree, etc) Density Enthalpy (Hdil and Hmix) Heat capacity Model Parameters Chemical & phase equilibrium calculations require Model Parameters Standard state properties Gref, Sref, Cp, and HKF parameters Excess properties Activity coefficient model parameters MSE Model: Excess Gibbs Energy ex G RT LR LC MR ex ex ex G G LR G LC MR RT RT RT Debye-Hückel theory Local composition model (UNIQUAC) for neutral molecule interactions Ionic interaction term for ion-ion and ion-molecule interactions ex G ln k nk RT T , P , n j , j k MSE Model: Long-range electrostatic interaction (Debye-Hückel) term 12 4 A I 1 I x x x ni ln RT i xi [1 I x0,i i ex G DH 12 ] A function of ionic strength and solvent properties No interaction parameters MSE Model: Neutral molecule interaction term – Local composition model (UNIQUAC) ex GUNIQUAC RT ex ex Gcombinator G ial residual RT RT ex Gcombinator i Z i ial n i xi ln qi xi ln RT xi 2 i i i i Parameters - ex Gresidual n i q i xi ln j ij RT i i j • Species specific: R (size) and Q (surface area) • Interaction: aij and aji MSE Model: Ionic interaction (Middle-Range) term ex G MR ni xi x j Bij I x RT i i j Bij I x bij (T ) cij (T ) exp( I x a1 ) Interaction Parameters bij and cij MSE Databank: MSEPUB • Equivalent to PUBLIC for OLI/Aqueous framework • H3OION-based databank – reactions are balanced using H3OION and H2O instead of using HION and H2O MSE Databank: MSEPUB Data items specifically used by MSE model In “Aqueous Phase” chapter Pure Liquid Properties (for organic molecules) LDEN – Coefficients for pure liquid molar density kmol / m A 3 1 (1T / C ) D B CP – Heat capacity parameters for pure liquid Cp J mol1 K 1 A BT CT 2 DT 3 ET 4 DIE0 – Coefficients for pure liquid dielectric const. F E T MSE Databank: MSEPUB Data items specifically used by MSE model - In “Aqueous Phase” chapter Other data items: R_UQ, Q_UQ UNIQUAC size (R) and surface (Q) parameters well-defined group values (Reid et al. 1987) SOLU (Two values are given) solubility of a species (usually organic component) in water and solubility of water in organic. MSE Databank: MSEPUB Interactions pertaining to MSE model – In “Interaction” chapter • UNIQ – UNIQUAC parameters (primarily for neutral-neutral interactions) Q0IJ Q1IJ Q2IJ Q3IJ Q4IJ Q0JI Q1JI Q2JI Q3JI Q4JI aij Q0 IJ Q1IJ * T Q 2 IJ * T 2 Q 3 IJ Q4 IJ * T * xi x j a ji Q0JI Q1JI * T Q 2JI * T 2 Q 3JI Q4JI * T * x j xi aij a ji For most systems, Q3IJ, Q4IJ, Q3JI, and Q4JI are set to zero MSE Databank: MSEPUB Interactions pertaining to MSE model – In “Interaction” chapter MIDRANGE – Middle-range parameters (primarily for neutral-ion and ion-ion; can be used for neutral-neutral) BMD0 BMD1 BMD2 BMD3 BMD4 CMD0 CMD1 CMD2 CMD3 CMD4 Bij bij cij exp I x 0.01 bij BMD0 BMD1 * T BMD2 / T BMD3 * T 2 BMD4 * lnT cij CMD0 CMD1 * T CMD2 / T CMD3 * T 2 CMD4 * lnT MSE Databank: MSEPUB Interactions pertaining to MSE model – In “Interaction” chapter DENUNIQ – UNIQUAC density parameters D0IJ D1IJ D2IJ D0JI D1JI D2JI aij P a ji P D0 IJ D1IJ * T D 2 IJ * T 2 D0JI D1JI * T D 2 JI * T 2 MSE Databank: MSEPUB Interactions pertaining to MSE model – In “Interaction” chapter DENMID – Middle-range density parameters DMD1 DMD2 DMD3 DMD4 DMD5 DMD6 DMD7 DMD8 DMD9 DMD0 Bij ( 0) (1) ( 2) Bij Bij * e xp I X 0.01 Bij * P P ( 0) Bij DMD1 DMD4 * T DMD5 * T 2 (1) Bij DMD2 DMD3 * T DMD6 * T 2 ( 2) Bij DMD7 DMD8 * T DMD9 * T 2 DMD0 / T Regression Adjustable Parameters Excess Properties • UNIQUAC parameters – Q0IJ Q1IJ Q2IJ Q3IJ Q4IJ Q0JI Q1JI Q2JI Q3JI Q4JI • Middle-range parameters – BMD0 BMD1 BMD2 BMD3 BMD4 CMD0 CMD1 CMD2 CMD3 CMD4 • UNIQUAC density parameters – D0IJ D0JI D1IJ D1JI D2IJ D2JI • Middle-range density parameters – DMD1 DMD2 DMD3 DMD4 DMD5 DMD6 DMD7 DMD8 DMD9 DMD0 Regression Adjustable Parameters Standard state Gibbs energy and entropy (appear in the databank as GREF and SREF) • • • • • • GRFS – std. state Gibbs energy for solid SRFS – std. state entropy for solid GREF – std. state Gibbs energy for aqueous species SREF – std. state entropy for aqueous species GRFV – std. state Gibbs energy for vapor species SRFV – std. state entropy for vapor species Regression Adjustable Parameters Standard state heat capacities • CPS1, CPS2, CPS3, CPS4, CPS5 – heat capacity equation parameters for solid species Cp CPS1 CPS 2 * TK CPS 3 TK2 CPS 4 * TK2 CPS 5 * TK3 HKF EOS parameters (aqueous species) • HA1 HA2 HA3 HA4 (P dependency) • HC1 HC2 HW (T dependency) Regression Adjustable Parameters Coefficients for equilibrium constant K: A, B, C, D can be adjusted as needed B 2 log K A C * TK D * TK TK OLI-MSE Data Regression Steps Collecting relevant literature data Customizing chemistry model Create a private databank, if necessary, with species of interest; create new species if not in DB Set up chemistry model using OLI/Express or ESP Process, with the private databank Define variables using OLI internal variables, if necessary, in the -.mod file Create a Private Databank Changes can be made to a private databank without affecting MSEPUB (the public MSE databank) Parameters developed may be based on proprietary data and are not going to be in public domain How to create a private databank Set up a chemistry model Change “current directory” to your working directory Using OLI Express or OLI/ESP Include the private databank Select Mix-Solvent H3OION-based framework Define variables using OLI internal variables, if necessary, in the -.mod file List of Some Commonly Used OLI Internal Variables Variable name Description T PT PH -IN -AQ, -ION H2O L-AQ, L-ION LH2O -PPT, -.nH2O YX-O V A-AQ, A-ION AH2O KDENMAS temperature pressure pH inflows mole-frac in soln mole-frac of H2O ln (mole-frac in soln) ln (mole-frac of H2O) precipitates and hydrates vapor mole-fractions 2nd liquid phase mole-frac total vapor moles ln (activity coef, x) ln (activity coef. of H2O,x) ln (equilibrium K-values) density of solution Default units Kelvin atmospheres moles moles moles g/L Comparison of Variables in OLI/MSE and OLI/Aqueous Framework MSE Aqueous Concentration Units mole-fraction; e.g. SO4ION=x(SO4-2) HSO4ION=x(HSO4-) H2SO4AQ=x(H2SO4-aq) H2O=x(H2O) Concentration Units (V6.7 or older) molality (mol/kg H2O); e.g. SO4ION=m(SO4-2) HSO4ION=m(HSO4-) H2SO4AQ=m(H2SO4-aq) H2O=55.5084 for all systems Water activity AH2O=ln γwater Water activity AH2O=ln awater DEFINE AWATER=EXP(AH2O+LH2O) DEFINE AWATER=EXP(AH2O) where LH2O=ln(xwater) Comparison of Variables in OLI/MSE and OLI/Aqueous Framework MSE Aqueous Activity coefficients AKION=ln γK+x,∞ γK+m,∞= xw•γK+x,∞ Activity coefficients AKION=ln γK+m,∞ Mean activity coefficient: Mean activity coefficient: DEFINE GAMMA= EXP(LH2O+(AKION+ACLION)/2.0) DEFINE GAMMA= EXP((AKION+ACLION)/2.0) Based on (for 1:1 electrolyte): ln ±,m= ½ • (ln K+,m+ ln Cl-,m) Comparison of Variables in OLI/MSE and OLI/Aqueous Framework MSE Aqueous Equilibirum Constant KMXAQ=ln KMX∞,x Equilibirum Constant KMXAQ=ln KMX∞,m , x , x x x X K , x M X M , x x MX MX , m , m m m X K , m M X M , m m MX MX log K , m log K , x n log55.509 where ∆n is the change in number of moles in reaction (∆n=1 for MXAQ=MION+XION). OLI-MSE Data Regression Steps Collecting relevant literature data Customizing chemistry model Preparing regression input file Regression Input Input file (-.inr) structure: $TITLE A line containing characters to explain the file $CONTROL Has several options $PARAMETERS The heart of the regression $DATA SET X Has a global parameter section and data section; An input file can have a number of data sets. Regression Input File (-.inr) $TITLE A line containing characters to explain the file $CONTROL Options are: MAXIT xx (Maximum number of iterations, default= 50) QFIT x.x (Convergence tolerance, default= 1.0E-05) METH x (Regression method) 0 - Brown’s algorithm, Uses MARQ parm 1 - Strict Decent (default) 2 – Semi Strict Decent, Uses MARQ and SCALING) MARQ x.x (Marquardt scaling parm – METH=1 or 2 default=1.0) SCALING x.x (Factor for adjusting MARQ – Meth=2 default=1.5) NUMERICAL (Forces numerical derivative calculation) TRACE (Produce ElectroChem output at every iteration) OBJECTIVE x (Change Objective function) 1 - (calc value/exp value – 1) default 2 – (max(calc or exp value)/min(calc or exp value) – 1) 3 – (calc value – exp value) ERROR xxxxx (Error assign to non-converged points, default=0) CSV variable-list (specify variables to be printed for each datum in a CSV file) Regression Input File (-.inr) $PARAMETERS The heart of the regression Format: P01 1.0 1.023E-2 -1 1. KION CLION species1 Alias species2 Initial value Active=1.0 Not active=0.0 BMD0 Lower and upper bound (not used, only for place holding) regression parameter Regression Input File (-.inr) $PARAMETERS P01 1.0 1.023E-2 ……… -1 1. KION CLION BMD0 P05 1.0 -45035.5 P06 1.0 38.35 -1 -1 1. 1. NAACETPPT NAACETPPT GRFS SRFS species Alias Initial value Active=1.0 Not active=0.0 Lower and upper bound (not used, only for place holding) regression parameter Consistency in standard state properties: Using ELEM in input file Values of ∆Gf0 (GREF), ∆Hf0 (HREF), and S0 (SREF) are related by H f 0 G f 0 T S f 0 S f 0 S 0 S 0elem This is done using an ELEM statement in input file — Consistency in standard state properties: Using ELEM in input file Example: if ∆Gf0 and S0 for NAACETPPT (solid sodium acetate) are adjusted in regression, In input file (at the end of $PARAMETERS section): ELEM NAACETPPT 1.0 12.26 2.0 1.372 1.0 49.0 1.5 31.21 The formation process and the standard state entropy for each of the elements are Na(s) + 2 C(s) + O2(g) + 1.5 H2(g) = CH3COONa (s) 12.26 1.372 49.0 31.21 (in cal/mol.K) Consistent values of ∆Gf0, ∆Hf0, S0 for NAACETPPT Consistency in standard state properties: Using ELEM in input file Example: NH2CO2ION (carbamate ion) In input file, write: ELEM NH2CO2ION 1.0 1.372 0.5 45.77 1.0 49.005 1.5 31.21 The formation reaction of carbamate ion and the standard state entropies are: C(s) + 0.5 N2(g) + O2(g) + 1.5 H2(g) = NH2CO2-(aq) + H+(aq) 1.372 45.77 49.005 31.21 0.0 Consistent values of ∆Gf0, ∆Hf0 and S0 for NH2CO2ION Regression Input File (-.inr) $DATA SET X Global parameter section TEMPERATURE 100.0 These lines may be PRESSURE 1.2249 eliminated if values of H2OIN 0.965 variables are given in METHANOLIN 0.035 data section FREE PT PT allowed to be adjusted FIX V 1.0E-9 # of FREE variables = # of FIX variables SC_INDEX list of solids allow calculations under super-saturation Data section independent variables dependent variables DATA T METHANOLIN H2OIN : PT YMETHANOL 100 0.035 0.965 1.2249 0.191 100 0.074 0.926 1.4085 0.313 100 0.163 0.837 1.7419 0.496 …………… Example: NaCl-H2O Define variables at the end of -.mod file: …….. EQUATIONS DEFINE AW=EXP(AH2O+LH2O) DEFINE PHI=-(AH2O+LH2O)*H2OIN/(2.0*NACLIN) DEFINE DENGCC=0.001*DENMAS END lnaw ln w ln xw Translation of the 1st and 2nd DEFINE: xw ln a w 2 x NaCl Examples – in c:\MSE-Reg Systems 1. 2. 3. 4. 5. 6. 7. 8. 9. NaCl+H2O Methanol+H2O Methanol+H2O+NaCl Sulfamic acid+H2O Phenol+H2O Benzene+H2O Benzene+H2O+NaCl MethaneSulfonic Acid+H2O AlCl3+HCl+H2O, AlCl3+NaCl+H2O 10. ZnCl2+HCl+H2O 11. Zn(NO3)2+HNO3+H2O File Names NaCl.inr Methanol.inr MWNaCl.inr NH3SO3.inr Phenol.inr Benzene.inr BzNaCl.inr MSA.inr AlCl3.inr ZnHCl.inr ZnHNO3.inr Example: NaCl-H2O Set up input file: NACL.INR $DATA SET 1 SC_INDEX H2OPPT NACLPPT NACL.2H2O DATA T PT H2OIN NACLIN : PHI AW CP DENGCC variables need to be defined ………. $DATA SET 4 SC_INDEX H2OPPT NACLPPT NACL.2H2O DATA T PT H2OIN NACLIN H2OIN NACLIN : HDILUT heat of dilution initial x final x (cal/mol) This is the fixed format for heat of dilution Example: NaCl-H2O Two ways to use solubility data in regression: Saturation concentration Scaling tendency as as dependent variables: dependent variables: $DATA SET 10 FREE NACLIN FIX NACLPPT 1.0E-9 SC_INDEX ALL NACLPPT DATA T PT H2OIN : NACLIN 25.0 1.0 0.90021 0.09979 50.0 1.0 0.89812 0.10188 ......... $DATA SET 9 SC_INDEX ALL DATA T PT H2OIN NACLIN : SC_NACLPPT 25.0 1.0 0.90021 0.09979 1.0 50.0 1.0 0.89812 0.10188 1.0 ……….. Scaling tendency (SC_solid = IAP/Ksp) must be 1.0 at saturation Heat of Mixing (DHMIX): MeOH-H2O and MeOH+H2O+NaCl Methanol+H2O (methanol.inr) DATA T PT METHANOLIN H2OIN METHANOLIN H2OIN METHANOLIN H2OIN : DHMIX 25 1 25 1 1 1 0 0 0 0 1 1 0.25 0.3 0.75 0.7 ……….. soln 1 (x) soln 2 (x) final mix. (x) -210.28 -213.96 ∆Hmix (cal/mol) Methanol+H2O+NaCl (MWNaCl.inr) DATA T PT METHANOLIN H2OIN NACLIN METHANOLIN H2OIN NACLIN METHANOLIN H2OIN NACLIN : DHMIX 12.5 1 1 0 0 0 0.9969 0.0031 0.2 0.7975 0.0025 -215.225 12.5 1 1 0 0 0 0.9969 0.0031 0.25 0.7477 0.0023 -226.004 ∆Hmix ………… soln 1 (x) soln 2 (x) final mix. (x) – The order of components in each of the 3 solutions must be the same (cal/mol) Example: Methanol + NaCl + H2O Define variables at the end of MWNaCl.mod file: …….. DEFINE GTRNA=8.3147*T*(ANAION+LOG(32.0424/18.0152)+LOG(0.997/0.7866)) DEFINE GTRCL=8.3147*T*(ACLION+LOG(32.0424/18.0152)+LOG(0.997/0.7866)) DEFINE GTRE=GTRNA+GTRCL END Based on w 0 tr G NaCl w M 2 RT ln M MM , x , x RT ln ln 2 RT ln M Na , M Cl , M w Example: Phenol-H2O Set up chemistry model: phenol.mod Define variables at the end of phenol.mod file: …….. EQUATIONS DEFINE PKPA=PT*101.325 END Example: Phenol-H2O Using LLE data in regression: • Activity ratio as dependent variables DATA T PT C6H5OHIN H2OIN C6H5OHIN H2OIN : LLE_C6H5OHAQ LLE_H2O 25 1 0.0173 0.9827 0.3223 0.6777 1 1 29.6 1 0.0153 0.9847 0.316 0.684 1 1 ……..... equil. x in 1st liq phase equil. x in 2nd liq phase LLE_C6H5OHAQ=aC6H5OHAQ(1st)/aC6H5OHAQ(2nd) LLE_H2O=aH2O(1st)/aH2O(2nd) must be 1.0 at LLE Example: Phenol-H2O Using LLE data in regression: • Equilibrium concentrations as dependent variables DATA T PT H2OIN C6H5OHIN : C6H5OHAQ H2O XC6H5OHAQO XH2OO 25 1 4.88928 1.0 0.0173 0.9827 0.3223 0.6777 29.6 1 5.03682 1.0 0.0153 0.9847 0.316 0.684 ……..... initial moles equil. x in equil. x in in mixture aqueous phase organic phase Other LLE cases: Benzene.inr BzNaCl.inr Other Example: AlCl3.inr Solubility of AlOOH as a function of pH: $DATA SET 1 SC_INDEX ALL ALOOHPPT H2OIN 55.509 FREE PT FIX V 1.0E-12 FREE HCLIN FIX PH 2.731 FREE ALOOHIN FIX ALOOHPPT 1.0E-12 DATA T NACLIN PH : ALOOHIN 152.4 0.1 2.614 6.442E-06 ; 2001PBW g-AlOOH 152.4 0.1 2.731 3.707E-06 ; 2001PBW g-AlOOH ………… Other Example: MSA.inr Using additional constraint on invariant points for solubility data regression ……. $DATA SET 2 SC_INDEX ALL DATA T PT H2OIN CH4SO3IN : SC_H2OPPT SC_CH4SO3.3H2O WEIGHT -75 1.0 0.8360 0.164 1.0 1.0 5.0 $DATA SET 3 SC_INDEX ALL DATA T PT H2OIN CH4SO3IN : SC_CH4SO3.3H2O SC_CH4SO3.1H2O WEIGHT -54.5 1.0 0.685 0.315 1.0 1.0 5.0 $DATA SET 4 SC_INDEX ALL DATA T PT H2OIN CH4SO3IN : SC_CH4SO3.1H2O SC_CH4SO3PPT WEIGHT -15 1.0 0.220 0.780 1.0 1.0 5.0 Constrains in regression parameters General Format: Pnn=Pmm x y Example: Let $PARAMETERS P01 1 0.1 -1. P02 1 0.001 -1. P03 0 0. -1. P04 0 0. -1. P05 1. 32. -1. P06 1. -40000. -1 P07 0 0. -1. P08 1. -46000. -1 P03=P01 P04=P02 2.5 P07=P05 1.0 10.0 Pnn=x*Pmm+y P03=P01 P04=2.5*P02 P07=P05+10.0 1. 1. 1. 1. 1. 1. 1. 1. SPE1 SPE2 BMD0 SPE1 SPE2 BMD1 SPE3 SPE4 BMD0 SPE3 SPE4 BMD1 SPE5PPT SRFS SPE5PPT GRFS SPE5.H2O SRFS SPE5.H2O GRFS Examples: ZnHCl.inr ZnHNO3.inr OLI-MSE Data Regression Steps Collecting relevant literature data Customizing chemistry model Preparing regression input file Running the regression Running the regression using REGRESS.EXE • Open a DOS window • Change to the working directory (e.g. C:\MSE-Reg) Your private databank (if any), input file (inr), model file (dbs) must be in the working directory • Run REGRESS (e.g. located in C:\OLI70\SYS): C:\MSE-Reg>C:\OLI70\SYS\REGRESS nacl nacl model inr name name OLI-MSE Data Regression Steps Collecting relevant literature data Customizing chemistry model Preparing regression input file Running the regression Reviewing the regression output Regression Output Files to review: OUE CSV – overwritten by results from the next iteration NRM – overwritten by results from the next iteration Files to review: OUE – – Summary of input data – Summary of results for each iteration • Parameters • comparison of cal- and exp- values • Overall NORM (=∑(cal-exp)2) and NORM for each data set – Complete results from the final iteration: • • • • Equilibrium concentrations in the vapor and liquid phases Activity coefficients of all aqueous species Fugacity coefficients of all vapor species Equilibrium constants for all associated species Files to review: CSV – Lists information at every single data point; Good for making plots – Deviations for all dependent variables, as defined by OBJECTIVE (in $CONTROL section) – Comparisons for the calculated and measured values for all dependent variables – Values of independent variables as input – Convergency flag (0=converged, 1=not converged) – Phase indicator (e.g. “L1 V”, “L1 L2”, “L1 V S”) – All other variables listed in INR file under $CONTROL section with CSV statement Files to review: NRM – – Regression parameters – Point-by-point comparison of caland exp- values for all dependent variables – All other parameters used (but not adjusted) in the calculations Part of the OUE file: