28 m_speciesFrozen(false),
29 m_elementsFrozen(false),
45 m_speciesFrozen(false) ,
46 m_elementsFrozen(false),
177 for (
size_t i = 0; i <
m_mm; i++) {
198 "Elements::entropy298",
199 "Entropy at 298 K of element is unknown");
235 for (
size_t m = 0; m <
m_mm; m++) {
246 for (
size_t k = 0; k <
m_kk; k++) {
285 return(
m_name +
":" + sn);
320 doublereal norm = 0.0;
325 for (
size_t k = 0; k <
m_kk; k++) {
353 doublereal rmmw = 1.0/
m_mmw;
356 m_y.begin(), multiplies<double>());
367 for (
size_t k = 0; k < kk; k++) {
380 for (
size_t k = 0; k < kk; k++) {
389 for (
size_t k = 0; k <
m_kk; k++) {
392 doublereal norm = accumulate(
m_y.begin(),
m_y.end(), 0.0);
396 m_ym.begin(), multiplies<double>());
405 doublereal sum = 0.0;
406 copy(y, y +
m_kk,
m_y.begin());
408 multiplies<double>());
409 sum = accumulate(
m_ym.begin(),
m_ym.end(), 0.0);
421 for (
size_t k = 0; k < kk; k++) {
434 for (
size_t k = 0; k < kk; k++) {
515 if (weights.size() < mw.size()) {
516 weights.resize(mw.size());
518 copy(mw.begin(), mw.end(), weights.begin());
524 copy(mw.begin(), mw.end(), weights);
530 copy(mw.begin(), mw.end(), weights);
542 for (
size_t k = 0; k < kk; k++) {
591 copy(
m_y.begin(),
m_y.end(), y);
608 doublereal sum = 0.0, norm = 0.0;
609 for (
size_t k = 0; k !=
m_kk; ++k) {
617 doublereal rsum = 1.0/sum;
618 for (
size_t k = 0; k !=
m_kk; ++k) {
650 doublereal cdens = 0.0;
651 for (
size_t k = 0; k < kk; k++) {
660 return m_mmw*std::inner_product(
m_ym.begin(),
m_ym.end(), Q, 0.0);
680 if (weight == -12345.0) {
703 doublereal weight = atof(e[
"atomicWt"].c_str());
704 string symbol = e[
"name"];
709 int atomicNumber, doublereal entropy298,
712 if (weight == -12345.0) {
750 "Duplicate Elements (" + symbol +
") have different weights");
757 doublereal weight = 0.0;
759 weight = atof(
stripws(e[
"atomicWt"]).c_str());
763 anum = atoi(
stripws(e[
"atomicNumber"]).c_str());
765 string symbol = e[
"name"];
783 if (! phase.
hasChild(
"elementArray")) {
785 "phase xml node doesn't have \"elementArray\" XML Node");
788 vector<string> enames;
792 string element_database =
"elements.xml";
794 element_database = elements[
"datasrc"];
804 local_db = &root.
child(
"ctml/elementData");
808 int nel =
static_cast<int>(enames.size());
812 for (i = 0; i < nel; i++) {
825 throw CanteraError(
"addElementsFromXML",
"no data for element "
842 doublereal weight,
int atomicNumber,
843 doublereal entropy298,
int elem_type)
855 throw CanteraError(
"Phase::addElementAfterFreeze()",
"confused");
860 for (
size_t k = 0; k <
m_kk; k++) {
861 size_t m_old = m_mm - 1;
862 for (
size_t m = 0; m < m_old; m++) {
871 void Phase::addSpecies(
const std::string& name,
const doublereal* comp,
872 doublereal charge, doublereal size)
882 for (
size_t m = 0; m < ne; m++) {
883 compNew[m] = comp[m];
889 if (eindex !=
npos) {
890 doublereal ecomp = compNew[eindex];
891 if (fabs(charge + ecomp) > 0.001) {
893 throw CanteraError(
"Phase::addSpecies",
894 "Input charge and element E compositions differ "
895 "for species " + name);
899 compNew[eindex] = -
charge;
908 compNew[ne - 1] = -
charge;
911 for (
size_t m = 0; m < ne; m++) {
913 wt += compNew[m] * aw[m];
920 doublereal charge, doublereal size)
923 for (
size_t k = 0; k <
m_kk; k++) {
928 for (
size_t i = 0; i <
m_mm; i++) {
931 "Duplicate species have different "
932 "compositions: " + *it);
937 "Duplicate species have different "
942 "Duplicate species have different "
949 addSpecies(name, comp, charge, size);
964 copy(mw.begin(), mw.end(),
m_molwts.begin());
965 for (
size_t k = 0; k <
m_kk; k++) {
968 "negative molecular weight for species number "
991 bool Phase::ready()
const