Removed obsolete C++ Chemkin mechanism converter

This commit is contained in:
Ray Speth 2012-07-26 20:49:50 +00:00
parent c57f9b644f
commit 88bb6fe679
80 changed files with 76 additions and 5898 deletions

View file

@ -1044,7 +1044,7 @@ if addInstallActions:
# Converter scripts
pyExt = '.py' if env['OS'] == 'Windows' else ''
install(env.InstallAs,
pjoin('$inst_bindir','ck2cti2%s' % pyExt),
pjoin('$inst_bindir','ck2cti%s' % pyExt),
'interfaces/python/ck2cti.py')
install(env.InstallAs,
pjoin('$inst_bindir','ctml_writer%s' % pyExt),

View file

@ -14,7 +14,7 @@ URL: http://code.google.com/p/cantera/
Requires:
Version: 2.0.0
LINK = -lctcxx -luser -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode -lctlapack -lctblas -lctf2c -lm -lstdc++
LINK = -lctcxx -luser -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode -lctlapack -lctblas -lctf2c -lm -lstdc++
#Libs: -L${libdir} ${LINK}
#Cflags: -I${includedir}

View file

@ -155,7 +155,6 @@ AC_OUTPUT(Makefile \
src/Makefile \
src/fortran/Makefile \
src/base/Makefile \
src/converters/Makefile \
src/kinetics/Makefile \
src/numerics/Makefile src/oneD/Makefile \
src/thermo/Makefile \
@ -166,8 +165,6 @@ AC_OUTPUT(Makefile \
cantera.pc)
# skipped tests
# test_problems/ck2cti/Makefile
# test_problems/nasa9_reader/Makefile
# test_problems/rankine_democxx/Makefile
# test_problems/VCSnonideal/NaCl_equil/Makefile

View file

@ -595,7 +595,6 @@ WARN_LOGFILE =
INPUT = src/apps \
src/base \
src/converters \
src/equil \
src/kinetics \
src/numerics \

View file

@ -1,65 +1,55 @@
.TH "ck2cti" 1 "16 Nov 2003" "ck2cti" \" -*- nroff -*-
.TH "ck2cti2" 1 "4 Jun 2012" "ck2cti2" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ck2cti \- convert a Chemkin-II-format reaction mechanism file to Cantera input format.
ck2cti2 \- convert Chemkin-II-format mechanisms to Cantera input files (.cti)
.SH SYNOPSIS
.br
ck2cti \fB-i \fIinput \fR[\fB-t \fIthermo\fR] \fR[\fB-tr\fI transport\fR]
\fR[\fB-id\fI idtag\fR]
.B ck2cti2
--input=\fImech-file\fR
[--thermo=\fIthermo-file\fR]
[--transport=\fItransport-file\fR]
[--id=\fIphase-id\fR]
[--output=\fIout-file\fR]
[-d | --debug]
.SH DESCRIPTION
.I ck2cti
.I ck2cti2
converts a Chemkin-II-format reaction mechanism file to Cantera input
format. The resulting Cantera input file contains a definition of one
.B ideal_gas
entry that represents an ideal gas mixture corresponding to the
Chemkin-II reaction mechanism. The file also contains Cantera-format
definitions for each species and each reaction in the input reaction
mechanism file. The Cantera-format text is written to the standard
output.
mechanism file. The Cantera-format mechanism is written to
.I out-file
The parameters are as follows:
.TP
.I input
Chemkin-II reaction mechanism file to be converted. Required.
.B --input=\fImech-file\fR
Chemkin-II reaction mechanism file to be converted. Required. This
file must contain the declarations of the elements and species, as
well as the reactions (if any). It may also contain the thermodyamic
and transport data.
.TP
.I thermo
.B --thermo=\fIthermo-file\fR
Thermodynamic property database. If the THERMO section of the input
file is missing or does not have entries for one or more species, this
file will be searched for the required thermo data. This file may be
another reaction mechanism file containing a THERMO section, or a
Chemkin-II-compatible thermodynamic database file.
file will be searched for the required thermo data.
.TP
.I transport
.B --transport=\fItransport-file\fR
Transport property database. If this file name is supplied, transport
property parameters will be taken from this file and included in the
output Cantera-format file. If this parameter is omitted, no transport
output Cantera-format file. If this parameter is omitted, and no
TRANSPORT section was included in the main input file, no transport
property parameters will be included in the output.
.TP
.I id
Identification string. The \fBideal_gas\fR entry in the Cantera-format
output has name \fIid\fR. If this parameter is omitted, it will be set
to the input file name without the extension. Since only one phase
definition is present in the \fIck2cti\fR output, this parameter is
not required.
.B --id=\fIphase-id\fR
Optional identification string, used to set the \fIid\fR field of the
\fBideal_gas\fR entry in the Cantera-format output. If this parameter
is omitted, it will be set to
.B gas
.SH EXAMPLES
Create a Cantera input file from a self-contained Chemkin-format file
without transport parameters:
.TP
ck2cti -i mech.inp > mech.cti
.TP
Create a Cantera input file from a Chemkin-format file that requires a
separate thermodynamic database
without transport parameters:
.TP
ck2cti -i mech.inp -t therm.dat > mech.cti
.TP
Create a Cantera input file from a Chemkin-format file that requires a
separate thermodynamic database and include transport parameters:
.TP
ck2cti -i mech.inp -t therm.dat -tr tran.dat > mech.cti
.SH EXAMPLE
ck2cti2 --input=chem.inp --thermo=therm.dat --transport=tran.dat

View file

@ -1,55 +0,0 @@
.TH "ck2cti2" 1 "4 Jun 2012" "ck2cti2" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ck2cti2 \- convert Chemkin-II-format mechanisms to Cantera input files (.cti)
.SH SYNOPSIS
.B ck2cti2
--input=\fImech-file\fR
[--thermo=\fIthermo-file\fR]
[--transport=\fItransport-file\fR]
[--id=\fIphase-id\fR]
[--output=\fIout-file\fR]
[-d | --debug]
.SH DESCRIPTION
.I ck2cti2
converts a Chemkin-II-format reaction mechanism file to Cantera input
format. The resulting Cantera input file contains a definition of one
.B ideal_gas
entry that represents an ideal gas mixture corresponding to the
Chemkin-II reaction mechanism. The file also contains Cantera-format
definitions for each species and each reaction in the input reaction
mechanism file. The Cantera-format mechanism is written to
.I out-file
The parameters are as follows:
.TP
.B --input=\fImech-file\fR
Chemkin-II reaction mechanism file to be converted. Required. This
file must contain the declarations of the elements and species, as
well as the reactions (if any). It may also contain the thermodyamic
and transport data.
.TP
.B --thermo=\fIthermo-file\fR
Thermodynamic property database. If the THERMO section of the input
file is missing or does not have entries for one or more species, this
file will be searched for the required thermo data.
.TP
.B --transport=\fItransport-file\fR
Transport property database. If this file name is supplied, transport
property parameters will be taken from this file and included in the
output Cantera-format file. If this parameter is omitted, and no
TRANSPORT section was included in the main input file, no transport
property parameters will be included in the output.
.TP
.B --id=\fIphase-id\fR
Optional identification string, used to set the \fIid\fR field of the
\fBideal_gas\fR entry in the Cantera-format output. If this parameter
is omitted, it will be set to
.B gas
.SH EXAMPLE
ck2cti2 --input=chem.inp --thermo=therm.dat --transport=tran.dat

View file

@ -6,7 +6,7 @@ cc_sources = examples.cpp kinetics_example1.cpp kinetics_example2.cpp \
rxnpath_example1.cpp
LINK = -lctcxx -luser -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++
LIBS = -L$(top_builddir)/build/lib/ $(LINK)

View file

@ -1,5 +1,5 @@
# will need to add python and matlab
SUBDIRS = base numerics converters thermo transport oneD zeroD kinetics spectra equil fortran tpx
SUBDIRS = base numerics thermo transport oneD zeroD kinetics spectra equil fortran tpx

View file

@ -27,7 +27,6 @@ libs = [('base', ['cpp'], baseSetup),
('thermo', ['cpp'], defaultSetup),
('tpx', ['cpp'], defaultSetup),
('equil', ['cpp','c'], equilSetup),
('converters', ['cpp'], defaultSetup),
('numerics', ['cpp'], numericsSetup),
('kinetics', ['cpp'], defaultSetup),
('transport', ['cpp'], defaultSetup),

View file

@ -11,7 +11,6 @@ def buildProgram(name, src):
install('$inst_bindir', prog)
buildProgram('cti2ctml', ['cti2ctml.cpp'])
buildProgram('ck2cti', ['ck2cti.cpp'])
if env['layout'] != 'debian':
buildProgram('csvdiff', ['csvdiff.cpp', 'tok_input_util.cpp', 'mdp_allo.cpp'])

View file

@ -1,121 +0,0 @@
/**
* @file ck2cti.cpp
*
* Program to convert Chemkin-II-format reaction mechanism files to
* Cantera input format. The resulting Cantera input file contains a
* definition of one ideal_gas entry that represents an ideal gas
* mixture corresponding to the Chemkin-II reaction mechanism. The
* file also contains Cantera-format definitions for each species and
* each reaction in the input reaction mechanism file.
*
* Usage: ck2cti -i input -t thermo -tr transport -id idtag
*
* The Cantera-format text is written to the standard output.
*
* @param input Chemkin-II reaction mechanism file to be converted. Required.
*
* @param thermo Thermodynamic property database. If the THERMO section of the
* input file is missing or does not have entries for one or more species,
* this file will be searched for the required thermo data. This file may
* be another reaction mechanism file containing a THERMO section, or
* a Chemkin-II-compatible thermodynamic database file.
*
* @param transport Transport property database. If this file name is supplied,
* transport property parameters will be taken from this file and
* included in the output Cantera-format file. If this parameter is omitted,
* no transport property parameters will be included in the output.
*
* @param id idtag. The ideal_gas entry in the Cantera-format output
* has name \i idtag. If this parameter is omitted, it will be set to the
* input file name without the extension. Since only one phase definition
* is present in the ck2cti output, this parameter is not required.
*/
#include <iostream>
#include <string>
using namespace std;
#include "cantera/base/ct_defs.h"
#include "cantera/base/global.h"
#include "converters/ck2ct.h"
using namespace Cantera;
int showHelp()
{
cout << "\nck2cti: convert a CK-format reaction mechanism file to Cantera input format.\n"
<< "\n D. G. Goodwin, Caltech \n"
<< " Version 1.0, August 2003.\n\n"
<< endl;
cout << "options:" << endl;
cout << " -i <input file> \n"
<< " -t <thermo database> \n"
<< " -tr <transport database> \n"
<< " -id <identifier> \n"
<< " -d print debugging output \n\n"
<< " -v validate the input file \n\n"
<< "The results are written to the standard output.\n";
return 0;
}
string getp(int& i, int argc, char** args)
{
string a="--";
if (i < argc-1) {
a = string(args[i+1]);
}
if (a[0] == '-') {
a = "<missing>";
} else {
i += 1;
}
return a;
}
int main(int argc, char** argv)
{
#ifdef _MSC_VER
_set_output_format(_TWO_DIGIT_EXPONENT);
#endif
string infile="chem.inp", dbfile="", trfile="", logfile;
string idtag = "gas";
bool debug = false;
bool validate = false;
int i=1;
if (argc == 1) {
return showHelp();
}
while (i < argc) {
string arg = string(argv[i]);
if (arg == "-i") {
infile = getp(i,argc,argv);
} else if (arg == "-t") {
dbfile = getp(i,argc,argv);
} else if (arg == "-tr") {
trfile = getp(i,argc,argv);
} else if (arg == "-id") {
idtag = getp(i,argc,argv);
} else if (arg == "-d") {
debug = true;
cout << "### DEBUG MODE ###" << endl;
} else if (arg == "-v") {
validate = true;
cout << "### VALIDATION ENABLED ###" << endl;
} else if (arg == "-h" || argc < 3) {
return showHelp();
} else {
cout << "unknown option:" << arg << endl;
exit(-1);
}
++i;
}
int ierr = pip::convert_ck(infile.c_str(), dbfile.c_str(), trfile.c_str(),
idtag.c_str(), debug, validate);
if (ierr < 0) {
showErrors(std::cerr);
}
return ierr;
}

File diff suppressed because it is too large Load diff

View file

@ -1,131 +0,0 @@
/**
* @file CKParser.h
*
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_CKPARSER_H
#define CKR_CKPARSER_H
#include <fstream>
#include <string>
#include <iostream>
#include "ckr_defs.h"
#include "Element.h"
#include "Species.h"
#include "Reaction.h"
namespace ckr
{
// typedefs
/// readability constants
//@{
const int NoThermoDatabase = 10;
const int HasTempRange = 11;
//@}
/// Exception class for syntax errors.
class CK_SyntaxError : public CK_Exception
{
public:
CK_SyntaxError(std::ostream& f, const std::string& s, int linenum = -1);
std::ostream& m_out;
};
/**
* Chemkin mechanism file parser. For internal use by class CKReader.
*/
class CKParser
{
public:
CKParser(std::string ckfile, std::ostream* log);
CKParser(std::istream* infile, const std::string& fname,
std::ostream* log);
/// Destructor.
~CKParser() {}
bool readElementSection(elementList& elements);
bool readSpeciesSection(speciesList& species);
bool readThermoSection(std::vector<std::string>& names,
speciesTable& speciesData, vector_fp& temp,
int& optionFlag, std::ostream& log);
bool readReactionSection(const std::vector<std::string>& speciesNames,
std::vector<std::string>& elementNames,
reactionList& reactions, ReactionUnits& units);
bool advanceToKeyword(const std::string& kw, const std::string& stop);
bool verbose;
bool debug;
bool readNASA9ThermoSection(std::vector<std::string>& names,
speciesTable& species, vector_fp& temp,
int& optionFlag, std::ostream& log);
void readNASA9ThermoRecord(Species& sp);
private:
//! Local value of the line number being read
/*!
* This is used for debug IO printout purposes
*/
int m_line;
std::string m_buf;
std::string m_comment;
//! This is the input file that is read
/*!
* It's an istream
*/
std::istream* m_ckfile;
std::string m_ckfilename;
//! Pointer to the ostream for writing debugging output log info
std::ostream* m_log;
bool m_nasafmt;
//! Boolean indicating new NASA input file format
/*!
* If this is true, a completely different input file parser is
* used.
*/
bool m_nasa9fmt;
char m_last_eol;
void readThermoRecord(Species& sp);
//! Get a line from the input file, and return it in string s.
/*!
* If the line contains a comment character (!), then return only the
* portion preceding it. Non-printing characters are replaced by
* spaces.
*
* The input file is m_ckfile, an istream.
*
* @param s On return, s contains the line read from the
* input file.
* @param comment On return, comment contains the text following the
* comment character on the line, if any.
*/
void getCKLine(std::string& s, std::string& comment);
void putCKLine(std::string& s, std::string& comment);
void missingAuxData(const std::string& kw);
void checkSpeciesName(std::string spname);
};
}
#endif

View file

@ -1,738 +0,0 @@
/**
* @file CKReader.cpp
*
*/
// Copyright 2001 California Institute of Technology
#include <fstream>
#include <string>
using namespace std;
#include "CKParser.h"
#include "CKReader.h"
#include "thermoFunctions.h"
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include "writelog.h"
#include <cstdio>
#include "ckr_defs.h"
//#include "cantera/base/global.h"
//#define APP Cantera::Application
namespace ckr
{
/**
* read and optionally validate an input file in Chemkin format.
* @param inputFile path to the input file
* @param thermoDatabase path to the species database file
* @param logfile path to the file where log messages should be written
* @return true if no errors were encountered, false otherwise
*/
bool CKReader::read(const std::string& inputFile, const std::string& thermoDatabase,
const std::string& logfile)
{
clock_t t0, t1;
t0 = clock();
ifstream ckinfile(inputFile.c_str());
ofstream log(logfile.c_str());
try {
// construct a parser for the input file
CKParser parser(&ckinfile, inputFile, &log);
parser.verbose = verbose;
parser.debug = debug;
// write header information to the log file
struct tm* newtime;
time_t aclock;
time(&aclock); /* Get time in seconds */
newtime = localtime(&aclock); /* Convert time to struct tm form */
log << "CKReader version 1.0" << endl
<< "http://www.cantera.org" << endl << endl
<< asctime(newtime) << endl
<< setw(20) << "input file: "
<< setw(30) << inputFile << endl;
if (thermoDatabase != "")
log << setw(20) << "species database: "
<< setw(30) << thermoDatabase << endl;
if (!validate)
log << endl << "*************** Warning ***************" << endl
<< " mechanism validation disabled" << endl
<< "*****************************************" << endl;
if (debug) {
log << "*** DEBUG MODE ***" << endl;
} else {
log << "debugging disabled." << endl;
}
//----------- process ELEMENT section ----------------------
bool elok = parser.readElementSection(elements);
int nel = static_cast<int>(elements.size());
vector<string> elementSymbols;
for (int j = 0; j < nel; j++) {
elementSymbols.push_back(elements[j].name);
}
if (verbose) {
log.flags(ios::showpoint);
log.precision(6);
log.width(0);
log << endl << newTask("reading elements") << endl;
// write summary to log file
for (int i = 0; i < nel; i++) {
log << i+1 << ". " << pad(elements[i].name,2) << " ";
double wt = elements[i].atomicWeight;
if (wt == 0.0) {
log << "<error>";
} else {
log << wt;
}
if (!elements[i].weightFromDB) {
log << " (specified)";
}
if (elements[i].comment != "") {
log << " ! " << elements[i].comment;
}
log << endl;
}
}
log << "\nread " << nel << " elements." << endl;
if (!elok) {
log << "\nerrors were encountered." << endl;
return false;
}
if (nel == 0) {
return false;
}
//------------ process SPECIES section ------------------------
vector<string> speciesSymbols;
bool spok = parser.readSpeciesSection(species);
int nsp = static_cast<int>(species.size());
if (verbose) {
log << newTask("reading species") << endl;
}
for (int i = 0; i < nsp; i++) {
Species& s = species[i];
if (verbose) {
log << i+1 << ". " << s.name << endl;
}
speciesSymbols.push_back(s.name);
}
log << "\nread " << nsp << " species." << endl;
if (!spok) {
log << "\nerrors were encountered." << endl;
return false;
}
if (nsp == 0) {
return false;
}
//------------- process THERMO section -------------------------
if (verbose) {
log << newTask("looking up species definitions") << endl;
}
// if a thermo database is specified, get the default Tmin, Tmid, Tmax
vector_fp temp;
if (thermoDatabase != "") {
if (verbose) log << "reading default temperature ranges from "
<< thermoDatabase << endl;
ifstream thermofile(thermoDatabase.c_str());
CKParser thermReader(&thermofile, thermoDatabase, &log);
thermReader.verbose = verbose;
thermReader.debug = debug;
int dbflag = HasTempRange;
vector<string> dummy;
thermReader.readThermoSection(dummy, speciesData, temp, dbflag, log);
}
bool hasthermo = parser.advanceToKeyword("THERM","REAC");
int k, optionFlag = 0;
int undefined = static_cast<int>(species.size());
string nm;
vector<string> undef;
bool allsp = (speciesSymbols[0] == "<ALL>");
if (hasthermo &&
parser.readThermoSection(speciesSymbols,
speciesData, temp, optionFlag, log)) {
if (allsp) {
nsp = static_cast<int>(speciesData.size());
for (k = 0; k < nsp; k++) {
Species s;
s.name = speciesSymbols[k];
species.push_back(s);
}
}
undefined = 0;
for (k = 0; k < nsp; k++) {
nm = species[k].name;
species[k] = speciesData[species[k].name];
if (species[k].name == "<empty>") {
undefined++;
undef.push_back(nm);
species[k].name = nm;
}
}
int localdefs = nsp - undefined;
if (localdefs > 0 && verbose) log << "found definitions for "
<< localdefs
<< " of "
<< nsp
<< " species in the input file. "
<< endl;
} else {
undef = speciesSymbols;
if (verbose) {
log << "no THERMO section in input file." << endl;
}
}
if (undefined > 0 && thermoDatabase != ""
&& optionFlag != NoThermoDatabase) {
if (verbose) log << "searching external database "
<< thermoDatabase << " for species definitions..."
<< endl;
ifstream thermofile(thermoDatabase.c_str());
CKParser thermoReader(&thermofile, thermoDatabase, &log);
thermoReader.verbose = verbose;
thermoReader.debug = debug;
int dbflag = HasTempRange;
thermoReader.readThermoSection(undef, speciesData, temp, dbflag, log);
undefined = 0;
if (allsp) {
species.clear();
nsp = static_cast<int>(speciesData.size());
for (k = 0; k < nsp; k++) {
Species s;
s.name = undef[k];
species.push_back(s);
}
}
for (int k = 0; k < nsp; k++) {
if (species[k].valid == 0) {
nm = species[k].name;
species[k] = speciesData[species[k].name];
if (species[k].name == "<empty>") {
undefined++;
species[k].name = nm;
}
}
}
}
if (validate && !validateSpecies(log)) {
//Cantera::setError("read","error in species");
return false;
}
//------------- process REACTIONS section -------------------------
if (verbose) {
log << newTask("reading reactions") << endl;
}
ckinfile.close();
ifstream ckinfile2(inputFile.c_str());
// construct a new parser for the input file
CKParser parser2(&ckinfile2, inputFile, &log);
parser2.verbose = verbose;
parser2.debug = debug;
parser2.readReactionSection(speciesSymbols, elementSymbols, reactions, units);
log << "\nread " << static_cast<int>(reactions.size())
<< " reactions." << endl;
bool rxnok = true;
if (validate) {
rxnok = rxnok && validateReactions(log);
}
bool writeok = true;
if (verbose || validate) {
writeok = writeReactions(log);
}
rxnok = rxnok && writeok;
if (!rxnok) {
return false;
}
log << "\nSuccess... ";
t1 = clock();
log << "elapsed CPU time = "
<< double(t1 - t0)/CLOCKS_PER_SEC
<< " s" << endl;
if (!validate) {
log << "*** no validation performed ***" << endl;
}
}
catch (CK_Exception& e) {
log << e.errorMessage() << endl;
//Cantera::setError("CKReader::read",e.errorMessage());
return false;
} catch (std::exception& e) {
log << "an exception was raised in CKReader:\n";
log << e.what() << std::endl;
return false;
}
return true;
}
/// print a summary of all reactions to the log file
bool CKReader::writeReactions(std::ostream& log)
{
bool ok = true;
// int ns = species.size();
int nrxns = static_cast<int>(reactions.size());
log.flags(ios::unitbuf);
log.precision(6);
log << endl;
for (int n = 0; n < nrxns; n++) {
Reaction& r = reactions[n];
log << "reaction " << r.number << endl;
log << " ";
printReactionEquation(log, r);
log << endl;
// rate coefficient
if (r.isFalloffRxn) {
log << " high P rate coeff: ";
ok = ok && writeRateCoeff(r.kf, log) ;
log << " low P rate coeff: ";
ok = ok && writeRateCoeff(r.kf_aux, log);
ok = ok && writeFalloff(r.falloffType, r.falloffParameters, log);
} else {
log << " rate coeff: ";
ok = ok && writeRateCoeff(r.kf, log);
}
if (r.isReversible && r.krev.A > 0) {
log << " reverse rate coeff: ";
ok = ok && writeRateCoeff(r.krev, log);
}
int ne = static_cast<int>(r.e3b.size());
if (ne > 0) {
vector<string> enhSpecies;
getMapKeys(r.e3b, enhSpecies);
log << " enhanced collision efficiencies:" << endl;
log << " ";
for (int nn = 0; nn < ne; nn++) {
log << enhSpecies[nn] << " "
<< r.e3b[enhSpecies[nn]];
if (nn < ne-1) {
log << ", ";
}
}
log << endl;
}
if (r.isDuplicate) log
<< " declared duplicate reaction. See reaction "
<< r.duplicate << "." << endl;
log << endl;
}
return ok;
}
/// validate the species
bool CKReader::validateSpecies(std::ostream& log)
{
size_t nel = elements.size();
size_t nsp = species.size();
double tol;
log << newTask("validating species");
// check for undeclared elements
vector<string> esyms;
log << " checking that all species have been defined... ";
for (size_t k = 0; k < nsp; k++) {
Species& s = species[k];
if (s.valid == 0) {
log << endl << " species " << s.name << " undefined ";
s.valid = -1;
}
}
if (valid(species)) {
log << "OK" << endl;
} else {
log << endl;
return false;
}
log << " checking that all species elements have been declared... ";
for (size_t k = 0; k < nsp; k++) {
Species& s = species[k];
getMapKeys(s.comp, esyms);
size_t nm = esyms.size();
for (size_t m = 0; m < nm; m++) {
size_t j;
for (j = 0; j < nel; j++) {
if (esyms[m] == elements[j].name) {
break;
}
}
if (j == nel) {
log << endl << " species "
<< s.name << ": undeclared element "
<< esyms[m];
s.valid = -1;
}
}
}
if (valid(species)) {
log << "OK" << endl;
} else {
log << endl;
return false;
}
log << " checking consistency of species thermo data... ";
tol = 0.01;
if (checkThermo(log, species, tol)) {
log << "OK" << endl;
} else {
log << endl;
return false;
}
return true;
}
/// validate the reactions
bool CKReader::validateReactions(std::ostream& log)
{
bool ok = true;
// int ns = species.size();
int nrxns = static_cast<int>(reactions.size());
vector<int> unbal;
log << "checking that all reactions balance...";
if (checkBalance(log, speciesData, reactions, unbal)) {
log << " OK" << endl;
} else {
int nu = static_cast<int>(unbal.size());
for (int iu = 0; iu < nu; iu++) {
log << " error... reaction " << unbal[iu]
<< " does not balance" << endl;
}
ok = false;
}
log << "checking for duplicate reactions...";
for (int nn = 0; nn < nrxns; nn++) {
Reaction& r1 = reactions[nn];
for (int mm = nn + 1; mm < nrxns; mm++) {
Reaction& r2 = reactions[mm];
if (r1 == r2) {
r1.duplicate = mm + 1;
r2.duplicate = nn + 1;
if (!r1.isDuplicate || !r2.isDuplicate) {
log << endl << " error... undeclared duplicate reactions: "
<< nn + 1 << " and " << mm + 1;
ok = false;
} else {
log << endl << " declared duplicate reactions: "
<< nn + 1
<< " and " << mm + 1;
}
}
}
}
if (ok) {
log << "...OK" << endl;
}
return ok;
}
/**
* Check the thermodynamic property parameterizations for all species.
* The following are verified:
* - The heat capacity is positive throughout the full temperature range;
* - The entropy at Tmin is positive;
* - The heat capacity, entropy, and enthalpy evaluated at Tmid using
* both the high and low polynomial coefficients are the same to within
* relative error tol
* - The heat capacity at Tmax is not greater than the equipartition limit
* for the number of atoms in the molecule
*/
bool checkThermo(std::ostream& log, speciesList& sp, double tol)
{
const double dt = 0.0001;
double t, cp0, h0, s0, cp1, h1, s1;
int nsp = static_cast<int>(sp.size());
const int n_points = 20;
int k;
bool ok = true;
for (k = 0; k < nsp; k++) {
Species& s = sp[k];
if (s.valid <= 0) {
ok = false;
log << endl << "species " << s.name
<< " contains an error." << endl;
}
if (!ok) {
return false;
}
}
log << endl << " Checking that cp/R is positive... ";
for (k = 0; k < nsp; k++) {
Species& s = sp[k];
// check that cp is positive
cp0 = 0.0;
for (int j = 0; j < n_points; j++) {
t = j*(s.thigh - s.tlow)/(n_points - 1) + s.tlow;
cp0 = cp(t, s);
if (cp0 < 0.0) {
log << endl << " error... Cp/R < 0 at T = " << t
<< " for species " << s.name << endl;
s.valid = -1;
ok = false;
}
}
}
if (ok) {
log << "ok" << endl;
} else {
return ok;
}
// check that S(tlow) > 0
log << " Checking that the species entropies are positive... ";
for (k = 0; k < nsp; k++) {
Species& s = sp[k];
if (entropy(s.tlow, s) <= 0.0) {
log << endl << " error... negative entropy for species "
<< s.name << endl;
s.valid = -1;
ok = false;
}
}
if (ok) {
log << "ok" << endl;
} else {
return ok;
}
log << " Checking that properties are continuous at the midpoint temperature... ";
for (k = 0; k < nsp; k++) {
Species& s = sp[k];
// check continuity at Tmid
t = s.tmid - dt;
cp0 = cp(t, s);
h0 = enthalpy(t, s) + cp0*dt;
s0 = entropy(t, s) + dt*cp0/t;
t = s.tmid + dt;
cp1 = cp(t, s);
h1 = enthalpy(t, s) - cp1*dt;
s1 = entropy(t, s) - cp1*dt/t;
if (absval((cp0 - cp1)/cp0) > tol) {
log << endl << "Warning... species " << s.name
<< ": discontinuity in Cp at Tmid = "
<< s.tmid << endl;
log << "Cp/R (low, high) = " << cp0
<< ", " << cp1 << endl;
ok = false;
}
if (absval((h0 - h1)/h0) > tol) {
log << endl << "Warning... species " << s.name
<< ": discontinuity in enthalpy at Tmid = "
<< s.tmid << endl;
log << "h/R (low, high) = "
<< h0 << ", " << h1 << endl;
ok = false;
}
if (absval((s0 - s1)/s0) > tol) {
log << endl << "Warning... species " << s.name
<< ": discontinuity in entropy at Tmid = "
<< s.tmid << endl;
log << "s/R (low, high) = "
<< s0 << ", " << s1 << endl;
ok = false;
}
}
if (ok) {
log << "ok \n\n\n";
} else {
log << "\n\n\n";
}
log << " Checking that cp is less that the high-temperature\n"
<< " limiting value predicted by equipartition of energy.\n";
log << " Note that this limit does not account for the electronic\n"
<< " contribution to cp, and so may be violated in some cases."
<< endl << endl;
for (k = 0; k < nsp; k++) {
Species& s = sp[k];
// check that cp at Tmax is less than the equipartion value
// This does not include any possible electronic contribution
cp0 = cp(s.thigh, s);
int nel = static_cast<int>(s.elements.size());
int i;
double na = 0.0;
for (i = 0; i < nel; i++)
if (s.elements[i].name != "E") {
na += s.elements[i].number;
}
int natoms = int(floor(na));
double cpmax;
switch (natoms) {
case 1:
cpmax = 2.5;
break;
case 2:
cpmax = 4.5;
break;
default:
cpmax = 3.0*natoms - 3.0;
}
if (cp0 > cpmax) {
double over = 100.0*(cp0 - cpmax)/cpmax;
log << endl << "Warning... species " << s.name
<< ": cp(Tmax) greater than equipartition value \nby "
<< over << " percent.";
if ((natoms > 2) && (cp0 - cpmax < 0.5))
log << endl << " (if molecule is linear, cp is ok)"
<< endl;
}
}
return valid(sp);
}
/**
* Check that all reactions balance.
* @param speciesData species property dataset used to look up
* elemental compositions.
* @param r list of reactions to check
* @param unbalanced list of integers specifying reaction numbers of
* unbalanced reactions.
* @return true if all reactions balance
* @todo use reaction number stored in reaction object
*/
bool checkBalance(std::ostream& f, speciesTable& speciesData,
reactionList& r, std::vector<int>& unbalanced, double tolerance)
{
int nrxn = static_cast<int>(r.size());
string rname, pname;
vector<string> elementSyms;
unsigned int m;
unbalanced.clear();
map<string, double> atoms;
for (int i = 0; i < nrxn; i++) {
atoms.clear();
int nr = static_cast<int>(r[i].reactants.size());
int np = static_cast<int>(r[i].products.size());
int j;
double stoichCoeff;
for (j = 0; j < nr; j++) {
rname = r[i].reactants[j].name;
stoichCoeff = r[i].reactants[j].number;
vector<Constituent>& elements = speciesData[rname].elements;
for (m = 0; m < elements.size(); m++) {
atoms[elements[m].name] -= stoichCoeff * elements[m].number;
}
}
for (j = 0; j < np; j++) {
pname = r[i].products[j].name;
stoichCoeff = r[i].products[j].number;
vector<Constituent>& elements = speciesData[pname].elements;
for (m = 0; m < elements.size(); m++) {
atoms[elements[m].name] += stoichCoeff * elements[m].number;
}
}
double atms;
getMapKeys(atoms, elementSyms);
for (m = 0; m < elementSyms.size(); m++) {
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;
}
}
}
return (unbalanced.empty());
}
}

View file

@ -1,119 +0,0 @@
/**
* @file CKReader.h
*
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_CKRREADER_H
#define CKR_CKRREADER_H
#include <fstream>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include "CKParser.h"
#include <string>
#include <vector>
namespace ckr
{
class Group
{
public:
/// Construct a new empty Group object
Group() : name("<empty>"), index(-1) {}
Group(const std::string& nm) : name(nm), index(-1) {}
/// Destructor
~Group() {}
std::string name; //!< name
int index; //!< index number
std::map<std::string, double> comp; //!< elemental composition
bool operator==(const Group& g) const {
return (name == g.name);
}
bool operator!=(const Group& g) const {
return !(*this == g);
}
};
/// a list (vector) of Groups
typedef std::vector<Group> groupList;
/**
* Chemkin file reader class. Class CKReader parses and validates a file
* containing a description of a chemical reaction mechanism in Chemkin
* format. See the Examples section for examples of how CKReader is
* used in user programs.
*/
class CKReader
{
public:
/**
* Constructor. Construct a new CKReader instance. By default,
* validation is enabled, as well as verbose output to the log file.
*/
CKReader() : verbose(true), validate(true), debug(false) {}
/// Destructor. Does nothing.
~CKReader() {}
elementList elements; ///< a list of Element objects
speciesList species; ///< a list of Species objects
reactionList reactions; ///< a list of Reaction objects
groupList groups; ///< a list of Groups
speciesTable speciesData; ///< a map from species names to Species objects
ReactionUnits units; ///< reaction units
/**
* Read and optionally validate a Chemkin input file.
* @param inputFile path to the input file.
* @param thermoDatabase path to the species thermodynamic property database.
* If no database is required, enter a null string.
* @param logFile file to write logging and error messages to.
* @return true if no errors encountered, false otherwise.
*/
bool read(const std::string& inputFile,
const std::string& thermoDatabase, const std::string& logFile);
void write(string outputFile); ///< not implemented.
bool verbose; ///< print detailed messages to log file
bool validate; ///< validate elements, species, and reaction
bool debug; ///< enable debugging output
private:
// void validateElements(ostream& log);
bool validateSpecies(ostream& log); ///< validate the species.
bool validateReactions(ostream& log); ///< validate the reactions.
bool writeReactions(ostream& log);
};
bool checkBalance(ostream& f, speciesTable& speciesData, reactionList& r,
vector<int>& unbalanced, double tolerance=1.0e-3);
bool checkThermo(ostream& f, speciesList& species, double tol);
bool filter(const string& infile, const string& database,
const string& outfile, const vector<int>& species, const vector<int>& reactions);
}
#endif

View file

@ -1,32 +0,0 @@
/**
* @file Constituent.h
*
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_CONSTITUENT_H
#define CKR_CONSTITUENT_H
#include <string>
#include <vector>
namespace ckr
{
/**
* A class for components of a composite object. The only members are
* a string identifying the component, and a double specifying the
* amount.
*/
class Constituent
{
public:
std::string name; //!< The name of the object.
double number; //!< The number of units (molecules, etc.).
};
}
#endif

View file

@ -1,98 +0,0 @@
/**
* @file Element.h
*
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_ELEMENT_H
#define CKR_ELEMENT_H
#include <string>
#include <vector>
#include <ostream>
namespace ckr
{
/**
* A class for elements.
* Example usage:
* @code
* Element e;
* e.name = "He";
* e.atomicWeight = 4.0026;
* e.comment = "helium";
* @endcode
*/
class Element
{
public:
/// Construct a new empty Element object
Element() :
name("<empty>"),
atomicWeight(0.0),
valid(0),
index(-1),
weightFromDB(false),
comment("")
{}
/// Construct a new empty Element object
Element(const std::string& nm, double wt) :
name(nm),
atomicWeight(wt),
valid(0),
index(-1),
weightFromDB(false),
comment("")
{}
/// Destructor
~Element() {}
std::string name; //!< Element name
double atomicWeight; //!< Atomic weight in amu
int valid; //!< flag returned by validation routines
int index; //!< index number
bool weightFromDB; //!< true if atomic weight is not specified
std::string comment; //!< comment in input file
/**
* Compare two Element instances for equality based on name.
* Primarily for internal use.
*/
bool operator==(const Element& e) const {
return (name == e.name);
}
bool operator!=(const Element& e) const {
return !(*this == e);
}
friend std::ostream& operator<<(std::ostream& s, const Element& e) {
s << e.name;
if (!e.weightFromDB) {
s << "/" << e.atomicWeight << "/";
}
if (e.comment != "") {
s << " !" << e.comment << std::endl;
} else {
s << " ";
}
return s;
}
};
/// a list (vector) of Elements
typedef std::vector<Element> elementList;
}
#endif

View file

@ -1,20 +0,0 @@
h_sources =
cc_sources = atomicWeightDB.cpp CKReader.cpp \
Reaction.cpp thermoFunctions.cpp ck2ct.cpp CKParser.cpp \
ckr_utils.cpp NASA9Parser.cpp Species.cpp writelog.cpp
AM_CPPFLAGS = -I$(top_builddir)/include
AM_CXXFLAGS = $(AM_CPPFLAGS)
lib_LTLIBRARIES = $(top_builddir)/build/lib/libconverters.la
library_includedir = $(includedir)
#-----------------------
# Cantera Converters C/C++ library
#-----------------------
__top_builddir__build_lib_libconverters_la_LDFLAGS = $(all_libraries) -release $(GENERIC_RELEASE)
__top_builddir__build_lib_libconverters_la_SOURCES = $(cc_sources) $(h_sources)
__top_builddir__build_lib_libconverters_include_HEADERS = $(h_sources)
__top_builddir__build_lib_libconverters_includedir = $(prefix)/include

View file

@ -1,496 +0,0 @@
/**
* @file CKParser.cpp
*
*/
// Copyright 2001 California Institute of Technology
#include <numeric>
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <math.h>
#include "CKParser.h"
#include "ckr_utils.h"
#include "writelog.h"
#include <stdio.h>
//#include "cantera/base/stringUtils.h"
#include <ctype.h>
#include <string>
#include <cstdlib>
using namespace std;
namespace ckr
{
/**
* Add an element to a species.
* @param symbol element symbol
* @param atoms number of atoms of this element in the
* species (may be non-integral)
* @param sp Species object to add element to
* @param log log file output stream
*/
static void addElement(std::string symbol, double atoms,
Species& sp, std::ostream& log)
{
if (atoms != 0.0) {
Constituent e;
e.name = symbol;
e.number = atoms;
sp.elements.push_back(e);
sp.comp[symbol] = atoms;
}
}
/**
* Throw an exception if number string is bad
*/
static void illegalNumber(std::ostream& f,
std::string s, int linenum = -1)
{
string msg = "illegal number: "+s;
throw CK_SyntaxError(f, msg, linenum);
};
void CKParser::checkSpeciesName(std::string spname)
{
if (spname.size() <= 0) {
string sss = "Empty for string name";
throw CK_SyntaxError(*m_log, sss, m_line);
}
char first = spname[0];
if (isdigit(first)) {
string sss = "First char of string name is number";
throw CK_SyntaxError(*m_log, sss, m_line);
}
if (isspace(first)) {
string sss = "First char of string name is white space";
throw CK_SyntaxError(*m_log, sss, m_line);
}
}
static std::string d2e(std::string s)
{
size_t n;
size_t sz = s.size();
string r = s;
char ch;
for (n = 0; n < sz; n++) {
ch = s[n];
if (ch == 'D') {
r[n] = 'E';
} else if (ch == 'd') {
r[n] = 'e';
}
}
return r;
}
static double de_atof(std::string s)
{
string r = d2e(s);
//double rval = Cantera::atofCheck(r.c_str());
double rval = atof(r.c_str());
return rval;
}
static double getNumberFromString(std::string s)
{
bool inexp = false;
removeWhiteSpace(s);
int sz = static_cast<int>(s.size());
char ch;
for (int n = 0; n < sz; n++) {
ch = s[n];
if (!inexp && (ch == 'E' || ch == 'e' || ch == 'D' || ch == 'd')) {
inexp = true;
} else if (ch == '+' || ch == '-') {
if (n > 0 && (s[n-1] != 'E' && s[n-1]
!= 'e' && s[n-1] != 'd' && s[n-1] != 'D')) {
return UNDEF;
}
} else if (ch != '.' && (ch < '0' || ch > '9')) {
return UNDEF;
}
}
return de_atof(s);
}
static int de_atoi(std::ostream& log, std::string s, int line = -1)
{
double val = getNumberFromString(s);
int ival = (int) val;
double val2 = (double) ival;
if (fabs(val - val2) >= 0.00001 * (val + val2)) {
string sss = "de_atoi: Conversion of int failed: " + s;
throw CK_SyntaxError(log, sss, line);
}
return ival;
}
/**
*
* Read species data from THERMO section records.
*
* @param names List of species names (input).
* @param species Table of species objects holding data from records
* in THERMO section (output).
* @param temp Default vector of temperature region boundaries
* There are one more temperatures than there are
* temperature regions.
*
* @return True, if the THERMO section exists and the species
* have all been successfully processed. False, if
* the THERMO section doesn't exist or there were
* additional problems.
*/
bool CKParser::readNASA9ThermoSection(std::vector<string>& names,
speciesTable& species, vector_fp& temp,
int& optionFlag, std::ostream& log)
{
// String buffer for lines
string s;
vector<string> toks;
string defaultDate="";
int nsp = static_cast<int>(names.size());
// Comment string
string comment;
// Check to see that we expect to be reading a NASA9 formatted file
if (!m_nasa9fmt) {
throw CK_SyntaxError(log,
"In NASA9 parser. However, we expect a different file format",
-1);
}
// now read in all species records that have names in list 'names'
bool getAllSpecies = (nsp > 0 && match(names[0], "<ALL>"));
if (getAllSpecies) {
names.clear();
}
// Map between the number of times a species name appears in the database
map<string, int> dup; // used to check for duplicate THERMO records
bool already_read;
while (1 > 0) {
// If we don't have any more species to read, break
if (nsp == 0) {
break;
}
already_read = false;
// Read a new species record from the section
Species spec;
readNASA9ThermoRecord(spec);
// we signal the end of the section by putting <END> as a
// species name. Break if you find the end of the section.
if (spec.name == "<END>") {
break;
}
// check for duplicate thermo data
if (dup[spec.name] == 2) {
log << "Warning: more than one THERMO record for "
<< "species " << spec.name << endl;
log << "Record at line " << m_line
<< " of " << m_ckfilename << " ignored." << endl;
already_read = true;
}
// Set the record in the map to 2 to create a signal for the
// next time.
dup[spec.name] = 2;
// Check to see whether we need this particular species name
if (!already_read && (getAllSpecies
|| (find(names.begin(), names.end(), spec.name)
< names.end()))) {
// Add the species object to the map. Note we are
// doing a copy constructor here, so we create a
// lasting entry.
species[spec.name] = spec;
if (verbose) {
log << endl << "found species " << spec.name;
log << " at line " << m_line
<< " of " << m_ckfilename;
writeSpeciesData(log, spec);
}
if (getAllSpecies) {
names.push_back(spec.name);
nsp = static_cast<int>(names.size());
} else {
nsp--;
}
}
}
return true;
}
/**
*
* Read one species definition in a NASA9 string.
*
*/
void CKParser::readNASA9ThermoRecord(Species& sp)
{
string s;
string numstr;
double cf;
// Set to the NASA9 polynomial format
sp.thermoFormatType = 1;
// look for line 1, but if a keyword is found first or the end of
// the file is reached, return "<END>" as the species name
string comment;
// Name of the species
string nameid;
vector<string> toks;
size_t nToks = 0;
// Loop forward until we get to the next nonempty line.
do {
getCKLine(s, comment);
if (isKeyword(s) || match(s, "<EOF>")) {
sp.name = "<END>";
putCKLine(s, comment);
return;
}
// The first 18 spaces are devoted to the name of the species
string nameid = s.substr(0,18);
getTokens(nameid, static_cast<int>(nameid.size()), toks);
nToks = toks.size();
} while (nToks == 0);
//------------- line 1 ---------------------------
// Everything after the first 18 spaces is a comment.
size_t nt = s.size();
sp.m_commentsRef = s.substr(18, nt-18);
// Parse the species name
sp.name = toks[0];
sp.id = "";
if (nToks > 1) {
throw CK_SyntaxError(*m_log,
"Illegal number of tokens for string name", m_line);
}
checkSpeciesName(sp.name);
//------------- line 2 ---------------------------
getCKLine(s, comment);
if (s.size() < 79) {
throw CK_SyntaxError(*m_log,
"Size of second line is too small", m_line);
}
// Read the number of temperature regions.
string sN = s.substr(0,2);
sp.nTempRegions = de_atoi(*m_log, sN);
string refDataCode = s.substr(3,6);
// elemental composition (first 5 elements)
for (int i = 0; i < 5; i++) {
string elementSym = "";
int iloc = 10 + 8*i;
if (s[iloc] != ' ') {
if (s[iloc+1] != ' ') {
elementSym = s.substr(iloc,2);
} else {
elementSym = s.substr(iloc,1);
}
} else if (s[iloc+1] != ' ') {
elementSym = s.substr(iloc+1,1);
}
double atoms = de_atof(s.substr(iloc+2,6));
addElement(elementSym, atoms, sp, *m_log);
}
// single-character phase descriptor
sp.phase = s.substr(50,2);
// Molecular weight in gm per gmol
string molecWeight = s.substr(52, 13);
// Heat of formation at 298.15 K in J / gmol
string Hf298_Jgmol = s.substr(65, 15);
vector_fp* coeffs_ptr;
for (int i = 0; i < sp.nTempRegions; i++) {
coeffs_ptr = new vector_fp(9);
vector_fp& coeffs = *coeffs_ptr;
//------------- line 3 ---------------------------
getCKLine(s, comment);
if (s.size() < 79) {
throw CK_SyntaxError(*m_log,
"Size of third line is too small", m_line);
}
string sTlow = s.substr(0, 11);
double tLow = de_atof(sTlow);
string sTHigh = s.substr(11, 11);
double tHigh = de_atof(sTHigh);
string sNCoeff = s.substr(22, 1);
int nCoeff = de_atoi(*m_log, sNCoeff);
if (nCoeff != 7) {
throw CK_SyntaxError(*m_log, "ncoeff ne 7", m_line);
}
string sTCoeff1 = s.substr(24, 5);
double TCoeff1 = de_atof(sTCoeff1);
if (TCoeff1 != -2.0) {
throw CK_SyntaxError(*m_log, "TCoeff1 ne -2.0", m_line);
}
string sTCoeff2 = s.substr(29, 5);
double TCoeff2 = de_atof(sTCoeff2);
if (TCoeff2 != -1.0) {
throw CK_SyntaxError(*m_log, "TCoeff2 ne -1.0", m_line);
}
string sTCoeff3 = s.substr(34, 5);
double TCoeff3 = de_atof(sTCoeff3);
if (TCoeff3 != 0.0) {
throw CK_SyntaxError(*m_log, "TCoeff3 ne 0.0", m_line);
}
string sTCoeff4 = s.substr(39, 5);
double TCoeff4 = de_atof(sTCoeff4);
if (TCoeff4 != 1.0) {
throw CK_SyntaxError(*m_log, "TCoeff4 ne 1.0", m_line);
}
string sTCoeff5 = s.substr(44, 5);
double TCoeff5 = de_atof(sTCoeff5);
if (TCoeff5 != 2.0) {
throw CK_SyntaxError(*m_log, "TCoeff5 ne 2.0", m_line);
}
string sTCoeff6 = s.substr(49, 5);
double TCoeff6 = de_atof(sTCoeff6);
if (TCoeff6 != 3.0) {
throw CK_SyntaxError(*m_log, "TCoeff6 ne 3.0", m_line);
}
string sTCoeff7 = s.substr(54, 5);
double TCoeff7 = de_atof(sTCoeff7);
if (TCoeff7 != 4.0) {
throw CK_SyntaxError(*m_log, "TCoeff7 ne 4.0", m_line);
}
string sHf298mHF0 = s.substr(65, 15);
//------------- line 4 ---------------------------
getCKLine(s, comment);
if (s.size() < 79) {
throw CK_SyntaxError(*m_log,
"Size of third line is too small", m_line);
}
numstr = s.substr(0, 16);
cf = getNumberFromString(numstr);
if (cf == UNDEF) {
illegalNumber(*m_log, numstr, m_line);
}
coeffs[0] = cf;
numstr = s.substr(16, 16);
cf = getNumberFromString(numstr);
if (cf == UNDEF) {
illegalNumber(*m_log, numstr, m_line);
}
coeffs[1] = cf;
numstr = s.substr(32, 16);
cf = getNumberFromString(numstr);
if (cf == UNDEF) {
illegalNumber(*m_log, numstr, m_line);
}
coeffs[2] = cf;
numstr = s.substr(48, 16);
cf = getNumberFromString(numstr);
if (cf == UNDEF) {
illegalNumber(*m_log, numstr, m_line);
}
coeffs[3] = cf;
numstr = s.substr(64, 16);
cf = getNumberFromString(numstr);
if (cf == UNDEF) {
illegalNumber(*m_log, numstr, m_line);
}
coeffs[4] = cf;
//------------- line 5 ---------------------------
getCKLine(s, comment);
if (s.size() < 79) {
throw CK_SyntaxError(*m_log,
"Size of fourth line is too small", m_line);
}
numstr = s.substr(0, 16);
cf = getNumberFromString(numstr);
if (cf == UNDEF) {
illegalNumber(*m_log, numstr, m_line);
}
coeffs[5] = cf;
numstr = s.substr(16, 16);
cf = getNumberFromString(numstr);
if (cf == UNDEF) {
illegalNumber(*m_log, numstr, m_line);
}
coeffs[6] = cf;
numstr = s.substr(48, 16);
cf = getNumberFromString(numstr);
if (cf == UNDEF) {
illegalNumber(*m_log, numstr, m_line);
}
coeffs[7] = cf;
numstr = s.substr(64, 16);
cf = getNumberFromString(numstr);
if (cf == UNDEF) {
illegalNumber(*m_log, numstr, m_line);
}
coeffs[8] = cf;
// Store the coefficients.
sp.minTemps.push_back(tLow);
sp.maxTemps.push_back(tHigh);
sp.region_coeffs.push_back(coeffs_ptr);
}
sp.valid = 1;
}
} // ckr namespace

