Cantera  2.1.2
IdealMolalSoln.h
Go to the documentation of this file.
1 /**
2  * @file IdealMolalSoln.h
3  * ThermoPhase object for the ideal molal equation of
4  * state (see \ref thermoprops
5  * and class \link Cantera::IdealMolalSoln IdealMolalSoln\endlink).
6  *
7  * Header file for a derived class of ThermoPhase that handles
8  * variable pressure standard state methods for calculating
9  * thermodynamic properties that are further based upon
10  * activities on the molality scale. The Ideal molal
11  * solution assumes that all molality-based activity
12  * coefficients are equal to one. This turns out to be highly
13  * nonlinear in the limit of the solvent mole fraction going
14  * to zero.
15  */
16 /*
17  * Copyright (2006) Sandia Corporation. Under the terms of
18  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
19  * U.S. Government retains certain rights in this software.
20  */
21 #ifndef CT_IDEALMOLALSOLN_H
22 #define CT_IDEALMOLALSOLN_H
23 
24 #include "MolalityVPSSTP.h"
25 
26 namespace Cantera
27 {
28 
29 /** \addtogroup thermoprops */
30 /* @{
31  */
32 
33 /**
34  * This phase is based upon the mixing-rule assumption that
35  * all molality-based activity coefficients are equal
36  * to one.
37  *
38  * This is a full instantiation of a ThermoPhase object.
39  * The assumption is that the molality-based activity
40  * coefficient is equal to one. This also implies that
41  * the osmotic coefficient is equal to one.
42  *
43  * Note, this does not mean that the solution is an
44  * ideal solution. In fact, there is a singularity in
45  * the formulation as
46  * the solvent concentration goes to zero.
47  *
48  * The mechanical equation of state is currently assumed to
49  * be that of an incompressible solution. This may change
50  * in the future. Each species has its own molar volume.
51  * The molar volume is a constant.
52  *
53  * Class IdealMolalSoln represents a condensed phase.
54  * The phase and the pure species phases which
55  * comprise the standard states of the species are assumed to have
56  * zero volume expansivity and zero isothermal compressibility.
57  * Each species does, however, have constant but distinct partial
58  * molar volumes equal to their pure species molar volumes.
59  * The class derives from class ThermoPhase,
60  * and overloads the virtual methods defined there with ones that
61  * use expressions appropriate for incompressible mixtures.
62  *
63  * The standard concentrations can have three different forms
64  * depending on the value of the member attribute m_formGC, which
65  * is supplied in the XML file.
66  *
67  * <TABLE>
68  * <TR><TD> m_formGC </TD><TD> ActivityConc </TD><TD> StandardConc </TD></TR>
69  * <TR><TD> 0 </TD><TD> \f$ {m_k}/ { m^{\Delta}}\f$ </TD><TD> \f$ 1.0 \f$ </TD></TR>
70  * <TR><TD> 1 </TD><TD> \f$ m_k / (m^{\Delta} V_k)\f$ </TD><TD> \f$ 1.0 / V_k \f$ </TD></TR>
71  * <TR><TD> 2 </TD><TD> \f$ m_k / (m^{\Delta} V^0_0)\f$</TD><TD> \f$ 1.0 / V^0_0\f$ </TD></TR>
72  * </TABLE>
73  *
74  * \f$ V^0_0 \f$ is the solvent standard molar volume. \f$ m^{\Delta} \f$ is a constant equal to a
75  * molality of \f$ 1.0 \quad\mbox{gm kmol}^{-1} \f$.
76  *
77  * The current default is to have mformGC = 2.
78  *
79  * The value and form of the activity concentration will affect
80  * reaction rate constants involving species in this phase.
81  *
82  * <thermo model="IdealMolalSoln">
83  * <standardConc model="solvent_volume" />
84  * <solvent> H2O(l) </solvent>
85  * <activityCoefficients model="IdealMolalSoln" >
86  * <idealMolalSolnCutoff model="polyExp">
87  * <gamma_O_limit> 1.0E-5 </gamma_O_limit>
88  * <gamma_k_limit> 1.0E-5 <gamma_k_limit>
89  * <X_o_cutoff> 0.20 </X_o_cutoff>
90  * <C_0_param> 0.05 </C_0_param>
91  * <slope_f_limit> 0.6 </slope_f_limit>
92  * <slope_g_limit> 0.0 </slope_g_limit>
93  * </idealMolalSolnCutoff>
94  * </activityCoefficients>
95  * </thermo>
96  */
98 {
99 public:
100 
101  /// Constructor
102  IdealMolalSoln();
103 
104  //! Copy Constructor
106 
107  //! Assignment operator
109 
110  //! Constructor for phase initialization
111  /*!
112  * This constructor will initialize a phase, by reading the required
113  * information from an input file.
114  *
115  * @param inputFile Name of the Input file that contains information about the phase
116  * @param id id of the phase within the input file
117  */
118  IdealMolalSoln(const std::string& inputFile, const std::string& id = "");
119 
120  //! Constructor for phase initialization
121  /*!
122  * This constructor will initialize a phase, by reading the required
123  * information from XML_Node tree.
124  *
125  * @param phaseRef reference for an XML_Node tree that contains
126  * the information necessary to initialize the phase.
127  * @param id id of the phase within the input file
128  */
129  IdealMolalSoln(XML_Node& phaseRef, const std::string& id = "");
130 
131  //! Duplication function
132  /*!
133  * This virtual function is used to create a duplicate of the
134  * current phase. It's used to duplicate the phase when given
135  * a ThermoPhase pointer to the phase.
136  *
137  * @return It returns a ThermoPhase pointer.
138  */
140 
141  //! @name Utilities
142  //! @{
143 
144  /**
145  * Equation of state type flag. The base class returns
146  * zero. Subclasses should define this to return a unique
147  * non-zero value. Constants defined for this purpose are
148  * listed in mix_defs.h.
149  */
150  virtual int eosType() const {
151  return 0;
152  }
153 
154  //! @}
155  //! @name Molar Thermodynamic Properties of the Solution
156  //! @{
157 
158  //! Molar enthalpy of the solution. Units: J/kmol.
159  /*!
160  * Returns the amount of enthalpy per mole of solution.
161  * For an ideal molal solution,
162  * \f[
163  * \bar{h}(T, P, X_k) = \sum_k X_k \bar{h}_k(T)
164  * \f]
165  * The formula is written in terms of the partial molar enthalpies.
166  * \f$ \bar{h}_k(T, p, m_k) \f$.
167  * See the partial molar enthalpy function, getPartialMolarEnthalpies(),
168  * for details.
169  *
170  * Units: J/kmol
171  */
172  virtual doublereal enthalpy_mole() const;
173 
174  //! Molar internal energy of the solution: Units: J/kmol.
175  /*!
176  * Returns the amount of internal energy per mole of solution.
177  * For an ideal molal solution,
178  * \f[
179  * \bar{u}(T, P, X_k) = \sum_k X_k \bar{u}_k(T)
180  * \f]
181  * The formula is written in terms of the partial molar internal energy.
182  * \f$ \bar{u}_k(T, p, m_k) \f$.
183  */
184  virtual doublereal intEnergy_mole() const;
185 
186  //! Molar entropy of the solution. Units: J/kmol/K.
187  /*!
188  * Returns the amount of entropy per mole of solution.
189  * For an ideal molal solution,
190  * \f[
191  * \bar{s}(T, P, X_k) = \sum_k X_k \bar{s}_k(T)
192  * \f]
193  * The formula is written in terms of the partial molar entropies.
194  * \f$ \bar{s}_k(T, p, m_k) \f$.
195  * See the partial molar entropies function, getPartialMolarEntropies(),
196  * for details.
197  *
198  * Units: J/kmol/K.
199  */
200  virtual doublereal entropy_mole() const;
201 
202  //! Molar Gibbs function for the solution: Units J/kmol.
203  /*!
204  * Returns the gibbs free energy of the solution per mole of the solution.
205  *
206  * \f[
207  * \bar{g}(T, P, X_k) = \sum_k X_k \mu_k(T)
208  * \f]
209  *
210  * Units: J/kmol
211  */
212  virtual doublereal gibbs_mole() const;
213 
214  //! Molar heat capacity of the solution at constant pressure. Units: J/kmol/K.
215  /*!
216  * \f[
217  * \bar{c}_p(T, P, X_k) = \sum_k X_k \bar{c}_{p,k}(T)
218  * \f]
219  *
220  * Units: J/kmol/K
221  */
222  virtual doublereal cp_mole() const;
223 
224  //! Molar heat capacity of the solution at constant volume. Units: J/kmol/K.
225  /*!
226  * NOT IMPLEMENTED.
227  */
228  virtual doublereal cv_mole() const;
229 
230  //@}
231  /** @name Mechanical Equation of State Properties
232  *
233  * In this equation of state implementation, the density is a
234  * function only of the mole fractions. Therefore, it can't be
235  * an independent variable. Instead, the pressure is used as the
236  * independent variable. Functions which try to set the thermodynamic
237  * state by calling setDensity() may cause an exception to be
238  * thrown.
239  */
240  //@{
241 
242  /**
243  * Set the pressure at constant temperature. Units: Pa.
244  * This method sets a constant within the object.
245  * The mass density is not a function of pressure.
246  *
247  * @param p Input Pressure
248  */
249  virtual void setPressure(doublereal p);
250 
251 protected:
252  /**
253  * Calculate the density of the mixture using the partial
254  * molar volumes and mole fractions as input
255  *
256  * The formula for this is
257  *
258  * \f[
259  * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
260  * \f]
261  *
262  * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
263  * the molecular weights, and \f$V_k\f$ are the pure species
264  * molar volumes.
265  *
266  * Note, the basis behind this formula is that in an ideal
267  * solution the partial molar volumes are equal to the pure
268  * species molar volumes. We have additionally specified
269  * in this class that the pure species molar volumes are
270  * independent of temperature and pressure.
271  */
272  void calcDensity();
273 
274 public:
275  /**
276  * Overwritten setDensity() function is necessary because the
277  * density is not an independent variable.
278  *
279  * This function will now throw an error condition
280  *
281  * @internal May have to adjust the strategy here to make
282  * the eos for these materials slightly compressible, in order
283  * to create a condition where the density is a function of
284  * the pressure.
285  *
286  * This function will now throw an error condition.
287  *
288  * @param rho Input Density
289  */
290  void setDensity(const doublereal rho);
291 
292  /**
293  * Overwritten setMolarDensity() function is necessary because the
294  * density is not an independent variable.
295  *
296  * This function will now throw an error condition.
297  *
298  * @param rho Input Density
299  */
300  void setMolarDensity(const doublereal rho);
301 
302  //! Set the temperature (K) and pressure (Pa)
303  /*!
304  * Set the temperature and pressure.
305  *
306  * @param t Temperature (K)
307  * @param p Pressure (Pa)
308  */
309  virtual void setState_TP(doublereal t, doublereal p);
310 
311  //! The isothermal compressibility. Units: 1/Pa.
312  /*!
313  * The isothermal compressibility is defined as
314  * \f[
315  * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
316  * \f]
317  *
318  * It's equal to zero for this model, since the molar volume
319  * doesn't change with pressure or temperature.
320  */
321  virtual doublereal isothermalCompressibility() const;
322 
323  //! The thermal expansion coefficient. Units: 1/K.
324  /*!
325  * The thermal expansion coefficient is defined as
326  *
327  * \f[
328  * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
329  * \f]
330  *
331  * It's equal to zero for this model, since the molar volume
332  * doesn't change with pressure or temperature.
333  */
334  virtual doublereal thermalExpansionCoeff() const;
335 
336  /**
337  * @}
338  * @name Potential Energy
339  *
340  * Species may have an additional potential energy due to the
341  * presence of external gravitation or electric fields. These
342  * methods allow specifying a potential energy for individual
343  * species.
344  * @{
345  */
346 
347  //!Set the potential energy of species k to pe.
348  /*!
349  * Units: J/kmol.
350  *
351  * @param k Species index
352  * @param pe Input potential energy.
353  */
354  virtual void setPotentialEnergy(int k, doublereal pe) {
355  err("setPotentialEnergy");
356  }
357 
358  /**
359  * Get the potential energy of species k.
360  * Units: J/kmol.
361  *
362  * @param k Species index
363  */
364  virtual doublereal potentialEnergy(int k) const {
365  return err("potentialEnergy");
366  }
367 
368  /**
369  * @}
370  * @name Activities and Activity Concentrations
371  *
372  * The activity \f$a_k\f$ of a species in solution is
373  * related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
374  * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T)\f$ is
375  * the chemical potential at unit activity, which depends only
376  * on temperature and the pressure.
377  * @{
378  */
379 
380  /*!
381  * This method returns an array of generalized concentrations
382  * \f$ C_k\f$ that are defined such that
383  * \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$
384  * is a standard concentration
385  * defined below. These generalized concentrations are used
386  * by kinetics manager classes to compute the forward and
387  * reverse rates of elementary reactions.
388  *
389  * @param c Array of generalized concentrations. The
390  * units depend upon the implementation of the
391  * reaction rate expressions within the phase.
392  */
393  virtual void getActivityConcentrations(doublereal* c) const;
394 
395  /**
396  * The standard concentration \f$ C^0_k \f$ used to normalize
397  * the generalized concentration. In many cases, this quantity
398  * will be the same for all species in a phase - for example,
399  * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
400  * reason, this method returns a single value, instead of an
401  * array. However, for phases in which the standard
402  * concentration is species-specific (e.g. surface species of
403  * different sizes), this method may be called with an
404  * optional parameter indicating the species.
405  *
406  * @param k Species index
407  */
408  virtual doublereal standardConcentration(size_t k=0) const;
409 
410  /*!
411  * Returns the natural logarithm of the standard
412  * concentration of the kth species
413  *
414  * @param k Species index
415  */
416  virtual doublereal logStandardConc(size_t k=0) const;
417 
418  /*!
419  * Returns the units of the standard and generalized
420  * concentrations Note they have the same units, as their
421  * ratio is defined to be equal to the activity of the kth
422  * species in the solution, which is unitless.
423  *
424  * This routine is used in print out applications where the
425  * units are needed. Usually, MKS units are assumed throughout
426  * the program and in the XML input files.
427  *
428  * @param uA Output vector containing the units
429  * uA[0] = kmol units - default = 1
430  * uA[1] = m units - default = -nDim(), the number of spatial
431  * dimensions in the Phase class.
432  * uA[2] = kg units - default = 0;
433  * uA[3] = Pa(pressure) units - default = 0;
434  * uA[4] = Temperature units - default = 0;
435  * uA[5] = time units - default = 0
436  * @param k species index. Defaults to 0.
437  * @param sizeUA output int containing the size of the vector.
438  * Currently, this is equal to 6.
439  * @deprecated
440  */
441  virtual void getUnitsStandardConc(double* uA, int k = 0,
442  int sizeUA = 6) const;
443 
444  /*!
445  * Get the array of non-dimensional activities at
446  * the current solution temperature, pressure, and
447  * solution concentration.
448  *
449  * (note solvent is on molar scale)
450  *
451  * @param ac Output activity coefficients.
452  * Length: m_kk.
453  */
454  virtual void getActivities(doublereal* ac) const;
455 
456  /*!
457  * Get the array of non-dimensional molality-based
458  * activity coefficients at the current solution temperature,
459  * pressure, and solution concentration.
460  *
461  *
462  * (note solvent is on molar scale. The solvent molar
463  * based activity coefficient is returned).
464  *
465  * @param acMolality Output Molality-based activity coefficients.
466  * Length: m_kk.
467  */
468  virtual void
469  getMolalityActivityCoefficients(doublereal* acMolality) const;
470 
471  //@}
472  /// @name Partial Molar Properties of the Solution
473  //@{
474 
475 
476  //!Get the species chemical potentials: Units: J/kmol.
477  /*!
478  * This function returns a vector of chemical potentials of the
479  * species in solution.
480  *
481  * \f[
482  * \mu_k = \mu^{o}_k(T,P) + R T \ln(\frac{m_k}{m^\Delta})
483  * \f]
484  * \f[
485  * \mu_w = \mu^{o}_w(T,P) +
486  * R T ((X_w - 1.0) / X_w)
487  * \f]
488  *
489  * \f$ w \f$ refers to the solvent species.
490  * \f$ X_w \f$ is the mole fraction of the solvent.
491  * \f$ m_k \f$ is the molality of the kth solute.
492  * \f$ m^\Delta \f$ is 1 gmol solute per kg solvent.
493  *
494  * Units: J/kmol.
495  *
496  * @param mu Output vector of species chemical potentials.
497  * Length: m_kk.
498  */
499  virtual void getChemPotentials(doublereal* mu) const;
500 
501  //! Returns an array of partial molar enthalpies for the species in the mixture.
502  /*!
503  * Units (J/kmol)
504  * For this phase, the partial molar enthalpies are equal to the
505  * species standard state enthalpies.
506  * \f[
507  * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
508  * \f]
509  * The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$,
510  * at the reference pressure,\f$ P_{ref} \f$,
511  * are computed by the species thermodynamic
512  * property manager. They are polynomial functions of temperature.
513  * @see SpeciesThermo
514  *
515  * @param hbar Output vector of partial molar enthalpies.
516  * Length: m_kk.
517  */
518  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
519 
520 
521  //! Returns an array of partial molar entropies of the species in the solution. Units: J/kmol.
522  /*!
523  *
524  * Maxwell's equations provide an insight in how to calculate this
525  * (p.215 Smith and Van Ness)
526  * \f[
527  * \frac{d(\mu_k)}{dT} = -\bar{s}_i
528  * \f]
529  * For this phase, the partial molar entropies are equal to the
530  * standard state species entropies plus the ideal molal solution contribution.
531  *
532  * \f[
533  * \bar{s}_k(T,P) = s^0_k(T) - R \ln( \frac{m_k}{m^{\triangle}} )
534  * \f]
535  * \f[
536  * \bar{s}_w(T,P) = s^0_w(T) - R ((X_w - 1.0) / X_w)
537  * \f]
538  *
539  * The subscript, w, refers to the solvent species. \f$ X_w \f$ is
540  * the mole fraction of solvent.
541  * The reference-state pure-species entropies,\f$ s^0_k(T) \f$,
542  * at the reference pressure, \f$ P_{ref} \f$, are computed by the
543  * species thermodynamic
544  * property manager. They are polynomial functions of temperature.
545  * @see SpeciesThermo
546  *
547  * @param sbar Output vector of partial molar entropies.
548  * Length: m_kk.
549  */
550  virtual void getPartialMolarEntropies(doublereal* sbar) const;
551 
552  // partial molar volumes of the species Units: m^3 kmol-1.
553  /*!
554  * For this solution, the partial molar volumes are equal to the
555  * constant species molar volumes.
556  *
557  * Units: m^3 kmol-1.
558  * @param vbar Output vector of partial molar volumes.
559  */
560  virtual void getPartialMolarVolumes(doublereal* vbar) const;
561 
562 
563  //! Partial molar heat capacity of the solution:. UnitsL J/kmol/K
564  /*!
565  * The kth partial molar heat capacity is equal to
566  * the temperature derivative of the partial molar
567  * enthalpy of the kth species in the solution at constant
568  * P and composition (p. 220 Smith and Van Ness).
569  * \f[
570  * \bar{Cp}_k(T,P) = {Cp}^0_k(T)
571  * \f]
572  *
573  * For this solution, this is equal to the reference state
574  * heat capacities.
575  *
576  * Units: J/kmol/K
577  *
578  * @param cpbar Output vector of partial molar heat capacities.
579  * Length: m_kk.
580  */
581  virtual void getPartialMolarCp(doublereal* cpbar) const;
582 
583  //!@}
584  //! @name Chemical Equilibrium
585  //! @{
586 
587  /**
588  * This method is used by the ChemEquil equilibrium solver.
589  * It sets the state such that the chemical potentials satisfy
590  * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
591  * \left(\frac{\lambda_m} {\hat R T}\right) \f] where
592  * \f$ \lambda_m \f$ is the element potential of element m. The
593  * temperature is unchanged. Any phase (ideal or not) that
594  * implements this method can be equilibrated by ChemEquil.
595  *
596  * Not implemented.
597  *
598  * @param lambda_RT vector of Nondimensional element potentials.
599  */
600  virtual void setToEquilState(const doublereal* lambda_RT) {
601  err("setToEquilState");
602  }
603 
604  //@}
605 
606  /**
607  * @internal
608  * Set equation of state parameters. The number and meaning of
609  * these depends on the subclass.
610  * @param n number of parameters
611  * @param c array of <I>n</I> coefficients
612  * @deprecated Unimplemented
613  */
614  virtual void setParameters(int n, doublereal* const c);
615 
616  /*!
617  * @internal
618  * Get the parameters used to initialize the phase.
619  *
620  * @param n number of parameters (output)
621  * @param c array of <I>n</I> coefficients
622  * * @deprecated Unimplemented
623  */
624  virtual void getParameters(int& n, doublereal* const c) const;
625 
626  /*!
627  * Set equation of state parameter values from XML
628  * entries. This method is called by function importPhase in
629  * file importCTML.cpp when processing a phase definition in
630  * an input file. It should be overloaded in subclasses to set
631  * any parameters that are specific to that particular phase
632  * model.
633  *
634  * HKM -> Right now, the parameters are set elsewhere (initThermo)
635  * It just didn't seem to fit.
636  *
637  *
638  * @param eosdata An XML_Node object corresponding to
639  * the "thermo" entry for this phase in the input file.
640  */
641  virtual void setParametersFromXML(const XML_Node& eosdata);
642 
643  /// @name Critical state properties.
644  /// These methods are only implemented by some subclasses.
645 
646  //@{
647 
648  /**
649  * Critical temperature (K).
650  * Not implemented for this phase type.
651  */
652  virtual doublereal critTemperature() const {
653  err("critTemperature");
654  return -1.0;
655  }
656 
657  /**
658  * Critical pressure (Pa).
659  *
660  * Not implemented for this phase type.
661  */
662  virtual doublereal critPressure() const {
663  err("critPressure");
664  return -1.0;
665  }
666 
667  /**
668  * Critical density (kg/m3).
669  * Not implemented for this phase type.
670  */
671  virtual doublereal critDensity() const {
672  err("critDensity");
673  return -1.0;
674  }
675 
676  //@}
677 
678  /*
679  * -------------- Utilities -------------------------------
680  */
681 
682  //! Initialization routine for an IdealMolalSoln phase.
683  /*!
684  * This internal routine is responsible for setting up
685  * the internal storage. This is reimplemented from the ThermoPhase
686  * class.
687  */
688  virtual void initThermo();
689 
690  //! Import and initialize an IdealMolalSoln phase
691  //! specification in an XML tree into the current object.
692  /*!
693  * This routine is called from importPhase() to finish
694  * up the initialization of the thermo object. It reads in the
695  * species molar volumes.
696  *
697  * @param phaseNode This object must be the phase node of a
698  * complete XML tree
699  * description of the phase, including all of the
700  * species data. In other words while "phase" must
701  * point to an XML phase object, it must have
702  * sibling nodes "speciesData" that describe
703  * the species in the phase.
704  * @param id ID of the phase. If nonnull, a check is done
705  * to see if phaseNode is pointing to the phase
706  * with the correct id.
707  */
708  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id="");
709 
710  //! Report the molar volume of species k
711  /*!
712  * units - \f$ m^3 kmol^{-1} \f$
713  *
714  * @param k Species index.
715  */
716  double speciesMolarVolume(int k) const;
717 
718  /*!
719  * Fill in a return vector containing the species molar volumes
720  * units - \f$ m^3 kmol^{-1} \f$
721  *
722  * @param smv Output vector of species molar volumes.
723  */
724  void getSpeciesMolarVolumes(double* smv) const;
725  //@}
726 
727 protected:
728  /**
729  * Species molar volume \f$ m^3 kmol^{-1} \f$
730  */
732 
733  /**
734  * The standard concentrations can have three different forms
735  * depending on the value of the member attribute m_formGC, which
736  * is supplied in the XML file.
737  *
738  * <TABLE>
739  * <TR><TD> m_formGC </TD><TD> ActivityConc </TD><TD> StandardConc </TD></TR>
740  * <TR><TD> 0 </TD><TD> \f$ {m_k}/ { m^{\Delta}}\f$ </TD><TD> \f$ 1.0 \f$ </TD></TR>
741  * <TR><TD> 1 </TD><TD> \f$ m_k / (m^{\Delta} V_k)\f$ </TD><TD> \f$ 1.0 / V_k \f$ </TD></TR>
742  * <TR><TD> 2 </TD><TD> \f$ m_k / (m^{\Delta} V^0_0)\f$</TD><TD> \f$ 1.0 / V^0_0\f$ </TD></TR>
743  * </TABLE>
744  */
745  int m_formGC;
746 
747 public:
748  //! Cutoff type
750 
751 private:
752  /**
753  * Temporary array used in equilibrium calculations
754  */
755  mutable vector_fp m_pp;
756 
757  /**
758  * vector of size m_kk, used as a temporary holding area.
759  */
760  mutable vector_fp m_tmpV;
761 
762  //! Logarithm of the molal activity coefficients
763  /*!
764  * Normally these are all one. However, stability schemes will change that
765  */
767 public:
768  //! value of the solute mole fraction that centers the cutoff polynomials
769  //! for the cutoff =1 process;
770  doublereal IMS_X_o_cutoff_;
771 
772  //! gamma_o value for the cutoff process at the zero solvent point
773  doublereal IMS_gamma_o_min_;
774 
775  //! gamma_k minimum for the cutoff process at the zero solvent point
776  doublereal IMS_gamma_k_min_;
777 
778  //! Parameter in the polyExp cutoff treatment
779  /*!
780  * This is the slope of the f function at the zero solvent point
781  * Default value is 0.6
782  */
783  doublereal IMS_slopefCut_;
784 
785  //! Parameter in the polyExp cutoff treatment
786  /*!
787  * This is the slope of the g function at the zero solvent point
788  * Default value is 0.0
789  */
790  doublereal IMS_slopegCut_;
791 
792  //! @name Parameters in the polyExp cutoff treatment having to do with rate of exp decay
793  //! @{
794  doublereal IMS_cCut_;
795  doublereal IMS_dfCut_;
796  doublereal IMS_efCut_;
797  doublereal IMS_afCut_;
798  doublereal IMS_bfCut_;
799  doublereal IMS_dgCut_;
800  doublereal IMS_egCut_;
801  doublereal IMS_agCut_;
802  doublereal IMS_bgCut_;
803  //! @}
804 
805 private:
806 
807  //! Internal error message
808  /*!
809  * @param msg message to be printed
810  */
811  doublereal err(const std::string& msg) const;
812 
813  //! This function will be called to update the internally stored
814  //! natural logarithm of the molality activity coefficients
815  /*!
816  * Normally the solutes are all zero. However, sometimes they are not,
817  * due to stability schemes.
818  *
819  * gamma_k_molar = gamma_k_molal / Xmol_solvent
820  *
821  * gamma_o_molar = gamma_o_molal
822  */
823  void s_updateIMS_lnMolalityActCoeff() const;
824 
825  //! This internal function adjusts the lengths of arrays.
826  /*!
827  * This function is not virtual nor is it inherited
828  */
829  void initLengths();
830 
831  //! Calculate parameters for cutoff treatments of activity coefficients
832  /*!
833  * Some cutoff treatments for the activity coefficients
834  * actually require some calculations to create a consistent treatment.
835  *
836  * This routine is called during the setup to calculate these parameters
837  */
838  void calcIMSCutoffParams_();
839 };
840 
841 /* @} */
842 }
843 
844 #endif
IdealMolalSoln & operator=(const IdealMolalSoln &)
Assignment operator.
virtual void setToEquilState(const doublereal *lambda_RT)
This method is used by the ChemEquil equilibrium solver.
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
doublereal IMS_slopefCut_
Parameter in the polyExp cutoff treatment.
double speciesMolarVolume(int k) const
Report the molar volume of species k.
doublereal IMS_slopegCut_
Parameter in the polyExp cutoff treatment.
IdealMolalSoln()
Constructor.
virtual void getPartialMolarVolumes(doublereal *vbar) const
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution. Units: J/kmol.
virtual void getActivityConcentrations(doublereal *c) const
vector_fp m_tmpV
vector of size m_kk, used as a temporary holding area.
virtual doublereal standardConcentration(size_t k=0) const
The standard concentration used to normalize the generalized concentration.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
ThermoPhase * duplMyselfAsThermoPhase() const
Duplication function.
doublereal IMS_gamma_k_min_
gamma_k minimum for the cutoff process at the zero solvent point
doublereal err(const std::string &msg) const
Internal error message.
virtual doublereal potentialEnergy(int k) const
Get the potential energy of species k.
void setDensity(const doublereal rho)
Overwritten setDensity() function is necessary because the density is not an independent variable...
void initLengths()
This internal function adjusts the lengths of arrays.
void setMolarDensity(const doublereal rho)
Overwritten setMolarDensity() function is necessary because the density is not an independent variabl...
doublereal IMS_gamma_o_min_
gamma_o value for the cutoff process at the zero solvent point
vector_fp m_pp
Temporary array used in equilibrium calculations.
vector_fp m_speciesMolarVolume
Species molar volume .
Header for intermediate ThermoPhase object for phases which employ molality based activity coefficien...
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual doublereal gibbs_mole() const
Molar Gibbs function for the solution: Units J/kmol.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials: Units: J/kmol.
virtual void getActivities(doublereal *ac) const
virtual doublereal isothermalCompressibility() const
The isothermal compressibility. Units: 1/Pa.
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
virtual doublereal critDensity() const
Critical density (kg/m3).
virtual doublereal cv_mole() const
Molar heat capacity of the solution at constant volume. Units: J/kmol/K.
void s_updateIMS_lnMolalityActCoeff() const
This function will be called to update the internally stored natural logarithm of the molality activi...
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id="")
Import and initialize an IdealMolalSoln phase specification in an XML tree into the current object...
virtual doublereal entropy_mole() const
Molar entropy of the solution. Units: J/kmol/K.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution. Units: J/kmol...
virtual doublereal cp_mole() const
Molar heat capacity of the solution at constant pressure. Units: J/kmol/K.
void getSpeciesMolarVolumes(double *smv) const
virtual void getParameters(int &n, doublereal *const c) const
virtual void setPotentialEnergy(int k, doublereal pe)
Set the potential energy of species k to pe.
virtual doublereal intEnergy_mole() const
Molar internal energy of the solution: Units: J/kmol.
virtual void getPartialMolarCp(doublereal *cpbar) const
Partial molar heat capacity of the solution:. UnitsL J/kmol/K.
int IMS_typeCutoff_
Cutoff type.
virtual doublereal logStandardConc(size_t k=0) const
virtual doublereal critTemperature() const
Critical temperature (K).
int m_formGC
The standard concentrations can have three different forms depending on the value of the member attri...
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:165
virtual void initThermo()
Initialization routine for an IdealMolalSoln phase.
virtual void getMolalityActivityCoefficients(doublereal *acMolality) const
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
virtual int eosType() const
Equation of state type flag.
This phase is based upon the mixing-rule assumption that all molality-based activity coefficients are...
virtual void setParametersFromXML(const XML_Node &eosdata)
virtual doublereal critPressure() const
Critical pressure (Pa).
void calcIMSCutoffParams_()
Calculate parameters for cutoff treatments of activity coefficients.
virtual void setParameters(int n, doublereal *const c)
doublereal IMS_X_o_cutoff_
value of the solute mole fraction that centers the cutoff polynomials for the cutoff =1 process; ...
virtual doublereal thermalExpansionCoeff() const
The thermal expansion coefficient. Units: 1/K.
vector_fp IMS_lnActCoeffMolal_
Logarithm of the molal activity coefficients.