Loading [MathJax]/extensions/tex2jax.js
Cantera  3.2.0a1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 variable pressure
8 * standard state methods for calculating thermodynamic properties that are
9 * further based upon activities on the molality scale. The Ideal molal solution
10 * assumes that all molality-based activity coefficients are equal to one. This
11 * turns out to be highly nonlinear in the limit of the solvent mole fraction
12 * going to zero.
13 */
14
15// This file is part of Cantera. See License.txt in the top-level directory or
16// at https://cantera.org/license.txt for license and copyright information.
17
18#ifndef CT_IDEALMOLALSOLN_H
19#define CT_IDEALMOLALSOLN_H
20
21#include "MolalityVPSSTP.h"
22
23namespace Cantera
24{
25
26/**
27 * This phase is based upon the mixing-rule assumption that all molality-based
28 * activity coefficients are equal to one.
29 *
30 * This is a full instantiation of a ThermoPhase object. The assumption is that
31 * the molality-based activity coefficient is equal to one. This also implies
32 * that the osmotic coefficient is equal to one.
33 *
34 * Note, this does not mean that the solution is an ideal solution. In fact,
35 * there is a singularity in the formulation as the solvent concentration goes
36 * to zero.
37 *
38 * The mechanical equation of state is currently assumed to be that of an
39 * incompressible solution. This may change in the future. Each species has its
40 * own molar volume. The molar volume is a constant.
41 *
42 * Class IdealMolalSoln represents a condensed phase. The phase and the pure
43 * species phases which comprise the standard states of the species are assumed
44 * to have zero volume expansivity and zero isothermal compressibility. Each
45 * species does, however, have constant but distinct partial molar volumes equal
46 * to their pure species molar volumes. The class derives from class
47 * ThermoPhase, and overloads the virtual methods defined there with ones that
48 * use expressions appropriate for incompressible mixtures.
49 *
50 * The standard concentrations can have three different forms.
51 * See setStandardConcentrationModel().
52 *
53 * @f$ V^0_0 @f$ is the solvent standard molar volume. @f$ m^{\Delta} @f$ is a
54 * constant equal to a molality of @f$ 1.0 \quad\mbox{gm kmol}^{-1} @f$.
55 *
56 * The current default is to have mformGC = 2.
57 *
58 * The value and form of the activity concentration will affect reaction rate
59 * constants involving species in this phase.
60 *
61 * An example phase definition is given in the
62 * <a href="../../sphinx/html/yaml/phases.html#ideal-molal-solution">
63 * YAML API Reference</a>.
64 *
65 * @ingroup thermoprops
66 */
68{
69public:
70 //! Constructor for phase initialization
71 /*!
72 * This constructor will initialize a phase, by reading the required
73 * information from an input file.
74 *
75 * @param inputFile Name of the Input file that contains information
76 * about the phase. If blank, an empty phase will be created.
77 * @param id id of the phase within the input file
78 */
79 explicit IdealMolalSoln(const string& inputFile="", const string& id="");
80
81 string type() const override {
82 return "ideal-molal-solution";
83 }
84
85 bool isIdeal() const override {
86 return true;
87 }
88
89 //! @name Molar Thermodynamic Properties of the Solution
90 //! @{
91
92 //! Molar internal energy of the solution: Units: J/kmol.
93 /*!
94 * Returns the amount of internal energy per mole of solution. For an ideal
95 * molal solution,
96 * @f[
97 * \bar{u}(T, P, X_k) = \sum_k X_k \bar{u}_k(T)
98 * @f]
99 * The formula is written in terms of the partial molar internal energy.
100 * @f$ \bar{u}_k(T, p, m_k) @f$.
101 */
102 double intEnergy_mole() const override;
103
104 //! @}
105 //! @name Mechanical Equation of State Properties
106 //!
107 //! In this equation of state implementation, the density is a function only
108 //! of the mole fractions. Therefore, it can't be an independent variable.
109 //! Instead, the pressure is used as the independent variable. Functions
110 //! which try to set the thermodynamic state by calling setDensity() will
111 //! cause an exception to be thrown.
112 //! @{
113
114public:
115 //! The isothermal compressibility. Units: 1/Pa.
116 /*!
117 * The isothermal compressibility is defined as
118 * @f[
119 * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
120 * @f]
121 *
122 * It's equal to zero for this model, since the molar volume doesn't change
123 * with pressure or temperature.
124 */
125 double isothermalCompressibility() const override;
126
127 //! The thermal expansion coefficient. Units: 1/K.
128 /*!
129 * The thermal expansion coefficient is defined as
130 *
131 * @f[
132 * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
133 * @f]
134 *
135 * It's equal to zero for this model, since the molar volume doesn't change
136 * with pressure or temperature.
137 */
138 double thermalExpansionCoeff() const override;
139
140 //! @}
141 //! @name Activities and Activity Concentrations
142 //!
143 //! The activity @f$ a_k @f$ of a species in solution is related to the
144 //! chemical potential by @f[ \mu_k = \mu_k^0(T) + \hat R T \ln a_k. @f] The
145 //! quantity @f$ \mu_k^0(T) @f$ is the chemical potential at unit activity,
146 //! which depends only on temperature and the pressure.
147 //! @{
148
149 Units standardConcentrationUnits() const override;
150 void getActivityConcentrations(double* c) const override;
151 double standardConcentration(size_t k=0) const override;
152
153 /**
154 * Get the array of non-dimensional activities at the current solution
155 * temperature, pressure, and solution concentration.
156 *
157 * (note solvent is on molar scale)
158 *
159 * @param ac Output activity coefficients. Length: m_kk.
160 */
161 void getActivities(double* ac) const override;
162
163 /**
164 * Get the array of non-dimensional molality-based activity coefficients at
165 * the current solution temperature, pressure, and solution concentration.
166 *
167 * (note solvent is on molar scale. The solvent molar
168 * based activity coefficient is returned).
169 *
170 * @param acMolality Output Molality-based activity coefficients.
171 * Length: m_kk.
172 */
173 void getMolalityActivityCoefficients(double* acMolality) const override;
174
175 //! @}
176 //! @name Partial Molar Properties of the Solution
177 //! @{
178
179 //!Get the species chemical potentials: Units: J/kmol.
180 /*!
181 * This function returns a vector of chemical potentials of the species in
182 * solution.
183 *
184 * @f[
185 * \mu_k = \mu^{o}_k(T,P) + R T \ln(\frac{m_k}{m^\Delta})
186 * @f]
187 * @f[
188 * \mu_w = \mu^{o}_w(T,P) +
189 * R T ((X_w - 1.0) / X_w)
190 * @f]
191 *
192 * @f$ w @f$ refers to the solvent species.
193 * @f$ X_w @f$ is the mole fraction of the solvent.
194 * @f$ m_k @f$ is the molality of the kth solute.
195 * @f$ m^\Delta @f$ is 1 gmol solute per kg solvent.
196 *
197 * Units: J/kmol.
198 *
199 * @param mu Output vector of species chemical potentials. Length: m_kk.
200 */
201 void getChemPotentials(double* mu) const override;
202
203 //! Returns an array of partial molar enthalpies for the species in the
204 //! mixture.
205 /*!
206 * Units (J/kmol). For this phase, the partial molar enthalpies are equal to
207 * the species standard state enthalpies.
208 * @f[
209 * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
210 * @f]
211 * The reference-state pure-species enthalpies, @f$ \hat h^{ref}_k(T) @f$,
212 * at the reference pressure,@f$ P_{ref} @f$, are computed by the species
213 * thermodynamic property manager. They are polynomial functions of
214 * temperature.
215 * @see MultiSpeciesThermo
216 *
217 * @param hbar Output vector of partial molar enthalpies.
218 * Length: m_kk.
219 */
220 void getPartialMolarEnthalpies(double* hbar) const override;
221
222 //! Returns an array of partial molar internal energies for the species in the
223 //! mixture.
224 /*!
225 * Units (J/kmol). For this phase, the partial molar internal energies are equal to
226 * the species standard state internal energies (which are equal to the reference
227 * state internal energies)
228 * @f[
229 * \bar u_k(T,P) = \hat u^{ref}_k(T)
230 * @f]
231 * @param hbar Output vector of partial molar internal energies, length #m_kk
232 */
233 void getPartialMolarIntEnergies(double* hbar) const override;
234
235 //! Returns an array of partial molar entropies of the species in the
236 //! solution. Units: J/kmol.
237 /*!
238 * Maxwell's equations provide an insight in how to calculate this
239 * (p.215 Smith and Van Ness)
240 * @f[
241 * \frac{d(\mu_k)}{dT} = -\bar{s}_i
242 * @f]
243 * For this phase, the partial molar entropies are equal to the standard
244 * state species entropies plus the ideal molal solution contribution.
245 *
246 * @f[
247 * \bar{s}_k(T,P) = s^0_k(T) - R \ln( \frac{m_k}{m^{\triangle}} )
248 * @f]
249 * @f[
250 * \bar{s}_w(T,P) = s^0_w(T) - R ((X_w - 1.0) / X_w)
251 * @f]
252 *
253 * The subscript, w, refers to the solvent species. @f$ X_w @f$ is the mole
254 * fraction of solvent. The reference-state pure-species entropies,@f$
255 * s^0_k(T) @f$, at the reference pressure, @f$ P_{ref} @f$, are computed by
256 * the species thermodynamic property manager. They are polynomial functions
257 * of temperature.
258 * @see MultiSpeciesThermo
259 *
260 * @param sbar Output vector of partial molar entropies.
261 * Length: m_kk.
262 */
263 void getPartialMolarEntropies(double* sbar) const override;
264
265 // partial molar volumes of the species Units: m^3 kmol-1.
266 /*!
267 * For this solution, the partial molar volumes are equal to the constant
268 * species molar volumes.
269 *
270 * Units: m^3 kmol-1.
271 * @param vbar Output vector of partial molar volumes.
272 */
273 void getPartialMolarVolumes(double* vbar) const override;
274
275 //! Partial molar heat capacity of the solution:. UnitsL J/kmol/K
276 /*!
277 * The kth partial molar heat capacity is equal to the temperature
278 * derivative of the partial molar enthalpy of the kth species in the
279 * solution at constant P and composition (p. 220 Smith and Van Ness).
280 * @f[
281 * \bar{Cp}_k(T,P) = {Cp}^0_k(T)
282 * @f]
283 *
284 * For this solution, this is equal to the reference state heat capacities.
285 *
286 * Units: J/kmol/K
287 *
288 * @param cpbar Output vector of partial molar heat capacities.
289 * Length: m_kk.
290 */
291 void getPartialMolarCp(double* cpbar) const override;
292
293 //! @}
294
295 // -------------- Utilities -------------------------------
296
297 bool addSpecies(shared_ptr<Species> spec) override;
298
299 void initThermo() override;
300
301 void getParameters(AnyMap& phaseNode) const override;
302
303 //! Set the standard concentration model.
304 /*!
305 * Must be one of 'unity', 'species-molar-volume', or 'solvent-molar-volume'.
306 * The default is 'solvent-molar-volume'.
307 *
308 * | model | ActivityConc | StandardConc |
309 * | -------------------- | -------------------------------- | ------------------ |
310 * | unity | @f$ {m_k}/ { m^{\Delta}} @f$ | @f$ 1.0 @f$ |
311 * | species-molar-volume | @f$ m_k / (m^{\Delta} V_k) @f$ | @f$ 1.0 / V_k @f$ |
312 * | solvent-molar-volume | @f$ m_k / (m^{\Delta} V^0_0) @f$ | @f$ 1.0 / V^0_0 @f$ |
313 */
314 void setStandardConcentrationModel(const string& model);
315
316 //! Set cutoff model. Must be one of 'none', 'poly', or 'polyExp'.
317 void setCutoffModel(const string& model);
318
319 //! Report the molar volume of species k
320 /*!
321 * units - @f$ m^3 kmol^{-1} @f$
322 *
323 * @param k Species index.
324 */
325 double speciesMolarVolume(int k) const;
326
327 /**
328 * Fill in a return vector containing the species molar volumes
329 * units - @f$ m^3 kmol^{-1} @f$
330 *
331 * @param smv Output vector of species molar volumes.
332 */
333 void getSpeciesMolarVolumes(double* smv) const;
334
335protected:
336 //! Species molar volume @f$ m^3 kmol^{-1} @f$
337 vector<double> m_speciesMolarVolume;
338
339 /**
340 * The standard concentrations can have one of three different forms:
341 * 0 = 'unity', 1 = 'species-molar-volume', 2 = 'solvent-molar-volume'. See
342 * setStandardConcentrationModel().
343 */
344 int m_formGC = 2;
345
346 //! Cutoff type
348
349private:
350 //! Logarithm of the molal activity coefficients
351 /*!
352 * Normally these are all one. However, stability schemes will change that
353 */
354 mutable vector<double> IMS_lnActCoeffMolal_;
355public:
356 //! value of the solute mole fraction that centers the cutoff polynomials
357 //! for the cutoff =1 process;
359
360 //! gamma_o value for the cutoff process at the zero solvent point
362
363 //! gamma_k minimum for the cutoff process at the zero solvent point
365
366 //! Parameter in the polyExp cutoff treatment. This is the slope of the f
367 //! function at the zero solvent point. Default value is 0.6
369
370 //! Parameter in the polyExp cutoff treatment. This is the slope of the g
371 //! function at the zero solvent point. Default value is 0.0
373
374 //! @name Parameters in the polyExp cutoff having to do with rate of exp decay
375 //! @{
376 double IMS_cCut_;
377 double IMS_dfCut_ = 0.0;
378 double IMS_efCut_ = 0.0;
379 double IMS_afCut_ = 0.0;
380 double IMS_bfCut_ = 0.0;
381 double IMS_dgCut_ = 0.0;
382 double IMS_egCut_ = 0.0;
383 double IMS_agCut_ = 0.0;
384 double IMS_bgCut_ = 0.0;
385 //! @}
386
387private:
388 //! This function will be called to update the internally stored
389 //! natural logarithm of the molality activity coefficients
390 /*!
391 * Normally the solutes are all zero. However, sometimes they are not,
392 * due to stability schemes.
393 *
394 * gamma_k_molar = gamma_k_molal / Xmol_solvent
395 *
396 * gamma_o_molar = gamma_o_molal
397 */
399
400 //! Calculate parameters for cutoff treatments of activity coefficients
401 /*!
402 * Some cutoff treatments for the activity coefficients actually require
403 * some calculations to create a consistent treatment.
404 *
405 * This routine is called during the setup to calculate these parameters
406 */
408};
409
410}
411
412#endif
Header for intermediate ThermoPhase object for phases which employ molality based activity coefficien...
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:432
This phase is based upon the mixing-rule assumption that all molality-based activity coefficients are...
void calcIMSCutoffParams_()
Calculate parameters for cutoff treatments of activity coefficients.
double thermalExpansionCoeff() const override
The thermal expansion coefficient. Units: 1/K.
bool isIdeal() const override
Boolean indicating whether phase is ideal.
void getPartialMolarEnthalpies(double *hbar) const override
Returns an array of partial molar enthalpies for the species in the mixture.
void getChemPotentials(double *mu) const override
Get the species chemical potentials: Units: J/kmol.
double IMS_slopegCut_
Parameter in the polyExp cutoff treatment.
double IMS_gamma_o_min_
gamma_o value for the cutoff process at the zero solvent point
int IMS_typeCutoff_
Cutoff type.
double speciesMolarVolume(int k) const
Report the molar volume of species k.
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
string type() const override
String indicating the thermodynamic model implemented.
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
void getActivityConcentrations(double *c) const override
This method returns an array of generalized concentrations.
void getSpeciesMolarVolumes(double *smv) const
Fill in a return vector containing the species molar volumes units - .
void getPartialMolarVolumes(double *vbar) const override
vector< double > IMS_lnActCoeffMolal_
Logarithm of the molal activity coefficients.
void setStandardConcentrationModel(const string &model)
Set the standard concentration model.
double IMS_slopefCut_
Parameter in the polyExp cutoff treatment.
double isothermalCompressibility() const override
The isothermal compressibility. Units: 1/Pa.
double intEnergy_mole() const override
Molar internal energy of the solution: Units: J/kmol.
void setCutoffModel(const string &model)
Set cutoff model. Must be one of 'none', 'poly', or 'polyExp'.
double IMS_gamma_k_min_
gamma_k minimum for the cutoff process at the zero solvent point
int m_formGC
The standard concentrations can have one of three different forms: 0 = 'unity', 1 = 'species-molar-vo...
vector< double > m_speciesMolarVolume
Species molar volume .
void getActivities(double *ac) const override
Get the array of non-dimensional activities at the current solution temperature, pressure,...
double IMS_X_o_cutoff_
value of the solute mole fraction that centers the cutoff polynomials for the cutoff =1 process;
Units standardConcentrationUnits() const override
Returns the units of the "standard concentration" for this phase.
void getPartialMolarCp(double *cpbar) const override
Partial molar heat capacity of the solution:. UnitsL J/kmol/K.
double standardConcentration(size_t k=0) const override
Return the standard concentration for the kth species.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
void getPartialMolarIntEnergies(double *hbar) const override
Returns an array of partial molar internal energies for the species in the mixture.
void s_updateIMS_lnMolalityActCoeff() const
This function will be called to update the internally stored natural logarithm of the molality activi...
void getMolalityActivityCoefficients(double *acMolality) const override
Get the array of non-dimensional molality-based activity coefficients at the current solution tempera...
void getPartialMolarEntropies(double *sbar) const override
Returns an array of partial molar entropies of the species in the solution.
MolalityVPSSTP is a derived class of ThermoPhase that handles variable pressure standard state method...
A representation of the units associated with a dimensional quantity.
Definition Units.h:35
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595