Cantera  4.0.0a1
Loading...
Searching...
No Matches
GibbsExcessVPSSTP.cpp
Go to the documentation of this file.
1/**
2 * @file GibbsExcessVPSSTP.cpp
3 * Definitions for intermediate ThermoPhase object for phases which
4 * employ excess Gibbs free energy formulations
5 * (see @ref thermoprops and class @link Cantera::GibbsExcessVPSSTP GibbsExcessVPSSTP@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 expressions for the excess Gibbs free energy expressed as
10 * a function of the mole fractions.
11 */
12
13// This file is part of Cantera. See License.txt in the top-level directory or
14// at https://cantera.org/license.txt for license and copyright information.
15
18#include "cantera/base/global.h"
19#include <numeric>
20
21namespace Cantera
22{
23
25{
28}
29
30// - Activities, Standard States, Activity Concentrations -----------
31
33{
34 return Units(1.0); // dimensionless
35}
36
38{
40}
41
43{
44 return 1.0;
45}
46
48{
49 return 0.0;
50}
51
52void GibbsExcessVPSSTP::getActivities(span<double> ac) const
53{
56 for (size_t k = 0; k < m_kk; k++) {
57 ac[k] *= moleFractions_[k];
58 }
59}
60
61void GibbsExcessVPSSTP::getActivityCoefficients(span<double> const ac) const
62{
64 for (size_t k = 0; k < m_kk; k++) {
65 if (ac[k] > 700.) {
66 ac[k] = exp(700.0);
67 } else if (ac[k] < -700.) {
68 ac[k] = exp(-700.0);
69 } else {
70 ac[k] = exp(ac[k]);
71 }
72 }
73}
74
75// ------------ Partial Molar Properties of the Solution ------------
76
77void GibbsExcessVPSSTP::getPartialMolarVolumes(span<double> vbar) const
78{
79 // Get the standard state values in m^3 kmol-1
81}
82
83bool GibbsExcessVPSSTP::addSpecies(shared_ptr<Species> spec)
84{
85 bool added = VPStandardStateTP::addSpecies(spec);
86 if (added) {
87 if (m_kk == 1) {
88 moleFractions_.push_back(1.0);
89 } else {
90 moleFractions_.push_back(0.0);
91 }
92 lnActCoeff_Scaled_.push_back(0.0);
93 dlnActCoeffdT_Scaled_.push_back(0.0);
94 d2lnActCoeffdT2_Scaled_.push_back(0.0);
95 dlnActCoeffdlnX_diag_.push_back(0.0);
96 dlnActCoeffdlnN_diag_.push_back(0.0);
98 }
99 return added;
100}
101
102} // end of namespace Cantera
Header for intermediate ThermoPhase object for phases which employ Gibbs excess free energy based for...
virtual void resize(size_t n, size_t m, double v=0.0)
Resize the array, and fill the new entries with 'v'.
Definition Array.cpp:52
vector< double > d2lnActCoeffdT2_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
double logStandardConc(size_t k=0) const override
Natural logarithm of the standard concentration of the kth species.
Array2D dlnActCoeffdlnN_
Storage for the current derivative values of the gradients with respect to logarithm of the species m...
void getActivityCoefficients(span< double > ac) const override
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
vector< double > lnActCoeff_Scaled_
Storage for the current values of the activity coefficients of the species.
vector< double > dlnActCoeffdlnX_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
void getActivities(span< double > ac) const override
Get the array of non-dimensional activities (molality based for this class and classes that derive fr...
vector< double > moleFractions_
Storage for the current values of the mole fractions of the species.
vector< double > dlnActCoeffdT_Scaled_
Storage for the current derivative values of the gradients with respect to temperature of the log of ...
void getPartialMolarVolumes(span< double > vbar) const override
Return an array of partial molar volumes for the species in the mixture.
Units standardConcentrationUnits() const override
Returns the units of the "standard concentration" for this phase.
void compositionChanged() override
Apply changes to the state which are needed after the composition changes.
double standardConcentration(size_t k=0) const override
The standard concentration used to normalize the generalized concentration.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
void getActivityConcentrations(span< double > c) const override
This method returns an array of generalized concentrations.
vector< double > dlnActCoeffdlnN_diag_
Storage for the current derivative values of the gradients with respect to logarithm of the mole frac...
void getMoleFractions(span< double > x) const
Get the species mole fraction vector.
Definition Phase.cpp:451
size_t m_kk
Number of species in the phase.
Definition Phase.h:882
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
Definition Phase.cpp:987
virtual void getLnActivityCoefficients(span< double > lnac) const
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
A representation of the units associated with a dimensional quantity.
Definition Units.h:35
void getStandardVolumes(span< double > vol) const override
Get the molar volumes of the species standard states at the current T and P of the solution.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
Contains declarations for string manipulation functions within Cantera.