30 const char* cc = estString.c_str();
32 const char* ccl = lcs.c_str();
33 if (!strcmp(ccl,
"solvent")) {
35 }
else if (!strcmp(ccl,
"chargedspecies")) {
36 return cEST_chargedSpecies;
37 }
else if (!strcmp(ccl,
"weakacidassociated")) {
38 return cEST_weakAcidAssociated;
39 }
else if (!strcmp(ccl,
"strongacidassociated")) {
40 return cEST_strongAcidAssociated;
41 }
else if (!strcmp(ccl,
"polarneutral")) {
42 return cEST_polarNeutral;
43 }
else if (!strcmp(ccl,
"nonpolarneutral")) {
44 return cEST_nonpolarNeutral;
47 if ((retn = sscanf(cc,
"%d", &rval)) != 1) {
53 void HMWSoln::readXMLBinarySalt(
XML_Node& BinSalt)
55 string xname = BinSalt.
name();
56 if (xname !=
"binarySaltParameters") {
58 "Incorrect name for processing this routine: " + xname);
62 string iName = BinSalt.
attrib(
"cation");
64 throw CanteraError(
"HMWSoln::readXMLBinarySalt",
"no cation attrib");
66 string jName = BinSalt.
attrib(
"anion");
68 throw CanteraError(
"HMWSoln::readXMLBinarySalt",
"no anion attrib");
74 size_t iSpecies = speciesIndex(iName);
75 if (iSpecies ==
npos) {
78 string ispName = speciesName(iSpecies);
79 if (charge(iSpecies) <= 0) {
80 throw CanteraError(
"HMWSoln::readXMLBinarySalt",
"cation charge problem");
82 size_t jSpecies = speciesIndex(jName);
83 if (jSpecies ==
npos) {
86 string jspName = speciesName(jSpecies);
87 if (charge(jSpecies) >= 0) {
88 throw CanteraError(
"HMWSoln::readXMLBinarySalt",
"anion charge problem");
91 size_t n = iSpecies * m_kk + jSpecies;
92 int counter = m_CounterIJ[n];
93 for (
size_t iChild = 0; iChild < BinSalt.
nChildren(); iChild++) {
95 string stemp = xmlChild.
name();
100 if (nodeName ==
"beta0") {
105 size_t nParamsFound = vParams.size();
106 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
107 if (nParamsFound != 1) {
108 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta0 for " + ispName
110 "wrong number of params found");
112 m_Beta0MX_ij[counter] = vParams[0];
113 m_Beta0MX_ij_coeff(0,counter) = m_Beta0MX_ij[counter];
114 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
115 if (nParamsFound != 2) {
116 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta0 for " + ispName
118 "wrong number of params found");
120 m_Beta0MX_ij_coeff(0,counter) = vParams[0];
121 m_Beta0MX_ij_coeff(1,counter) = vParams[1];
122 m_Beta0MX_ij[counter] = vParams[0];
123 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
124 if (nParamsFound != 5) {
125 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta0 for " + ispName
127 "wrong number of params found");
129 for (
size_t i = 0; i < nParamsFound; i++) {
130 m_Beta0MX_ij_coeff(i, counter) = vParams[i];
132 m_Beta0MX_ij[counter] = vParams[0];
135 if (nodeName ==
"beta1") {
141 size_t nParamsFound = vParams.size();
142 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
143 if (nParamsFound != 1) {
144 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta1 for " + ispName
146 "wrong number of params found");
148 m_Beta1MX_ij[counter] = vParams[0];
149 m_Beta1MX_ij_coeff(0,counter) = m_Beta1MX_ij[counter];
150 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
151 if (nParamsFound != 2) {
152 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta1 for " + ispName
154 "wrong number of params found");
156 m_Beta1MX_ij_coeff(0,counter) = vParams[0];
157 m_Beta1MX_ij_coeff(1,counter) = vParams[1];
158 m_Beta1MX_ij[counter] = vParams[0];
159 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
160 if (nParamsFound != 5) {
161 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta1 for " + ispName
163 "wrong number of params found");
165 for (
size_t i = 0; i < nParamsFound; i++) {
166 m_Beta1MX_ij_coeff(i, counter) = vParams[i];
168 m_Beta1MX_ij[counter] = vParams[0];
171 if (nodeName ==
"beta2") {
173 size_t nParamsFound = vParams.size();
174 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
175 if (nParamsFound != 1) {
176 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta2 for " + ispName
178 "wrong number of params found");
180 m_Beta2MX_ij[counter] = vParams[0];
181 m_Beta2MX_ij_coeff(0,counter) = m_Beta2MX_ij[counter];
182 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
183 if (nParamsFound != 2) {
184 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta2 for " + ispName
186 "wrong number of params found");
188 m_Beta2MX_ij_coeff(0,counter) = vParams[0];
189 m_Beta2MX_ij_coeff(1,counter) = vParams[1];
190 m_Beta2MX_ij[counter] = vParams[0];
191 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
192 if (nParamsFound != 5) {
193 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta2 for " + ispName
195 "wrong number of params found");
197 for (
size_t i = 0; i < nParamsFound; i++) {
198 m_Beta2MX_ij_coeff(i, counter) = vParams[i];
200 m_Beta2MX_ij[counter] = vParams[0];
204 if (nodeName ==
"cphi") {
209 size_t nParamsFound = vParams.size();
210 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
211 if (nParamsFound != 1) {
212 throw CanteraError(
"HMWSoln::readXMLBinarySalt::Cphi for " + ispName
214 "wrong number of params found");
216 m_CphiMX_ij[counter] = vParams[0];
217 m_CphiMX_ij_coeff(0,counter) = m_CphiMX_ij[counter];
218 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
219 if (nParamsFound != 2) {
220 throw CanteraError(
"HMWSoln::readXMLBinarySalt::Cphi for " + ispName
222 "wrong number of params found");
224 m_CphiMX_ij_coeff(0,counter) = vParams[0];
225 m_CphiMX_ij_coeff(1,counter) = vParams[1];
226 m_CphiMX_ij[counter] = vParams[0];
227 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
228 if (nParamsFound != 5) {
229 throw CanteraError(
"HMWSoln::readXMLBinarySalt::Cphi for " + ispName
231 "wrong number of params found");
233 for (
size_t i = 0; i < nParamsFound; i++) {
234 m_CphiMX_ij_coeff(i, counter) = vParams[i];
236 m_CphiMX_ij[counter] = vParams[0];
240 if (nodeName ==
"alpha1") {
241 stemp = xmlChild.
value();
245 if (nodeName ==
"alpha2") {
246 stemp = xmlChild.
value();
254 string xname = BinSalt.
name();
256 if (xname !=
"thetaAnion") {
258 "Incorrect name for processing this routine: " + xname);
261 string ispName = BinSalt.
attrib(
"anion1");
263 throw CanteraError(
"HMWSoln::readXMLThetaAnion",
"no anion1 attrib");
265 string jspName = BinSalt.
attrib(
"anion2");
267 throw CanteraError(
"HMWSoln::readXMLThetaAnion",
"no anion2 attrib");
273 size_t iSpecies = speciesIndex(ispName);
274 if (iSpecies ==
npos) {
277 if (charge(iSpecies) >= 0) {
278 throw CanteraError(
"HMWSoln::readXMLThetaAnion",
"anion1 charge problem");
280 size_t jSpecies = speciesIndex(jspName);
281 if (jSpecies ==
npos) {
284 if (charge(jSpecies) >= 0) {
285 throw CanteraError(
"HMWSoln::readXMLThetaAnion",
"anion2 charge problem");
288 size_t n = iSpecies * m_kk + jSpecies;
289 int counter = m_CounterIJ[n];
290 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
292 stemp = xmlChild.
name();
294 if (nodeName ==
"theta") {
296 size_t nParamsFound = vParams.size();
297 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
298 if (nParamsFound != 1) {
299 throw CanteraError(
"HMWSoln::readXMLThetaAnion::Theta for " + ispName
301 "wrong number of params found");
303 m_Theta_ij_coeff(0,counter) = vParams[0];
304 m_Theta_ij[counter] = vParams[0];
305 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
306 if (nParamsFound != 2) {
307 throw CanteraError(
"HMWSoln::readXMLThetaAnion::Theta for " + ispName
309 "wrong number of params found");
311 m_Theta_ij_coeff(0,counter) = vParams[0];
312 m_Theta_ij_coeff(1,counter) = vParams[1];
313 m_Theta_ij[counter] = vParams[0];
314 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
315 if (nParamsFound == 1) {
316 vParams.resize(5, 0.0);
318 }
else if (nParamsFound != 5) {
319 throw CanteraError(
"HMWSoln::readXMLThetaAnion::Theta for " + ispName
321 "wrong number of params found");
323 for (
size_t j = 0; j < nParamsFound; j++) {
324 m_Theta_ij_coeff(j, counter) = vParams[j];
326 m_Theta_ij[counter] = vParams[0];
332 void HMWSoln::readXMLThetaCation(
XML_Node& BinSalt)
334 string xname = BinSalt.
name();
336 if (xname !=
"thetaCation") {
338 "Incorrect name for processing this routine: " + xname);
340 string ispName = BinSalt.
attrib(
"cation1");
342 throw CanteraError(
"HMWSoln::readXMLThetaCation",
"no cation1 attrib");
344 string jspName = BinSalt.
attrib(
"cation2");
346 throw CanteraError(
"HMWSoln::readXMLThetaCation",
"no cation2 attrib");
352 size_t iSpecies = speciesIndex(ispName);
353 if (iSpecies ==
npos) {
356 if (charge(iSpecies) <= 0) {
357 throw CanteraError(
"HMWSoln::readXMLThetaCation",
"cation1 charge problem");
359 size_t jSpecies = speciesIndex(jspName);
360 if (jSpecies ==
npos) {
363 if (charge(jSpecies) <= 0) {
364 throw CanteraError(
"HMWSoln::readXMLThetaCation",
"cation2 charge problem");
367 size_t n = iSpecies * m_kk + jSpecies;
368 int counter = m_CounterIJ[n];
369 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
371 string stemp = xmlChild.
name();
373 if (nodeName ==
"theta") {
375 size_t nParamsFound = vParams.size();
376 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
377 if (nParamsFound != 1) {
378 throw CanteraError(
"HMWSoln::readXMLThetaCation::Theta for " + ispName
380 "wrong number of params found");
382 m_Theta_ij_coeff(0,counter) = vParams[0];
383 m_Theta_ij[counter] = vParams[0];
384 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
385 if (nParamsFound != 2) {
386 throw CanteraError(
"HMWSoln::readXMLThetaCation::Theta for " + ispName
388 "wrong number of params found");
390 m_Theta_ij_coeff(0,counter) = vParams[0];
391 m_Theta_ij_coeff(1,counter) = vParams[1];
392 m_Theta_ij[counter] = vParams[0];
393 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
394 if (nParamsFound == 1) {
395 vParams.resize(5, 0.0);
397 }
else if (nParamsFound != 5) {
398 throw CanteraError(
"HMWSoln::readXMLThetaCation::Theta for " + ispName
400 "wrong number of params found");
402 for (
size_t j = 0; j < nParamsFound; j++) {
403 m_Theta_ij_coeff(j, counter) = vParams[j];
405 m_Theta_ij[counter] = vParams[0];
411 void HMWSoln::readXMLPsiCommonCation(
XML_Node& BinSalt)
413 string xname = BinSalt.
name();
414 if (xname !=
"psiCommonCation") {
416 "Incorrect name for processing this routine: " + xname);
419 string kName = BinSalt.
attrib(
"cation");
421 throw CanteraError(
"HMWSoln::readXMLPsiCommonCation",
"no cation attrib");
423 string iName = BinSalt.
attrib(
"anion1");
425 throw CanteraError(
"HMWSoln::readXMLPsiCommonCation",
"no anion1 attrib");
427 string jName = BinSalt.
attrib(
"anion2");
429 throw CanteraError(
"HMWSoln::readXMLPsiCommonCation",
"no anion2 attrib");
435 size_t kSpecies = speciesIndex(kName);
436 if (kSpecies ==
npos) {
439 if (charge(kSpecies) <= 0) {
441 "cation charge problem");
443 size_t iSpecies = speciesIndex(iName);
444 if (iSpecies ==
npos) {
447 if (charge(iSpecies) >= 0) {
449 "anion1 charge problem");
451 size_t jSpecies = speciesIndex(jName);
452 if (jSpecies ==
npos) {
455 if (charge(jSpecies) >= 0) {
457 "anion2 charge problem");
460 size_t n = iSpecies * m_kk + jSpecies;
461 int counter = m_CounterIJ[n];
462 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
464 string stemp = xmlChild.
name();
466 if (nodeName ==
"theta") {
467 stemp = xmlChild.
value();
468 double old = m_Theta_ij[counter];
471 if (old != m_Theta_ij[counter]) {
473 "conflicting values");
477 if (nodeName ==
"psi") {
479 size_t nParamsFound = vParams.size();
480 n = iSpecies * m_kk *m_kk + jSpecies * m_kk + kSpecies ;
482 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
483 if (nParamsFound != 1) {
484 throw CanteraError(
"HMWSoln::readXMLPsiCommonCation::Psi for "
485 + kName +
"::" + iName +
"::" + jName,
486 "wrong number of params found");
488 m_Psi_ijk_coeff(0,n) = vParams[0];
489 m_Psi_ijk[n] = vParams[0];
490 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
491 if (nParamsFound != 2) {
492 throw CanteraError(
"HMWSoln::readXMLPsiCation::Psi for "
493 + kName +
"::" + iName +
"::" + jName,
494 "wrong number of params found");
496 m_Psi_ijk_coeff(0,n) = vParams[0];
497 m_Psi_ijk_coeff(1,n) = vParams[1];
498 m_Psi_ijk[n] = vParams[0];
499 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
500 if (nParamsFound == 1) {
501 vParams.resize(5, 0.0);
503 }
else if (nParamsFound != 5) {
504 throw CanteraError(
"HMWSoln::readXMLPsiCation::Psi for "
505 + kName +
"::" + iName +
"::" + jName,
506 "wrong number of params found");
508 for (
size_t j = 0; j < nParamsFound; j++) {
509 m_Psi_ijk_coeff(j, n) = vParams[j];
511 m_Psi_ijk[n] = vParams[0];
516 n = iSpecies * m_kk *m_kk + kSpecies * m_kk + jSpecies ;
517 for (
size_t j = 0; j < nParamsFound; j++) {
518 m_Psi_ijk_coeff(j, n) = vParams[j];
520 m_Psi_ijk[n] = vParams[0];
522 n = jSpecies * m_kk *m_kk + iSpecies * m_kk + kSpecies ;
523 for (
size_t j = 0; j < nParamsFound; j++) {
524 m_Psi_ijk_coeff(j, n) = vParams[j];
526 m_Psi_ijk[n] = vParams[0];
528 n = jSpecies * m_kk *m_kk + kSpecies * m_kk + iSpecies ;
529 for (
size_t j = 0; j < nParamsFound; j++) {
530 m_Psi_ijk_coeff(j, n) = vParams[j];
532 m_Psi_ijk[n] = vParams[0];
534 n = kSpecies * m_kk *m_kk + jSpecies * m_kk + iSpecies ;
535 for (
size_t j = 0; j < nParamsFound; j++) {
536 m_Psi_ijk_coeff(j, n) = vParams[j];
538 m_Psi_ijk[n] = vParams[0];
540 n = kSpecies * m_kk *m_kk + iSpecies * m_kk + jSpecies ;
541 for (
size_t j = 0; j < nParamsFound; j++) {
542 m_Psi_ijk_coeff(j, n) = vParams[j];
544 m_Psi_ijk[n] = vParams[0];
549 void HMWSoln::readXMLPsiCommonAnion(
XML_Node& BinSalt)
551 string xname = BinSalt.
name();
552 if (xname !=
"psiCommonAnion") {
554 "Incorrect name for processing this routine: " + xname);
557 string kName = BinSalt.
attrib(
"anion");
559 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion",
"no anion attrib");
561 string iName = BinSalt.
attrib(
"cation1");
563 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion",
"no cation1 attrib");
565 string jName = BinSalt.
attrib(
"cation2");
567 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion",
"no cation2 attrib");
573 size_t kSpecies = speciesIndex(kName);
574 if (kSpecies ==
npos) {
577 if (charge(kSpecies) >= 0) {
578 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion",
"anion charge problem");
580 size_t iSpecies = speciesIndex(iName);
581 if (iSpecies ==
npos) {
584 if (charge(iSpecies) <= 0) {
586 "cation1 charge problem");
588 size_t jSpecies = speciesIndex(jName);
589 if (jSpecies ==
npos) {
592 if (charge(jSpecies) <= 0) {
594 "cation2 charge problem");
597 size_t n = iSpecies * m_kk + jSpecies;
598 int counter = m_CounterIJ[n];
599 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
601 string stemp = xmlChild.
name();
603 if (nodeName ==
"theta") {
604 stemp = xmlChild.
value();
605 double old = m_Theta_ij[counter];
608 if (old != m_Theta_ij[counter]) {
610 "conflicting values");
614 if (nodeName ==
"psi") {
617 size_t nParamsFound = vParams.size();
618 n = iSpecies * m_kk *m_kk + jSpecies * m_kk + kSpecies ;
620 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
621 if (nParamsFound != 1) {
622 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion::Psi for "
623 + kName +
"::" + iName +
"::" + jName,
624 "wrong number of params found");
626 m_Psi_ijk_coeff(0,n) = vParams[0];
627 m_Psi_ijk[n] = vParams[0];
628 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
629 if (nParamsFound != 2) {
631 + kName +
"::" + iName +
"::" + jName,
632 "wrong number of params found");
634 m_Psi_ijk_coeff(0,n) = vParams[0];
635 m_Psi_ijk_coeff(1,n) = vParams[1];
636 m_Psi_ijk[n] = vParams[0];
637 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
638 if (nParamsFound == 1) {
639 vParams.resize(5, 0.0);
641 }
else if (nParamsFound != 5) {
643 + kName +
"::" + iName +
"::" + jName,
644 "wrong number of params found");
646 for (
size_t j = 0; j < nParamsFound; j++) {
647 m_Psi_ijk_coeff(j, n) = vParams[j];
649 m_Psi_ijk[n] = vParams[0];
654 n = iSpecies * m_kk *m_kk + kSpecies * m_kk + jSpecies ;
655 for (
size_t j = 0; j < nParamsFound; j++) {
656 m_Psi_ijk_coeff(j, n) = vParams[j];
658 m_Psi_ijk[n] = vParams[0];
660 n = jSpecies * m_kk *m_kk + iSpecies * m_kk + kSpecies ;
661 for (
size_t j = 0; j < nParamsFound; j++) {
662 m_Psi_ijk_coeff(j, n) = vParams[j];
664 m_Psi_ijk[n] = vParams[0];
666 n = jSpecies * m_kk *m_kk + kSpecies * m_kk + iSpecies ;
667 for (
size_t j = 0; j < nParamsFound; j++) {
668 m_Psi_ijk_coeff(j, n) = vParams[j];
670 m_Psi_ijk[n] = vParams[0];
672 n = kSpecies * m_kk *m_kk + jSpecies * m_kk + iSpecies ;
673 for (
size_t j = 0; j < nParamsFound; j++) {
674 m_Psi_ijk_coeff(j, n) = vParams[j];
676 m_Psi_ijk[n] = vParams[0];
678 n = kSpecies * m_kk *m_kk + iSpecies * m_kk + jSpecies ;
679 for (
size_t j = 0; j < nParamsFound; j++) {
680 m_Psi_ijk_coeff(j, n) = vParams[j];
682 m_Psi_ijk[n] = vParams[0];
688 void HMWSoln::readXMLLambdaNeutral(
XML_Node& BinSalt)
690 string xname = BinSalt.
name();
692 if (xname !=
"lambdaNeutral") {
694 "Incorrect name for processing this routine: " + xname);
697 string iName = BinSalt.
attrib(
"species1");
699 throw CanteraError(
"HMWSoln::readXMLLambdaNeutral",
"no species1 attrib");
701 string jName = BinSalt.
attrib(
"species2");
703 throw CanteraError(
"HMWSoln::readXMLLambdaNeutral",
"no species2 attrib");
709 size_t iSpecies = speciesIndex(iName);
710 if (iSpecies ==
npos) {
713 if (charge(iSpecies) != 0) {
715 "neutral charge problem");
717 size_t jSpecies = speciesIndex(jName);
718 if (jSpecies ==
npos) {
722 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
724 stemp = xmlChild.
name();
726 if (nodeName ==
"lambda") {
727 size_t nCount = iSpecies*m_kk + jSpecies;
729 size_t nParamsFound = vParams.size();
730 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
731 if (nParamsFound != 1) {
732 throw CanteraError(
"HMWSoln::readXMLLambdaNeutral::Lambda for " + iName
734 "wrong number of params found");
736 m_Lambda_nj_coeff(0,nCount) = vParams[0];
737 m_Lambda_nj(iSpecies,jSpecies) = vParams[0];
739 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
740 if (nParamsFound != 2) {
741 throw CanteraError(
"HMWSoln::readXMLLambdaNeutral::Lambda for " + iName
743 "wrong number of params found");
745 m_Lambda_nj_coeff(0,nCount) = vParams[0];
746 m_Lambda_nj_coeff(1,nCount) = vParams[1];
747 m_Lambda_nj(iSpecies, jSpecies) = vParams[0];
749 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
750 if (nParamsFound == 1) {
751 vParams.resize(5, 0.0);
753 }
else if (nParamsFound != 5) {
754 throw CanteraError(
"HMWSoln::readXMLLambdaNeutral::Lambda for " + iName
756 "wrong number of params found");
758 for (
size_t j = 0; j < nParamsFound; j++) {
759 m_Lambda_nj_coeff(j,nCount) = vParams[j];
761 m_Lambda_nj(iSpecies, jSpecies) = vParams[0];
767 void HMWSoln::readXMLMunnnNeutral(
XML_Node& BinSalt)
769 string xname = BinSalt.
name();
771 if (xname !=
"MunnnNeutral") {
773 "Incorrect name for processing this routine: " + xname);
776 string iName = BinSalt.
attrib(
"species1");
778 throw CanteraError(
"HMWSoln::readXMLMunnnNeutral",
"no species1 attrib");
785 size_t iSpecies = speciesIndex(iName);
786 if (iSpecies ==
npos) {
789 if (charge(iSpecies) != 0) {
791 "neutral charge problem");
794 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
796 stemp = xmlChild.
name();
798 if (nodeName ==
"munnn") {
800 size_t nParamsFound = vParams.size();
801 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
802 if (nParamsFound != 1) {
803 throw CanteraError(
"HMWSoln::readXMLMunnnNeutral::Munnn for " + iName,
804 "wrong number of params found");
806 m_Mu_nnn_coeff(0,iSpecies) = vParams[0];
807 m_Mu_nnn[iSpecies] = vParams[0];
809 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
810 if (nParamsFound != 2) {
811 throw CanteraError(
"HMWSoln::readXMLMunnnNeutral::Munnn for " + iName,
812 "wrong number of params found");
814 m_Mu_nnn_coeff(0, iSpecies) = vParams[0];
815 m_Mu_nnn_coeff(1, iSpecies) = vParams[1];
816 m_Mu_nnn[iSpecies] = vParams[0];
818 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
819 if (nParamsFound == 1) {
820 vParams.resize(5, 0.0);
822 }
else if (nParamsFound != 5) {
823 throw CanteraError(
"HMWSoln::readXMLMunnnNeutral::Munnn for " + iName,
824 "wrong number of params found");
826 for (
size_t j = 0; j < nParamsFound; j++) {
827 m_Mu_nnn_coeff(j, iSpecies) = vParams[j];
829 m_Mu_nnn[iSpecies] = vParams[0];
835 void HMWSoln::readXMLZetaCation(
const XML_Node& BinSalt)
837 string xname = BinSalt.
name();
838 if (xname !=
"zetaCation") {
840 "Incorrect name for processing this routine: " + xname);
844 string iName = BinSalt.
attrib(
"neutral");
846 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"no neutral attrib");
849 string jName = BinSalt.
attrib(
"cation1");
851 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"no cation1 attrib");
854 string kName = BinSalt.
attrib(
"anion1");
856 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"no anion1 attrib");
862 size_t iSpecies = speciesIndex(iName);
863 if (iSpecies ==
npos) {
866 if (charge(iSpecies) != 0.0) {
867 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"neutral charge problem");
870 size_t jSpecies = speciesIndex(jName);
871 if (jSpecies ==
npos) {
874 if (charge(jSpecies) <= 0.0) {
875 throw CanteraError(
"HMWSoln::readXLZetaCation",
"cation1 charge problem");
878 size_t kSpecies = speciesIndex(kName);
879 if (kSpecies ==
npos) {
882 if (charge(kSpecies) >= 0.0) {
883 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"anion1 charge problem");
886 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
888 string stemp = xmlChild.
name();
890 if (nodeName ==
"zeta") {
892 size_t nParamsFound = vParams.size();
893 size_t n = iSpecies * m_kk *m_kk + jSpecies * m_kk + kSpecies ;
895 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
896 if (nParamsFound != 1) {
897 throw CanteraError(
"HMWSoln::readXMLZetaCation::Zeta for "
898 + iName +
"::" + jName +
"::" + kName,
899 "wrong number of params found");
901 m_Psi_ijk_coeff(0,n) = vParams[0];
902 m_Psi_ijk[n] = vParams[0];
903 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
904 if (nParamsFound != 2) {
905 throw CanteraError(
"HMWSoln::readXMLZetaCation::Zeta for "
906 + iName +
"::" + jName +
"::" + kName,
907 "wrong number of params found");
909 m_Psi_ijk_coeff(0,n) = vParams[0];
910 m_Psi_ijk_coeff(1,n) = vParams[1];
911 m_Psi_ijk[n] = vParams[0];
912 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
913 if (nParamsFound == 1) {
914 vParams.resize(5, 0.0);
916 }
else if (nParamsFound != 5) {
917 throw CanteraError(
"HMWSoln::readXMLZetaCation::Zeta for "
918 + iName +
"::" + jName +
"::" + kName,
919 "wrong number of params found");
921 for (
size_t j = 0; j < nParamsFound; j++) {
922 m_Psi_ijk_coeff(j, n) = vParams[j];
924 m_Psi_ijk[n] = vParams[0];
932 void HMWSoln::readXMLCroppingCoefficients(
const XML_Node& acNode)
935 if (acNode.
hasChild(
"croppingCoefficients")) {
937 if (cropNode.
hasChild(
"ln_gamma_k_min")) {
941 if (cropNode.
hasChild(
"ln_gamma_k_max")) {
946 if (cropNode.
hasChild(
"ln_gamma_o_min")) {
951 if (cropNode.
hasChild(
"ln_gamma_o_max")) {
958 void HMWSoln::initThermo()
960 MolalityVPSSTP::initThermo();
964 void HMWSoln::constructPhaseFile(std::string inputFile, std::string id_)
967 if (inputFile.size() == 0) {
969 "input file is null");
972 std::ifstream fin(path.c_str());
974 throw CanteraError(
"HMWSoln:constructPhaseFile",
"could not open "
975 +path+
" for reading.");
986 "ERROR: Can not find phase named " +
987 id_ +
" in file named " + inputFile);
989 setXMLdata(*fxml_phase);
990 constructPhaseXML(*fxml_phase, id_);
993 void HMWSoln::constructPhaseXML(
XML_Node& phaseNode, std::string id_)
995 if (id_.size() > 0) {
996 string idp = phaseNode.
id();
999 "phasenode and Id are incompatible");
1006 if (!phaseNode.
hasChild(
"thermo")) {
1008 "no thermo XML node");
1015 if (thermoNode.
hasChild(
"standardConc")) {
1018 string stemp = scNode.
attrib(
"model");
1020 if (formString !=
"") {
1021 if (formString ==
"unity") {
1024 "standardConc = unity not done");
1025 }
else if (formString ==
"molar_volume") {
1028 "standardConc = molar_volume not done");
1029 }
else if (formString ==
"solvent_volume") {
1033 "Unknown standardConc model: " + formString);
1041 string solventName =
"";
1042 if (thermoNode.
hasChild(
"solvent")) {
1044 vector<string> nameSolventa;
1046 if (nameSolventa.size() != 1) {
1048 "badly formed solvent XML node");
1050 solventName = nameSolventa[0];
1057 if (thermoNode.
hasChild(
"activityCoefficients")) {
1058 XML_Node& scNode = thermoNode.
child(
"activityCoefficients");
1059 string stemp = scNode.
attrib(
"model");
1061 if (formString !=
"") {
1062 if (formString ==
"pitzer" || formString ==
"default") {
1064 }
else if (formString ==
"base") {
1068 "Unknown Pitzer ActivityCoeff model: "
1076 stemp = scNode.
attrib(
"TempModel");
1078 if (formString !=
"") {
1079 if (formString ==
"constant" || formString ==
"default") {
1080 m_formPitzerTemp = PITZER_TEMP_CONSTANT;
1081 }
else if (formString ==
"linear") {
1082 m_formPitzerTemp = PITZER_TEMP_LINEAR;
1083 }
else if (formString ==
"complex" || formString ==
"complex1") {
1084 m_formPitzerTemp = PITZER_TEMP_COMPLEX1;
1087 "Unknown Pitzer ActivityCoeff Temp model: "
1097 stemp = scNode.
attrib(
"TempReference");
1099 if (formString !=
"") {
1102 m_TempPitzerRef = 273.15 + 25;
1115 void HMWSoln::initThermoXML(
XML_Node& phaseNode,
const std::string& id_)
1117 if (id_.size() > 0) {
1118 string idp = phaseNode.
id();
1121 "phasenode and Id are incompatible");
1128 if (!phaseNode.
hasChild(
"thermo")) {
1130 "no thermo XML node");
1137 if (thermoNode.
hasChild(
"standardConc")) {
1140 string stemp = scNode.
attrib(
"model");
1142 if (formString !=
"") {
1143 if (formString ==
"unity") {
1146 "standardConc = unity not done");
1147 }
else if (formString ==
"molar_volume") {
1150 "standardConc = molar_volume not done");
1151 }
else if (formString ==
"solvent_volume") {
1155 "Unknown standardConc model: " + formString);
1164 if (thermoNode.
hasChild(
"activityCoefficients")) {
1165 XML_Node& scNode = thermoNode.
child(
"activityCoefficients");
1166 string stemp = scNode.
attrib(
"model");
1168 if (formString !=
"") {
1169 if (formString ==
"pitzer" || formString ==
"default") {
1171 }
else if (formString ==
"base") {
1175 "Unknown Pitzer ActivityCoeff model: "
1184 stemp = scNode.
attrib(
"TempModel");
1186 if (formString !=
"") {
1187 if (formString ==
"constant" || formString ==
"default") {
1188 m_formPitzerTemp = PITZER_TEMP_CONSTANT;
1189 }
else if (formString ==
"linear") {
1190 m_formPitzerTemp = PITZER_TEMP_LINEAR;
1191 }
else if (formString ==
"complex" || formString ==
"complex1") {
1192 m_formPitzerTemp = PITZER_TEMP_COMPLEX1;
1195 "Unknown Pitzer ActivityCoeff Temp model: "
1205 stemp = scNode.
attrib(
"TempReference");
1207 if (formString !=
"") {
1210 m_TempPitzerRef = 273.15 + 25;
1219 string solventName =
"";
1220 if (thermoNode.
hasChild(
"solvent")) {
1222 vector<string> nameSolventa;
1224 if (nameSolventa.size() != 1) {
1226 "badly formed solvent XML node");
1228 solventName = nameSolventa[0];
1240 for (
size_t k = 0; k < m_kk; k++) {
1241 string sname = speciesName(k);
1242 if (solventName == sname) {
1246 "Solvent must be species 0 atm");
1252 if (m_indexSolvent ==
npos) {
1253 std::cout <<
"HMWSoln::initThermo: Solvent Name not found"
1256 "Solvent name not found");
1258 if (m_indexSolvent != 0) {
1260 "Solvent " + solventName +
1261 " should be first species");
1273 const vector<string>&sss = speciesNames();
1275 for (
size_t k = 0; k < m_kk; k++) {
1279 "Species Data Base " + sss[k] +
" not found");
1284 "Species " + sss[k] +
1285 " standardState XML block not found");
1287 string modelStringa = ss->
attrib(
"model");
1288 if (modelStringa ==
"") {
1290 "Species " + sss[k] +
1291 " standardState XML block model attribute not found");
1293 string modelString =
lowercase(modelStringa);
1295 if (modelString ==
"wateriapws" || modelString ==
"real_water" ||
1296 modelString ==
"waterpdss") {
1301 m_waterSS =
dynamic_cast<PDSS_Water*
>(providePDSS(0)) ;
1304 "Dynamic cast to PDSS_Water failed");
1311 m_waterSS->setState_TP(300.,
OneAtm);
1312 double dens = m_waterSS->density();
1313 double mw = m_waterSS->molecularWeight();
1314 m_speciesSize[0] = mw / dens;
1315 #ifdef DEBUG_HKM_NOT
1316 cout <<
"Solvent species " << sss[k] <<
" has volume " <<
1317 m_speciesSize[k] << endl;
1320 m_waterSS = providePDSS(0);
1321 m_waterSS->setState_TP(300.,
OneAtm);
1322 double dens = m_waterSS->density();
1323 double mw = m_waterSS->molecularWeight();
1324 m_speciesSize[0] = mw / dens;
1327 if (modelString !=
"constant_incompressible" && modelString !=
"hkft") {
1329 "Solute SS Model \"" + modelStringa +
1332 if (modelString ==
"constant_incompressible") {
1333 m_speciesSize[k] =
getFloat(*ss,
"molarVolume",
"toSI");
1334 #ifdef DEBUG_HKM_NOT
1335 cout <<
"species " << sss[k] <<
" has volume " <<
1336 m_speciesSize[k] << endl;
1347 m_waterProps =
new WaterProps(dynamic_cast<PDSS_Water*>(m_waterSS));
1356 for (
size_t k = 0; k < m_kk; k++) {
1357 m_speciesCharge_Stoich[k] = charge(k);
1365 if (thermoNode.
hasChild(
"activityCoefficients")) {
1366 XML_Node& acNode = thermoNode.
child(
"activityCoefficients");
1367 acNodePtr = &acNode;
1373 m_form_A_Debye = A_DEBYE_CONST;
1374 string stemp =
"model";
1376 string atemp = ADebye.
attrib(stemp);
1378 if (stemp ==
"water") {
1379 m_form_A_Debye = A_DEBYE_WATER;
1382 if (m_form_A_Debye == A_DEBYE_CONST) {
1383 m_A_Debye =
getFloat(acNode,
"A_Debye");
1385 #ifdef DEBUG_HKM_NOT
1386 cout <<
"A_Debye = " << m_A_Debye << endl;
1393 if (acNode.
hasChild(
"maxIonicStrength")) {
1394 m_maxIionicStrength =
getFloat(acNode,
"maxIonicStrength");
1395 #ifdef DEBUG_HKM_NOT
1396 cout <<
"m_maxIionicStrength = "
1397 <<m_maxIionicStrength << endl;
1405 if (acNode.
hasChild(
"ionicRadius")) {
1408 double Afactor = 1.0;
1410 string Aunits = irNode.
attrib(
"units");
1411 Afactor =
toSI(Aunits);
1415 string ads = irNode.
attrib(
"default");
1417 for (
size_t k = 0; k < m_kk; k++) {
1418 m_Aionic[k] = ad * Afactor;
1429 std::vector<const XML_Node*> xspecies = speciesData();
1431 for (
size_t k = 0; k < m_kk; k++) {
1433 string kname = speciesName(k);
1434 for (
size_t j = 0; j < xspecies.size(); j++) {
1436 string jname = sp[
"name"];
1437 if (jname == kname) {
1443 const XML_Node& sp = *xspecies[jmap];
1452 if (acNodePtr->
hasChild(
"stoichIsMods")) {
1455 map<string, string> msIs;
1457 for (map<string,string>::const_iterator _b = msIs.begin();
1460 size_t kk = speciesIndex(_b->first);
1462 double val =
fpValue(_b->second);
1463 m_speciesCharge_Stoich[kk] = val;
1475 for (
size_t i = 0; i < acNodePtr->
nChildren(); i++) {
1477 string stemp = xmlACChild.
name();
1484 if (nodeName ==
"binarysaltparameters") {
1485 readXMLBinarySalt(xmlACChild);
1486 }
else if (nodeName ==
"thetaanion") {
1487 readXMLThetaAnion(xmlACChild);
1488 }
else if (nodeName ==
"thetacation") {
1489 readXMLThetaCation(xmlACChild);
1490 }
else if (nodeName ==
"psicommonanion") {
1491 readXMLPsiCommonAnion(xmlACChild);
1492 }
else if (nodeName ==
"psicommoncation") {
1493 readXMLPsiCommonCation(xmlACChild);
1494 }
else if (nodeName ==
"lambdaneutral") {
1495 readXMLLambdaNeutral(xmlACChild);
1496 }
else if (nodeName ==
"zetacation") {
1497 readXMLZetaCation(xmlACChild);
1503 readXMLCroppingCoefficients(acNode);
1514 for (
size_t k = 0; k < m_kk; k++) {
1515 if (fabs(charge(k)) > 0.0001) {
1516 m_electrolyteSpeciesType[k] = cEST_chargedSpecies;
1517 if (fabs(m_speciesCharge_Stoich[k] - charge(k))
1519 m_electrolyteSpeciesType[k] = cEST_weakAcidAssociated;
1521 }
else if (fabs(m_speciesCharge_Stoich[k]) > 0.0001) {
1522 m_electrolyteSpeciesType[k] = cEST_weakAcidAssociated;
1524 m_electrolyteSpeciesType[k] = cEST_nonpolarNeutral;
1527 m_electrolyteSpeciesType[m_indexSolvent] =
cEST_solvent;
1533 std::vector<const XML_Node*> xspecies = speciesData();
1534 for (
size_t k = 0; k < m_kk; k++) {
1535 const XML_Node* spPtr = xspecies[k];
1537 if (spPtr->
hasChild(
"electrolyteSpeciesType")) {
1538 string est =
getChildValue(*spPtr,
"electrolyteSpeciesType");
1539 if ((m_electrolyteSpeciesType[k] =
interp_est(est)) == -1) {
1541 "Bad electrolyte type: " + est);
1550 if (acNodePtr->
hasChild(
"electrolyteSpeciesType")) {
1551 XML_Node& ESTNode = acNodePtr->
child(
"electrolyteSpeciesType");
1552 map<string, string> msEST;
1554 for (map<string,string>::const_iterator _b = msEST.begin();
1557 size_t kk = speciesIndex(_b->first);
1559 string est = _b->second;
1560 if ((m_electrolyteSpeciesType[kk] =
interp_est(est)) == -1) {
1562 "Bad electrolyte type: " + est);
1569 IMS_typeCutoff_ = 2;
1570 if (IMS_typeCutoff_ == 2) {
1571 calcIMSCutoffParams_();
1573 calcMCCutoffParams_();
1574 setMoleFSolventMin(1.0E-5);
1576 MolalityVPSSTP::initThermoXML(phaseNode, id_);
1583 bool notDone =
true;
1587 size_t kMaxC =
npos;
1589 for (
size_t k = 0; k < m_kk; k++) {
1590 sum += mf[k] * charge(k);
1591 if (fabs(mf[k] * charge(k)) > MaxC) {
1595 size_t kHp = speciesIndex(
"H+");
1596 size_t kOHm = speciesIndex(
"OH-");
1599 if (fabs(sum) > 1.0E-30) {
1601 if (mf[kHp] > sum * 1.1) {
1615 if (mf[kOHm] > -sum * 1.1) {
1628 if (kMaxC !=
npos) {
1629 if (mf[kMaxC] > (1.1 * sum / charge(kMaxC))) {
1630 mf[kMaxC] -= sum / charge(kMaxC);
1631 mf[0] += sum / charge(kMaxC);
1647 void HMWSoln::calcIMSCutoffParams_()
1649 IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_);
1651 bool converged =
false;
1653 for (
int its = 0; its < 100 && !converged; its++) {
1655 IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_) -IMS_efCut_;
1656 IMS_bfCut_ = IMS_afCut_ / IMS_cCut_ + IMS_slopefCut_ - 1.0;
1657 IMS_dfCut_ = ((- IMS_afCut_/IMS_cCut_ + IMS_bfCut_ - IMS_bfCut_*IMS_X_o_cutoff_/IMS_cCut_)
1659 (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
1660 double tmp = IMS_afCut_ + IMS_X_o_cutoff_*(IMS_bfCut_ + IMS_dfCut_ *IMS_X_o_cutoff_);
1661 double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
1662 IMS_efCut_ = - eterm * (tmp);
1663 if (fabs(IMS_efCut_ - oldV) < 1.0E-14) {
1669 " failed to converge on the f polynomial");
1672 double f_0 = IMS_afCut_ + IMS_efCut_;
1673 double f_prime_0 = 1.0 - IMS_afCut_ / IMS_cCut_ + IMS_bfCut_;
1675 for (
int its = 0; its < 100 && !converged; its++) {
1677 double lng_0 = -log(IMS_gamma_o_min_) - f_prime_0 / f_0;
1678 IMS_agCut_ = exp(lng_0) - IMS_egCut_;
1679 IMS_bgCut_ = IMS_agCut_ / IMS_cCut_ + IMS_slopegCut_ - 1.0;
1680 IMS_dgCut_ = ((- IMS_agCut_/IMS_cCut_ + IMS_bgCut_ - IMS_bgCut_*IMS_X_o_cutoff_/IMS_cCut_)
1682 (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
1683 double tmp = IMS_agCut_ + IMS_X_o_cutoff_*(IMS_bgCut_ + IMS_dgCut_ *IMS_X_o_cutoff_);
1684 double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
1685 IMS_egCut_ = - eterm * (tmp);
1686 if (fabs(IMS_egCut_ - oldV) < 1.0E-14) {
1692 " failed to converge on the g polynomial");
1696 void HMWSoln::calcMCCutoffParams_()
1699 MC_X_o_cutoff_ = 0.6;
1700 MC_slopepCut_ = 0.02;
1704 MC_apCut_ = MC_X_o_min_;
1706 bool converged =
false;
1709 for (
int its = 0; its < 500 && !converged; its++) {
1711 MC_apCut_ = damp *(MC_X_o_min_ - MC_epCut_) + (1-damp) * MC_apCut_;
1712 double MC_bpCutNew = MC_apCut_ / MC_cpCut_ + MC_slopepCut_ - 1.0;
1713 MC_bpCut_ = damp * MC_bpCutNew + (1-damp) * MC_bpCut_;
1714 double MC_dpCutNew = ((- MC_apCut_/MC_cpCut_ + MC_bpCut_ - MC_bpCut_ * MC_X_o_cutoff_/MC_cpCut_)
1716 (MC_X_o_cutoff_ * MC_X_o_cutoff_/MC_cpCut_ - 2.0 * MC_X_o_cutoff_));
1717 MC_dpCut_ = damp * MC_dpCutNew + (1-damp) * MC_dpCut_;
1718 double tmp = MC_apCut_ + MC_X_o_cutoff_*(MC_bpCut_ + MC_dpCut_ * MC_X_o_cutoff_);
1719 double eterm = std::exp(- MC_X_o_cutoff_ / MC_cpCut_);
1720 MC_epCut_ = - eterm * (tmp);
1721 double diff = MC_epCut_ - oldV;
1722 if (fabs(diff) < 1.0E-14) {
1728 " failed to converge on the p polynomial");
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.
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...
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].
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
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"
Header file for a common definitions used in electrolytes thermodynamics.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
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...
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
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...
bool importPhase(XML_Node &phase, ThermoPhase *th, SpeciesThermoFactory *spfactory)
Import a phase information into an empty ThermoPhase object.
Headers for the HMWSoln ThermoPhase object, which models concentrated electrolyte solutions (see Ther...
The WaterProps class is used to house several approximation routines for properties of water...
#define PITZERFORM_BASE
Major Parameters: The form of the Pitzer expression refers to the form of the Gibbs free energy expre...
Class for the liquid water pressure dependent standard state.
std::string name() const
Returns the name of the XML node.
Base class for exceptions thrown by Cantera classes.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
std::string value() const
Return the value of an XML node as a string.
std::string id() const
Return the id attribute, if present.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
void getStringArray(const XML_Node &node, std::vector< std::string > &v)
This function interprets the value portion of an XML element as a string.
size_t getFloatArray(const XML_Node &node, std::vector< doublereal > &v, const bool convert, const std::string &unitsString, const std::string &nodeName)
This function reads the current node or a child node of the current node with the default name...
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.
XML_Node & root() const
Return the root of the current XML_Node tree.
doublereal fpValueCheck(const std::string &val)
Translate a string into one doublereal value, with error checking.
void build(std::istream &f)
Main routine to create an tree-like representation of an XML file.
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 ...
size_t nChildren(bool discardComments=false) const
Return the number of children.
bool hasAttrib(const std::string &a) const
Tests whether the current node has an attribute with a particular name.
bool getOptionalFloat(const XML_Node &parent, const std::string &name, doublereal &fltRtn, const std::string &type)
Get an optional floating-point value from a child element.