31 DebyeHuckel::DebyeHuckel() :
33 m_formDH(DHFORM_DILUTE_LIMIT),
35 m_IionicMolality(0.0),
36 m_maxIionicStrength(30.0),
37 m_useHelgesonFixedForm(false),
38 m_IionicMolalityStoich(0.0),
39 m_form_A_Debye(A_DEBYE_CONST),
54 const std::string& id_) :
56 m_formDH(DHFORM_DILUTE_LIMIT),
58 m_IionicMolality(0.0),
59 m_maxIionicStrength(30.0),
60 m_useHelgesonFixedForm(false),
61 m_IionicMolalityStoich(0.0),
62 m_form_A_Debye(A_DEBYE_CONST),
78 m_formDH(DHFORM_DILUTE_LIMIT),
80 m_IionicMolality(0.0),
81 m_maxIionicStrength(3.0),
82 m_useHelgesonFixedForm(false),
83 m_IionicMolalityStoich(0.0),
84 m_form_A_Debye(A_DEBYE_CONST),
100 m_formDH(DHFORM_DILUTE_LIMIT),
102 m_IionicMolality(0.0),
103 m_maxIionicStrength(30.0),
104 m_useHelgesonFixedForm(false),
105 m_IionicMolalityStoich(0.0),
106 m_form_A_Debye(A_DEBYE_CONST),
108 m_B_Debye(3.28640E9),
110 m_densWaterSS(1000.),
142 throw CanteraError(
"DebyHuckel::operator=()",
"Dynamic cast to waterPDSS failed");
213 return hh - pres * molarV;
238 err(
"not implemented");
289 double* vbar = &
m_pp[0];
293 doublereal vtotal = 0.0;
294 for (
size_t i = 0; i <
m_kk; i++) {
295 vtotal += vbar[i] * x[i];
303 throw CanteraError(
"DebyeHuckel::isothermalCompressibility",
310 throw CanteraError(
"DebyeHuckel::thermalExpansionCoeff",
320 "Density is not an independent variable");
329 "molarDensity/density is not an independent variable");
346 for (
size_t k = 0; k <
m_kk; k++) {
354 return 1.0 / mvSolvent;
360 return log(c_solvent);
365 for (
int i = 0; i < sizeUA; i++) {
370 uA[1] = -int(
nDim());
395 for (
size_t k = 0; k <
m_kk; k++) {
412 for (
size_t k = 0; k <
m_kk; k++) {
413 acMolality[k] = exp(acMolality[k]);
437 for (
size_t k = 0; k <
m_kk; k++) {
459 for (
size_t k = 0; k <
m_kk; k++) {
476 for (
size_t k = 0; k <
m_kk; k++) {
494 for (
size_t k = 0; k <
m_kk; k++) {
507 for (
size_t k = 0; k <
m_kk; k++) {
525 for (
size_t k = 0; k <
m_kk; k++) {
541 for (
size_t k = 0; k <
m_kk; k++) {
554 for (
size_t k = 0; k <
m_kk; k++) {
575 for (
size_t k = 0; k <
m_kk; k++) {
598 const char* cc = estString.c_str();
600 const char* ccl = lc.c_str();
601 if (!strcmp(ccl,
"solvent")) {
603 }
else if (!strcmp(ccl,
"chargedspecies")) {
604 return cEST_chargedSpecies;
605 }
else if (!strcmp(ccl,
"weakacidassociated")) {
606 return cEST_weakAcidAssociated;
607 }
else if (!strcmp(ccl,
"strongacidassociated")) {
608 return cEST_strongAcidAssociated;
609 }
else if (!strcmp(ccl,
"polarneutral")) {
610 return cEST_polarNeutral;
611 }
else if (!strcmp(ccl,
"nonpolarneutral")) {
612 return cEST_nonpolarNeutral;
615 if ((retn = sscanf(cc,
"%d", &rval)) != 1) {
624 if (id_.size() > 0) {
625 std::string idp = phaseNode.
id();
628 "phasenode and Id are incompatible");
635 if (!phaseNode.
hasChild(
"thermo")) {
637 "no thermo XML node");
645 if (thermoNode.
hasChild(
"activityCoefficients")) {
648 std::string formString = scNode.
attrib(
"model");
649 if (formString !=
"") {
650 if (formString ==
"Dilute_limit") {
652 }
else if (formString ==
"Bdot_with_variable_a") {
654 }
else if (formString ==
"Bdot_with_common_a") {
656 }
else if (formString ==
"Beta_ij") {
658 }
else if (formString ==
"Pitzer_with_Beta_ij") {
662 "Unknown standardConc model: " + formString);
678 if (thermoNode.
hasChild(
"standardConc")) {
681 std::string formString = scNode.
attrib(
"model");
682 if (formString !=
"") {
683 if (formString ==
"unity") {
685 printf(
"exit standardConc = unity not done\n");
687 }
else if (formString ==
"molar_volume") {
689 printf(
"exit standardConc = molar_volume not done\n");
691 }
else if (formString ==
"solvent_volume") {
695 "Unknown standardConc model: " + formString);
707 std::string solventName =
"";
708 if (thermoNode.
hasChild(
"solvent")) {
710 vector<std::string> nameSolventa;
712 int nsp =
static_cast<int>(nameSolventa.size());
715 "badly formed solvent XML node");
717 solventName = nameSolventa[0];
719 for (
size_t k = 0; k <
m_kk; k++) {
721 if (solventName == sname) {
727 cout <<
"DebyeHuckel::initThermoXML: Solvent Name not found"
730 "Solvent name not found");
734 "Solvent " + solventName +
735 " should be first species");
755 for (
size_t k = 0; k <
m_kk; k++) {
759 "Species Data Base " + sss[k] +
" not found");
764 "Species " + sss[k] +
765 " standardState XML block not found");
767 std::string modelStringa = ss->
attrib(
"model");
768 if (modelStringa ==
"") {
770 "Species " + sss[k] +
771 " standardState XML block model attribute not found");
773 std::string modelString =
lowercase(modelStringa);
776 if (modelString ==
"wateriapws" || modelString ==
"real_water" ||
777 modelString ==
"waterpdss") {
784 "Dynamic cast to PDSS_Water failed");
795 #ifdef DEBUG_MODE_NOT
796 cout <<
"Solvent species " << sss[k] <<
" has volume " <<
799 }
else if (modelString ==
"constant_incompressible") {
801 #ifdef DEBUG_MODE_NOT
802 cout <<
"species " << sss[k] <<
" has volume " <<
807 "Solvent SS Model \"" + modelStringa +
811 if (modelString !=
"constant_incompressible") {
813 "Solute SS Model \"" + modelStringa +
817 #ifdef DEBUG_MODE_NOT
818 cout <<
"species " << sss[k] <<
" has volume " <<
830 if (thermoNode.
hasChild(
"activityCoefficients")) {
838 string modelStringa = ss->
attrib(
"model");
839 string modelString =
lowercase(modelStringa);
840 if (modelString !=
"") {
841 if (modelString ==
"water") {
845 "A_Debye Model \"" + modelStringa +
851 cout <<
"A_Debye = " <<
m_A_Debye << endl;
871 cout <<
"B_Debye = " <<
m_B_Debye << endl;
883 "B_dot entry in the wrong DH form");
885 double bdot_common =
getFloat(acNode,
"B_dot");
887 cout <<
"B_dot = " << bdot_common << endl;
892 for (
size_t k = 0; k <
m_kk; k++) {
894 if (fabs(z_k) > 0.0001) {
905 if (acNode.
hasChild(
"maxIonicStrength")) {
908 cout <<
"m_maxIionicStrength = "
916 if (acNode.
hasChild(
"UseHelgesonFixedForm")) {
925 if (acNode.
hasChild(
"ionicRadius")) {
928 double Afactor = 1.0;
930 std::string Aunits = irNode.
attrib(
"units");
931 Afactor =
toSI(Aunits);
935 std::string ads = irNode.
attrib(
"default");
937 for (
size_t k = 0; k <
m_kk; k++) {
960 map<string, string> m;
969 map<std::string,std::string>::const_iterator _b = m.begin();
970 for (; _b != m.end(); ++_b) {
983 if (acNode.
hasChild(
"DHBetaMatrix")) {
991 "DHBetaMatrix found for wrong type");
1003 for (
size_t k = 0; k <
m_kk; k++) {
1011 std::vector<const XML_Node*> xspecies=
speciesData();
1012 std::string kname, jname;
1013 size_t jj = xspecies.size();
1014 for (
size_t k = 0; k <
m_kk; k++) {
1017 for (
size_t j = 0; j < jj; j++) {
1020 if (jname == kname) {
1026 const XML_Node& sp = *xspecies[jmap];
1028 double val =
getFloat(sp,
"stoichIsMods");
1038 if (acNodePtr->
hasChild(
"stoichIsMods")) {
1041 map<std::string, std::string> msIs;
1043 map<std::string,std::string>::const_iterator _b = msIs.begin();
1044 for (; _b != msIs.end(); ++_b) {
1046 double val =
fpValue(_b->second);
1060 for (
size_t k = 0; k <
m_kk; k++) {
1079 std::vector<const XML_Node*> xspecies=
speciesData();
1082 for (
size_t k = 0; k <
m_kk; k++) {
1084 spPtr = xspecies[k];
1086 if (spPtr->
hasChild(
"electrolyteSpeciesType")) {
1087 std::string est =
getChildValue(*spPtr,
"electrolyteSpeciesType");
1090 "Bad electrolyte type: " + est);
1099 if (acNodePtr->
hasChild(
"electrolyteSpeciesType")) {
1100 XML_Node& ESTNode = acNodePtr->
child(
"electrolyteSpeciesType");
1101 map<std::string, std::string> msEST;
1103 map<std::string,std::string>::const_iterator _b = msEST.begin();
1104 for (; _b != msEST.end(); ++_b) {
1106 std::string est = _b->second;
1109 "Bad electrolyte type: " + est);
1145 if (tempArg != -1.0) {
1149 if (presArg != -1.0) {
1162 printf(
"shouldn't be here\n");
1171 if (tempArg != -1.0) {
1175 if (presArg != -1.0) {
1187 printf(
"shouldn't be here\n");
1196 if (tempArg != -1.0) {
1200 if (presArg != -1.0) {
1212 printf(
"shouldn't be here\n");
1221 if (tempArg != -1.0) {
1225 if (presArg != -1.0) {
1237 printf(
"shouldn't be here\n");
1259 "Unfinished func called: " + msg);
1282 m_formDH == DHFORM_PITZER_BETAIJ) {
1289 double I2 = IionicMolality * IionicMolality;
1290 double l10actCoeff =
1294 return pow(10.0 , l10actCoeff);
1299 const double a0 = 1.454;
1300 const double b0 = 0.02236;
1301 const double c0 = 9.380E-3;
1302 const double d0 = -5.362E-4;
1307 double Is2 = Is * Is;
1308 double bhat = 1.0 + a0 * sqrt(Is);
1309 double func = bhat - 2.0 * log(bhat) - 1.0/bhat;
1310 double v1 =
m_A_Debye / (a0 * a0 * a0 * Is) * func;
1311 double oc = 1.0 - v1 + b0 * Is / 2.0 + 2.0 * c0 * Is2 / 3.0
1312 + 3.0 * d0 * Is2 * Is / 4.0;
1324 for (
size_t k = 0; k <
m_kk; k++) {
1337 double z_k, zs_k1, zs_k2;
1350 for (
size_t k = 0; k <
m_kk; k++) {
1364 for (
size_t k = 0; k <
m_kk; k++) {
1370 zs_k2 = z_k - zs_k1;
1397 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1400 double ac_nonPolar = 1.0;
1404 double lnActivitySolvent = 0.0;
1407 double y, yp1, sigma;
1409 case DHFORM_DILUTE_LIMIT:
1410 for (
size_t k = 0; k <
m_kk; k++) {
1415 (xmolSolvent - 1.0)/xmolSolvent +
1420 case DHFORM_BDOT_AK:
1422 for (
size_t k = 0; k <
m_kk; k++) {
1424 if (est == cEST_nonpolarNeutral) {
1429 - z_k * z_k * numTmp / (1.0 + denomTmp *
m_Aionic[k])
1434 lnActivitySolvent = (xmolSolvent - 1.0)/xmolSolvent;
1438 if (denomTmp > 0.0) {
1439 for (
size_t k = 0; k <
m_kk; k++) {
1443 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1449 lnActivitySolvent += coeff * tmp;
1451 for (
size_t k = 0; k <
m_kk; k++) {
1457 lnActivitySolvent -=
1469 case DHFORM_BDOT_ACOMMON:
1471 for (
size_t k = 0; k <
m_kk; k++) {
1474 - z_k * z_k * numTmp / (1.0 + denomTmp)
1477 if (denomTmp > 0.0) {
1480 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1485 (xmolSolvent - 1.0)/xmolSolvent +
1489 for (
size_t k = 0; k <
m_kk; k++) {
1495 lnActivitySolvent -=
1504 (xmolSolvent - 1.0)/xmolSolvent;
1506 for (
size_t k = 0; k <
m_kk; k++) {
1510 - z_k * z_k * numTmp / (1.0 + denomTmp);
1511 for (
size_t j = 0; j <
m_kk; j++) {
1513 #ifdef DEBUG_HKM_NOT
1515 printf(
"b: k = %d, j = %d, betakj = %g\n",
1523 if (denomTmp > 0.0) {
1526 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 -2.0*log(yp1));
1531 (xmolSolvent - 1.0)/xmolSolvent +
1535 for (
size_t k = 0; k <
m_kk; k++) {
1536 for (
size_t j = 0; j <
m_kk; j++) {
1544 case DHFORM_PITZER_BETAIJ:
1546 denomTmp *= m_Aionic[0];
1548 tmpLn = log(1.0 + denomTmp);
1549 for (
size_t k = 0; k <
m_kk; k++) {
1553 - z_k * z_k * numTmp / 3.0 / (1.0 + denomTmp);
1557 for (
size_t j = 0; j <
m_kk; j++) {
1563 sigma = 1.0 / (1.0 + denomTmp);
1565 (xmolSolvent - 1.0)/xmolSolvent +
1569 for (
size_t k = 0; k <
m_kk; k++) {
1570 for (
size_t j = 0; j <
m_kk; j++) {
1590 lnActivitySolvent - log(xmolSolvent);
1595 double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
1599 for (
size_t k = 0; k <
m_kk; k++) {
1609 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1613 double numdAdTTmp = dAdT * sqrtI;
1615 double d_lnActivitySolvent_dT = 0;
1618 case DHFORM_DILUTE_LIMIT:
1619 for (
size_t k = 1; k <
m_kk; k++) {
1623 d_lnActivitySolvent_dT = 2.0 / 3.0 * dAdT *
m_Mnaught *
1628 case DHFORM_BDOT_AK:
1629 for (
size_t k = 0; k <
m_kk; k++) {
1632 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp *
m_Aionic[k]);
1637 coeff = 2.0 / 3.0 * dAdT *
m_Mnaught * sqrtI;
1639 if (denomTmp > 0.0) {
1640 for (
size_t k = 0; k <
m_kk; k++) {
1643 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1651 case DHFORM_BDOT_ACOMMON:
1653 for (
size_t k = 0; k <
m_kk; k++) {
1656 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp);
1658 if (denomTmp > 0.0) {
1661 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1672 for (
size_t k = 0; k <
m_kk; k++) {
1676 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp);
1679 if (denomTmp > 0.0) {
1682 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1691 case DHFORM_PITZER_BETAIJ:
1693 tmpLn = log(1.0 + denomTmp);
1694 for (
size_t k = 0; k <
m_kk; k++) {
1698 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp)
1699 - 2.0 * z_k * z_k * dAdT * tmpLn
1705 sigma = 1.0 / (1.0 + denomTmp);
1722 double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
1725 if (d2AdT2 == 0.0 && dAdT == 0.0) {
1726 for (
size_t k = 0; k <
m_kk; k++) {
1737 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1741 double numd2AdT2Tmp = d2AdT2 * sqrtI;
1745 case DHFORM_DILUTE_LIMIT:
1746 for (
size_t k = 0; k <
m_kk; k++) {
1752 case DHFORM_BDOT_AK:
1753 for (
size_t k = 0; k <
m_kk; k++) {
1756 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp *
m_Aionic[k]);
1761 coeff = 2.0 / 3.0 * d2AdT2 *
m_Mnaught * sqrtI;
1763 if (denomTmp > 0.0) {
1764 for (
size_t k = 0; k <
m_kk; k++) {
1767 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1775 case DHFORM_BDOT_ACOMMON:
1777 for (
size_t k = 0; k <
m_kk; k++) {
1780 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp);
1782 if (denomTmp > 0.0) {
1785 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1796 for (
size_t k = 0; k <
m_kk; k++) {
1800 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp);
1803 if (denomTmp > 0.0) {
1806 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 -2.0*log(yp1));
1815 case DHFORM_PITZER_BETAIJ:
1817 tmpLn = log(1.0 + denomTmp);
1818 for (
size_t k = 0; k <
m_kk; k++) {
1822 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp)
1823 - 2.0 * z_k * z_k * d2AdT2 * tmpLn
1829 sigma = 1.0 / (1.0 + denomTmp);
1844 double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
1848 for (
size_t k = 0; k <
m_kk; k++) {
1858 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1862 double numdAdPTmp = dAdP * sqrtI;
1866 case DHFORM_DILUTE_LIMIT:
1867 for (
size_t k = 0; k <
m_kk; k++) {
1873 case DHFORM_BDOT_AK:
1874 for (
size_t k = 0; k <
m_kk; k++) {
1876 if (est == cEST_nonpolarNeutral) {
1881 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp *
m_Aionic[k]);
1887 coeff = 2.0 / 3.0 * dAdP *
m_Mnaught * sqrtI;
1889 if (denomTmp > 0.0) {
1890 for (
size_t k = 0; k <
m_kk; k++) {
1893 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1901 case DHFORM_BDOT_ACOMMON:
1903 for (
size_t k = 0; k <
m_kk; k++) {
1906 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp);
1908 if (denomTmp > 0.0) {
1911 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1922 for (
size_t k = 0; k <
m_kk; k++) {
1926 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp);
1929 if (denomTmp > 0.0) {
1932 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1941 case DHFORM_PITZER_BETAIJ:
1943 tmpLn = log(1.0 + denomTmp);
1944 for (
size_t k = 0; k <
m_kk; k++) {
1948 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp)
1949 - 2.0 * z_k * z_k * dAdP * tmpLn
1955 sigma = 1.0 / (1.0 + denomTmp);
const int cEST_solvent
Electrolyte species type.
double m_IionicMolalityStoich
Stoichiometric ionic strength on the molality scale.
doublereal fpValue(const std::string &val)
Translate a string into one doublereal value.
XML_Node * findByAttr(const std::string &attr, const std::string &val, int depth=100000) const
This routine carries out a recursive search for an XML node based on an attribute of each XML node...
void s_update_d2lnMolalityActCoeff_dT2() const
Calculate the temperature 2nd derivative of the activity coefficient.
double _lnactivityWaterHelgesonFixedForm() const
Formula for the log of the water activity that occurs in the GWB.
int m_form_A_Debye
Form of the constant outside the Debye-Huckel term called A.
virtual doublereal density() const
Density (kg/m^3).
virtual double A_Debye_TP(double temperature=-1.0, double pressure=-1.0) const
Return the Debye Huckel constant as a function of temperature and pressure (Units = sqrt(kg/gmol)) ...
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
static int interp_est(const std::string &estString)
Utility function to assign an integer value from a string for the ElectrolyteSpeciesType field...
const doublereal OneAtm
One atmosphere [Pa].
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
vector_fp m_dlnActCoeffMolaldT
Derivative of log act coeff wrt T.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the array, and fill the new entries with 'v'.
doublereal m_Mnaught
This is the multiplication factor that goes inside log expressions involving the molalities of specie...
virtual doublereal isothermalCompressibility() const
The isothermal compressibility.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of each species in their standard states at the current T and P of the solution...
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
doublereal toSI(const std::string &unit)
Return the conversion factor to convert unit std::string 'unit' to SI units.
const size_t npos
index returned by functions to indicate "no position"
vector_fp m_speciesCharge
Vector of species charges. length m_kk.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
ThermoPhase * duplMyselfAsThermoPhase() const
Duplicator from the ThermoPhase parent class.
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the standard state of the species at ...
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Class XML_Node is a tree-based representation of the contents of an XML file.
Implementation of a pressure dependent standard state virtual function for a Pure Water Phase (see Sp...
virtual void initThermo()
Initialize the object's internal lengths after species are set.
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
virtual double d2A_DebyedT2_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the 2nd derivative of the Debye Huckel constant with respect to temperature as a function of...
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
vector_fp m_speciesSize
Vector of species sizes.
doublereal getFloat(const Cantera::XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
bool m_useHelgesonFixedForm
If true, then the fixed for of Helgeson's activity for water is used instead of the rigorous form obt...
Header for a class used to house several approximation routines for properties of water...
virtual double dA_DebyedP_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the derivative of the Debye Huckel constant with respect to pressure, as a function of tempe...
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
doublereal molarDensity() const
Molar density (kmol/m^3).
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
virtual doublereal density() const
Return the standard state density at standard state.
doublereal err(const std::string &msg) const
Bail out of functions with an error exit if they are not implemented.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
void setDensity(const doublereal rho)
Set the internally stored density (gm/m^3) of the phase.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Headers for the DebyeHuckel ThermoPhase object, which models dilute electrolyte solutions (see Thermo...
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
const int cDebyeHuckel0
eosTypes returned for this ThermoPhase Object
DebyeHuckel()
Default Constructor.
virtual int eosType() const
Equation of state type flag.
Class DebyeHuckel represents a dilute liquid electrolyte phase which obeys the Debye Huckel formulati...
Base class for a phase with thermodynamic properties.
virtual void setTemperature(const doublereal temp)
Set the temperature (K)
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
const XML_Node * findByName(const std::string &nm, int depth=100000) const
This routine carries out a recursive search for an XML node based on the name of the node...
virtual double dA_DebyedT_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the derivative of the Debye Huckel constant with respect to temperature. ...
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
bool importPhase(XML_Node &phase, ThermoPhase *th, SpeciesThermoFactory *spfactory)
Import a phase information into an empty thermophase object.
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
The WaterProps class is used to house several approximation routines for properties of water...
Array2D m_Beta_ij
Array of 2D data used in the DHFORM_BETAIJ formulation Beta_ij.value(i,j) is the coefficient of the j...
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
void s_update_lnMolalityActCoeff() const
Calculate the log activity coefficients.
vector_fp m_Aionic
a_k = Size of the ionic species in the DH formulation units = meters
Class for the liquid water pressure dependent standard state.
MolalityVPSSTP & operator=(const MolalityVPSSTP &b)
Assignment operator.
double _nonpolarActCoeff(double IionicMolality) const
Static function that implements the non-polar species salt-out modifications.
double m_maxIionicStrength
Maximum value of the ionic strength allowed in the calculation of the activity coefficients.
int m_formDH
form of the Debye-Huckel parameterization used in the model.
double m_A_Debye
Current value of the Debye Constant, A_Debye.
vector_fp m_lnActCoeffMolal
Logarithm of the activity coefficients on the molality scale.
Base class for exceptions thrown by Cantera classes.
PDSS_Water * m_waterSS
Pointer to the Water standard state object.
vector_fp m_B_Dot
Array of B_Dot values.
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
int m_formGC
Format for the generalized concentration:
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
double _osmoticCoeffHelgesonFixedForm() const
Formula for the osmotic coefficient that occurs in the GWB.
virtual void setStateFromXML(const XML_Node &state)
Set equation of state parameter values from XML entries.
doublereal & value(size_t i, size_t j)
Returns a changeable reference to position in the matrix.
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution. Units: J/kmol.
void initLengths()
Initialize the internal lengths.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
DebyeHuckel & operator=(const DebyeHuckel &)
Assignment operator.
vector_int m_electrolyteSpeciesType
Vector containing the electrolyte species type.
size_t nSpecies() const
Returns the number of species in the phase.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
void s_update_dlnMolalityActCoeff_dT() const
Calculation of temperature derivative of activity coefficient.
const std::vector< std::string > & speciesNames() const
Return a const reference to the vector of species names.
vector_fp m_speciesCharge_Stoich
Stoichiometric species charge -> This is for calculations of the ionic strength which ignore ion-ion ...
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
virtual doublereal intEnergy_mole() const
Molar internal energy of the solution. Units: J/kmol.
double m_IionicMolality
Current value of the ionic strength on the molality scale.
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
doublereal temperature() const
Temperature (K).
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
double AionicRadius(int k=0) const
Reports the ionic radius of the kth species.
vector_fp m_molalities
Current value of the molalities of the species in the phase.
std::string id() const
Return the id attribute, if present.
const doublereal SmallNumber
smallest number to compare to zero.
vector_fp m_npActCoeff
These are coefficients to describe the increase in activity coeff for non-polar molecules due to the ...
vector_fp m_d2lnActCoeffMolaldT2
2nd Derivative of log act coeff wrt T
void getStringArray(const Cantera::XML_Node &node, std::vector< std::string > &v)
This function interprets the value portion of an XML element as a string.
vector_fp m_tmpV
vector of size m_kk, used as a temporary holding area.
virtual void setTemperature(const doublereal temp)
Set the internally stored temperature of the phase (K).
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
doublereal molecularWeight() const
Return the molecular weight of the species in units of kg kmol-1.
vector_fp m_pp
Temporary array used in equilibrium calculations.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
double m_B_Debye
Current value of the constant that appears in the denominator.
void s_update_dlnMolalityActCoeff_dP() const
Calculate the pressure derivative of the activity coefficient.
void getMatrixValues(const Cantera::XML_Node &node, const std::vector< std::string > &keyStringRow, const std::vector< std::string > &keyStringCol, Cantera::Array2D &retnValues, const bool convert, const bool matrixSymmetric)
This function interprets the value portion of an XML element as a series of "Matrix ids and entries" ...
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
WaterProps * m_waterProps
Pointer to the water property calculator.
Contains declarations for string manipulation functions within Cantera.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Process the XML file after species are set up.
doublereal ADebye(doublereal T, doublereal P, int ifunc)
ADebye calculates the value of A_Debye as a function of temperature and pressure according to relatio...
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities at the current solution temperature, pressure, and solution concentration.
size_t m_kk
Number of species in the phase.
vector_fp m_dlnActCoeffMolaldP
Derivative of log act coeff wrt P.
virtual void getMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of non-dimensional molality-based activity coefficients at the current solution tempera...
void getMap(const Cantera::XML_Node &node, std::map< std::string, std::string > &m)
This routine is used to interpret the value portions of XML elements that contain colon separated pai...
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
doublereal m_Pcurrent
Current value of the pressure - state variable.
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity.
XML_Node & root() const
Return the root of the current XML_Node tree.
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and generalized concentrations.
size_t m_indexSolvent
Index of the solvent.
virtual ~DebyeHuckel()
Destructor.
std::string getChildValue(const Cantera::XML_Node &parent, const std::string &nameString)
This function reads a child node with the name, nameString, and returns its xml value as the return s...
virtual doublereal thermalExpansionCoeff() const
The thermal expansion coefficient.
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
void calcMolalities() const
Calculates the molality of all species and stores the result internally.
std::string speciesName(size_t k) const
Name of the species with index k.
XML_Node * get_XML_NameID(const std::string &nameTarget, const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase Note the density of a phase is an independent...
bool hasAttrib(const std::string &a) const
Tests whether the current node has an attribute with a particular name.
double m_densWaterSS
Storage for the density of water's standard state.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
virtual void setMolarDensity(const doublereal conc)
Set the internally stored molar density (kmol/m^3) of the phase.
virtual void _updateStandardStateThermo() const
Updates the standard state thermodynamic functions at the current T and P of the solution.