30 DebyeHuckel::DebyeHuckel() :
31 m_formDH(DHFORM_DILUTE_LIMIT),
33 m_IionicMolality(0.0),
34 m_maxIionicStrength(30.0),
35 m_useHelgesonFixedForm(false),
36 m_IionicMolalityStoich(0.0),
37 m_form_A_Debye(A_DEBYE_CONST),
52 const std::string& id_) :
53 m_formDH(DHFORM_DILUTE_LIMIT),
55 m_IionicMolality(0.0),
56 m_maxIionicStrength(30.0),
57 m_useHelgesonFixedForm(false),
58 m_IionicMolalityStoich(0.0),
59 m_form_A_Debye(A_DEBYE_CONST),
74 m_formDH(DHFORM_DILUTE_LIMIT),
76 m_IionicMolality(0.0),
77 m_maxIionicStrength(3.0),
78 m_useHelgesonFixedForm(false),
79 m_IionicMolalityStoich(0.0),
80 m_form_A_Debye(A_DEBYE_CONST),
95 m_formDH(DHFORM_DILUTE_LIMIT),
97 m_IionicMolality(0.0),
98 m_maxIionicStrength(30.0),
99 m_useHelgesonFixedForm(false),
100 m_IionicMolalityStoich(0.0),
101 m_form_A_Debye(A_DEBYE_CONST),
103 m_B_Debye(3.28640E9),
105 m_densWaterSS(1000.),
136 throw CanteraError(
"DebyHuckel::operator=()",
"Dynamic cast to waterPDSS failed");
269 double* vbar = &
m_pp[0];
273 doublereal vtotal = 0.0;
274 for (
size_t i = 0; i <
m_kk; i++) {
275 vtotal += vbar[i] * x[i];
286 "Density is not an independent variable");
295 "molarDensity/density is not an independent variable");
312 for (
size_t k = 0; k <
m_kk; k++) {
320 return 1.0 / mvSolvent;
326 "To be removed after Cantera 2.2.");
327 for (
int i = 0; i < sizeUA; i++) {
332 uA[1] = -int(
nDim());
357 for (
size_t k = 0; k <
m_kk; k++) {
373 for (
size_t k = 0; k <
m_kk; k++) {
374 acMolality[k] = exp(acMolality[k]);
398 for (
size_t k = 0; k <
m_kk; k++) {
420 for (
size_t k = 0; k <
m_kk; k++) {
437 for (
size_t k = 0; k <
m_kk; k++) {
454 for (
size_t k = 0; k <
m_kk; k++) {
467 for (
size_t k = 0; k <
m_kk; k++) {
485 for (
size_t k = 0; k <
m_kk; k++) {
501 for (
size_t k = 0; k <
m_kk; k++) {
514 for (
size_t k = 0; k <
m_kk; k++) {
535 for (
size_t k = 0; k <
m_kk; k++) {
558 const char* cc = estString.c_str();
560 const char* ccl = lc.c_str();
561 if (!strcmp(ccl,
"solvent")) {
563 }
else if (!strcmp(ccl,
"chargedspecies")) {
564 return cEST_chargedSpecies;
565 }
else if (!strcmp(ccl,
"weakacidassociated")) {
566 return cEST_weakAcidAssociated;
567 }
else if (!strcmp(ccl,
"strongacidassociated")) {
568 return cEST_strongAcidAssociated;
569 }
else if (!strcmp(ccl,
"polarneutral")) {
570 return cEST_polarNeutral;
571 }
else if (!strcmp(ccl,
"nonpolarneutral")) {
572 return cEST_nonpolarNeutral;
575 if ((retn = sscanf(cc,
"%d", &rval)) != 1) {
583 if (id_.size() > 0) {
584 std::string idp = phaseNode.
id();
587 "phasenode and Id are incompatible");
594 if (!phaseNode.
hasChild(
"thermo")) {
596 "no thermo XML node");
604 if (thermoNode.
hasChild(
"activityCoefficients")) {
607 std::string formString = scNode.
attrib(
"model");
608 if (formString !=
"") {
609 if (formString ==
"Dilute_limit") {
611 }
else if (formString ==
"Bdot_with_variable_a") {
613 }
else if (formString ==
"Bdot_with_common_a") {
615 }
else if (formString ==
"Beta_ij") {
617 }
else if (formString ==
"Pitzer_with_Beta_ij") {
621 "Unknown standardConc model: " + formString);
635 if (thermoNode.
hasChild(
"standardConc")) {
638 std::string formString = scNode.
attrib(
"model");
639 if (formString !=
"") {
640 if (formString ==
"unity") {
643 "standardConc = unity not done");
644 }
else if (formString ==
"molar_volume") {
647 "standardConc = molar_volume not done");
648 }
else if (formString ==
"solvent_volume") {
652 "Unknown standardConc model: " + formString);
664 std::string solventName =
"";
665 if (thermoNode.
hasChild(
"solvent")) {
667 vector<std::string> nameSolventa;
669 if (nameSolventa.size() != 1) {
671 "badly formed solvent XML node");
673 solventName = nameSolventa[0];
675 for (
size_t k = 0; k <
m_kk; k++) {
677 if (solventName == sname) {
683 cout <<
"DebyeHuckel::initThermoXML: Solvent Name not found"
686 "Solvent name not found");
690 "Solvent " + solventName +
691 " should be first species");
711 for (
size_t k = 0; k <
m_kk; k++) {
715 "Species Data Base " + sss[k] +
" not found");
720 "Species " + sss[k] +
721 " standardState XML block not found");
723 std::string modelStringa = ss->
attrib(
"model");
724 if (modelStringa ==
"") {
726 "Species " + sss[k] +
727 " standardState XML block model attribute not found");
729 std::string modelString =
lowercase(modelStringa);
732 if (modelString ==
"wateriapws" || modelString ==
"real_water" ||
733 modelString ==
"waterpdss") {
740 "Dynamic cast to PDSS_Water failed");
751 #ifdef DEBUG_MODE_NOT
752 cout <<
"Solvent species " << sss[k] <<
" has volume " <<
755 }
else if (modelString ==
"constant_incompressible") {
757 #ifdef DEBUG_MODE_NOT
758 cout <<
"species " << sss[k] <<
" has volume " <<
763 "Solvent SS Model \"" + modelStringa +
767 if (modelString !=
"constant_incompressible") {
769 "Solute SS Model \"" + modelStringa +
773 #ifdef DEBUG_MODE_NOT
774 cout <<
"species " << sss[k] <<
" has volume " <<
786 if (thermoNode.
hasChild(
"activityCoefficients")) {
794 string modelStringa = ss->
attrib(
"model");
795 string modelString =
lowercase(modelStringa);
796 if (modelString !=
"") {
797 if (modelString ==
"water") {
801 "A_Debye Model \"" + modelStringa +
807 cout <<
"A_Debye = " <<
m_A_Debye << endl;
827 cout <<
"B_Debye = " <<
m_B_Debye << endl;
839 "B_dot entry in the wrong DH form");
841 double bdot_common =
getFloat(acNode,
"B_dot");
843 cout <<
"B_dot = " << bdot_common << endl;
848 for (
size_t k = 0; k <
m_kk; k++) {
850 if (fabs(z_k) > 0.0001) {
861 if (acNode.
hasChild(
"maxIonicStrength")) {
864 cout <<
"m_maxIionicStrength = "
872 if (acNode.
hasChild(
"UseHelgesonFixedForm")) {
881 if (acNode.
hasChild(
"ionicRadius")) {
884 double Afactor = 1.0;
886 std::string Aunits = irNode.
attrib(
"units");
887 Afactor =
toSI(Aunits);
891 std::string ads = irNode.
attrib(
"default");
893 for (
size_t k = 0; k <
m_kk; k++) {
916 map<string, string> m;
925 for (map<std::string,std::string>::const_iterator _b = m.begin();
940 if (acNode.
hasChild(
"DHBetaMatrix")) {
948 "DHBetaMatrix found for wrong type");
960 for (
size_t k = 0; k <
m_kk; k++) {
968 std::vector<const XML_Node*> xspecies=
speciesData();
969 size_t jj = xspecies.size();
970 for (
size_t k = 0; k <
m_kk; k++) {
973 for (
size_t j = 0; j < jj; j++) {
975 std::string jname = sp[
"name"];
976 if (jname == kname) {
982 const XML_Node& sp = *xspecies[jmap];
984 double val =
getFloat(sp,
"stoichIsMods");
994 if (acNodePtr->
hasChild(
"stoichIsMods")) {
997 map<std::string, std::string> msIs;
999 for (map<std::string,std::string>::const_iterator _b = msIs.begin();
1003 double val =
fpValue(_b->second);
1017 for (
size_t k = 0; k <
m_kk; k++) {
1036 std::vector<const XML_Node*> xspecies=
speciesData();
1037 for (
size_t k = 0; k <
m_kk; k++) {
1039 const XML_Node* spPtr = xspecies[k];
1041 if (spPtr->
hasChild(
"electrolyteSpeciesType")) {
1042 std::string est =
getChildValue(*spPtr,
"electrolyteSpeciesType");
1045 "Bad electrolyte type: " + est);
1054 if (acNodePtr->
hasChild(
"electrolyteSpeciesType")) {
1055 XML_Node& ESTNode = acNodePtr->
child(
"electrolyteSpeciesType");
1056 map<std::string, std::string> msEST;
1058 for (map<std::string,std::string>::const_iterator _b = msEST.begin();
1062 std::string est = _b->second;
1065 "Bad electrolyte type: " + est);
1085 if (tempArg != -1.0) {
1089 if (presArg != -1.0) {
1102 throw CanteraError(
"DebyeHuckel::A_Debye_TP",
"shouldn't be here");
1110 if (tempArg != -1.0) {
1114 if (presArg != -1.0) {
1126 throw CanteraError(
"DebyeHuckel::dA_DebyedT_TP",
"shouldn't be here");
1134 if (tempArg != -1.0) {
1138 if (presArg != -1.0) {
1150 throw CanteraError(
"DebyeHuckel::d2A_DebyedT2_TP",
"shouldn't be here");
1158 if (tempArg != -1.0) {
1162 if (presArg != -1.0) {
1174 throw CanteraError(
"DebyeHuckel::dA_DebyedP_TP",
"shouldn't be here");
1209 m_formDH == DHFORM_PITZER_BETAIJ) {
1216 double I2 = IionicMolality * IionicMolality;
1217 double l10actCoeff =
1221 return pow(10.0 , l10actCoeff);
1226 const double a0 = 1.454;
1227 const double b0 = 0.02236;
1228 const double c0 = 9.380E-3;
1229 const double d0 = -5.362E-4;
1234 double Is2 = Is * Is;
1235 double bhat = 1.0 + a0 * sqrt(Is);
1236 double func = bhat - 2.0 * log(bhat) - 1.0/bhat;
1237 double v1 =
m_A_Debye / (a0 * a0 * a0 * Is) * func;
1238 double oc = 1.0 - v1 + b0 * Is / 2.0 + 2.0 * c0 * Is2 / 3.0
1239 + 3.0 * d0 * Is2 * Is / 4.0;
1251 for (
size_t k = 0; k <
m_kk; k++) {
1264 double z_k, zs_k1, zs_k2;
1277 for (
size_t k = 0; k <
m_kk; k++) {
1288 for (
size_t k = 0; k <
m_kk; k++) {
1294 zs_k2 = z_k - zs_k1;
1318 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1321 double ac_nonPolar = 1.0;
1325 double lnActivitySolvent = 0.0;
1328 double y, yp1, sigma;
1330 case DHFORM_DILUTE_LIMIT:
1331 for (
size_t k = 0; k <
m_kk; k++) {
1336 (xmolSolvent - 1.0)/xmolSolvent +
1341 case DHFORM_BDOT_AK:
1343 for (
size_t k = 0; k <
m_kk; k++) {
1345 if (est == cEST_nonpolarNeutral) {
1350 - z_k * z_k * numTmp / (1.0 + denomTmp *
m_Aionic[k])
1355 lnActivitySolvent = (xmolSolvent - 1.0)/xmolSolvent;
1359 if (denomTmp > 0.0) {
1360 for (
size_t k = 0; k <
m_kk; k++) {
1364 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1370 lnActivitySolvent += coeff * tmp;
1372 for (
size_t k = 0; k <
m_kk; k++) {
1378 lnActivitySolvent -=
1390 case DHFORM_BDOT_ACOMMON:
1392 for (
size_t k = 0; k <
m_kk; k++) {
1395 - z_k * z_k * numTmp / (1.0 + denomTmp)
1398 if (denomTmp > 0.0) {
1401 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1406 (xmolSolvent - 1.0)/xmolSolvent +
1410 for (
size_t k = 0; k <
m_kk; k++) {
1416 lnActivitySolvent -=
1425 (xmolSolvent - 1.0)/xmolSolvent;
1427 for (
size_t k = 0; k <
m_kk; k++) {
1431 - z_k * z_k * numTmp / (1.0 + denomTmp);
1432 for (
size_t j = 0; j <
m_kk; j++) {
1434 #ifdef DEBUG_HKM_NOT
1436 printf(
"b: k = %d, j = %d, betakj = %g\n",
1444 if (denomTmp > 0.0) {
1447 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 -2.0*log(yp1));
1452 (xmolSolvent - 1.0)/xmolSolvent +
1456 for (
size_t k = 0; k <
m_kk; k++) {
1457 for (
size_t j = 0; j <
m_kk; j++) {
1465 case DHFORM_PITZER_BETAIJ:
1467 denomTmp *= m_Aionic[0];
1469 tmpLn = log(1.0 + denomTmp);
1470 for (
size_t k = 0; k <
m_kk; k++) {
1474 - z_k * z_k * numTmp / 3.0 / (1.0 + denomTmp);
1478 for (
size_t j = 0; j <
m_kk; j++) {
1484 sigma = 1.0 / (1.0 + denomTmp);
1486 (xmolSolvent - 1.0)/xmolSolvent +
1490 for (
size_t k = 0; k <
m_kk; k++) {
1491 for (
size_t j = 0; j <
m_kk; j++) {
1500 throw CanteraError(
"DebyeHuckel::s_update_lnMolalityActCoeff",
"ERROR");
1510 lnActivitySolvent - log(xmolSolvent);
1515 double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
1519 for (
size_t k = 0; k <
m_kk; k++) {
1529 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1533 double numdAdTTmp = dAdT * sqrtI;
1535 double d_lnActivitySolvent_dT = 0;
1538 case DHFORM_DILUTE_LIMIT:
1539 for (
size_t k = 1; k <
m_kk; k++) {
1543 d_lnActivitySolvent_dT = 2.0 / 3.0 * dAdT *
m_Mnaught *
1548 case DHFORM_BDOT_AK:
1549 for (
size_t k = 0; k <
m_kk; k++) {
1552 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp *
m_Aionic[k]);
1557 coeff = 2.0 / 3.0 * dAdT *
m_Mnaught * sqrtI;
1559 if (denomTmp > 0.0) {
1560 for (
size_t k = 0; k <
m_kk; k++) {
1563 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1571 case DHFORM_BDOT_ACOMMON:
1573 for (
size_t k = 0; k <
m_kk; k++) {
1576 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp);
1578 if (denomTmp > 0.0) {
1581 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1592 for (
size_t k = 0; k <
m_kk; k++) {
1596 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp);
1599 if (denomTmp > 0.0) {
1602 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1611 case DHFORM_PITZER_BETAIJ:
1613 tmpLn = log(1.0 + denomTmp);
1614 for (
size_t k = 0; k <
m_kk; k++) {
1618 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp)
1619 - 2.0 * z_k * z_k * dAdT * tmpLn
1625 sigma = 1.0 / (1.0 + denomTmp);
1632 throw CanteraError(
"DebyeHuckel::s_update_dlnMolalityActCoeff_dT",
1641 double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
1644 if (d2AdT2 == 0.0 && dAdT == 0.0) {
1645 for (
size_t k = 0; k <
m_kk; k++) {
1656 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1660 double numd2AdT2Tmp = d2AdT2 * sqrtI;
1664 case DHFORM_DILUTE_LIMIT:
1665 for (
size_t k = 0; k <
m_kk; k++) {
1671 case DHFORM_BDOT_AK:
1672 for (
size_t k = 0; k <
m_kk; k++) {
1675 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp *
m_Aionic[k]);
1680 coeff = 2.0 / 3.0 * d2AdT2 *
m_Mnaught * sqrtI;
1682 if (denomTmp > 0.0) {
1683 for (
size_t k = 0; k <
m_kk; k++) {
1686 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1694 case DHFORM_BDOT_ACOMMON:
1696 for (
size_t k = 0; k <
m_kk; k++) {
1699 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp);
1701 if (denomTmp > 0.0) {
1704 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1715 for (
size_t k = 0; k <
m_kk; k++) {
1719 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp);
1722 if (denomTmp > 0.0) {
1725 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 -2.0*log(yp1));
1734 case DHFORM_PITZER_BETAIJ:
1736 tmpLn = log(1.0 + denomTmp);
1737 for (
size_t k = 0; k <
m_kk; k++) {
1741 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp)
1742 - 2.0 * z_k * z_k * d2AdT2 * tmpLn
1748 sigma = 1.0 / (1.0 + denomTmp);
1755 throw CanteraError(
"DebyeHuckel::s_update_d2lnMolalityActCoeff_dT2",
1762 double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
1766 for (
size_t k = 0; k <
m_kk; k++) {
1776 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1780 double numdAdPTmp = dAdP * sqrtI;
1784 case DHFORM_DILUTE_LIMIT:
1785 for (
size_t k = 0; k <
m_kk; k++) {
1791 case DHFORM_BDOT_AK:
1792 for (
size_t k = 0; k <
m_kk; k++) {
1794 if (est == cEST_nonpolarNeutral) {
1799 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp *
m_Aionic[k]);
1805 coeff = 2.0 / 3.0 * dAdP *
m_Mnaught * sqrtI;
1807 if (denomTmp > 0.0) {
1808 for (
size_t k = 0; k <
m_kk; k++) {
1811 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1819 case DHFORM_BDOT_ACOMMON:
1821 for (
size_t k = 0; k <
m_kk; k++) {
1824 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp);
1826 if (denomTmp > 0.0) {
1829 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1840 for (
size_t k = 0; k <
m_kk; k++) {
1844 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp);
1847 if (denomTmp > 0.0) {
1850 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1859 case DHFORM_PITZER_BETAIJ:
1861 tmpLn = log(1.0 + denomTmp);
1862 for (
size_t k = 0; k <
m_kk; k++) {
1866 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp)
1867 - 2.0 * z_k * z_k * dAdP * tmpLn
1873 sigma = 1.0 / (1.0 + denomTmp);
1880 throw CanteraError(
"DebyeHuckel::s_update_dlnMolalityActCoeff_dP",
void getMap(const 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...
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.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
std::string getChildValue(const 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...
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'.
An error indicating that an unimplemented function has been called.
doublereal m_Mnaught
This is the multiplication factor that goes inside log expressions involving the molalities of specie...
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.
Header file for a common definitions used in electrolytes thermodynamics.
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 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.
bool m_useHelgesonFixedForm
If true, then the fixed for of Helgeson's activity for water is used instead of the rigorous form obt...
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.
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.
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.
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 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.
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.
void getMatrixValues(const XML_Node &node, const std::vector< std::string > &keyStringRow, const std::vector< std::string > &keyStringCol, 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" ...
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
vector_fp m_tmpV
vector of size m_kk, used as a temporary holding area.
void getStringArray(const XML_Node &node, std::vector< std::string > &v)
This function interprets the value portion of an XML element as a string.
virtual void setTemperature(const doublereal temp)
Set the internally stored temperature of the phase (K).
virtual void initThermo()
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.
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.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
#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...
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.
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.