28 DebyeHuckel::DebyeHuckel() :
29 m_formDH(DHFORM_DILUTE_LIMIT),
31 m_IionicMolality(0.0),
32 m_maxIionicStrength(30.0),
33 m_useHelgesonFixedForm(false),
34 m_IionicMolalityStoich(0.0),
35 m_form_A_Debye(A_DEBYE_CONST),
44 const std::string& id_) :
45 m_formDH(DHFORM_DILUTE_LIMIT),
47 m_IionicMolality(0.0),
48 m_maxIionicStrength(30.0),
49 m_useHelgesonFixedForm(false),
50 m_IionicMolalityStoich(0.0),
51 m_form_A_Debye(A_DEBYE_CONST),
61 m_formDH(DHFORM_DILUTE_LIMIT),
63 m_IionicMolality(0.0),
64 m_maxIionicStrength(3.0),
65 m_useHelgesonFixedForm(false),
66 m_IionicMolalityStoich(0.0),
67 m_form_A_Debye(A_DEBYE_CONST),
77 m_formDH(DHFORM_DILUTE_LIMIT),
79 m_IionicMolality(0.0),
80 m_maxIionicStrength(30.0),
81 m_useHelgesonFixedForm(false),
82 m_IionicMolalityStoich(0.0),
83 m_form_A_Debye(A_DEBYE_CONST),
94 DebyeHuckel& DebyeHuckel::operator=(
const DebyeHuckel& b)
97 MolalityVPSSTP::operator=(b);
111 m_waterSS =
dynamic_cast<PDSS_Water*
>(providePDSS(0));
113 throw CanteraError(
"DebyeHuckel::operator=()",
"Dynamic cast to waterPDSS failed");
118 if (b.m_waterProps) {
131 DebyeHuckel::~DebyeHuckel()
143 "To be removed after Cantera 2.3.");
207 "Density is not an independent variable");
216 "molarDensity/density is not an independent variable");
226 for (
size_t k = 0; k <
m_kk; k++) {
234 return 1.0 / mvSolvent;
244 for (
size_t k = 0; k <
m_kk; k++) {
260 for (
size_t k = 0; k <
m_kk; k++) {
261 acMolality[k] = exp(acMolality[k]);
279 for (
size_t k = 0; k <
m_kk; k++) {
296 for (
size_t k = 0; k <
m_kk; k++) {
309 for (
size_t k = 0; k <
m_kk; k++) {
322 for (
size_t k = 0; k <
m_kk; k++) {
333 for (
size_t k = 0; k <
m_kk; k++) {
349 for (
size_t k = 0; k <
m_kk; k++) {
362 for (
size_t k = 0; k <
m_kk; k++) {
370 for (
size_t k = 0; k <
m_kk; k++) {
384 for (
size_t k = 0; k <
m_kk; k++) {
400 if (ba::iequals(estString,
"solvent")) {
402 }
else if (ba::iequals(estString,
"chargedspecies")) {
403 return cEST_chargedSpecies;
404 }
else if (ba::iequals(estString,
"weakacidassociated")) {
405 return cEST_weakAcidAssociated;
406 }
else if (ba::iequals(estString,
"strongacidassociated")) {
407 return cEST_strongAcidAssociated;
408 }
else if (ba::iequals(estString,
"polarneutral")) {
409 return cEST_polarNeutral;
410 }
else if (ba::iequals(estString,
"nonpolarneutral")) {
411 return cEST_nonpolarNeutral;
414 if ((retn = sscanf(estString.c_str(),
"%d", &rval)) != 1) {
422 if (id_.size() > 0) {
423 std::string idp = phaseNode.
id();
426 "phasenode and Id are incompatible");
431 if (!phaseNode.
hasChild(
"thermo")) {
433 "no thermo XML node");
439 if (thermoNode.
hasChild(
"activityCoefficients")) {
442 std::string formString = scNode.
attrib(
"model");
443 if (formString !=
"") {
444 if (formString ==
"Dilute_limit") {
446 }
else if (formString ==
"Bdot_with_variable_a") {
448 }
else if (formString ==
"Bdot_with_common_a") {
450 }
else if (formString ==
"Beta_ij") {
452 }
else if (formString ==
"Pitzer_with_Beta_ij") {
456 "Unknown standardConc model: " + formString);
466 if (thermoNode.
hasChild(
"standardConc")) {
469 std::string formString = scNode.
attrib(
"model");
470 if (formString !=
"") {
471 if (formString ==
"unity") {
474 "standardConc = unity not done");
475 }
else if (formString ==
"molar_volume") {
478 "standardConc = molar_volume not done");
479 }
else if (formString ==
"solvent_volume") {
483 "Unknown standardConc model: " + formString);
492 std::string solventName =
"";
493 if (thermoNode.
hasChild(
"solvent")) {
495 vector<std::string> nameSolventa;
497 if (nameSolventa.size() != 1) {
499 "badly formed solvent XML node");
501 solventName = nameSolventa[0];
503 for (
size_t k = 0; k <
m_kk; k++) {
505 if (solventName == sname) {
511 cout <<
"DebyeHuckel::initThermoXML: Solvent Name not found" 514 "Solvent name not found");
518 "Solvent " + solventName +
519 " should be first species");
531 for (
size_t k = 0; k <
m_kk; k++) {
535 "Species Data Base " + sss[k] +
" not found");
540 "Species " + sss[k] +
541 " standardState XML block not found");
543 std::string modelString = ss->
attrib(
"model");
544 if (modelString ==
"") {
546 "Species " + sss[k] +
547 " standardState XML block model attribute not found");
551 if (ba::iequals(modelString,
"wateriapws") || ba::iequals(modelString,
"real_water") ||
552 ba::iequals(modelString,
"waterpdss")) {
557 "Dynamic cast to PDSS_Water failed");
567 }
else if (ba::iequals(modelString,
"constant_incompressible")) {
571 "Solvent SS Model \"" + modelString +
575 if (!ba::iequals(modelString,
"constant_incompressible")) {
577 "Solute SS Model \"" + modelString +
587 if (thermoNode.
hasChild(
"activityCoefficients")) {
594 string modelString = ss->
attrib(
"model");
595 if (modelString !=
"") {
596 if (ba::iequals(modelString,
"water")) {
600 "A_Debye Model \"" + modelString +
625 "B_dot entry in the wrong DH form");
627 double bdot_common =
getFloat(acNode,
"B_dot");
629 for (
size_t k = 0; k <
m_kk; k++) {
631 if (fabs(z_k) > 0.0001) {
640 if (acNode.
hasChild(
"maxIonicStrength")) {
645 if (acNode.
hasChild(
"UseHelgesonFixedForm")) {
652 if (acNode.
hasChild(
"ionicRadius")) {
655 double Afactor = 1.0;
657 std::string Aunits = irNode.
attrib(
"units");
658 Afactor =
toSI(Aunits);
662 std::string ads = irNode.
attrib(
"default");
664 for (
size_t k = 0; k <
m_kk; k++) {
681 map<string, string> m;
688 for (
const auto& b : m) {
698 if (acNode.
hasChild(
"DHBetaMatrix")) {
707 "DHBetaMatrix found for wrong type");
715 for (
size_t k = 0; k <
m_kk; k++) {
721 std::vector<const XML_Node*> xspecies=
speciesData();
722 size_t jj = xspecies.size();
723 for (
size_t k = 0; k <
m_kk; k++) {
726 for (
size_t j = 0; j < jj; j++) {
728 std::string jname = sp[
"name"];
729 if (jname == kname) {
735 const XML_Node& sp = *xspecies[jmap];
737 double val =
getFloat(sp,
"stoichIsMods");
744 if (acNodePtr && acNodePtr->
hasChild(
"stoichIsMods")) {
746 map<std::string, std::string> msIs;
748 for (
const auto& b : msIs) {
750 double val =
fpValue(b.second);
759 for (
size_t k = 0; k <
m_kk; k++) {
775 std::vector<const XML_Node*> xspecies=
speciesData();
776 for (
size_t k = 0; k <
m_kk; k++) {
778 const XML_Node* spPtr = xspecies[k];
779 if (spPtr && spPtr->
hasChild(
"electrolyteSpeciesType")) {
780 std::string est =
getChildValue(*spPtr,
"electrolyteSpeciesType");
783 "Bad electrolyte type: " + est);
789 if (acNodePtr && acNodePtr->
hasChild(
"electrolyteSpeciesType")) {
790 XML_Node& ESTNode = acNodePtr->
child(
"electrolyteSpeciesType");
791 map<std::string, std::string> msEST;
793 for (
const auto& b : msEST) {
795 std::string est = b.second;
798 "Bad electrolyte type: " + est);
814 if (tempArg != -1.0) {
818 if (presArg != -1.0) {
831 throw CanteraError(
"DebyeHuckel::A_Debye_TP",
"shouldn't be here");
839 if (tempArg != -1.0) {
843 if (presArg != -1.0) {
855 throw CanteraError(
"DebyeHuckel::dA_DebyedT_TP",
"shouldn't be here");
863 if (tempArg != -1.0) {
867 if (presArg != -1.0) {
879 throw CanteraError(
"DebyeHuckel::d2A_DebyedT2_TP",
"shouldn't be here");
887 if (tempArg != -1.0) {
891 if (presArg != -1.0) {
903 throw CanteraError(
"DebyeHuckel::dA_DebyedP_TP",
"shouldn't be here");
939 const static double npActCoeff[] = {0.1127, -0.01049, 1.545E-3};
940 double I2 = IionicMolality * IionicMolality;
942 npActCoeff[0] * IionicMolality +
944 npActCoeff[2] * I2 * IionicMolality;
945 return pow(10.0 , l10actCoeff);
950 const double a0 = 1.454;
951 const double b0 = 0.02236;
952 const double c0 = 9.380E-3;
953 const double d0 = -5.362E-4;
958 double Is2 = Is * Is;
959 double bhat = 1.0 + a0 * sqrt(Is);
960 double func = bhat - 2.0 * log(bhat) - 1.0/bhat;
961 double v1 =
m_A_Debye / (a0 * a0 * a0 * Is) * func;
962 double oc = 1.0 - v1 + b0 * Is / 2.0 + 2.0 * c0 * Is2 / 3.0
963 + 3.0 * d0 * Is2 * Is / 4.0;
973 for (
size_t k = 0; k <
m_kk; k++) {
986 double z_k, zs_k1, zs_k2;
997 for (
size_t k = 0; k <
m_kk; k++) {
1006 for (
size_t k = 0; k <
m_kk; k++) {
1012 zs_k2 = z_k - zs_k1;
1028 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1031 double ac_nonPolar = 1.0;
1035 double lnActivitySolvent = 0.0;
1038 double y, yp1, sigma;
1040 case DHFORM_DILUTE_LIMIT:
1041 for (
size_t k = 0; k <
m_kk; k++) {
1046 (xmolSolvent - 1.0)/xmolSolvent +
1051 case DHFORM_BDOT_AK:
1053 for (
size_t k = 0; k <
m_kk; k++) {
1055 if (est == cEST_nonpolarNeutral) {
1060 - z_k * z_k * numTmp / (1.0 + denomTmp *
m_Aionic[k])
1065 lnActivitySolvent = (xmolSolvent - 1.0)/xmolSolvent;
1069 if (denomTmp > 0.0) {
1070 for (
size_t k = 0; k <
m_kk; k++) {
1074 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1080 lnActivitySolvent += coeff * tmp;
1082 for (
size_t k = 0; k <
m_kk; k++) {
1088 lnActivitySolvent -=
1098 case DHFORM_BDOT_ACOMMON:
1100 for (
size_t k = 0; k <
m_kk; k++) {
1103 - z_k * z_k * numTmp / (1.0 + denomTmp)
1106 if (denomTmp > 0.0) {
1109 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1114 (xmolSolvent - 1.0)/xmolSolvent +
1118 for (
size_t k = 0; k <
m_kk; k++) {
1124 lnActivitySolvent -=
1132 (xmolSolvent - 1.0)/xmolSolvent;
1134 for (
size_t k = 0; k <
m_kk; k++) {
1138 - z_k * z_k * numTmp / (1.0 + denomTmp);
1139 for (
size_t j = 0; j <
m_kk; j++) {
1145 if (denomTmp > 0.0) {
1148 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 -2.0*log(yp1));
1153 (xmolSolvent - 1.0)/xmolSolvent +
1157 for (
size_t k = 0; k <
m_kk; k++) {
1158 for (
size_t j = 0; j <
m_kk; j++) {
1166 case DHFORM_PITZER_BETAIJ:
1170 tmpLn = log(1.0 + denomTmp);
1171 for (
size_t k = 0; k <
m_kk; k++) {
1175 - z_k * z_k * numTmp / 3.0 / (1.0 + denomTmp);
1179 for (
size_t j = 0; j <
m_kk; j++) {
1185 sigma = 1.0 / (1.0 + denomTmp);
1187 (xmolSolvent - 1.0)/xmolSolvent +
1191 for (
size_t k = 0; k <
m_kk; k++) {
1192 for (
size_t j = 0; j <
m_kk; j++) {
1201 throw CanteraError(
"DebyeHuckel::s_update_lnMolalityActCoeff",
"ERROR");
1209 lnActivitySolvent - log(xmolSolvent);
1214 double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
1218 for (
size_t k = 0; k <
m_kk; k++) {
1226 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1228 double numdAdTTmp = dAdT * sqrtI;
1230 double d_lnActivitySolvent_dT = 0;
1233 case DHFORM_DILUTE_LIMIT:
1234 for (
size_t k = 1; k <
m_kk; k++) {
1238 d_lnActivitySolvent_dT = 2.0 / 3.0 * dAdT *
m_Mnaught *
1243 case DHFORM_BDOT_AK:
1244 for (
size_t k = 0; k <
m_kk; k++) {
1247 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp *
m_Aionic[k]);
1251 coeff = 2.0 / 3.0 * dAdT *
m_Mnaught * sqrtI;
1253 if (denomTmp > 0.0) {
1254 for (
size_t k = 0; k <
m_kk; k++) {
1257 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1265 case DHFORM_BDOT_ACOMMON:
1267 for (
size_t k = 0; k <
m_kk; k++) {
1270 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp);
1272 if (denomTmp > 0.0) {
1275 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1286 for (
size_t k = 0; k <
m_kk; k++) {
1290 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp);
1293 if (denomTmp > 0.0) {
1296 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1305 case DHFORM_PITZER_BETAIJ:
1307 tmpLn = log(1.0 + denomTmp);
1308 for (
size_t k = 0; k <
m_kk; k++) {
1312 - z_k * z_k * numdAdTTmp / (1.0 + denomTmp)
1313 - 2.0 * z_k * z_k * dAdT * tmpLn
1319 sigma = 1.0 / (1.0 + denomTmp);
1326 throw CanteraError(
"DebyeHuckel::s_update_dlnMolalityActCoeff_dT",
1333 double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
1336 if (d2AdT2 == 0.0 && dAdT == 0.0) {
1337 for (
size_t k = 0; k <
m_kk; k++) {
1345 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1347 double numd2AdT2Tmp = d2AdT2 * sqrtI;
1351 case DHFORM_DILUTE_LIMIT:
1352 for (
size_t k = 0; k <
m_kk; k++) {
1358 case DHFORM_BDOT_AK:
1359 for (
size_t k = 0; k <
m_kk; k++) {
1362 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp *
m_Aionic[k]);
1366 coeff = 2.0 / 3.0 * d2AdT2 *
m_Mnaught * sqrtI;
1368 if (denomTmp > 0.0) {
1369 for (
size_t k = 0; k <
m_kk; k++) {
1372 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1380 case DHFORM_BDOT_ACOMMON:
1382 for (
size_t k = 0; k <
m_kk; k++) {
1385 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp);
1387 if (denomTmp > 0.0) {
1390 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1401 for (
size_t k = 0; k <
m_kk; k++) {
1405 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp);
1408 if (denomTmp > 0.0) {
1411 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 -2.0*log(yp1));
1420 case DHFORM_PITZER_BETAIJ:
1422 tmpLn = log(1.0 + denomTmp);
1423 for (
size_t k = 0; k <
m_kk; k++) {
1427 - z_k * z_k * numd2AdT2Tmp / (1.0 + denomTmp)
1428 - 2.0 * z_k * z_k * d2AdT2 * tmpLn
1434 sigma = 1.0 / (1.0 + denomTmp);
1441 throw CanteraError(
"DebyeHuckel::s_update_d2lnMolalityActCoeff_dT2",
1448 double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
1452 for (
size_t k = 0; k <
m_kk; k++) {
1460 xmolSolvent = std::max(8.689E-3, xmolSolvent);
1462 double numdAdPTmp = dAdP * sqrtI;
1466 case DHFORM_DILUTE_LIMIT:
1467 for (
size_t k = 0; k <
m_kk; k++) {
1473 case DHFORM_BDOT_AK:
1474 for (
size_t k = 0; k <
m_kk; k++) {
1476 if (est == cEST_nonpolarNeutral) {
1481 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp *
m_Aionic[k]);
1486 coeff = 2.0 / 3.0 * dAdP *
m_Mnaught * sqrtI;
1488 if (denomTmp > 0.0) {
1489 for (
size_t k = 0; k <
m_kk; k++) {
1492 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1500 case DHFORM_BDOT_ACOMMON:
1502 for (
size_t k = 0; k <
m_kk; k++) {
1505 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp);
1507 if (denomTmp > 0.0) {
1510 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1521 for (
size_t k = 0; k <
m_kk; k++) {
1525 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp);
1528 if (denomTmp > 0.0) {
1531 sigma = 3.0 / (y * y * y) * (yp1 - 1.0/yp1 - 2.0*log(yp1));
1540 case DHFORM_PITZER_BETAIJ:
1542 tmpLn = log(1.0 + denomTmp);
1543 for (
size_t k = 0; k <
m_kk; k++) {
1547 - z_k * z_k * numdAdPTmp / (1.0 + denomTmp)
1548 - 2.0 * z_k * z_k * dAdP * tmpLn
1554 sigma = 1.0 / (1.0 + denomTmp);
1561 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.
int m_form_A_Debye
Form of the constant outside the Debye-Huckel term called A.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
static double _nonpolarActCoeff(double IionicMolality)
Static function that implements the non-polar species salt-out modifications.
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 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...
const doublereal OneAtm
One atmosphere [Pa].
doublereal temperature() const
Temperature (K).
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'.
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
doublereal m_Mnaught
This is the multiplication factor that goes inside log expressions involving the molalities of specie...
doublereal toSI(const std::string &unit)
Return the conversion factor to convert unit std::string 'unit' to SI units.
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
std::unique_ptr< WaterProps > m_waterProps
Pointer to the water property calculator.
const size_t npos
index returned by functions to indicate "no position"
vector_fp m_speciesCharge
Vector of species charges. length m_kk.
Header file for a common definitions used in electrolytes thermodynamics.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
doublereal molecularWeight() const
Return the molecular weight of the species in units of kg kmol-1.
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 getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
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.
virtual doublereal density() const
Density (kg/m^3).
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...
void s_update_lnMolalityActCoeff() const
Calculate the log activity coefficients.
virtual bool addSpecies(shared_ptr< Species > spec)
double _osmoticCoeffHelgesonFixedForm() const
Formula for the osmotic coefficient that occurs in the GWB.
bool hasAttrib(const std::string &a) const
Tests whether the current node has an attribute with a particular name.
virtual void setDensity(const doublereal rho)
Set the internally stored density (gm/m^3) of the phase.
Headers for the DebyeHuckel ThermoPhase object, which models dilute electrolyte solutions (see Thermo...
const std::vector< std::string > & speciesNames() const
Return a const reference to the vector of species names.
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
const int cDebyeHuckel0
eosTypes returned for this ThermoPhase Object
DebyeHuckel()
Default Constructor.
Class DebyeHuckel represents a dilute liquid electrolyte phase which obeys the Debye Huckel formulati...
Base class for a phase with thermodynamic properties.
virtual int eosType() const
Equation of state type flag.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
doublereal molarDensity() const
Molar density (kmol/m^3).
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. ...
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.
vector_fp m_Aionic
a_k = Size of the ionic species in the DH formulation. units = meters
std::string speciesName(size_t k) const
Name of the species with index k.
Class for the liquid water pressure dependent standard state.
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.
virtual void _updateStandardStateThermo() const
Updates the standard state thermodynamic functions at the current T and P of the solution.
double m_A_Debye
Current value of the Debye Constant, A_Debye.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
double AionicRadius(int k=0) const
Reports the ionic radius of the kth species.
vector_fp m_lnActCoeffMolal
Logarithm of the activity coefficients on the molality scale.
void s_update_dlnMolalityActCoeff_dP() const
Calculate the pressure derivative of the activity coefficient.
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Base class for exceptions thrown by Cantera classes.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
PDSS_Water * m_waterSS
Pointer to the Water standard state object.
vector_fp m_B_Dot
Array of B_Dot values.
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
void s_update_d2lnMolalityActCoeff_dT2() const
Calculate the temperature 2nd derivative of the activity coefficient.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
int m_formGC
Format for the generalized concentration:
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.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
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)) ...
void s_update_dlnMolalityActCoeff_dT() const
Calculation of temperature derivative of activity coefficient.
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities at the current solution temperature, pressure, and solution concentration.
virtual doublereal pressure() const
Returns the current pressure of the phase.
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
vector_int m_electrolyteSpeciesType
Vector containing the electrolyte species type.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
XML_Node & root() const
Return the root of the current XML_Node tree.
vector_fp m_speciesCharge_Stoich
Stoichiometric species charge -> This is for calculations of the ionic strength which ignore ion-ion ...
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 getMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of non-dimensional molality-based activity coefficients at the current solution tempera...
vector_fp m_molalities
Current value of the molalities of the species in the phase.
const doublereal SmallNumber
smallest number to compare to zero.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
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.
std::string id() const
Return the id attribute, if present.
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
double m_B_Debye
Current value of the constant that appears in the denominator.
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.
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
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...
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
size_t m_kk
Number of species in the phase.
vector_fp m_dlnActCoeffMolaldP
Derivative of log act coeff wrt P.
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
virtual doublereal density() const
Return the standard state density at standard state.
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...
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
void calcMolalities() const
Calculates the molality of all species and stores the result internally.
Namespace for the Cantera kernel.
size_t m_indexSolvent
Index of the solvent.
double _lnactivityWaterHelgesonFixedForm() const
Formula for the log of the water activity that occurs in the GWB.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
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 ...
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
virtual bool addSpecies(shared_ptr< Species > spec)
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution...
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase.
double m_densWaterSS
Storage for the density of water's standard state.
virtual void setMolarDensity(const doublereal conc)
Set the internally stored molar density (kmol/m^3) of the phase.