View file

@ -1,196 +0,0 @@
/**
* @file Reaction.cpp
*
*/
// Copyright 2001 California Institute of Technology
#include "Reaction.h"
#include <iostream>
#include <stdio.h>
using namespace std;
namespace ckr
{
Reaction forwardReaction(const Reaction& rxn)
{
Reaction r(rxn);
r.isReversible = false;
r.krev = RateCoeff();
return r;
}
Reaction reverseReaction(const Reaction& rxn)
{
Reaction r(rxn);
if (rxn.isReversible && (r.krev.A > 0.0)) {
r.isReversible = false;
r.products = rxn.reactants;
r.reactants = rxn.products;
r.kf = rxn.krev;
r.krev = RateCoeff();
} else {
r.reactants.clear();
r.products.clear();
}
return r;
}
Reaction& Reaction::operator=(const Reaction& b)
{
if (this == &b) {
return *this;
}
type = b.type;
reactants = b.reactants;
fwdOrder = b.fwdOrder;
products = b.products;
thirdBody = b.thirdBody;
e3b = b.e3b;
kf = b.kf;
kf_aux = b.kf_aux;
krev = b.krev;
duplicate = b.duplicate;
falloffType = b.falloffType;
falloffParameters = b.falloffParameters;
otherAuxData = b.otherAuxData;
isFalloffRxn = b.isFalloffRxn;
isChemActRxn = b.isChemActRxn;
isThreeBodyRxn = b.isThreeBodyRxn;
isDuplicate = b.isDuplicate;
lines = b.lines;
number = b.number;
comment = b.comment;
return *this;
}
void Reaction::write(std::ostream& s) const
{
int nl = static_cast<int>(lines.size());
for (int nn = 0; nn < nl; nn++) {
s << lines[nn] << std::endl;
}
// int nr = reactants.size();
// int np = products.size();
// int n;
// double nu;
// for (n = 0; n < nr; n++) {
// nu = reactants[n].number;
// if (nu > 1) s << nu;
// s << reactants[n].name;
// if (n < nr - 1)
// s << " + ";
// else if (isThreeBodyRxn)
// s << " + " << thirdBody;
// else if (isFalloffRxn || isChemActRxn)
// s << " (+ " << thirdBody << ")";
// }
// if (isReversible) s << " = ";
// else s << "=>";
// for (n = 0; n < np; n++) {
// nu = products[n].number;
// if (nu > 1) s << nu;
// s << products[n].name;
// if (n < np - 1)
// s << " + ";
// else if (isThreeBodyRxn)
// s << " + " << thirdBody;
// else if (isFalloffRxn || isChemActRxn)
// s << " (+ " << thirdBody << ")";
// }
// char kfstr[100];
// sprintf(kfstr, " %14.5g %4.2g %f", kf.A, kf.n, kf.E);
// s << kfstr << endl;
}
/**
* stoichiometric coefficient of species s in the reaction. Negative
* for reactants, positive for products, and zero if the species does
* not participate in the reaction.
*/
double Reaction::stoichCoefficient(const std::string& s) const
{
int k;
int nr = static_cast<int>(reactants.size());
for (k = 0; k < nr; k++)
if (reactants[k].name == s) {
return -reactants[k].number;
}
int np = static_cast<int>(products.size());
for (k = 0; k < np; k++)
if (products[k].name == s) {
return products[k].number;
}
return 0.0;
}
/**
* used to find undeclared duplicate reactions.
* @todo could be made faster
*/
bool Reaction::operator==(const Reaction& r) const
{
int nr = static_cast<int>(reactants.size());
int np = static_cast<int>(products.size());
if (int(r.reactants.size()) != nr ||
int(r.products.size()) != np || r.thirdBody != thirdBody) {
return false;
}
std::string nm;
std::map<std::string, double> coeffs;
for (int ir = 0; ir < nr; ir++) {
coeffs[reactants[ir].name] = -reactants[ir].number;
}
for (int ip = 0; ip < np; ip++) {
coeffs[products[ip].name] = products[ip].number;
}
for (int jr = 0; jr < nr; jr++) {
nm = r.reactants[jr].name;
if (coeffs[nm] == 0.0) {
return false;
}
coeffs[nm] /= -r.reactants[jr].number;
}
for (int jp = 0; jp < np; jp++) {
nm = r.products[jp].name;
if (coeffs[nm] == 0.0) {
return false;
}
coeffs[nm] /= products[jp].number;
}
int nc = static_cast<int>(coeffs.size());
std::vector<double> ratios;
getMapValues(coeffs, ratios);
if (!isReversible && ratios[0] < 0.0) {
return false;
}
for (int ic = 0; ic < nc; ic++) {
if (ratios[ic] != ratios[0]) {
return false;
}
}
return true;
}
}

View file

@ -1,261 +0,0 @@
/**
* @file Reaction.h
*
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_REACTION_H
#define CKR_REACTION_H
#include <string>
#include <vector>
#include <map>
#include <ostream>
#include "ckr_defs.h"
#include "ckr_utils.h"
#include "RxnSpecies.h"
namespace ckr
{
/** @name Reaction Types
*/
//@{
const int Elementary = 2000; ///< elementary, pressure-independent reaction
const int ThreeBody = 2001; ///< three-body reaction
const int Falloff = 2002; ///< falloff reaction
const int ChemAct = 2003; ///< chemical activation reaction
//@}
/**
* Reaction rate coefficient class. For simplicity, the RateCoeff
* class has public members representing the parameters of all rate
* coefficient types supported by Chemkin. The 'type' attribute
* specifies the rate coefficient type.
*/
class RateCoeff
{
public:
/**
* Constructor. Construct a default rate coefficient object. The
* type is set to Arrhenius, and all parameter values are set to
* zero.
*/
RateCoeff() : A(0.0), n(0.0), E(0.0),
B(0.0), C(0.0), type(Arrhenius) {}
/**
* Copy constructor
*/
RateCoeff(const RateCoeff& k) : A(k.A), n(k.n), E(k.E),
B(k.B), C(k.C), type(k.type), b(k.b) {}
/// Destructor. Does nothing.
~RateCoeff() {}
RateCoeff& operator=(const RateCoeff& k) {
if (this == &k) {
return *this;
}
A = k.A;
n = k.n;
E = k.E;
B = k.B;
C = k.C;
type = k.type;
b = k.b;
return *this;
}
// Modified Arrhenius parameters, common to all types.
double A; ///< pre-exponential factor (all types)
double n; ///< temperature exponent (all types)
double E; ///< activation energy (all types)
// Landau-Teller parameters
double B; ///< Landau-Teller B parameter
double C; ///< Landau-Teller C parameter
int type; ///< rate coefficient type
// Coefficients for the special forms allowed by Chemkin-III
vector_fp b; ///< coefficients for JAN or FIT1 form
};
//////////////////////////////////////////////////////////////////////////
//! Specifies the Units for all reactions
/**
* The default units are Cal per gmol for the activivation units
* and the default number type is assumed to be gmol.
*/
class ReactionUnits
{
public:
ReactionUnits() :
ActEnergy(ckr::Cal_per_Mole),
Quantity(ckr::Moles) { }
int ActEnergy; ///< Activation energy unit flag
int Quantity; ///< Moles or molecules unit flag
};
//////////////////////////////////////////////////////////////////////////
/// A class for reactions.
// Note: if you add data items to this class, be sure to update
// the copy constructor and the assignment operator !
class Reaction
{
public:
/// a list of auxiliary data values
typedef vector_fp auxdata;
/// Construct an empty Reaction object
Reaction() : type(Elementary),
isFalloffRxn(false),
isChemActRxn(false),
isThreeBodyRxn(false),
isReversible(false),
isDuplicate(false),
duplicate(0),
thirdBody("<none>"),
number(0),
falloffType(Lindemann) {}
/// Copy constructor
Reaction(const Reaction& r) : type(r.type),
isFalloffRxn(r.isFalloffRxn),
isChemActRxn(r.isChemActRxn),
isThreeBodyRxn(r.isThreeBodyRxn),
isReversible(r.isReversible),
isDuplicate(r.isDuplicate),
duplicate(r.duplicate),
thirdBody(r.thirdBody),
number(r.number),
reactants(r.reactants),
fwdOrder(r.fwdOrder),
products(r.products),
e3b(r.e3b),
kf(r.kf),
kf_aux(r.kf_aux),
krev(r.krev),
falloffType(r.falloffType),
falloffParameters(r.falloffParameters),
otherAuxData(r.otherAuxData),
lines(r.lines), comment(r.comment) {}
/// Destructor
virtual ~Reaction() {}
Reaction& operator=(const Reaction& r);
int type; ///< Reaction type.
bool isFalloffRxn; ///< True if reaction is a falloff reaction.
bool isChemActRxn; ///< True if reaction is a chemical activation reaction.
bool isThreeBodyRxn; ///< True if reaction is a three-body reaction.
bool isReversible; ///< True if reaction is reversible.
bool isDuplicate; ///< True if reaction is declared to be a duplicate;
/**
* reaction number this one is a duplicate to (declared or not).
* If the reaction is not a duplicate, the value is zero.
*/
int duplicate;
/**
* For pressure-dependent reactions (including three-body ones)
* this string contains either "M" if all species may act as
* third body collision partners, or a species name if only
* one species does.
*/
std::string thirdBody;
/// Reaction number.
int number;
/**
* list of species that participate as reactants,
* and their stoichiometric coefficients
*/
std::vector<RxnSpecies> reactants;
mutable std::map<std::string, double> fwdOrder;
/**
* list of species that participate as products,
* and their stoichiometric coefficients
*/
std::vector<RxnSpecies> products;
/**
* map from species names to enhanced third-body collision efficiencies
*/
mutable std::map<std::string, double> e3b;
/**
* Forward rate coefficient. For falloff reactions, this is the
* high-pressure rate coefficient, and for chemical activation
* reactions it is the low-pressure one.
*/
RateCoeff kf;
/**
* For pressure-dependent reactions, the rate coefficient for the
* opposite pressure limit as kf (
*/
RateCoeff kf_aux;
/// Reverse rate coefficient. Empty unless REV auxiliary data given.
RateCoeff krev;
int falloffType;
vector_fp falloffParameters;
/**
* auxiliary data not handled elsewhere.
*/
mutable std::map<std::string, auxdata> otherAuxData;
/**
* input file lines
*/
std::vector<std::string> lines;
/**
* comments
*/
std::vector<std::string> comment;
// methods
double stoichCoefficient(const std::string& s) const;
bool operator==(const Reaction& r) const;
void write(std::ostream& s) const;
};
/// a list of Reaction objects
typedef std::vector<Reaction> reactionList;
Reaction forwardReaction(const Reaction& rxn);
Reaction reverseReaction(const Reaction& rxn);
}
#endif

View file

@ -1,37 +0,0 @@
/**
* @file RxnSpecies.h
*
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_RXNSPECIES_H
#define CKR_RXNSPECIES_H
#include <string>
#include <vector>
namespace ckr
{
typedef vector_int group_t;
typedef std::vector<group_t> grouplist_t;
/**
* A class for species in a reaction.
*
*/
class RxnSpecies
{
public:
RxnSpecies() :
number(0) {}
std::string name; //!< The name of the object.
double number; //!< The number of units (molecules, etc.).
grouplist_t groups;
};
}
#endif

View file

@ -1,108 +0,0 @@
/**
* @file Species.cpp
*
*/
// Copyright 2001 California Institute of Technology
#include "Species.h"
#include <iostream>
#include <stdio.h>
namespace ckr
{
// Construct an empty Species object
Species::Species() :
thermoFormatType(0),
name("<empty>"),
id("<none>"),
phase(""),
tlow(0.0),
tmid(0.0),
thigh(0.0),
nTempRegions(2),
valid(0),
index(-1)
{
}
// Destructor
Species::~Species()
{
delR();
}
void Species::delR()
{
for (size_t i = 0; i < region_coeffs.size(); i++) {
if (region_coeffs[i]) {
delete region_coeffs[i];
region_coeffs[i] = 0;
}
}
}
//! Copy constructor
Species::Species(const Species& s)
{
/*
* Use the assignment operator to do the brunt
* of the work for the copy constructor.
*/
*this = s;
}
// Assignment operator
Species& Species::operator=(const Species& s)
{
if (&s == this) {
return *this;
}
thermoFormatType = s.thermoFormatType;
name = s.name;
id = s.id;
phase = s.phase;
tlow = s.tlow;
tmid = s.tmid;
thigh = s.thigh;
nTempRegions = s.nTempRegions;
elements = s.elements;
comp = s.comp;
lowCoeffs = s.lowCoeffs;
highCoeffs = s.highCoeffs;
delR();
for (size_t i = 0; i < s.region_coeffs.size(); i++) {
region_coeffs.push_back(new vector_fp(*(s.region_coeffs[i])));
}
minTemps = s.minTemps;
maxTemps = s.maxTemps;
m_commentsRef = s.m_commentsRef;
valid = s.valid;
index = s.index;
return *this;
}
// Test for equality based on name only.
bool Species::operator==(const Species& s) const
{
return (s.name == name);
}
bool Species::operator!=(const Species& s) const
{
return !(*this == s);
}
// Used to sort lists of species by index number.
bool Species::operator<(const Species& s) const
{
return (index < s.index);
}
}

View file

@ -1,106 +0,0 @@
/**
* @file Species.h
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_SPECIES_H
#define CKR_SPECIES_H
#include "ckr_defs.h"
#include "Constituent.h"
#include <map>
#include <vector>
namespace ckr
{
/**
* Holds species data read in from entries in the THERMO section of
* a chemkin or nasa9 fortran formatted input file.
*/
class Species
{
public:
/// Construct an empty Species object
Species();
//! Copy constructor
Species(const Species& s);
/// Destructor
~Species();
/// Assignment operator
Species& operator=(const Species& s);
/// Test for equality based on name only.
bool operator==(const Species& s) const;
bool operator!=(const Species& s) const;
/// Used to sort lists of species by index number.
bool operator<(const Species& s) const;
//! Type of thermodynamic representation
/*!
* 0 This is a 2 region NASA polynomial representation
*
* 1 This is a multiple temperature region NASA9 polynomial
* representation.
*/
int thermoFormatType;
//! Species Name
std::string name;
std::string id; //!< ID tag from 'date' field in input
std::string phase; //!< Phase string. Usually "G", "L", or "S".
double tlow; //!< Min temperature for thermo data fit
double tmid; //!< Mid temperature for thermo data fit
double thigh; //!< Max temperature for thermo data fit
/// list of Constituent objects defining elemental composition
std::vector<Constituent> elements;
/// map from element symbols to atom numbers
mutable std::map<std::string, double> comp;
/// polynomial coefficients for the lower temperature range
vector_fp lowCoeffs;
/// polynomial coefficients for the upper temperature range
vector_fp highCoeffs;
//! Number of temperature regions
int nTempRegions;
std::vector<vector_fp*> region_coeffs;
vector_fp minTemps;
vector_fp maxTemps;
/// flag set by the validation routines
int valid;
/// position in the list of species in the input file
int index;
std::string m_commentsRef;
private:
//! Delete private data
void delR();
};
//! Shorthand for a list of Species
typedef std::vector<Species> speciesList;
//! A map from species names to Species objects
typedef std::map<std::string, Species> speciesTable;
}
#endif

View file

@ -1,127 +0,0 @@
/**
* @file atomicWeightDB.cpp
*
* internal database of default atomic weights
*
*/
// Copyright 2001 California Institute of Technology
#include <map>
#include <string>
#include <iostream>
using namespace std;
namespace ckr
{
static double _weights[] = {
1.00797, 4.0026, 6.939, 9.01220, 10.811, // H - B
12.01115, 14.0067, 15.9994, 18.9984, 20.183, 22.9898, // C - Na
24.312, 26.9815, 28.086, 30.9738, 32.064, // Mg - S
35.453, 39.948, 39.102, 40.08, 44.956, // Cl - Sc
47.9, 50.942, 51.996, 54.938, 55.847, // Ti - Fe
58.9332, 58.71, 63.54, 65.37, 69.72, // Co - Ga
72.59, 74.9216, 78.96, 79.9009, 83.8, // Ge - Kr
85.47, 87.62, 88.905, 91.22, 92.9064, // Rb - Nb
95.94, 98, 101.07, 102.906, 106.42, // Mo - Pd
107.868, 112.41, 114.82, 118.71, 121.75, // Ag - Sb
127.6, 126.905, 131.29, 132.905, 137.33, // Te - Ba
138.906, 140.12, 140.908, 144.24, 145, // La - Pm
150.36, 151.96, 157.25, 158.925, 162.5, // Sm - Dy
164.93, 167.26, 168.934, 173.04, 174.967, // Ho - Lu
178.49, 180.948, 183.85, 186.207, 190.2, // Hf - Os
192.22, 195.08, 196.967, 200.59, 204.383, // Ir - Tl
207.2, 208.98, 209, 210, 222, // Pb - Rn
223, 226.025, 227.028, 232.038, 231.036, // Fr - Pa
238.029, 237.048, 244, 243, 247, // U - Cm
247, 251, 252, 257, 258, // Bk - Md
259, 269, 2.0141, 5.45e-4, -1.0 // No - E
};
static char _symbols[][3] = {
"H", "He", "Li", "Be", "B",
"C", "N", "O", "F", "Ne", "Na",
"Mg", "Al", "Si", "P", "S",
"Cl", "Ar", "K", "Ca", "Sc",
"Ti", "V", "Cr", "Mn", "Fe",
"Co", "Ni", "Cu", "Zn", "Ga",
"Ge", "As", "Se", "Br", "Kr",
"Rb", "Sr", "Y", "Zr", "Nb",
"Mo", "Tc", "Ru", "Rh", "Pd",
"Ag", "Cd", "In", "Sn", "Sb",
"Te", "I", "Xe", "Cs", "Ba",
"La", "Ce", "Pr", "Nd", "Pm",
"Sm", "Eu", "Gd", "Tb", "Dy",
"Ho", "Er", "Tm", "Yb", "Lu",
"Hf", "Ta", "W", "Re", "Os",
"Ir", "Pt", "Au", "Hg", "Tl",
"Pb", "Bi", "Po", "At", "Rn",
"Fr", "Ra", "Ac", "Th", "Pa",
"U", "Np", "Pu", "Am", "Cm",
"Bk", "Cf", "Ei", "Fm", "Md",
"No", "Lw", "D", "E", "!"
};
/**
* Get table of atomic weights from the internal database.
* @param weights atomic symbol -> atomic weight map
*
* Example usage:
* @code
* #include "atomicWeightDB.h"
* ...
* map<string, double> atw;
* getDefaultAtomicWeights(atw);
* double copperAtomicWeight = atw["Cu"];
* ...
* @endcode
* Note that if the atomic weight is requested for an unknown
* element symbol, the value zero will be returned.
*/
//void getDefaultAtomicWeights(ct::ctmap_sd& weights) {
void getDefaultAtomicWeights(map<string, double>& weights)
{
// erase existing entries, if any
//weights.clear();
const int MAX_NUM = 200;
int n;
for (n = 0; n < MAX_NUM; n++) {
if (_symbols[n][0] == '!') {
break;
}
weights[_symbols[n]] = _weights[n];
}
}
void writeKnownElements(ostream& s, string fmt)
{
const int MAX_NUM = 200;
int n;
if (fmt == "CK") {
for (n = 0; n < MAX_NUM; n++) {
if (_symbols[n][0] == '!') {
break;
}
s << " " << string(_symbols[n]) << "/" << _weights[n] << "/" << endl;
}
} else if (fmt == "XML") {
s << "<known_elements>" << endl;
for (n = 0; n < MAX_NUM; n++) {
if (_symbols[n][0] == '!') {
break;
}
s << " <element>" << _symbols[n] << "<wt>"
<< _weights[n] << "</wt></element>" << endl;
}
s << "</known_elements>" << endl;
}
}
}

View file

@ -1,634 +0,0 @@
/**
* @file ck2ct.cpp
* Convert CK-format reaction mechanism files to Cantera input format.
*/
#include <iostream>
#include <string>
#include <ctype.h>
#include "cantera/base/config.h"
#include <sstream>
using namespace std;
#include "CKReader.h"
#include "Reaction.h"
#include "writelog.h"
#include "ck2ct.h"
#include "cantera/base/stringUtils.h"
#include <time.h>
#include "cantera/base/ct_defs.h"
#include "cantera/base/ctml.h"
using namespace Cantera;
namespace pip
{
struct trdata {
int geom;
doublereal welldepth, diam, dipole, polar, rot;
};
static map<string, trdata> _trmap;
static bool _with_transport = false;
static void getTransportData(string trfile)
{
_with_transport = true;
ifstream s(trfile.c_str());
if (!s) throw CanteraError("getTransportData",
"could not open transport database "+trfile);
/*
* The first thing we will do is to read the entire transport
* database and place its contents into a map structure,
* indexed by the name of the species.
*/
string rest;
while (! s.eof()) {
/*
* Read a line from the file
*
* SOLARIS 10 NOTES: Optimized version of solaris seg faults
* without the '\n' argument for some reason, probably
* an internal solaris stl bug.
*/
getline(s, rest,'\n');
/*
* In the transport database, we allow comment lines that
* consist of '#' and '!' as the first character in the
* in the line. We also don't bother to parse short lines that
* can't possibly have enough data in them to comprise a
* properly formatted record.
*/
if (rest.size() > 5 && rest[0] != '#' && rest[0] != '!') {
/*
* copy the string into a stringstream and parse the line
* into the trdata object
*/
std::istringstream ioline(rest);
trdata t;
string nm;
ioline >> nm >> t.geom >> t.welldepth >> t.diam
>> t.dipole >> t.polar >> t.rot;
/*
* Add the trdata object into the map database by making a
* copy of it, and index it by the species name.
*/
if (nm != "") {
_trmap[nm] = t; // t.name] = t;
}
}
}
}
// add a NASA polynomial parameterization
static void addNASA(FILE* f,
const vector_fp& low, const vector_fp& high,
doublereal minx, doublereal midx,
doublereal maxx)
{
fprintf(f," thermo = (\n");
fprintf(f," NASA( [%8.2f, %8.2f], ", minx, midx);
fprintf(f,"[%17.9E, %17.9E, \n", low[0], low[1]);
fprintf(f," %17.9E, %17.9E, %17.9E,\n",
low[2], low[3], low[4]);
fprintf(f," %17.9E, %17.9E] ),\n", low[5], low[6]);
fprintf(f," NASA( [%8.2f, %8.2f], ", midx, maxx);
fprintf(f,"[%17.9E, %17.9E, \n", high[0], high[1]);
fprintf(f," %17.9E, %17.9E, %17.9E,\n",
high[2], high[3], high[4]);
fprintf(f," %17.9E, %17.9E] )\n", high[5], high[6]);
fprintf(f," )");
}
//! Add a NASA polynomial parameterization to the cti file
/*!
* This little tidbit of code writes out the polynomials to the cti file
*/
static void addNASA9(FILE* f,
const std::vector<vector_fp*> &region_coeffs,
const vector_fp& minTemps, const vector_fp& maxTemps)
{
size_t nReg = region_coeffs.size();
if (minTemps.size() != nReg) {
throw CanteraError("addNASA9", "incompat");
}
if (maxTemps.size() != nReg) {
throw CanteraError("addNASA9", "incompat");
}
fprintf(f," thermo = (\n");
for (size_t i = 0; i < nReg; i++) {
double minT = minTemps[i];
double maxT = maxTemps[i];
const vector_fp& coeffs = *(region_coeffs[i]);
if ((int) coeffs.size() != 9) {
throw CanteraError("addNASA9", "incompat");
}
fprintf(f," NASA9( [%8.2f, %8.2f], ", minT, maxT);
fprintf(f,"[%17.9E, %17.9E, %17.9E,\n", coeffs[0],
coeffs[1], coeffs[2]);
fprintf(f," %17.9E, %17.9E, %17.9E,\n",
coeffs[3], coeffs[4], coeffs[5]);
fprintf(f," %17.9E, %17.9E, %17.9E] )",
coeffs[6], coeffs[7], coeffs[8]);
if (i < nReg - 1) {
fprintf(f,",\n");
} else {
fprintf(f,"\n");
}
}
fprintf(f," )");
}
static void addTransportParams(FILE* f, string name)
{
trdata td;
if (_with_transport && _trmap.find(name) != _trmap.end()) {
td = _trmap[name];
} else {
throw CanteraError("addTransportParams",
"no transport data for species "+name);
}
fprintf(f,",\n transport = gas_transport(\n");
int geom = td.geom;
switch (geom) {
case 0:
fprintf(f," geom = \"atom\",\n");
break;
case 1:
fprintf(f," geom = \"linear\",\n");
break;
case 2:
fprintf(f," geom = \"nonlinear\",\n");
break;
default:
throw CanteraError("addTransportParams",
"Unrecognized geometry flag for species " + name);
}
fprintf(f," diam = %g,\n",td.diam);
fprintf(f," well_depth = %g",td.welldepth);
if (td.polar != 0.0) {
fprintf(f,",\n polar = %g",td.polar);
}
if (td.dipole != 0.0) {
fprintf(f,",\n dipole = %g",td.dipole);
}
if (td.rot != 0.0) {
fprintf(f,",\n rot_relax = %g",td.rot);
}
fprintf(f,")");
}
static void addFalloff(FILE* f, string type,
const vector_fp& params)
{
if (type == "Troe") {
fprintf(f, "%s", (",\n falloff = Troe(A = " +
fp2str(params[0]) + ", T3 = " +
fp2str(params[1]) + ", T1 = " +
fp2str(params[2])).c_str());
if (params.size() >= 4) {
fprintf(f, "%s", (", T2 = " + fp2str(params[3])).c_str());
}
fprintf(f, ")");
} else if (type == "SRI") {
fprintf(f, "%s", (",\n falloff = SRI(A = " +
fp2str(params[0]) + ", B = " +
fp2str(params[1]) + ", C = " +
fp2str(params[2])).c_str());
if (params.size() >= 5) {
fprintf(f, "%s", (", D = " + fp2str(params[3]) +
", E = " + fp2str(params[4])).c_str());
}
fprintf(f, ")");
}
}
/**
* Write out a species cti block to the output file.
*
*/
static void addSpecies(FILE* f, string idtag, const ckr::Species& sp)
{
string spname = sp.name;
if (spname.size() == 0) {
throw CanteraError("addSpecies",
"Species name is empty");
}
fprintf(f,"\nspecies(name = \"%s\",\n",spname.c_str());
int nel = static_cast<int>(sp.elements.size());
int m, num;
string nm, str="";
for (m = 0; m < nel; m++) {
/*
* Copy the element name into the string, nm. Lower case the
* second letter, if needed.
*/
nm = sp.elements[m].name;
nm[0] = (char) toupper(nm[0]);
if (nm.size() == 2) {
nm[1] = (char) tolower(nm[1]);
}
/*
* Obtain the current number of atoms in the species.
* Linearize the number (HKM question? can we employ real values here
* instead?)
*/
num = int(sp.elements[m].number);
/*
* Add the name and number to end of the string, str
*/
str += " "+nm+":"+int2str(num)+" ";
}
fprintf(f," atoms = \"%s\",\n", str.c_str());
// Add the NASA block according to the thermoFormatType value
if (sp.thermoFormatType == 0) {
if (sp.lowCoeffs.size() == 0) {
throw CanteraError("addSpecies",
"Low Nasa Thermo Polynomial was not found");
}
if (sp.highCoeffs.size() == 0) {
throw CanteraError("addSpecies",
"High Nasa Thermo Polynomial was not found");
}
if (sp.tlow >= sp.thigh) {
throw CanteraError("addSpecies",
"Low temp limit is greater or equal to high temp limit");
}
addNASA(f, sp.lowCoeffs, sp.highCoeffs,
sp.tlow, sp.tmid, sp.thigh);
} else if (sp.thermoFormatType == 1) {
// This new typs is a multiregion 9 coefficient formulation
addNASA9(f, sp.region_coeffs, sp.minTemps, sp.maxTemps);
} else {
throw CanteraError("addSpecies", "Unknown thermoFormatType");
}
if (_with_transport) {
addTransportParams(f, sp.name);
}
if (sp.id != "" || sp.m_commentsRef != "") {
fprintf(f,",\n note = \"");
if (sp.id != "") {
fprintf(f, "%s", sp.id.c_str());
}
if (sp.m_commentsRef != "") {
fprintf(f, " %s", sp.m_commentsRef.c_str());
}
fprintf(f, "\"");
}
fprintf(f,"\n )\n");
}
static void addReaction(FILE* f, string idtag, int i,
const ckr::Reaction& rxn,
const ckr::ReactionUnits& runits, doublereal version)
{
fprintf(f, "%s", ("\n# Reaction " + int2str(i+1) + "\n").c_str());
int nc = static_cast<int>(rxn.comment.size());
vector<string> options;
for (int nn = 0; nn < nc; nn++)
if (rxn.comment[nn] != "") fprintf(f, "# %s \n",
rxn.comment[nn].c_str());
string eqn = ckr::reactionEquation(rxn);
if (rxn.isThreeBodyRxn) {
fprintf(f, "three_body_reaction( \"%s\",", eqn.c_str());
} else if (rxn.isFalloffRxn) {
fprintf(f, "falloff_reaction( \"%s\",", eqn.c_str());
} else {
fprintf(f, "reaction( \"%s\",", eqn.c_str());
}
if (rxn.isFalloffRxn) {
if (rxn.kf.type == ckr::Arrhenius) {
fprintf(f,"\n kf = [%10.5E, %g, %g]", rxn.kf.A, rxn.kf.n, rxn.kf.E);
}
if (rxn.kf_aux.type == ckr::Arrhenius) {
fprintf(f,",\n kf0 = [%10.5E, %g, %g]", rxn.kf_aux.A, rxn.kf_aux.n, rxn.kf_aux.E);
}
if (rxn.falloffType == ckr::Lindemann) {
addFalloff(f, "Lindemann",rxn.falloffParameters);
} else if (rxn.falloffType == ckr::Troe) {
addFalloff(f, "Troe",rxn.falloffParameters);
} else if (rxn.falloffType == ckr::SRI) {
addFalloff(f, "SRI",rxn.falloffParameters);
} else {
throw CanteraError("addReaction","unknown falloff type");
}
} else {
if (rxn.kf.type == ckr::Arrhenius) {
fprintf(f," [%10.5E, %g, %g]", rxn.kf.A, rxn.kf.n, rxn.kf.E);
} else {
throw CanteraError("addReaction",
"unknown kf_type to reaction: " + int2str(rxn.kf.type));
}
}
// reaction orders
int nord = static_cast<int>(rxn.fwdOrder.size());
if (nord > 0) {
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>") {
if (rxn.thirdBody != "M") {
;
} else if (ne > 0.0) {
map<string, double>::const_iterator b = rxn.e3b.begin(),
e = rxn.e3b.end();
string estr = "";
for (; b != e; ++b) {
estr += " "+b->first+":"+fp2str(b->second)+" ";
}
fprintf(f, ",\n efficiencies = \"%s\"", estr.c_str());
}
}
if (rxn.kf.A <= 0.0) {
options.push_back("negative_A");
}
if (rxn.isDuplicate) {
options.push_back("duplicate");
}
size_t nopt = options.size();
if (nopt > 0) {
fprintf(f, ",\n options = [");
for (size_t n = 0; n < nopt; n++) {
fprintf(f, "\"%s\"", options[n].c_str());
if (n < nopt-1) {
fprintf(f, ", ");
}
}
fprintf(f, "]");
}
fprintf(f, ")\n");
}
void writeline(FILE* f)
{
fprintf(f, "#-------------------------------------------------------------------------------\n");
}
/*!
* This routine is the main routine.
*
* @param r reference to a ckreader object that has already
* read a chemkin formatted mechanism. This is the input to the routine.
*
* @param root Reference to the root node of an XML description of the
* mechanism. The node will be filled up with the description
* of the mechanism. This is the output to the routine.
*/
void ck2ct(FILE* f, string idtag, ckr::CKReader& r, bool hastransport)
{
popError();
doublereal version = 1.0;
fprintf(f, "units(length = \"cm\", time = \"s\", quantity = \"mol\", ");
string e_unit = " ";
int eunit = r.units.ActEnergy;
if (eunit == ckr::Cal_per_Mole) {
e_unit = "cal/mol";
} else if (eunit == ckr::Kcal_per_Mole) {
e_unit = "kcal/mol";
} else if (eunit == ckr::Joules_per_Mole) {
e_unit = "J/mol";
} else if (eunit == ckr::Kjoules_per_Mole) {
e_unit = "kJ/mol";
} else if (eunit == ckr::Kelvin) {
e_unit = "K";
} else if (eunit == ckr::Electron_Volts) {
e_unit = "eV";
}
fprintf(f, "act_energy = \"%s\")\n\n", e_unit.c_str());
fprintf(f,"\nideal_gas(name = \"%s\",\n",idtag.c_str());
string enames;
int nel = static_cast<int>(r.elements.size());
int i;
map<string, string> emap;
string elnm;
for (i = 0; i < nel; i++) {
elnm = r.elements[i].name;
elnm[0] = (char) toupper(elnm[0]);
if (elnm.size() == 2) {
elnm[1] = (char) tolower(elnm[1]);
}
emap[r.elements[i].name] = elnm;
enames += " "+elnm+" ";
}
fprintf(f," elements = \"%s\",\n",enames.c_str());
string spnames = "";
int nsp = static_cast<int>(r.species.size());
for (i = 0; i < nsp; i++) {
spnames += " "+r.species[i].name+" ";
if ((i+1) % 10 == 0) {
spnames += "\n ";
}
}
fprintf(f," species = \"\"\"%s\"\"\",\n", spnames.c_str());
fprintf(f," reactions = \"all\",\n");
if (hastransport) {
fprintf(f," transport = \"Mix\",\n");
}
fprintf(f," initial_state = state(temperature = 300.0,\n");
fprintf(f," pressure = OneAtm)");
fprintf(f, " )\n");
fprintf(f, "\n\n\n");
writeline(f);
fprintf(f, "# Species data \n");
writeline(f);
for (i = 0; i < nsp; i++) {
addSpecies(f, idtag, r.species[i]);
}
fprintf(f, "\n\n\n");
writeline(f);
fprintf(f, "# Reaction data \n");
writeline(f);
int nrxns = static_cast<int>(r.reactions.size());
int irxn = 0;
string idktag = idtag;
for (i = 0; i < nrxns; i++) {
// if krev.A is non-zero, then the reverse rate coefficient is
// being explicitly specified rather than being computed from
// thermochemistry. In this case, convert the reaction into
// two irreversible reactions.
if (r.reactions[i].krev.A != 0.0) {
fprintf(f, "\n# [CK Reaction (+%d)]\n",i+1);
addReaction(f, idktag, irxn,
ckr::forwardReaction(r.reactions[i]), r.units, version);
irxn++;
fprintf(f, "# [CK Reaction (-%d)]\n",i+1);
addReaction(f, idktag, irxn,
ckr::reverseReaction(r.reactions[i]), r.units, version);
irxn++;
}
// Otherwise, just add the whole reaction, which may or may
// not be reversible.
else {
if (i != irxn) {
fprintf(f, "\n# [CK Reaction (%d)]\n",i+1);
}
addReaction(f, idktag, irxn, r.reactions[i],
r.units, version);
irxn++;
}
}
}
/*
static int fixtext(string infile, string outfile) {
ifstream fin(infile.c_str());
ofstream fout(outfile.c_str());
if (!fout) {
throw CanteraError("fixtext","could not open "+outfile+" for writing.");
}
char ch;
char last_eol = ' ';
const char char10 = char(10);
const char char13 = char(13);
string line;
while (1 > 0) {
line = "";
while (1 > 0) {
fin.get(ch);
if (fin.eof()) break;
if (ch == char13 || (ch == char10
&& (last_eol != char13))) {
last_eol = ch;
break;
}
if (isprint(ch)) line += ch;
}
fout << line << endl;
if (fin.eof()) break;
}
fin.close();
fout.close();
return 0;
}
*/
int convert_ck(const char* in_file, const char* db_file,
const char* tr_file, const char* id_tag, bool debug, bool validate)
{
ckr::CKReader r;
r.validate = validate;
r.debug = debug;
//int i=1;
string infile = string(in_file);
string dbfile = string(db_file);
string trfile = string(tr_file);
//string outfile = string(out_file);
string idtag = string(id_tag);
string logfile;
if (dbfile == "-") {
dbfile = "";
}
if (trfile == "-") {
trfile = "";
}
string::size_type idot = infile.rfind('.');
string ctifile, ext;
if (idot != string::npos) {
ext = infile.substr(idot, infile.size());
ctifile = infile.substr(0,idot)+".cti";
} else {
ctifile = infile+".cti";
}
FILE* f = fopen(ctifile.c_str(),"w");
struct tm* newtime;
time_t aclock;
::time(&aclock); /* Get time in seconds */
newtime = localtime(&aclock); /* Convert time to struct tm form */
try {
//string tmpinfile = tmpDir()+
//fixtext(infile, tmpinfile);
//string tmpdbfile = "";
//string tmptrfile = "";
//if (dbfile != "") {
// tmpdbfile = tmpDir()+"/.tmp_"+dbfile;
// fixtext(dbfile, tmpdbfile);
//}
//if (trfile != "") {
// tmptrfile = tmpDir()+"/.tmp_"+trfile;
// fixtext(trfile, tmptrfile);
//}
logfile = "ck2cti.log";
if (!r.read(infile, dbfile, logfile)) {
throw CanteraError("convert_ck",
"error encountered in input file " + string(infile)
+ "\nsee file ck2cti.log for more information.\n");
}
fprintf(f, "#\n");
fprintf(f, "# Generated from file %s\n# by ck2cti on %s#\n",
infile.c_str(), asctime(newtime));
if (trfile != "") {
fprintf(f, "# Transport data from file %s.\n\n",
trfile.c_str());
getTransportData(trfile);
}
bool hastransport = (trfile != "");
ck2ct(f, idtag, r, hastransport);
} catch (CanteraError& err) {
err.save();
fclose(f);
return -1;
}
fclose(f);
return 0;
}
}

View file

@ -1,26 +0,0 @@
#ifndef CT_CK2CT_H
#define CT_CK2CT_H
#include <iostream>
#include <string>
#include <cstdlib>
//#include "cantera/base/ctml.h"
namespace ckr
{
class CKReader;
}
namespace pip
{
void ck2ct(std::string idtag, ckr::CKReader& r);
int convert_ck(const char* in_file, const char* db_file,
const char* tr_file, const char* id_tag, bool debug, bool validate);
}
#endif

View file

@ -1,96 +0,0 @@
/**
* @file ckr_defs.h
*
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_DEFS_H
#define CKR_DEFS_H
//#include "cantera/base/config.h"
#include <string>
#include <iostream>
#include <vector>
/// the namespace for the CKReader packaage
namespace ckr
{
typedef std::vector<double> vector_fp;
typedef std::vector<double> vector_int;
// exceptions
class CK_Exception
{
public:
CK_Exception() {
m_msg = "";
}
virtual ~CK_Exception() {}
std::string errorMessage() {
return m_msg;
}
protected:
std::string m_msg;
};
const double UNDEF = -9999.1234;
/**
* @name Falloff Parameterizations
* These constants are used to specify which falloff parameterization
* to use for a pressure-dependent reaction.
* @see Reaction.h
*/
//@{
const int Lindemann = 0;
const int Troe = 1;
const int SRI = 2;
//@}
/** @name Reaction Rate Types
* These constant are used to specify the type of rate coefficient
*/
//@{
const int Arrhenius = 0, LandauTeller = 1, Jan = 2, Fit1 = 3;
//@}
/** @name Activation Energy Units
* These constants specify the supported units for the activation energy of
* a reaction
* The default is to assume Cal_per_Mole for unspecified units in the activation energy
* as this was the original default
*/
//@{
const int Cal_per_Mole = 1,
Kcal_per_Mole = 2,
Joules_per_Mole = 3,
Kelvin= 4,
Electron_Volts = 5,
Kjoules_per_Mole = 6;
//@}
/**
* @name Quantity Units
* These constants define the supported units for number of molecules.
*/
//@{
const int Moles = 100; ///< specify number of moles (6.023e23 molecules / mole)
const int Molecules = 101; ///< specify number of molecules
//@}
} // namespace
#endif

View file

@ -1,167 +0,0 @@
/**
* @file ckr_utils.cpp
*
*/
// Copyright 2001 California Institute of Technology
#include <ctype.h>
#include <math.h>
#include "ckr_utils.h"
#include <string.h>
using namespace std;
namespace ckr
{
bool match(const std::string& s1, const std::string& s2)
{
size_t n = s2.size();
if (s1.size() < n) {
return false;
}
for (size_t i = 0; i < n; i++)
if (s2[i] != '*' && (toupper(s1[i]) != toupper(s2[i]))) {
return false;
}
return true;
}
void removeWhiteSpace(std::string& s)
{
string r;
int ssize = static_cast<int>(s.size());
for (int n = 0; n < ssize; n++) if (s[n] != ' '
&& s[n] != '\t' && s[n] != '\n') {
r += s[n];
}
s = r;
}
/**
* Get tokens from char array of length n beginning at 'begin'. Tokens are
* delimited by character 'delim' (space by default), with the exception of
* text contained within forward slashes ('/'), which is treated literally.
*
* code
* vector<string> tokens;
* char line[] = "a b/3.0 txt/ c /4.0 6/ d";
* int n = strlen(line);
* getTokens(line, n, tokens);
* for (int i = 0; i < tokens.size(); i++) cout << tokens[i] << endl;
* endcode
*
*/
void getTokens(std::string& s, int n, std::vector<std::string>& toks, char delim)
{
string::iterator q, p = s.begin(), end = p + n;
vector<string> tokk;
int inslash = -1;
//p = begin;
while (1 > 0) {
for (; p < end; p++) {
if (*p != delim) {
break;
}
}
q = p;
for (; q < end; q++) {
if (*q == '/') {
inslash *= -1;
}
if (inslash < 0 && *q == delim) {
break;
}
}
if (p != q) {
tokk.push_back(s.substr(p - s.begin(), q - p));
}
p = q;
if (p == end) {
break;
}
}
toks.clear();
int nt = static_cast<int>(tokk.size());
string t = "";
for (int i = 0; i < nt; i++) {
if (tokk[i][0] == '/') {
t += tokk[i];
} else {
if (t != "") {
toks.push_back(t);
}
t = tokk[i];
}
}
if (t != "") {
toks.push_back(t);
}
}
/**
* Look for a slash-delimited number in string s,
* and if found set v to the numerical value, and
* set s to the portion of the string before the
* first slash. Return true if slash data found,
* false otherwise.
*/
bool extractSlashData(std::string& s, std::string& name, std::string& data)
{
int slen = static_cast<int>(s.size());
string::size_type n = s.find_first_of("/");
if (n != string::npos && (static_cast<int>(n) < slen)) {
int m;
for (m = static_cast<int>(n)+1; m < slen; m++) if (s[m] == '/') {
break;
}
if (m < slen) {
data = s.substr(n+1,m-n-1);
name = s.substr(0,n);
removeWhiteSpace(name);
s = s.substr(m+1,1000);
return true;
} else {
name = s;
removeWhiteSpace(name);
data = "";
s = "";
return false;
}
} else {
name = s;
removeWhiteSpace(name);
data = "";
s = "";
return false;
}
}
/**
* Return a modified version of string word, in which
* the first letter is upper case, and the rest are
* lower case.
*/
string capitalize(const std::string& word)
{
string cap = word;
int n = static_cast<int>(word.size());
if (n > 0) {
cap[0] = (char) toupper(word[0]);
for (int m = 1; m < n; m++) {
cap[m] = (char) tolower(word[m]);
}
}
return cap;
}
}

View file

@ -1,163 +0,0 @@
/**
* @file ckr_utils.h
*
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_UTILS_H
#define CKR_UTILS_H
#include <math.h>
#include <string>
#include <map>
#include <vector>
namespace ckr
{
/**
* Fill vector 'keys' with the keys of map 'mp'
*/
template<class K, class V>
void getMapKeys(const std::map<K,V>& mp, std::vector<K>& keys)
{
keys.clear();
typename std::map<K,V>::const_iterator i = mp.begin();
for (; i != mp.end(); ++i) {
keys.push_back(i->first);
}
}
/**
* Fill vector 'values' with the values of map 'mp'
*/
template<class K, class V>
void getMapValues(const std::map<K,V>& mp, std::vector<V>& values)
{
values.clear();
typename std::map<K,V>::const_iterator i = mp.begin();
for (; i != mp.end(); ++i) {
values.push_back(i->second);
}
}
/**
*
* Template to compare two objects a and b, possibly of different
* types, and return the greater of the two, converted to the type of
* a. The '<' operator is used for the comparison, and must be
* defined for the two types in question.
*
*/
template<class T, class S>
inline T max(T a, S b)
{
return (a < b ? b : a);
}
/**
*
* Template to compare two objects a and b, possibly of different
* types, and * return the lesser of the two, converted to the type
* of a. The '<' operator is used for the comparison, and must be
* defined for the two types in question.
*
*/
template<class T, class S>
inline T min(T a, S b)
{
return (a < b ? a : b);
}
/**
* Template to return a string equal to s, but padded with spaces on
* the right as necessary to make the length n.
*/
template<class S>
inline S pad(const S& s, size_t n)
{
S output;
output.resize(max(n,s.size()),' ');
copy(s.begin(), s.end(), output.begin());
return output;
}
/// Absolute value.
template<class T>
inline T absval(T x)
{
if (x < 0) {
return -x;
}
return x;
}
/**
*
* Iterate through a list of objects that have a numeric member named
* 'valid', and return false if for any object this attribute is not
* greater than 0. Otherwise return true.
*
*/
template<class L>
inline bool valid(L& list)
{
size_t i;
for (i=0; i < list.size(); i++) if (list[i].valid <= 0) {
return false;
}
return true;
}
/// Remove all white space from string s.
void removeWhiteSpace(std::string& s);
void getTokens(std::string& begin,
int n, std::vector<std::string>& toks, char delim=' ');
/**
* Perform a case-insensitive comparison of the first n2 characters
* of strings s1 and s2, where n2 is the length of s2. Typically, s1
* is an unknown string and s2 is the significant portion of a
* keyword. Returns true if a match is found, false otherwise. An asterisk
* in string s2 matches any character at that position.
*
* Example: if s1 = "elements", then match(s1, "ELEM") would return true.
*/
bool match(const std::string& s1, const std::string& s2);
/**
* Check whether string 'word' begins with a Chemkin keyword.
*/
inline bool isKeyword(std::string word)
{
return (match(word, "ELEM") ||
match(word, "SPEC") ||
match(word, "THERM") ||
match(word, "REAC") ||
match(word, "END"));
}
bool extractSlashData(std::string& s, std::string& name, std::string& data);
std::string capitalize(const std::string& word);
}
#endif

View file

@ -1,12 +0,0 @@
Currently, we will branch off of the therm keyword's argument list:
The default is to assume the old thermo file format:
therm NASA
therm
The new file format is signaled by the following line
therm NASA9

View file

@ -1,146 +0,0 @@
/**
* @file thermoFunctions.cpp
* File containing thermo evaluation functions for NASA polynomials,
* which are used in testing the interpolations.
*/
// Copyright 2001 California Institute of Technology
#include <math.h>
#include "thermoFunctions.h"
#include <iostream>
using namespace std;
namespace ckr
{
/**
* non-dimensional heat capacity (\f$ C_p/R \f$) at constant P for
* one species @param t temperature @param s species object
*/
double cp(double t, const Species& s)
{
if (s.thermoFormatType == 1) {
const vector_fp* cpc;
int ireg = -1;
for (int i = 0; i < s.nTempRegions; i++) {
if (t <= s.maxTemps[i]) {
ireg = i;
break;
}
}
cpc = s.region_coeffs[ireg];
const vector_fp& c = *cpc;
double cp0r = c[0]/(t*t) + c[1]/t + c[2] + c[3]*t + c[4]*t*t
+ c[5]*t*t*t + c[6]*t*t*t*t;
return cp0r;
}
const vector_fp* cpc;
if (t > s.tmid) {
cpc = &s.highCoeffs;
} else {
cpc = &s.lowCoeffs;
}
const vector_fp& c = *cpc;
double cp0r = c[0] + c[1]*t + c[2]*t*t + c[3]*t*t*t + c[4]*t*t*t*t;
return cp0r;
}
/**
* enthalpy in Kelvin (\f$ H/R \f$) for
* one species. @param t temperature @param s species object
*/
double enthalpy(double t, const Species& s)
{
if (s.thermoFormatType == 1) {
const vector_fp* cpc;
int ireg = -1;
for (int i = 0; i < s.nTempRegions; i++) {
if (t <= s.maxTemps[i]) {
ireg = i;
break;
}
}
cpc = s.region_coeffs[ireg];
const vector_fp& c = *cpc;
double h0rt = -c[0]/(t*t) + c[1]*log(t)/t
+ c[2] + 0.5*c[3]*t + c[4]*t*t/3.0 + 0.25*c[5]*t*t*t
+ 0.2*c[6]*t*t*t*t + c[7]/t;
return t*h0rt;
}
const vector_fp* cp;
if (t > s.tmid) {
cp = &s.highCoeffs;
} else {
cp = &s.lowCoeffs;
}
const vector_fp& c = *cp;
double h0rt = c[0] + 0.5*c[1]*t + c[2]*t*t/3.0 + 0.25*c[3]*t*t*t
+ 0.2*c[4]*t*t*t*t + c[5]/t;
return t*h0rt;
}
/**
* non-dimensional entropy (\f$ S/R \f$) for
* one species @param t temperature @param s species object
*/
double entropy(double t, const Species& s)
{
if (s.thermoFormatType == 1) {
const vector_fp* cpc;
int ireg = -1;
for (int i = 0; i < s.nTempRegions; i++) {
if (t <= s.maxTemps[i]) {
ireg = i;
break;
}
}
cpc = s.region_coeffs[ireg];
const vector_fp& c = *cpc;
double s0r = -0.5*c[0]/(t*t) - c[1]/t
+ c[2]*log(t) + c[3]*t + 0.5*c[4]*t*t + c[5]*t*t*t/3.0
+ 0.25*c[6]*t*t*t*t + c[8];
return t*s0r;
}
const vector_fp* cp;
if (t > s.tmid) {
cp = &s.highCoeffs;
} else {
cp = &s.lowCoeffs;
}
const vector_fp& c = *cp;
double s0r = c[0]*log(t) + c[1]*t + 0.5*c[2]*t*t + c[3]*t*t*t/3.0
+ 0.25*c[4]*t*t*t*t + c[6];
return t*s0r;
}
/**
* Gibbs function in Kelvin (\f$ G/R \f$) for
* one species. @param t temperature @param s species object
*/
double gibbs(double t, const Species& s)
{
if (s.thermoFormatType == 1) {
double s0r = entropy(t, s);
double h0r = enthalpy(t, s);
return (h0r - s0r * t);
}
const vector_fp* cp;
if (t > s.tmid) {
cp = &s.highCoeffs;
} else {
cp = &s.lowCoeffs;
}
const vector_fp& c = *cp;
double h0rt = c[0] + 0.5*c[1]*t + c[2]*t*t/3.0 + 0.25*c[3]*t*t*t
+ 0.2*c[4]*t*t*t*t + c[5]/t;
double s0r = c[0]*log(t) + c[1]*t + 0.5*c[2]*t*t + c[3]*t*t*t/3.0
+ 0.25*c[4]*t*t*t*t + c[6];
return t*(h0rt - s0r);
}
}

View file

@ -1,26 +0,0 @@
/**
* @file thermoFunctions.h
*
* Thermodynamic properties. Note that these functions are used only
* for validation purposes by CKReader. They are not used by Cantera.
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_THERMOFUNCTIONS_H
#define CKR_THERMOFUNCTIONS_H
#include "Species.h"
namespace ckr
{
double enthalpy(double t, const Species& s);
double cp(double t, const Species& s);
double entropy(double t, const Species& s);
double gibbs(double t, const Species& s);
}
#endif

View file

@ -1,282 +0,0 @@
/**
* @file converters/writelog.cpp
*
*/
// Copyright 2001 California Institute of Technology
#include <cstdio>
#include "writelog.h"
using namespace std;
namespace ckr
{
/// format a string for the log file message printed when starting a new task
string newTask(std::string msg)
{
string s = "\n";
s += msg + "...\n";
return s;
}
/// print the falloff parameters for a pressure-dependent reaction
bool writeFalloff(int type, const vector_fp& c, std::ostream& log)
{
log.precision(6);
log.width(0);
log.flags(ios::uppercase);
// bool ok = true;
switch (type) {
case Lindemann:
log << " Lindemann falloff function" << endl;
return true;
case Troe:
log << " Troe falloff function: " << endl;
if (c.size() == 3) {
log << " alpha, T***, T* = (" << c[0] << ", " << c[1]
<< ", " << c[2] << ")" << endl;
} else if (c.size() == 4) {
log << " alpha, T***, T*, T** = (" << c[0] << ", " << c[1]
<< ", " << c[2] << ", " << c[3] << ")" << endl;
} else {
for (size_t n = 0; n < c.size(); n++) {
log << c[n] << ", ";
log << endl;
}
log << "###### ERROR ##### incorrect number of parameters" << endl;
return false;
}
return true;
case SRI:
log << " SRI falloff function: " << endl;
if (c.size() == 3) {
log << " a, b, c = (" << c[0] << ", " << c[1]
<< ", " << c[2] << ")" << endl;
} else if (c.size() == 5) {
log << " a, b, c, d, e = (" << c[0] << ", " << c[1]
<< ", " << c[2] << ", " << c[3] << ", " << c[4]
<< ")" << endl;
} else {
for (size_t n = 0; n < c.size(); n++) {
log << c[n] << ", ";
log << endl;
}
log << "##### ERROR ##### incorrect number of parameters" << endl;
return false;
}
return true;
default:
log << "unknown falloff type: " << type << endl;
return false;
}
}
/// print the rate coefficient parameters
bool writeRateCoeff(const RateCoeff& k, std::ostream& log)
{
log.precision(10);
log.width(0);
log.flags(ios::uppercase);
bool ok = true;
size_t nb;
switch (k.type) {
case Arrhenius:
log <<" A, n, E = (" << k.A << ", " << k.n
<< ", " << k.E << ")" << endl;
break;
case LandauTeller:
log << "A, n, E, B, C = (" << k.A << ", " << k.n
<< ", " << k.E << ", " << k.B << ", " << k.C
<< ") *** Landau-Teller ***" << endl;
break;
case Jan:
log <<" A, n, E = (" << k.A << ", " << k.n
<< ", " << k.E << ") *** JAN *** " << endl;
nb = k.b.size();
for (size_t n = 0; n < nb; n++) {
log << " b" << n+1 << ": " << k.b[n] << endl;
}
if (nb != 9) log
<< "warning: number of b coefficients should be 9."
<< endl;
break;
case Fit1:
log <<" A, n, E = (" << k.A << ", " << k.n
<< ", " << k.E << ") *** FIT1 *** " << endl;
nb = k.b.size();
for (size_t n = 0; n < nb; n++) {
log << " b" << n+1 << ": " << k.b[n] << endl;
}
if (nb != 9) log
<< "warning: number of b coefficients should be 4."
<< endl;
break;
default:
log << "unknown rate coefficient type: " << k.type << endl;
ok = false;
}
return ok;
}
/**
* Write onto an output stream the chemical equation for a reaction.
*/
void printReactionEquation(std::ostream& f, const Reaction& r)
{
// r.write(f);
f << reactionEquation(r);
}
/**
* Write to a string the chemical equation for a reaction.
*/
string reactionEquation(const Reaction& r)
{
string s = "";
int nr = static_cast<int>(r.reactants.size());
int np = static_cast<int>(r.products.size());
int k;
double m;
char buf[20];
for (k = 0; k < nr; k++) {
m = r.reactants[k].number;
if (m != 1.0) {
sprintf(buf,"%g",m);
s += string(buf);
s += " ";
}
s += r.reactants[k].name;
if (k < nr - 1) {
s += " + ";
}
}
if (r.isFalloffRxn) {
s += " (+ " + r.thirdBody + ")";
} else if (r.isThreeBodyRxn) {
s += " + " + r.thirdBody;
}
if (r.isReversible) {
s += " <=> ";
} else {
s += " => ";
}
for (k = 0; k < np; k++) {
m = r.products[k].number;
if (m != 1.0) {
sprintf(buf,"%g",m);
s += string(buf);
s += " ";
}
s += r.products[k].name;
if (k < np - 1) {
s += " + ";
}
}
if (r.isFalloffRxn) {
s += " (+ " + r.thirdBody + ")";
} else if (r.isThreeBodyRxn) {
s += " + " + r.thirdBody;
}
return s;
}
/**
*
* Write a summary of the properties of one species to the log file.
* @param log log file output stream
* @param spec instance of Species class
*/
void writeSpeciesData(std::ostream& log, const Species& spec)
{
if (!spec.id.empty()) {
log << endl << " id/date: " << spec.id << endl;
} else {
log << " ... " << endl;
}
log << " phase: "
<< spec.phase << endl
<< " composition: (";
for (size_t ie = 0; ie < spec.elements.size(); ie++) {
if (!spec.elements[ie].name.empty()) {
log.flags(ios::fixed);
log.precision(0);
if (ie > 0) {
log << ", ";
}
log << spec.elements[ie].number << " "
<< spec.elements[ie].name;
}
}
log << ")";
if (spec.thermoFormatType == 0) {
log.flags(ios::showpoint | ios::fixed);
log.precision(2);
log << endl << " Tlow, Tmid, Thigh: (" << spec.tlow << ", " <<
spec.tmid << ", " << spec.thigh << ")" << endl << endl;
log << " coefficients (low, high):" << endl;
log.flags(ios::scientific | ios::uppercase | ios::internal);
log.precision(8);
for (int j = 0; j < 7; j++) {
log << " a" << j + 1;
log.setf(ios::showpos);
log << " \t" << spec.lowCoeffs[j]
<< " \t" << spec.highCoeffs[j] << endl;
log.unsetf(ios::showpos);
}
log << endl;
} else if (spec.thermoFormatType == 1) {
log.flags(ios::showpoint | ios::fixed);
log.precision(2);
log << endl;
log << "Number of temp regions = " << spec.nTempRegions << endl;
for (int i = 0; i < spec.nTempRegions; i++) {
log << " Tlow, Thigh: (" << spec.minTemps[i] << ", "
<< spec.maxTemps[i] << ")" << endl << endl;
log << " coefficients :" << endl;
log.flags(ios::scientific | ios::uppercase | ios::internal);
log.precision(8);
vector_fp& cc = *spec.region_coeffs[i];
for (int j = 0; j < 9; j++) {
log << " a" << j + 1;
log.setf(ios::showpos);
log << " \t" << cc[j] << endl;
log.unsetf(ios::showpos);
}
log << endl;
}
}
}
}

View file

@ -1,30 +0,0 @@
/**
* @file writelog.h
*
*/
// Copyright 2001 California Institute of Technology
#ifndef CKR_WRITELOG_H
#define CKR_WRITELOG_H
#include <string>
#include <vector>
#include <iostream>
#include "Species.h"
#include "Reaction.h"
namespace ckr
{
std::string newTask(std::string msg);
bool writeFalloff(int type, const vector_fp& c, std::ostream& log);
bool writeRateCoeff(const RateCoeff& k, std::ostream& log);
void printReactionEquation(std::ostream& f, const Reaction& r);
void writeSpeciesData(std::ostream& log, const Species& spec);
std::string reactionEquation(const Reaction& r);
}
#endif

View file

@ -12,7 +12,7 @@ AM_CXXFLAGS = $(AM_CPPFLAGS)
AM_FCFLAGS = $(AM_CPPFLAGS)
LINK = -luser -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lctcxx -lm -lctf2c -lstdc++
AM_LDFLAGS = -L$(top_builddir)/build/lib/

View file

@ -2,7 +2,6 @@
*_output.txt
*_output.csv
*_output.out
ck2cti.log
ChemEquil_gri_matrix/gri_matrix
ChemEquil_gri_pairs/gri_pairs
ChemEquil_ionizedGas/ionizedGasEquil
@ -39,8 +38,6 @@ cathermo/testIAPWSTripP/testIAPWSTripP
cathermo/testWaterPDSS/testWaterPDSS
cathermo/testWaterTP/testWaterSSTP
cathermo/wtWater/wtWater
ck2cti_test/gri30.cti
ck2cti_test/soot.cti
cxx_ex/cxx_examples
cxx_ex/eq1.csv
cxx_ex/eq1.dat
@ -59,7 +56,6 @@ diamondSurf/runDiamond
fracCoeff/fracCoeff
mixGasTransport/mixGasTransport
multiGasTransport/multiGasTransport
nasa9_reader/sample.cti
negATest/negATest
negATest/noxNeg.xml
printUtilUnitTest/pUtest

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -9,8 +9,6 @@ SUBDIRS += VCSnonideal PecosTransport
#f77test
# skipped (uses ck2cti or python):
# ck2cti_test
# nasa9_reader (uses ck2cti)
# python
# rankine_democxx
# VCSnonideal (unsure of problem)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -luser -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lctcxx -lm -lctf2c -lstdc++
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -4,7 +4,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
#-lctcxx -luser
AM_LDFLAGS = -L$(top_builddir)/build/lib/

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
LIBS = $(LINK)
AM_LDFLAGS = -L$(top_builddir)/build/lib/

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -luser -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lctcxx -lm -lctf2c -lstdc++
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -3,7 +3,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -6,7 +6,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)

View file

@ -5,7 +5,7 @@ AM_CPPFLAGS = $(INC)
AM_CXXFLAGS = $(AM_CPPFLAGS)
LINK = -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lctbase -lcvode
LINK += -lctlapack -lctblas -lctf2c -lm -lctf2c -lstdc++ -lexecstream -pthread
AM_LDFLAGS = -L$(top_builddir)/build/lib/
LIBS = $(LINK)