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);
61 size_t nParamsFound, i;
63 string iName = BinSalt.
attrib(
"cation");
65 throw CanteraError(
"HMWSoln::readXMLBinarySalt",
"no cation attrib");
67 string jName = BinSalt.
attrib(
"anion");
69 throw CanteraError(
"HMWSoln::readXMLBinarySalt",
"no anion attrib");
75 size_t iSpecies = speciesIndex(iName);
76 if (iSpecies ==
npos) {
79 string ispName = speciesName(iSpecies);
80 if (charge(iSpecies) <= 0) {
81 throw CanteraError(
"HMWSoln::readXMLBinarySalt",
"cation charge problem");
83 size_t jSpecies = speciesIndex(jName);
84 if (jSpecies ==
npos) {
87 string jspName = speciesName(jSpecies);
88 if (charge(jSpecies) >= 0) {
89 throw CanteraError(
"HMWSoln::readXMLBinarySalt",
"anion charge problem");
92 size_t n = iSpecies * m_kk + jSpecies;
93 int counter = m_CounterIJ[n];
94 for (
size_t iChild = 0; iChild < BinSalt.
nChildren(); iChild++) {
96 stemp = xmlChild.
name();
101 if (nodeName ==
"beta0") {
106 nParamsFound = vParams.size();
107 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
108 if (nParamsFound != 1) {
109 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta0 for " + ispName
111 "wrong number of params found");
113 m_Beta0MX_ij[counter] = vParams[0];
114 m_Beta0MX_ij_coeff(0,counter) = m_Beta0MX_ij[counter];
115 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
116 if (nParamsFound != 2) {
117 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta0 for " + ispName
119 "wrong number of params found");
121 m_Beta0MX_ij_coeff(0,counter) = vParams[0];
122 m_Beta0MX_ij_coeff(1,counter) = vParams[1];
123 m_Beta0MX_ij[counter] = vParams[0];
124 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
125 if (nParamsFound != 5) {
126 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta0 for " + ispName
128 "wrong number of params found");
130 for (i = 0; i < nParamsFound; i++) {
131 m_Beta0MX_ij_coeff(i, counter) = vParams[i];
133 m_Beta0MX_ij[counter] = vParams[0];
136 if (nodeName ==
"beta1") {
142 nParamsFound = vParams.size();
143 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
144 if (nParamsFound != 1) {
145 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta1 for " + ispName
147 "wrong number of params found");
149 m_Beta1MX_ij[counter] = vParams[0];
150 m_Beta1MX_ij_coeff(0,counter) = m_Beta1MX_ij[counter];
151 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
152 if (nParamsFound != 2) {
153 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta1 for " + ispName
155 "wrong number of params found");
157 m_Beta1MX_ij_coeff(0,counter) = vParams[0];
158 m_Beta1MX_ij_coeff(1,counter) = vParams[1];
159 m_Beta1MX_ij[counter] = vParams[0];
160 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
161 if (nParamsFound != 5) {
162 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta1 for " + ispName
164 "wrong number of params found");
166 for (i = 0; i < nParamsFound; i++) {
167 m_Beta1MX_ij_coeff(i, counter) = vParams[i];
169 m_Beta1MX_ij[counter] = vParams[0];
172 if (nodeName ==
"beta2") {
174 nParamsFound = vParams.size();
175 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
176 if (nParamsFound != 1) {
177 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta2 for " + ispName
179 "wrong number of params found");
181 m_Beta2MX_ij[counter] = vParams[0];
182 m_Beta2MX_ij_coeff(0,counter) = m_Beta2MX_ij[counter];
183 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
184 if (nParamsFound != 2) {
185 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta2 for " + ispName
187 "wrong number of params found");
189 m_Beta2MX_ij_coeff(0,counter) = vParams[0];
190 m_Beta2MX_ij_coeff(1,counter) = vParams[1];
191 m_Beta2MX_ij[counter] = vParams[0];
192 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
193 if (nParamsFound != 5) {
194 throw CanteraError(
"HMWSoln::readXMLBinarySalt::beta2 for " + ispName
196 "wrong number of params found");
198 for (i = 0; i < nParamsFound; i++) {
199 m_Beta2MX_ij_coeff(i, counter) = vParams[i];
201 m_Beta2MX_ij[counter] = vParams[0];
205 if (nodeName ==
"cphi") {
210 nParamsFound = vParams.size();
211 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
212 if (nParamsFound != 1) {
213 throw CanteraError(
"HMWSoln::readXMLBinarySalt::Cphi for " + ispName
215 "wrong number of params found");
217 m_CphiMX_ij[counter] = vParams[0];
218 m_CphiMX_ij_coeff(0,counter) = m_CphiMX_ij[counter];
219 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
220 if (nParamsFound != 2) {
221 throw CanteraError(
"HMWSoln::readXMLBinarySalt::Cphi for " + ispName
223 "wrong number of params found");
225 m_CphiMX_ij_coeff(0,counter) = vParams[0];
226 m_CphiMX_ij_coeff(1,counter) = vParams[1];
227 m_CphiMX_ij[counter] = vParams[0];
228 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
229 if (nParamsFound != 5) {
230 throw CanteraError(
"HMWSoln::readXMLBinarySalt::Cphi for " + ispName
232 "wrong number of params found");
234 for (i = 0; i < nParamsFound; i++) {
235 m_CphiMX_ij_coeff(i, counter) = vParams[i];
237 m_CphiMX_ij[counter] = vParams[0];
241 if (nodeName ==
"alpha1") {
242 stemp = xmlChild.
value();
246 if (nodeName ==
"alpha2") {
247 stemp = xmlChild.
value();
255 string xname = BinSalt.
name();
257 size_t nParamsFound = 0;
258 if (xname !=
"thetaAnion") {
260 "Incorrect name for processing this routine: " + xname);
263 string ispName = BinSalt.
attrib(
"anion1");
265 throw CanteraError(
"HMWSoln::readXMLThetaAnion",
"no anion1 attrib");
267 string jspName = BinSalt.
attrib(
"anion2");
269 throw CanteraError(
"HMWSoln::readXMLThetaAnion",
"no anion2 attrib");
275 size_t iSpecies = speciesIndex(ispName);
276 if (iSpecies ==
npos) {
279 if (charge(iSpecies) >= 0) {
280 throw CanteraError(
"HMWSoln::readXMLThetaAnion",
"anion1 charge problem");
282 size_t jSpecies = speciesIndex(jspName);
283 if (jSpecies ==
npos) {
286 if (charge(jSpecies) >= 0) {
287 throw CanteraError(
"HMWSoln::readXMLThetaAnion",
"anion2 charge problem");
290 size_t n = iSpecies * m_kk + jSpecies;
291 int counter = m_CounterIJ[n];
292 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
294 stemp = xmlChild.
name();
296 if (nodeName ==
"theta") {
298 nParamsFound = vParams.size();
299 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
300 if (nParamsFound != 1) {
301 throw CanteraError(
"HMWSoln::readXMLThetaAnion::Theta for " + ispName
303 "wrong number of params found");
305 m_Theta_ij_coeff(0,counter) = vParams[0];
306 m_Theta_ij[counter] = vParams[0];
307 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
308 if (nParamsFound != 2) {
309 throw CanteraError(
"HMWSoln::readXMLThetaAnion::Theta for " + ispName
311 "wrong number of params found");
313 m_Theta_ij_coeff(0,counter) = vParams[0];
314 m_Theta_ij_coeff(1,counter) = vParams[1];
315 m_Theta_ij[counter] = vParams[0];
316 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
317 if (nParamsFound == 1) {
318 vParams.resize(5, 0.0);
320 }
else if (nParamsFound != 5) {
321 throw CanteraError(
"HMWSoln::readXMLThetaAnion::Theta for " + ispName
323 "wrong number of params found");
325 for (
size_t j = 0; j < nParamsFound; j++) {
326 m_Theta_ij_coeff(j, counter) = vParams[j];
328 m_Theta_ij[counter] = vParams[0];
334 void HMWSoln::readXMLThetaCation(
XML_Node& BinSalt)
336 string xname = BinSalt.
name();
338 size_t nParamsFound = 0;
339 if (xname !=
"thetaCation") {
341 "Incorrect name for processing this routine: " + xname);
344 string ispName = BinSalt.
attrib(
"cation1");
346 throw CanteraError(
"HMWSoln::readXMLThetaCation",
"no cation1 attrib");
348 string jspName = BinSalt.
attrib(
"cation2");
350 throw CanteraError(
"HMWSoln::readXMLThetaCation",
"no cation2 attrib");
356 size_t iSpecies = speciesIndex(ispName);
357 if (iSpecies ==
npos) {
360 if (charge(iSpecies) <= 0) {
361 throw CanteraError(
"HMWSoln::readXMLThetaCation",
"cation1 charge problem");
363 size_t jSpecies = speciesIndex(jspName);
364 if (jSpecies ==
npos) {
367 if (charge(jSpecies) <= 0) {
368 throw CanteraError(
"HMWSoln::readXMLThetaCation",
"cation2 charge problem");
371 size_t n = iSpecies * m_kk + jSpecies;
372 int counter = m_CounterIJ[n];
373 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
375 stemp = xmlChild.
name();
377 if (nodeName ==
"theta") {
379 nParamsFound = vParams.size();
380 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
381 if (nParamsFound != 1) {
382 throw CanteraError(
"HMWSoln::readXMLThetaCation::Theta for " + ispName
384 "wrong number of params found");
386 m_Theta_ij_coeff(0,counter) = vParams[0];
387 m_Theta_ij[counter] = vParams[0];
388 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
389 if (nParamsFound != 2) {
390 throw CanteraError(
"HMWSoln::readXMLThetaCation::Theta for " + ispName
392 "wrong number of params found");
394 m_Theta_ij_coeff(0,counter) = vParams[0];
395 m_Theta_ij_coeff(1,counter) = vParams[1];
396 m_Theta_ij[counter] = vParams[0];
397 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
398 if (nParamsFound == 1) {
399 vParams.resize(5, 0.0);
401 }
else if (nParamsFound != 5) {
402 throw CanteraError(
"HMWSoln::readXMLThetaCation::Theta for " + ispName
404 "wrong number of params found");
406 for (
size_t j = 0; j < nParamsFound; j++) {
407 m_Theta_ij_coeff(j, counter) = vParams[j];
409 m_Theta_ij[counter] = vParams[0];
415 void HMWSoln::readXMLPsiCommonCation(
XML_Node& BinSalt)
417 string xname = BinSalt.
name();
418 if (xname !=
"psiCommonCation") {
420 "Incorrect name for processing this routine: " + xname);
424 size_t nParamsFound = 0;
425 string kName = BinSalt.
attrib(
"cation");
427 throw CanteraError(
"HMWSoln::readXMLPsiCommonCation",
"no cation attrib");
429 string iName = BinSalt.
attrib(
"anion1");
431 throw CanteraError(
"HMWSoln::readXMLPsiCommonCation",
"no anion1 attrib");
433 string jName = BinSalt.
attrib(
"anion2");
435 throw CanteraError(
"HMWSoln::readXMLPsiCommonCation",
"no anion2 attrib");
441 size_t kSpecies = speciesIndex(kName);
442 if (kSpecies ==
npos) {
445 if (charge(kSpecies) <= 0) {
447 "cation charge problem");
449 size_t iSpecies = speciesIndex(iName);
450 if (iSpecies ==
npos) {
453 if (charge(iSpecies) >= 0) {
455 "anion1 charge problem");
457 size_t jSpecies = speciesIndex(jName);
458 if (jSpecies ==
npos) {
461 if (charge(jSpecies) >= 0) {
463 "anion2 charge problem");
466 size_t n = iSpecies * m_kk + jSpecies;
467 int counter = m_CounterIJ[n];
468 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
470 stemp = xmlChild.
name();
472 if (nodeName ==
"theta") {
473 stemp = xmlChild.
value();
474 double old = m_Theta_ij[counter];
477 if (old != m_Theta_ij[counter]) {
479 "conflicting values");
483 if (nodeName ==
"psi") {
485 nParamsFound = vParams.size();
486 n = iSpecies * m_kk *m_kk + jSpecies * m_kk + kSpecies ;
488 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
489 if (nParamsFound != 1) {
490 throw CanteraError(
"HMWSoln::readXMLPsiCommonCation::Psi for "
491 + kName +
"::" + iName +
"::" + jName,
492 "wrong number of params found");
494 m_Psi_ijk_coeff(0,n) = vParams[0];
495 m_Psi_ijk[n] = vParams[0];
496 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
497 if (nParamsFound != 2) {
498 throw CanteraError(
"HMWSoln::readXMLPsiCation::Psi for "
499 + kName +
"::" + iName +
"::" + jName,
500 "wrong number of params found");
502 m_Psi_ijk_coeff(0,n) = vParams[0];
503 m_Psi_ijk_coeff(1,n) = vParams[1];
504 m_Psi_ijk[n] = vParams[0];
505 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
506 if (nParamsFound == 1) {
507 vParams.resize(5, 0.0);
509 }
else if (nParamsFound != 5) {
510 throw CanteraError(
"HMWSoln::readXMLPsiCation::Psi for "
511 + kName +
"::" + iName +
"::" + jName,
512 "wrong number of params found");
514 for (
size_t j = 0; j < nParamsFound; j++) {
515 m_Psi_ijk_coeff(j, n) = vParams[j];
517 m_Psi_ijk[n] = vParams[0];
522 n = iSpecies * m_kk *m_kk + kSpecies * m_kk + jSpecies ;
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 + iSpecies * m_kk + kSpecies ;
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 = jSpecies * m_kk *m_kk + kSpecies * 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 + jSpecies * m_kk + iSpecies ;
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];
546 n = kSpecies * m_kk *m_kk + iSpecies * m_kk + jSpecies ;
547 for (
size_t j = 0; j < nParamsFound; j++) {
548 m_Psi_ijk_coeff(j, n) = vParams[j];
550 m_Psi_ijk[n] = vParams[0];
555 void HMWSoln::readXMLPsiCommonAnion(
XML_Node& BinSalt)
557 string xname = BinSalt.
name();
558 if (xname !=
"psiCommonAnion") {
560 "Incorrect name for processing this routine: " + xname);
564 size_t nParamsFound = 0;
565 string kName = BinSalt.
attrib(
"anion");
567 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion",
"no anion attrib");
569 string iName = BinSalt.
attrib(
"cation1");
571 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion",
"no cation1 attrib");
573 string jName = BinSalt.
attrib(
"cation2");
575 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion",
"no cation2 attrib");
581 size_t kSpecies = speciesIndex(kName);
582 if (kSpecies ==
npos) {
585 if (charge(kSpecies) >= 0) {
586 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion",
"anion charge problem");
588 size_t iSpecies = speciesIndex(iName);
589 if (iSpecies ==
npos) {
592 if (charge(iSpecies) <= 0) {
594 "cation1 charge problem");
596 size_t jSpecies = speciesIndex(jName);
597 if (jSpecies ==
npos) {
600 if (charge(jSpecies) <= 0) {
602 "cation2 charge problem");
605 size_t n = iSpecies * m_kk + jSpecies;
606 int counter = m_CounterIJ[n];
607 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
609 stemp = xmlChild.
name();
611 if (nodeName ==
"theta") {
612 stemp = xmlChild.
value();
613 double old = m_Theta_ij[counter];
616 if (old != m_Theta_ij[counter]) {
618 "conflicting values");
622 if (nodeName ==
"psi") {
625 nParamsFound = vParams.size();
626 n = iSpecies * m_kk *m_kk + jSpecies * m_kk + kSpecies ;
628 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
629 if (nParamsFound != 1) {
630 throw CanteraError(
"HMWSoln::readXMLPsiCommonAnion::Psi for "
631 + kName +
"::" + iName +
"::" + jName,
632 "wrong number of params found");
634 m_Psi_ijk_coeff(0,n) = vParams[0];
635 m_Psi_ijk[n] = vParams[0];
636 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
637 if (nParamsFound != 2) {
639 + kName +
"::" + iName +
"::" + jName,
640 "wrong number of params found");
642 m_Psi_ijk_coeff(0,n) = vParams[0];
643 m_Psi_ijk_coeff(1,n) = vParams[1];
644 m_Psi_ijk[n] = vParams[0];
645 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
646 if (nParamsFound == 1) {
647 vParams.resize(5, 0.0);
649 }
else if (nParamsFound != 5) {
651 + kName +
"::" + iName +
"::" + jName,
652 "wrong number of params found");
654 for (
size_t j = 0; j < nParamsFound; j++) {
655 m_Psi_ijk_coeff(j, n) = vParams[j];
657 m_Psi_ijk[n] = vParams[0];
662 n = iSpecies * m_kk *m_kk + kSpecies * m_kk + jSpecies ;
663 for (
size_t j = 0; j < nParamsFound; j++) {
664 m_Psi_ijk_coeff(j, n) = vParams[j];
666 m_Psi_ijk[n] = vParams[0];
668 n = jSpecies * m_kk *m_kk + iSpecies * m_kk + kSpecies ;
669 for (
size_t j = 0; j < nParamsFound; j++) {
670 m_Psi_ijk_coeff(j, n) = vParams[j];
672 m_Psi_ijk[n] = vParams[0];
674 n = jSpecies * m_kk *m_kk + kSpecies * m_kk + iSpecies ;
675 for (
size_t j = 0; j < nParamsFound; j++) {
676 m_Psi_ijk_coeff(j, n) = vParams[j];
678 m_Psi_ijk[n] = vParams[0];
680 n = kSpecies * m_kk *m_kk + jSpecies * m_kk + iSpecies ;
681 for (
size_t j = 0; j < nParamsFound; j++) {
682 m_Psi_ijk_coeff(j, n) = vParams[j];
684 m_Psi_ijk[n] = vParams[0];
686 n = kSpecies * m_kk *m_kk + iSpecies * m_kk + jSpecies ;
687 for (
size_t j = 0; j < nParamsFound; j++) {
688 m_Psi_ijk_coeff(j, n) = vParams[j];
690 m_Psi_ijk[n] = vParams[0];
696 void HMWSoln::readXMLLambdaNeutral(
XML_Node& BinSalt)
698 string xname = BinSalt.
name();
701 if (xname !=
"lambdaNeutral") {
703 "Incorrect name for processing this routine: " + xname);
706 string iName = BinSalt.
attrib(
"species1");
708 throw CanteraError(
"HMWSoln::readXMLLambdaNeutral",
"no species1 attrib");
710 string jName = BinSalt.
attrib(
"species2");
712 throw CanteraError(
"HMWSoln::readXMLLambdaNeutral",
"no species2 attrib");
718 size_t iSpecies = speciesIndex(iName);
719 if (iSpecies ==
npos) {
722 if (charge(iSpecies) != 0) {
724 "neutral charge problem");
726 size_t jSpecies = speciesIndex(jName);
727 if (jSpecies ==
npos) {
731 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
733 stemp = xmlChild.
name();
735 if (nodeName ==
"lambda") {
736 size_t nCount = iSpecies*m_kk + jSpecies;
738 nParamsFound = vParams.size();
739 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
740 if (nParamsFound != 1) {
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(iSpecies,jSpecies) = vParams[0];
748 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
749 if (nParamsFound != 2) {
750 throw CanteraError(
"HMWSoln::readXMLLambdaNeutral::Lambda for " + iName
752 "wrong number of params found");
754 m_Lambda_nj_coeff(0,nCount) = vParams[0];
755 m_Lambda_nj_coeff(1,nCount) = vParams[1];
756 m_Lambda_nj(iSpecies, jSpecies) = vParams[0];
758 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
759 if (nParamsFound == 1) {
760 vParams.resize(5, 0.0);
762 }
else if (nParamsFound != 5) {
763 throw CanteraError(
"HMWSoln::readXMLLambdaNeutral::Lambda for " + iName
765 "wrong number of params found");
767 for (
size_t j = 0; j < nParamsFound; j++) {
768 m_Lambda_nj_coeff(j,nCount) = vParams[j];
770 m_Lambda_nj(iSpecies, jSpecies) = vParams[0];
776 void HMWSoln::readXMLMunnnNeutral(
XML_Node& BinSalt)
778 string xname = BinSalt.
name();
781 if (xname !=
"MunnnNeutral") {
783 "Incorrect name for processing this routine: " + xname);
786 string iName = BinSalt.
attrib(
"species1");
788 throw CanteraError(
"HMWSoln::readXMLMunnnNeutral",
"no species1 attrib");
795 size_t iSpecies = speciesIndex(iName);
796 if (iSpecies ==
npos) {
799 if (charge(iSpecies) != 0) {
801 "neutral charge problem");
804 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
806 stemp = xmlChild.
name();
808 if (nodeName ==
"munnn") {
810 nParamsFound = vParams.size();
811 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
812 if (nParamsFound != 1) {
813 throw CanteraError(
"HMWSoln::readXMLMunnnNeutral::Munnn for " + iName,
814 "wrong number of params found");
816 m_Mu_nnn_coeff(0,iSpecies) = vParams[0];
817 m_Mu_nnn[iSpecies] = vParams[0];
819 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
820 if (nParamsFound != 2) {
821 throw CanteraError(
"HMWSoln::readXMLMunnnNeutral::Munnn for " + iName,
822 "wrong number of params found");
824 m_Mu_nnn_coeff(0, iSpecies) = vParams[0];
825 m_Mu_nnn_coeff(1, iSpecies) = vParams[1];
826 m_Mu_nnn[iSpecies] = vParams[0];
828 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
829 if (nParamsFound == 1) {
830 vParams.resize(5, 0.0);
832 }
else if (nParamsFound != 5) {
833 throw CanteraError(
"HMWSoln::readXMLMunnnNeutral::Munnn for " + iName,
834 "wrong number of params found");
836 for (
size_t j = 0; j < nParamsFound; j++) {
837 m_Mu_nnn_coeff(j, iSpecies) = vParams[j];
839 m_Mu_nnn[iSpecies] = vParams[0];
845 void HMWSoln::readXMLZetaCation(
const XML_Node& BinSalt)
847 string xname = BinSalt.
name();
848 if (xname !=
"zetaCation") {
850 "Incorrect name for processing this routine: " + xname);
854 size_t nParamsFound = 0;
856 string iName = BinSalt.
attrib(
"neutral");
858 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"no neutral attrib");
861 string jName = BinSalt.
attrib(
"cation1");
863 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"no cation1 attrib");
866 string kName = BinSalt.
attrib(
"anion1");
868 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"no anion1 attrib");
874 size_t iSpecies = speciesIndex(iName);
875 if (iSpecies ==
npos) {
878 if (charge(iSpecies) != 0.0) {
879 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"neutral charge problem");
882 size_t jSpecies = speciesIndex(jName);
883 if (jSpecies ==
npos) {
886 if (charge(jSpecies) <= 0.0) {
887 throw CanteraError(
"HMWSoln::readXLZetaCation",
"cation1 charge problem");
890 size_t kSpecies = speciesIndex(kName);
891 if (kSpecies ==
npos) {
894 if (charge(kSpecies) >= 0.0) {
895 throw CanteraError(
"HMWSoln::readXMLZetaCation",
"anion1 charge problem");
898 for (
size_t i = 0; i < BinSalt.
nChildren(); i++) {
900 stemp = xmlChild.
name();
902 if (nodeName ==
"zeta") {
904 nParamsFound = vParams.size();
905 size_t n = iSpecies * m_kk *m_kk + jSpecies * m_kk + kSpecies ;
907 if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
908 if (nParamsFound != 1) {
909 throw CanteraError(
"HMWSoln::readXMLZetaCation::Zeta for "
910 + iName +
"::" + jName +
"::" + kName,
911 "wrong number of params found");
913 m_Psi_ijk_coeff(0,n) = vParams[0];
914 m_Psi_ijk[n] = vParams[0];
915 }
else if (m_formPitzerTemp == PITZER_TEMP_LINEAR) {
916 if (nParamsFound != 2) {
917 throw CanteraError(
"HMWSoln::readXMLZetaCation::Zeta for "
918 + iName +
"::" + jName +
"::" + kName,
919 "wrong number of params found");
921 m_Psi_ijk_coeff(0,n) = vParams[0];
922 m_Psi_ijk_coeff(1,n) = vParams[1];
923 m_Psi_ijk[n] = vParams[0];
924 }
else if (m_formPitzerTemp == PITZER_TEMP_COMPLEX1) {
925 if (nParamsFound == 1) {
926 vParams.resize(5, 0.0);
928 }
else if (nParamsFound != 5) {
929 throw CanteraError(
"HMWSoln::readXMLZetaCation::Zeta for "
930 + iName +
"::" + jName +
"::" + kName,
931 "wrong number of params found");
933 for (
size_t j = 0; j < nParamsFound; j++) {
934 m_Psi_ijk_coeff(j, n) = vParams[j];
936 m_Psi_ijk[n] = vParams[0];
944 void HMWSoln::readXMLCroppingCoefficients(
const XML_Node& acNode)
947 if (acNode.
hasChild(
"croppingCoefficients")) {
949 if (cropNode.
hasChild(
"ln_gamma_k_min")) {
953 if (cropNode.
hasChild(
"ln_gamma_k_max")) {
958 if (cropNode.
hasChild(
"ln_gamma_o_min")) {
963 if (cropNode.
hasChild(
"ln_gamma_o_max")) {
970 void HMWSoln::initThermo()
972 MolalityVPSSTP::initThermo();
976 void HMWSoln::constructPhaseFile(std::string inputFile, std::string id_)
979 if (inputFile.size() == 0) {
981 "input file is null");
984 std::ifstream fin(path.c_str());
986 throw CanteraError(
"HMWSoln:constructPhaseFile",
"could not open "
987 +path+
" for reading.");
999 "ERROR: Can not find phase named " +
1000 id_ +
" in file named " + inputFile);
1002 fxml_phase->
copy(&phaseNode_XML);
1003 constructPhaseXML(*fxml_phase, id_);
1007 void HMWSoln::constructPhaseXML(
XML_Node& phaseNode, std::string id_)
1010 if (id_.size() > 0) {
1011 string idp = phaseNode.
id();
1014 "phasenode and Id are incompatible");
1021 if (!phaseNode.
hasChild(
"thermo")) {
1023 "no thermo XML node");
1030 if (thermoNode.
hasChild(
"standardConc")) {
1033 stemp = scNode.
attrib(
"model");
1035 if (formString !=
"") {
1036 if (formString ==
"unity") {
1038 printf(
"exit standardConc = unity not done\n");
1040 }
else if (formString ==
"molar_volume") {
1042 printf(
"exit standardConc = molar_volume not done\n");
1044 }
else if (formString ==
"solvent_volume") {
1048 "Unknown standardConc model: " + formString);
1056 string solventName =
"";
1057 if (thermoNode.
hasChild(
"solvent")) {
1059 vector<string> nameSolventa;
1061 int nsp =
static_cast<int>(nameSolventa.size());
1064 "badly formed solvent XML node");
1066 solventName = nameSolventa[0];
1073 if (thermoNode.
hasChild(
"activityCoefficients")) {
1074 XML_Node& scNode = thermoNode.
child(
"activityCoefficients");
1075 stemp = scNode.
attrib(
"model");
1077 if (formString !=
"") {
1078 if (formString ==
"pitzer" || formString ==
"default") {
1080 }
else if (formString ==
"base") {
1084 "Unknown Pitzer ActivityCoeff model: "
1092 stemp = scNode.
attrib(
"TempModel");
1094 if (formString !=
"") {
1095 if (formString ==
"constant" || formString ==
"default") {
1096 m_formPitzerTemp = PITZER_TEMP_CONSTANT;
1097 }
else if (formString ==
"linear") {
1098 m_formPitzerTemp = PITZER_TEMP_LINEAR;
1099 }
else if (formString ==
"complex" || formString ==
"complex1") {
1100 m_formPitzerTemp = PITZER_TEMP_COMPLEX1;
1103 "Unknown Pitzer ActivityCoeff Temp model: "
1113 stemp = scNode.
attrib(
"TempReference");
1115 if (formString !=
"") {
1118 m_TempPitzerRef = 273.15 + 25;
1130 throw CanteraError(
"HMWSoln::constructPhaseXML",
"importPhase failed ");
1136 initThermoXML(
XML_Node& phaseNode,
const std::string& id_)
1139 if (id_.size() > 0) {
1140 string idp = phaseNode.
id();
1143 "phasenode and Id are incompatible");
1150 if (!phaseNode.
hasChild(
"thermo")) {
1152 "no thermo XML node");
1159 if (thermoNode.
hasChild(
"standardConc")) {
1162 stemp = scNode.
attrib(
"model");
1164 if (formString !=
"") {
1165 if (formString ==
"unity") {
1167 printf(
"exit standardConc = unity not done\n");
1169 }
else if (formString ==
"molar_volume") {
1171 printf(
"exit standardConc = molar_volume not done\n");
1173 }
else if (formString ==
"solvent_volume") {
1177 "Unknown standardConc model: " + formString);
1186 if (thermoNode.
hasChild(
"activityCoefficients")) {
1187 XML_Node& scNode = thermoNode.
child(
"activityCoefficients");
1188 stemp = scNode.
attrib(
"model");
1190 if (formString !=
"") {
1191 if (formString ==
"pitzer" || formString ==
"default") {
1193 }
else if (formString ==
"base") {
1197 "Unknown Pitzer ActivityCoeff model: "
1206 stemp = scNode.
attrib(
"TempModel");
1208 if (formString !=
"") {
1209 if (formString ==
"constant" || formString ==
"default") {
1210 m_formPitzerTemp = PITZER_TEMP_CONSTANT;
1211 }
else if (formString ==
"linear") {
1212 m_formPitzerTemp = PITZER_TEMP_LINEAR;
1213 }
else if (formString ==
"complex" || formString ==
"complex1") {
1214 m_formPitzerTemp = PITZER_TEMP_COMPLEX1;
1217 "Unknown Pitzer ActivityCoeff Temp model: "
1227 stemp = scNode.
attrib(
"TempReference");
1229 if (formString !=
"") {
1232 m_TempPitzerRef = 273.15 + 25;
1241 string solventName =
"";
1242 if (thermoNode.
hasChild(
"solvent")) {
1244 vector<string> nameSolventa;
1246 int nsp =
static_cast<int>(nameSolventa.size());
1249 "badly formed solvent XML node");
1251 solventName = nameSolventa[0];
1263 for (
size_t k = 0; k < m_kk; k++) {
1264 string sname = speciesName(k);
1265 if (solventName == sname) {
1269 "Solvent must be species 0 atm");
1275 if (m_indexSolvent ==
npos) {
1276 std::cout <<
"HMWSoln::initThermo: Solvent Name not found"
1279 "Solvent name not found");
1281 if (m_indexSolvent != 0) {
1283 "Solvent " + solventName +
1284 " should be first species");
1296 const vector<string>&sss = speciesNames();
1298 for (
size_t k = 0; k < m_kk; k++) {
1302 "Species Data Base " + sss[k] +
" not found");
1307 "Species " + sss[k] +
1308 " standardState XML block not found");
1310 string modelStringa = ss->
attrib(
"model");
1311 if (modelStringa ==
"") {
1313 "Species " + sss[k] +
1314 " standardState XML block model attribute not found");
1316 string modelString =
lowercase(modelStringa);
1318 if (modelString ==
"wateriapws" || modelString ==
"real_water" ||
1319 modelString ==
"waterpdss") {
1324 m_waterSS =
dynamic_cast<PDSS_Water*
>(providePDSS(0)) ;
1327 "Dynamic cast to PDSS_Water failed");
1334 m_waterSS->setState_TP(300.,
OneAtm);
1335 double dens = m_waterSS->density();
1336 double mw = m_waterSS->molecularWeight();
1337 m_speciesSize[0] = mw / dens;
1338 #ifdef DEBUG_HKM_NOT
1339 cout <<
"Solvent species " << sss[k] <<
" has volume " <<
1340 m_speciesSize[k] << endl;
1346 m_waterSS = providePDSS(0);
1347 m_waterSS->setState_TP(300.,
OneAtm);
1348 double dens = m_waterSS->density();
1349 double mw = m_waterSS->molecularWeight();
1350 m_speciesSize[0] = mw / dens;
1353 if (modelString !=
"constant_incompressible" && modelString !=
"hkft") {
1355 "Solute SS Model \"" + modelStringa +
1358 if (modelString ==
"constant_incompressible") {
1359 m_speciesSize[k] =
getFloat(*ss,
"molarVolume",
"toSI");
1360 #ifdef DEBUG_HKM_NOT
1361 cout <<
"species " << sss[k] <<
" has volume " <<
1362 m_speciesSize[k] << endl;
1373 m_waterProps =
new WaterProps(dynamic_cast<PDSS_Water*>(m_waterSS));
1382 for (
size_t k = 0; k < m_kk; k++) {
1383 m_speciesCharge_Stoich[k] = charge(k);
1391 if (thermoNode.
hasChild(
"activityCoefficients")) {
1392 XML_Node& acNode = thermoNode.
child(
"activityCoefficients");
1393 acNodePtr = &acNode;
1399 m_form_A_Debye = A_DEBYE_CONST;
1402 string atemp = ADebye.
attrib(stemp);
1404 if (stemp ==
"water") {
1405 m_form_A_Debye = A_DEBYE_WATER;
1408 if (m_form_A_Debye == A_DEBYE_CONST) {
1409 m_A_Debye =
getFloat(acNode,
"A_Debye");
1411 #ifdef DEBUG_HKM_NOT
1412 cout <<
"A_Debye = " << m_A_Debye << endl;
1419 if (acNode.
hasChild(
"maxIonicStrength")) {
1420 m_maxIionicStrength =
getFloat(acNode,
"maxIonicStrength");
1421 #ifdef DEBUG_HKM_NOT
1422 cout <<
"m_maxIionicStrength = "
1423 <<m_maxIionicStrength << endl;
1431 if (acNode.
hasChild(
"ionicRadius")) {
1434 double Afactor = 1.0;
1436 string Aunits = irNode.
attrib(
"units");
1437 Afactor =
toSI(Aunits);
1441 string ads = irNode.
attrib(
"default");
1443 for (
size_t k = 0; k < m_kk; k++) {
1444 m_Aionic[k] = ad * Afactor;
1455 std::vector<const XML_Node*> xspecies = speciesData();
1457 string kname, jname;
1458 size_t jj = xspecies.size();
1459 for (
size_t k = 0; k < m_kk; k++) {
1461 kname = speciesName(k);
1462 for (
size_t j = 0; j < jj; j++) {
1465 if (jname == kname) {
1471 const XML_Node& sp = *xspecies[jmap];
1484 if (acNodePtr->
hasChild(
"stoichIsMods")) {
1487 map<string, string> msIs;
1489 map<string,string>::const_iterator _b = msIs.begin();
1490 for (; _b != msIs.end(); ++_b) {
1491 size_t kk = speciesIndex(_b->first);
1493 double val =
fpValue(_b->second);
1494 m_speciesCharge_Stoich[kk] = val;
1506 for (
size_t i = 0; i < acNodePtr->
nChildren(); i++) {
1508 stemp = xmlACChild.
name();
1515 if (nodeName ==
"binarysaltparameters") {
1516 readXMLBinarySalt(xmlACChild);
1517 }
else if (nodeName ==
"thetaanion") {
1518 readXMLThetaAnion(xmlACChild);
1519 }
else if (nodeName ==
"thetacation") {
1520 readXMLThetaCation(xmlACChild);
1521 }
else if (nodeName ==
"psicommonanion") {
1522 readXMLPsiCommonAnion(xmlACChild);
1523 }
else if (nodeName ==
"psicommoncation") {
1524 readXMLPsiCommonCation(xmlACChild);
1525 }
else if (nodeName ==
"lambdaneutral") {
1526 readXMLLambdaNeutral(xmlACChild);
1527 }
else if (nodeName ==
"zetacation") {
1528 readXMLZetaCation(xmlACChild);
1534 readXMLCroppingCoefficients(acNode);
1545 for (
size_t k = 0; k < m_kk; k++) {
1546 if (fabs(charge(k)) > 0.0001) {
1547 m_electrolyteSpeciesType[k] = cEST_chargedSpecies;
1548 if (fabs(m_speciesCharge_Stoich[k] - charge(k))
1550 m_electrolyteSpeciesType[k] = cEST_weakAcidAssociated;
1552 }
else if (fabs(m_speciesCharge_Stoich[k]) > 0.0001) {
1553 m_electrolyteSpeciesType[k] = cEST_weakAcidAssociated;
1555 m_electrolyteSpeciesType[k] = cEST_nonpolarNeutral;
1558 m_electrolyteSpeciesType[m_indexSolvent] =
cEST_solvent;
1564 std::vector<const XML_Node*> xspecies = speciesData();
1567 for (
size_t k = 0; k < m_kk; k++) {
1568 kname = speciesName(k);
1569 spPtr = xspecies[k];
1571 if (spPtr->
hasChild(
"electrolyteSpeciesType")) {
1572 string est =
getChildValue(*spPtr,
"electrolyteSpeciesType");
1573 if ((m_electrolyteSpeciesType[k] =
interp_est(est)) == -1) {
1575 "Bad electrolyte type: " + est);
1584 if (acNodePtr->
hasChild(
"electrolyteSpeciesType")) {
1585 XML_Node& ESTNode = acNodePtr->
child(
"electrolyteSpeciesType");
1586 map<string, string> msEST;
1588 map<string,string>::const_iterator _b = msEST.begin();
1589 for (; _b != msEST.end(); ++_b) {
1590 size_t kk = speciesIndex(_b->first);
1592 string est = _b->second;
1593 if ((m_electrolyteSpeciesType[kk] =
interp_est(est)) == -1) {
1595 "Bad electrolyte type: " + est);
1602 IMS_typeCutoff_ = 2;
1603 if (IMS_typeCutoff_ == 2) {
1604 calcIMSCutoffParams_();
1606 calcMCCutoffParams_();
1607 setMoleFSolventMin(1.0E-5);
1609 MolalityVPSSTP::initThermoXML(phaseNode, id_);
1616 bool notDone =
true;
1620 size_t kMaxC =
npos;
1622 for (
size_t k = 0; k < m_kk; k++) {
1623 sum += mf[k] * charge(k);
1624 if (fabs(mf[k] * charge(k)) > MaxC) {
1628 size_t kHp = speciesIndex(
"H+");
1629 size_t kOHm = speciesIndex(
"OH-");
1632 if (fabs(sum) > 1.0E-30) {
1634 if (mf[kHp] > sum * 1.1) {
1648 if (mf[kOHm] > -sum * 1.1) {
1661 if (kMaxC !=
npos) {
1662 if (mf[kMaxC] > (1.1 * sum / charge(kMaxC))) {
1663 mf[kMaxC] -= sum / charge(kMaxC);
1664 mf[0] += sum / charge(kMaxC);
1693 void HMWSoln::calcIMSCutoffParams_()
1695 IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_);
1697 bool converged =
false;
1700 for (its = 0; its < 100 && !converged; its++) {
1702 IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_) -IMS_efCut_;
1703 IMS_bfCut_ = IMS_afCut_ / IMS_cCut_ + IMS_slopefCut_ - 1.0;
1704 IMS_dfCut_ = ((- IMS_afCut_/IMS_cCut_ + IMS_bfCut_ - IMS_bfCut_*IMS_X_o_cutoff_/IMS_cCut_)
1706 (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
1707 double tmp = IMS_afCut_ + IMS_X_o_cutoff_*(IMS_bfCut_ + IMS_dfCut_ *IMS_X_o_cutoff_);
1708 double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
1709 IMS_efCut_ = - eterm * (tmp);
1710 if (fabs(IMS_efCut_ - oldV) < 1.0E-14) {
1716 " failed to converge on the f polynomial");
1719 double f_0 = IMS_afCut_ + IMS_efCut_;
1720 double f_prime_0 = 1.0 - IMS_afCut_ / IMS_cCut_ + IMS_bfCut_;
1722 for (its = 0; its < 100 && !converged; its++) {
1724 double lng_0 = -log(IMS_gamma_o_min_) - f_prime_0 / f_0;
1725 IMS_agCut_ = exp(lng_0) - IMS_egCut_;
1726 IMS_bgCut_ = IMS_agCut_ / IMS_cCut_ + IMS_slopegCut_ - 1.0;
1727 IMS_dgCut_ = ((- IMS_agCut_/IMS_cCut_ + IMS_bgCut_ - IMS_bgCut_*IMS_X_o_cutoff_/IMS_cCut_)
1729 (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
1730 double tmp = IMS_agCut_ + IMS_X_o_cutoff_*(IMS_bgCut_ + IMS_dgCut_ *IMS_X_o_cutoff_);
1731 double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
1732 IMS_egCut_ = - eterm * (tmp);
1733 if (fabs(IMS_egCut_ - oldV) < 1.0E-14) {
1739 " failed to converge on the g polynomial");
1743 void HMWSoln::calcMCCutoffParams_()
1746 MC_X_o_cutoff_ = 0.6;
1747 MC_slopepCut_ = 0.02;
1751 MC_apCut_ = MC_X_o_min_;
1753 bool converged =
false;
1757 for (its = 0; its < 500 && !converged; its++) {
1759 MC_apCut_ = damp *(MC_X_o_min_ - MC_epCut_) + (1-damp) * MC_apCut_;
1760 double MC_bpCutNew = MC_apCut_ / MC_cpCut_ + MC_slopepCut_ - 1.0;
1761 MC_bpCut_ = damp * MC_bpCutNew + (1-damp) * MC_bpCut_;
1762 double MC_dpCutNew = ((- MC_apCut_/MC_cpCut_ + MC_bpCut_ - MC_bpCut_ * MC_X_o_cutoff_/MC_cpCut_)
1764 (MC_X_o_cutoff_ * MC_X_o_cutoff_/MC_cpCut_ - 2.0 * MC_X_o_cutoff_));
1765 MC_dpCut_ = damp * MC_dpCutNew + (1-damp) * MC_dpCut_;
1766 double tmp = MC_apCut_ + MC_X_o_cutoff_*(MC_bpCut_ + MC_dpCut_ * MC_X_o_cutoff_);
1767 double eterm = std::exp(- MC_X_o_cutoff_ / MC_cpCut_);
1768 MC_epCut_ = - eterm * (tmp);
1769 double diff = MC_epCut_ - oldV;
1770 if (fabs(diff) < 1.0E-14) {
1776 " failed to converge on the p polynomial");
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...
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
static int interp_est(const std::string &estString)
Utility function to assign an integer value from a string for the ElectrolyteSpeciesType field...
const doublereal OneAtm
One atmosphere [Pa].
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"
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...
bool getOptionalFloat(const Cantera::XML_Node &parent, const std::string &name, doublereal &fltRtn, const std::string &type)
Get an optional floating-point value from a child element.
doublereal getFloat(const Cantera::XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
Header for a class used to house several approximation routines for properties of water...
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.
void copy(XML_Node *const node_dest) const
Copy all of the information in the current XML_Node tree into the destination XML_Node tree...
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 Cantera::XML_Node &node, std::vector< std::string > &v)
This function interprets the value portion of an XML element as a string.
Contains declarations for string manipulation functions within Cantera.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
void getMap(const Cantera::XML_Node &node, std::map< std::string, std::string > &m)
This routine is used to interpret the value portions of XML elements that contain colon separated pai...
XML_Node & root() const
Return the root of the current XML_Node tree.
std::string getChildValue(const Cantera::XML_Node &parent, const std::string &nameString)
This function reads a child node with the name, nameString, and returns its xml value as the return s...
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 getFloatArray(const Cantera::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...
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.