*** empty log message ***

This commit is contained in:
Dave Goodwin 2004-12-02 22:11:28 +00:00
parent b3df568a46
commit 4c65331514
4 changed files with 94 additions and 20 deletions

View file

@ -1025,7 +1025,7 @@ class phase:
if s[0] == ',': s = s[1:]
if s[-1] == ',': s = s[:-1]
if self._spmap.has_key(s):
if s <> 'all' and self._spmap.has_key(s):
raise CTI_Error('Multiply-declared species '+s+' in phase '+self._name)
self._spmap[s] = self._dim
@ -1495,7 +1495,10 @@ if __name__ == "__main__":
# $Revision$
# $Date$
# $Log$
# Revision 1.7 2004-11-15 02:33:21 dggoodwin
# Revision 1.8 2004-12-02 22:11:28 dggoodwin
# *** empty log message ***
#
# Revision 1.7 2004/11/15 02:33:21 dggoodwin
# changed f90 mod file handling in Makefiles
#
# Revision 1.6 2004/09/29 11:00:39 dggoodwin

View file

@ -7,6 +7,7 @@
#include <iostream>
using namespace std;
#define DEBUG_MULTIPHASE_EQUIL
namespace Cantera {
@ -312,6 +313,22 @@ namespace Cantera {
}
}
#ifdef DEBUG_MULTIPHASE_EQUIL
// check
bool ok = true;
for (m = 0; m < nRows; m++) {
if (m_A(m,m) != 1.0) ok = false;
for (n = 0; n < nRows; n++) {
if (n != m && fabs(m_A(m,n)) > TINY)
ok = false;
}
}
if (!ok) {
cout << m_A << endl;
throw CanteraError("getComponents","error in A matrix");
}
#endif
// create stoichometric coefficient matrix.
for (n = 0; n < m_nsp; n++) {
if (n < m_nel)
@ -385,7 +402,7 @@ namespace Cantera {
index_t k, ik;
if (omega < 0.0)
throw CanteraError("step","negative omega");
//cout << "entering step " << m_moles << endl << deltaN << endl;
for (ik = 0; ik < m_nel; ik++) {
k = m_order[ik];
m_lastmoles[k] = m_moles[k];
@ -445,16 +462,22 @@ namespace Cantera {
// such that all
if (m_dsoln[k] == 1) {
if ((m_moles[k] > MAJOR_THRESHOLD) || (ik < m_nel)) {
if ((m_moles[k] > MAJOR_THRESHOLD) ) || (ik < m_nel)) {
omax = m_moles[k]*FCTR/(fabs(m_work[k]) + TINY);
if (m_work[k] < 0.0 && omax < omegamax) {
omegamax = omax;
#ifdef DEBUG_MULTIPHASE_EQUIL
if (omegamax < 1.0e-5) {
cout << m_mix->speciesName(m_species[k]) << " results in "
<< " omega = " << omegamax << endl;
//cout << m_moles[k] << " " << m_work[k] << endl;
if (ik < m_nel) cout << "component" << endl;
index_t nk;
for (nk = 0; nk < m_nel; nk++) {
cout << "component " << m_mix->speciesName(m_species[m_order[nk]]) << " " << m_moles[m_order[nk]] << endl;
}
}
#endif
}
m_majorsp[k] = true;
}
@ -467,12 +490,14 @@ namespace Cantera {
omax = -m_moles[k]/m_work[k];
if (omax < omegamax) {
omegamax = omax*1.000001;
#ifdef DEBUG_MULTIPHASE_EQUIL
if (omegamax < 1.0e-5) {
cout << m_mix->speciesName(m_species[k]) << " results in "
<< " omega = " << omegamax << endl;
//cout << m_moles[k] << " " << m_work[k] << endl;
if (ik < m_nel) cout << "component" << endl;
}
#endif
}
}
m_majorsp[k] = true;
@ -498,6 +523,9 @@ namespace Cantera {
for (k = 0; k < m_nsp; k++) m_moles[k] = m_lastmoles[k];
step(omega, m_work);
}
cout << m_moles << endl;
cout << m_work << endl;
cout << m_iter << " " << m_mix->elementMoles(m_element[0]) << endl;
//cout << m_moles << endl;
//cout << "omega: " << omega << " " << m_mix->gibbs() << " " << error() << endl;
return omega;
@ -590,7 +618,7 @@ namespace Cantera {
if (m_moles[m_order[m]] <= 0.0 && (m_N(m, j)*dxi[j] < 0.0))
dxi[j] = 0.0;
}
//cout << reactionString(j) << " " << dxi[j] << " " << fctr << " " << dg_rt << endl;
cout << reactionString(j) << " " << dxi[j] << " " << fctr << " " << dg_rt << endl;
grad += dxi[j]*dg_rt;
}

View file

@ -779,6 +779,10 @@ namespace Cantera {
if (eskip == "undeclared") {
sprule[jsp] = 1;
}
string dskip = sk["species"];
if (dskip == "duplicate") {
sprule[jsp] += 10;
}
}
string fname, idstr;
@ -837,28 +841,47 @@ namespace Cantera {
spnames[nn] = (*allsp[nn])["name"];
}
}
else if (nsp == 1 && spnames[0] == "unique") {
vector<XML_Node*> uniquesp;
db->getChildren("species",uniquesp);
nsp = static_cast<int>(uniquesp.size());
spnames.clear();
spnames.resize(nsp);
string spnm;
for (int nn = 0; nn < nsp; nn++) {
spnm = (*uniquesp[nn])["name"];
if (!declared[spnm]) spnames[nn] = spnm;
}
}
string name;
bool skip;
for (i = 0; i < nsp; i++) {
name = spnames[i];
skip = false;
if (name == "") skip = true;
// Check that every species is only declared once
if (declared[name]) {
throw CanteraError("importPhase",
"duplicate species: "+name);
if (sprule[jsp] >= 10)
skip = true;
else
throw CanteraError("importPhase",
"duplicate species: "+name);
}
declared[name] = true;
if (!skip) {
declared[name] = true;
// Find the species in the database by name.
XML_Node* s = db->findByAttr("name",spnames[i]);
if (s) {
if (installSpecies(k, *s, *th, spthermo, sprule[jsp],
spfactory))
++k;
}
else {
throw CanteraError("importPhase","no data for species "
+name);
// Find the species in the database by name.
XML_Node* s = db->findByAttr("name",spnames[i]);
if (s) {
if (installSpecies(k, *s, *th, spthermo, sprule[jsp],
spfactory))
++k;
}
else {
throw CanteraError("importPhase","no data for species "
+name);
}
}
}
}

View file

@ -124,7 +124,27 @@ namespace Cantera {
XML_Node* get_XML_File(string file) {
string path = findInputFile(file);
string path = "";
try {
path = findInputFile(file);
}
catch (CanteraError) {
string::size_type idot = file.rfind('.');
string ext = "";
if (idot != string::npos) {
ext = file.substr(idot, file.size());
string ctifile = file.substr(0,idot)+".cti";
try {
path = findInputFile(ctifile);
}
catch (CanteraError) {
path = findInputFile(file);
}
}
else
path = findInputFile(file);
}
string ff = path;
if (app()->xmlfiles.find(path)
== app()->xmlfiles.end()) {