Fix IdealMolalSolution::standardConcentration
Standard concentrations in the IdealMolalSolution phase depend on a user-specified m_formGC parameter, where m_formGC=0 results in a standard concentration of 1.0, m_formGC = 1 is supposed to result in a standard concentration for species k equal to 1 divided by the molar volume of species k, and m_formGC = 2 is supposed to result in a standard concentration equal to 1 divided by the molar volume of the solvent species (which is species 0). Current behavior is that m_formGC = 1 and m_formGC = 2 *both* result in a standard concentration of 1 divided by molar vlume of the solvent. This commit fixes how this is handled, cleans up the switch statement (the three cases were written somewhat inconsistently), and throws an error if m_formGC is set < 0 or > 2.
This commit is contained in:
parent
b8d5eb405a
commit
3c9bbc4ec9
1 changed files with 7 additions and 7 deletions
|
|
@ -176,18 +176,18 @@ void IdealMolalSoln::getActivityConcentrations(doublereal* c) const
|
|||
|
||||
doublereal IdealMolalSoln::standardConcentration(size_t k) const
|
||||
{
|
||||
double c0 = 1.0;
|
||||
switch (m_formGC) {
|
||||
case 0:
|
||||
break;
|
||||
return 1.0;
|
||||
case 1:
|
||||
return c0 = 1.0 /m_speciesMolarVolume[0];
|
||||
break;
|
||||
return 1.0 / m_speciesMolarVolume[k];
|
||||
case 2:
|
||||
c0 = 1.0 / m_speciesMolarVolume[0];
|
||||
break;
|
||||
return 1.0 / m_speciesMolarVolume[0];
|
||||
default:
|
||||
throw CanteraError("IdealMolalSoln::standardConcentration",
|
||||
"m_formGC is set to an incorrect value. \
|
||||
Allowed values are 0, 1, and 2");
|
||||
}
|
||||
return c0;
|
||||
}
|
||||
|
||||
void IdealMolalSoln::getActivities(doublereal* ac) const
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue