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