support for fractional stoich coefficients
This commit is contained in:
parent
ae323fb7da
commit
6844a24c67
3 changed files with 24 additions and 8 deletions
|
|
@ -227,7 +227,6 @@ bool CKReader::read(const string& inputFile, const string& thermoDatabase,
|
|||
for (k = 0; k < nsp; k++) {
|
||||
Species s;
|
||||
s.name = undef[k];
|
||||
cout << k << " " << s.name << endl;
|
||||
species.push_back(s);
|
||||
}
|
||||
}
|
||||
|
|
@ -637,7 +636,7 @@ bool checkThermo(ostream& log, speciesList& sp, double tol) {
|
|||
* @todo use reaction number stored in reaction object
|
||||
*/
|
||||
bool checkBalance(ostream& f, speciesTable& speciesData,
|
||||
reactionList& r, vector<int>& unbalanced)
|
||||
reactionList& r, vector<int>& unbalanced, double tolerance)
|
||||
{
|
||||
int nrxn = static_cast<int>(r.size());
|
||||
string rname, pname;
|
||||
|
|
@ -674,12 +673,15 @@ bool checkThermo(ostream& log, speciesList& sp, double tol) {
|
|||
atoms[elements[m].name] += stoichCoeff * elements[m].number;
|
||||
}
|
||||
}
|
||||
double atms;
|
||||
getMapKeys(atoms, elementSyms);
|
||||
for (m = 0; m < elementSyms.size(); m++) {
|
||||
if (atoms[elementSyms[m]] != 0.0) {
|
||||
//cout << "unbalanced element: "
|
||||
// << elementSyms[m] << " "
|
||||
// << atoms[elementSyms[m]] << endl;
|
||||
atms = atoms[elementSyms[m]];
|
||||
if (fabs(atms) > tolerance) {
|
||||
//if (atoms[elementSyms[m]] != 0.0) {
|
||||
// cout << "Reaction " << i+1 << " has an unbalanced element: "
|
||||
// << elementSyms[m] << " "
|
||||
// << atoms[elementSyms[m]] << endl;
|
||||
unbalanced.push_back(i+1); break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace ckr {
|
|||
|
||||
|
||||
bool checkBalance(ostream& f, speciesTable& speciesData, reactionList& r,
|
||||
vector<int>& unbalanced);
|
||||
vector<int>& unbalanced, double tolerance=1.0e-3);
|
||||
bool checkThermo(ostream& f, speciesList& species, double tol);
|
||||
|
||||
bool filter(const string& infile, const string& database,
|
||||
|
|
|
|||
|
|
@ -274,7 +274,21 @@ namespace pip {
|
|||
fprintf(f," [%10.5E, %g, %g]", rxn.kf.A, rxn.kf.n, rxn.kf.E);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// reaction orders
|
||||
cout << "checking for rxn orders..." << endl;
|
||||
int nord = static_cast<int>(rxn.fwdOrder.size());
|
||||
cout << nord << endl;
|
||||
if (nord > 0) {
|
||||
cout << "processing order..." << endl;
|
||||
map<string, double>::const_iterator b = rxn.fwdOrder.begin(),
|
||||
e = rxn.fwdOrder.end();
|
||||
string estr = "";
|
||||
for (; b != e; ++b) {
|
||||
estr += " "+b->first+":"+fp2str(b->second)+" ";
|
||||
}
|
||||
fprintf(f, ",\n order = \"%s\"", estr.c_str());
|
||||
}
|
||||
|
||||
int ne = static_cast<int>(rxn.e3b.size());
|
||||
if (rxn.thirdBody != "<none>") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue