Cantera  3.1.0a1
Loading...
Searching...
No Matches
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 enthalpy of the solution. Units: J/kmol.
93 /*!
94 * Returns the amount of enthalpy per mole of solution. For an ideal molal
95 * solution,
96 * @f[
97 * \bar{h}(T, P, X_k) = \sum_k X_k \bar{h}_k(T)
98 * @f]
99 * The formula is written in terms of the partial molar enthalpies.
100 * @f$ \bar{h}_k(T, p, m_k) @f$.
101 * See the partial molar enthalpy function, getPartialMolarEnthalpies(),
102 * for details.
103 *
104 * Units: J/kmol
105 */
106 double enthalpy_mole() const override;
107
108 //! Molar internal energy of the solution: Units: J/kmol.
109 /*!
110 * Returns the amount of internal energy per mole of solution. For an ideal
111 * molal solution,
112 * @f[
113 * \bar{u}(T, P, X_k) = \sum_k X_k \bar{u}_k(T)
114 * @f]
115 * The formula is written in terms of the partial molar internal energy.
116 * @f$ \bar{u}_k(T, p, m_k) @f$.
117 */
118 double intEnergy_mole() const override;
119
120 //! Molar entropy of the solution. Units: J/kmol/K.
121 /*!
122 * Returns the amount of entropy per mole of solution. For an ideal molal
123 * solution,
124 * @f[
125 * \bar{s}(T, P, X_k) = \sum_k X_k \bar{s}_k(T)
126 * @f]
127 * The formula is written in terms of the partial molar entropies.
128 * @f$ \bar{s}_k(T, p, m_k) @f$.
129 * See the partial molar entropies function, getPartialMolarEntropies(),
130 * for details.
131 *
132 * Units: J/kmol/K.
133 */
134 double entropy_mole() const override;
135
136 //! Molar Gibbs function for the solution: Units J/kmol.
137 /*!
138 * Returns the Gibbs free energy of the solution per mole of the solution.
139 *
140 * @f[
141 * \bar{g}(T, P, X_k) = \sum_k X_k \mu_k(T)
142 * @f]
143 *
144 * Units: J/kmol
145 */
146 double gibbs_mole() const override;
147
148 //! Molar heat capacity of the solution at constant pressure. Units: J/kmol/K.
149 /*!
150 * @f[
151 * \bar{c}_p(T, P, X_k) = \sum_k X_k \bar{c}_{p,k}(T)
152 * @f]
153 *
154 * Units: J/kmol/K
155 */
156 double cp_mole() const override;
157
158 //! @}
159 //! @name Mechanical Equation of State Properties
160 //!
161 //! In this equation of state implementation, the density is a function only
162 //! of the mole fractions. Therefore, it can't be an independent variable.
163 //! Instead, the pressure is used as the independent variable. Functions
164 //! which try to set the thermodynamic state by calling setDensity() will
165 //! cause an exception to be thrown.
166 //! @{
167
168protected:
169 void calcDensity() override;
170
171public:
172 //! The isothermal compressibility. Units: 1/Pa.
173 /*!
174 * The isothermal compressibility is defined as
175 * @f[
176 * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
177 * @f]
178 *
179 * It's equal to zero for this model, since the molar volume doesn't change
180 * with pressure or temperature.
181 */
182 double isothermalCompressibility() const override;
183
184 //! The thermal expansion coefficient. Units: 1/K.
185 /*!
186 * The thermal expansion coefficient is defined as
187 *
188 * @f[
189 * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
190 * @f]
191 *
192 * It's equal to zero for this model, since the molar volume doesn't change
193 * with pressure or temperature.
194 */
195 double thermalExpansionCoeff() const override;
196
197 //! @}
198 //! @name Activities and Activity Concentrations
199 //!
200 //! The activity @f$ a_k @f$ of a species in solution is related to the
201 //! chemical potential by @f[ \mu_k = \mu_k^0(T) + \hat R T \ln a_k. @f] The
202 //! quantity @f$ \mu_k^0(T) @f$ is the chemical potential at unit activity,
203 //! which depends only on temperature and the pressure.
204 //! @{
205
206 Units standardConcentrationUnits() const override;
207 void getActivityConcentrations(double* c) const override;
208 double standardConcentration(size_t k=0) const override;
209
210 /**
211 * Get the array of non-dimensional activities at the current solution
212 * temperature, pressure, and solution concentration.
213 *
214 * (note solvent is on molar scale)
215 *
216 * @param ac Output activity coefficients. Length: m_kk.
217 */
218 void getActivities(double* ac) const override;
219
220 /**
221 * Get the array of non-dimensional molality-based activity coefficients at
222 * the current solution temperature, pressure, and solution concentration.
223 *
224 * (note solvent is on molar scale. The solvent molar
225 * based activity coefficient is returned).
226 *
227 * @param acMolality Output Molality-based activity coefficients.
228 * Length: m_kk.
229 */
230 void getMolalityActivityCoefficients(double* acMolality) const override;
231
232 //! @}
233 //! @name Partial Molar Properties of the Solution
234 //! @{
235
236 //!Get the species chemical potentials: Units: J/kmol.
237 /*!
238 * This function returns a vector of chemical potentials of the species in
239 * solution.
240 *
241 * @f[
242 * \mu_k = \mu^{o}_k(T,P) + R T \ln(\frac{m_k}{m^\Delta})
243 * @f]
244 * @f[
245 * \mu_w = \mu^{o}_w(T,P) +
246 * R T ((X_w - 1.0) / X_w)
247 * @f]
248 *
249 * @f$ w @f$ refers to the solvent species.
250 * @f$ X_w @f$ is the mole fraction of the solvent.
251 * @f$ m_k @f$ is the molality of the kth solute.
252 * @f$ m^\Delta @f$ is 1 gmol solute per kg solvent.
253 *
254 * Units: J/kmol.
255 *
256 * @param mu Output vector of species chemical potentials. Length: m_kk.
257 */
258 void getChemPotentials(double* mu) const override;
259
260 //! Returns an array of partial molar enthalpies for the species in the
261 //! mixture.
262 /*!
263 * Units (J/kmol). For this phase, the partial molar enthalpies are equal to
264 * the species standard state enthalpies.
265 * @f[
266 * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
267 * @f]
268 * The reference-state pure-species enthalpies, @f$ \hat h^{ref}_k(T) @f$,
269 * at the reference pressure,@f$ P_{ref} @f$, are computed by the species
270 * thermodynamic property manager. They are polynomial functions of
271 * temperature.
272 * @see MultiSpeciesThermo
273 *
274 * @param hbar Output vector of partial molar enthalpies.
275 * Length: m_kk.
276 */
277 void getPartialMolarEnthalpies(double* hbar) const override;
278
279 //! Returns an array of partial molar internal energies for the species in the
280 //! mixture.
281 /*!
282 * Units (J/kmol). For this phase, the partial molar internal energies are equal to
283 * the species standard state internal energies (which are equal to the reference
284 * state internal energies)
285 * @f[
286 * \bar u_k(T,P) = \hat u^{ref}_k(T)
287 * @f]
288 * @param hbar Output vector of partial molar internal energies, length #m_kk
289 */
290 void getPartialMolarIntEnergies(double* hbar) const override;
291
292 //! Returns an array of partial molar entropies of the species in the
293 //! solution. Units: J/kmol.
294 /*!
295 * Maxwell's equations provide an insight in how to calculate this
296 * (p.215 Smith and Van Ness)
297 * @f[
298 * \frac{d(\mu_k)}{dT} = -\bar{s}_i
299 * @f]
300 * For this phase, the partial molar entropies are equal to the standard
301 * state species entropies plus the ideal molal solution contribution.
302 *
303 * @f[
304 * \bar{s}_k(T,P) = s^0_k(T) - R \ln( \frac{m_k}{m^{\triangle}} )
305 * @f]
306 * @f[
307 * \bar{s}_w(T,P) = s^0_w(T) - R ((X_w - 1.0) / X_w)
308 * @f]
309 *
310 * The subscript, w, refers to the solvent species. @f$ X_w @f$ is the mole
311 * fraction of solvent. The reference-state pure-species entropies,@f$
312 * s^0_k(T) @f$, at the reference pressure, @f$ P_{ref} @f$, are computed by
313 * the species thermodynamic property manager. They are polynomial functions
314 * of temperature.
315 * @see MultiSpeciesThermo
316 *
317 * @param sbar Output vector of partial molar entropies.
318 * Length: m_kk.
319 */
320 void getPartialMolarEntropies(double* sbar) const override;
321
322 // partial molar volumes of the species Units: m^3 kmol-1.
323 /*!
324 * For this solution, the partial molar volumes are equal to the constant
325 * species molar volumes.
326 *
327 * Units: m^3 kmol-1.
328 * @param vbar Output vector of partial molar volumes.
329 */
330 void getPartialMolarVolumes(double* vbar) const override;
331
332 //! Partial molar heat capacity of the solution:. UnitsL J/kmol/K
333 /*!
334 * The kth partial molar heat capacity is equal to the temperature
335 * derivative of the partial molar enthalpy of the kth species in the
336 * solution at constant P and composition (p. 220 Smith and Van Ness).
337 * @f[
338 * \bar{Cp}_k(T,P) = {Cp}^0_k(T)
339 * @f]
340 *
341 * For this solution, this is equal to the reference state heat capacities.
342 *
343 * Units: J/kmol/K
344 *
345 * @param cpbar Output vector of partial molar heat capacities.
346 * Length: m_kk.
347 */
348 void getPartialMolarCp(double* cpbar) const override;
349
350 //! @}
351
352 // -------------- Utilities -------------------------------
353
354 bool addSpecies(shared_ptr<Species> spec) override;
355
356 void initThermo() override;
357
358 void getParameters(AnyMap& phaseNode) const override;
359
360 //! Set the standard concentration model.
361 /*!
362 * Must be one of 'unity', 'species-molar-volume', or 'solvent-molar-volume'.
363 * The default is 'solvent-molar-volume'.
364 *
365 * | model | ActivityConc | StandardConc |
366 * | -------------------- | -------------------------------- | ------------------ |
367 * | unity | @f$ {m_k}/ { m^{\Delta}} @f$ | @f$ 1.0 @f$ |
368 * | species-molar-volume | @f$ m_k / (m^{\Delta} V_k) @f$ | @f$ 1.0 / V_k @f$ |
369 * | solvent-molar-volume | @f$ m_k / (m^{\Delta} V^0_0) @f$ | @f$ 1.0 / V^0_0 @f$ |
370 */
371 void setStandardConcentrationModel(const string& model);
372
373 //! Set cutoff model. Must be one of 'none', 'poly', or 'polyExp'.
374 void setCutoffModel(const string& model);
375
376 //! Report the molar volume of species k
377 /*!
378 * units - @f$ m^3 kmol^{-1} @f$
379 *
380 * @param k Species index.
381 */
382 double speciesMolarVolume(int k) const;
383
384 /**
385 * Fill in a return vector containing the species molar volumes
386 * units - @f$ m^3 kmol^{-1} @f$
387 *
388 * @param smv Output vector of species molar volumes.
389 */
390 void getSpeciesMolarVolumes(double* smv) const;
391
392protected:
393 //! Species molar volume @f$ m^3 kmol^{-1} @f$
394 vector<double> m_speciesMolarVolume;
395
396 /**
397 * The standard concentrations can have one of three different forms:
398 * 0 = 'unity', 1 = 'species-molar-volume', 2 = 'solvent-molar-volume'. See
399 * setStandardConcentrationModel().
400 */
401 int m_formGC = 2;
402
403 //! Cutoff type
405
406private:
407 //! vector of size m_kk, used as a temporary holding area.
408 mutable vector<double> m_tmpV;
409
410 //! Logarithm of the molal activity coefficients
411 /*!
412 * Normally these are all one. However, stability schemes will change that
413 */
414 mutable vector<double> IMS_lnActCoeffMolal_;
415public:
416 //! value of the solute mole fraction that centers the cutoff polynomials
417 //! for the cutoff =1 process;
419
420 //! gamma_o value for the cutoff process at the zero solvent point
422
423 //! gamma_k minimum for the cutoff process at the zero solvent point
425
426 //! Parameter in the polyExp cutoff treatment. This is the slope of the f
427 //! function at the zero solvent point. Default value is 0.6
429
430 //! Parameter in the polyExp cutoff treatment. This is the slope of the g
431 //! function at the zero solvent point. Default value is 0.0
433
434 //! @name Parameters in the polyExp cutoff having to do with rate of exp decay
435 //! @{
436 double IMS_cCut_;
437 double IMS_dfCut_ = 0.0;
438 double IMS_efCut_ = 0.0;
439 double IMS_afCut_ = 0.0;
440 double IMS_bfCut_ = 0.0;
441 double IMS_dgCut_ = 0.0;
442 double IMS_egCut_ = 0.0;
443 double IMS_agCut_ = 0.0;
444 double IMS_bgCut_ = 0.0;
445 //! @}
446
447private:
448 //! This function will be called to update the internally stored
449 //! natural logarithm of the molality activity coefficients
450 /*!
451 * Normally the solutes are all zero. However, sometimes they are not,
452 * due to stability schemes.
453 *
454 * gamma_k_molar = gamma_k_molal / Xmol_solvent
455 *
456 * gamma_o_molar = gamma_o_molal
457 */
459
460 //! Calculate parameters for cutoff treatments of activity coefficients
461 /*!
462 * Some cutoff treatments for the activity coefficients actually require
463 * some calculations to create a consistent treatment.
464 *
465 * This routine is called during the setup to calculate these parameters
466 */
468};
469
470}
471
472#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:427
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 enthalpy_mole() const override
Molar enthalpy of the solution. Units: J/kmol.
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.
vector< double > m_tmpV
vector of size m_kk, used as a temporary holding area.
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.
double entropy_mole() const override
Molar entropy of the solution. Units: J/kmol/K.
void calcDensity() override
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
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 .
double cp_mole() const override
Molar heat capacity of the solution at constant pressure. Units: J/kmol/K.
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 gibbs_mole() const override
Molar Gibbs function for the solution: Units J/kmol.
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:564