*** empty log message ***

This commit is contained in:
Dave Goodwin 2004-02-03 03:31:05 +00:00
parent f6ae921137
commit 2e6c5ad2a1
44 changed files with 1575 additions and 1296 deletions

View file

@ -26,7 +26,7 @@ endif
clean:
cd src; @MAKE@ clean
cd cxx; @MAKE@ clean
cd cxx/src; @MAKE@ clean
cd clib/src; @MAKE@ clean
cd python; @MAKE@ clean
ifeq ($(build_f90),1)
@ -38,7 +38,7 @@ endif
depends:
cd src; @MAKE@ depends
cd cxx; @MAKE@ depends
cd cxx/src; @MAKE@ depends
cd clib/src; @MAKE@ depends
ifeq ($(build_f90),1)
cd fortran/src; @MAKE@ depends
@ -49,7 +49,7 @@ endif
install:
cd src; @MAKE@ install
cd cxx; @MAKE@ install
cd cxx/src; @MAKE@ install
cd clib/src; @MAKE@ install
ifeq ($(build_f90),1)
cd fortran/src; @MAKE@ install

View file

@ -31,6 +31,8 @@ inline XML_Node* _xml(int i) {
return Cabinet<XML_Node>::cabinet(false)->item(i);
}
#ifdef INCL_PURE_FLUID
static PureFluid* purefluid(int n) {
ThermoPhase* tp = th(n);
if (tp->eosType() == cPureFluid) {
@ -40,6 +42,11 @@ static PureFluid* purefluid(int n) {
throw CanteraError("purefluid","object is not a PureFluid object");
}
}
#else
static ThermoPhase* purefluid(int n) {
return th(n);
}
#endif
inline int nThermo() {
return Storage::storage()->nThermo();
@ -528,7 +535,6 @@ extern "C" {
purefluid(n)->setState_satVapor();
return 0;
}
//-------------- Kinetics ------------------//

View file

@ -76,6 +76,7 @@ extern "C" {
int DLL_IMPORT th_set_SP(int n, double* vals);
int DLL_IMPORT th_equil(int n, int XY);
#ifdef INCL_PURE_FLUIDS
double DLL_IMPORT th_critTemperature(int n);
double DLL_IMPORT th_critPressure(int n);
double DLL_IMPORT th_critDensity(int n);
@ -83,8 +84,9 @@ extern "C" {
double DLL_IMPORT th_satTemperature(int n, double p);
double DLL_IMPORT th_satPressure(int n, double t);
int DLL_IMPORT th_setState_satLiquid(int n);
int DLL_IMPORT th_setState_satVapor(int n);
int DLL_IMPORT th_setState_satVapor(int n);
#endif
int DLL_IMPORT newKineticsFromXML(int mxml, int iphase,
int neighbor1=-1, int neighbor2=-1, int neighbor3=-1,
int neighbor4=-1);

View file

@ -5,7 +5,7 @@
# if script ctnew is not on the PATH, set this to the path to it.
CTNEW = ctnew
SRCS = kinetics1.cpp
SRCS = kinetics1.cpp kinetics2.cpp flame1.cpp
OBJS = $(SRCS:.cpp=.o)
EXES = $(SRCS:.cpp=.x)

View file

@ -1,3 +1,3 @@
Library files.
This directory is no longer used, and will be removed in a future release.

View file

@ -12,3 +12,4 @@ StefanBoltz = 5.67e-8
ElectronCharge = 1.602e-19
Pi = 3.1415926
Faraday = ElectronCharge * Avogadro
Planck = 6.6262e-34

View file

@ -574,6 +574,9 @@ class reaction(writer):
if self._type == 'surface':
mdim += -1
ldim += 2
elif self._type == 'edge':
mdim += -1
ldim += 1
else:
mdim += -1
ldim += 3
@ -591,7 +594,9 @@ class reaction(writer):
if self._type == '':
self._kf = [self._kf]
elif self._type == 'surface':
self._kf = [self._kf]
self._kf = [self._kf]
elif self._type == 'edge':
self._kf = [self._kf]
elif self._type == 'threeBody':
self._kf = [self._kf]
mdim += 1
@ -735,6 +740,18 @@ class surface_reaction(reaction):
self._type = 'surface'
class edge_reaction(reaction):
def __init__(self,
equation = '',
kf = None,
id = '',
order = '',
options = []):
reaction.__init__(self, equation, kf, id, order, options)
self._type = 'edge'
#--------------
@ -995,7 +1012,6 @@ class pure_solid(phase):
self._pure = 1
if self._dens < 0.0:
raise 'density must be specified.'
self._pure = 0
self._tr = transport
def conc_dim(self):
@ -1013,6 +1029,74 @@ class pure_solid(phase):
k['model'] = 'none'
class metal(phase):
"""A metal."""
def __init__(self,
name = '',
elements = '',
species = '',
density = -1.0,
transport = 'None',
initial_state = None,
options = []):
phase.__init__(self, name, 3, elements, species, 'none',
initial_state, options)
self._dens = density
self._pure = 0
#if self._dens < 0.0:
# raise 'density must be specified.'
self._tr = transport
def conc_dim(self):
return (0,0)
def build(self, p):
ph = phase.build(self, p)
e = ph.addChild("thermo")
e['model'] = 'Metal'
addFloat(e, 'density', self._dens, defunits = _umass+'/'+_ulen+'3')
if self._tr:
t = ph.addChild('transport')
t['model'] = self._tr
k = ph.addChild("kinetics")
k['model'] = 'none'
class incompressible_solid(phase):
"""An incompressible solid."""
def __init__(self,
name = '',
elements = '',
species = '',
density = -1.0,
transport = 'None',
initial_state = None,
options = []):
phase.__init__(self, name, 3, elements, species, 'none',
initial_state, options)
self._dens = density
self._pure = 0
if self._dens < 0.0:
raise 'density must be specified.'
self._tr = transport
def conc_dim(self):
return (1,-3)
def build(self, p):
ph = phase.build(self, p)
e = ph.addChild("thermo")
e['model'] = 'Incompressible'
addFloat(e, 'density', self._dens, defunits = _umass+'/'+_ulen+'3')
if self._tr:
t = ph.addChild('transport')
t['model'] = self._tr
k = ph.addChild("kinetics")
k['model'] = 'none'
class pure_fluid(phase):
"""A pure fluid."""
def __init__(self,
@ -1078,6 +1162,45 @@ class ideal_interface(phase):
def conc_dim(self):
return (1, -2)
class edge(phase):
"""A 1D boundary between two surface phases."""
def __init__(self,
name = '',
elements = '',
species = '',
reactions = 'none',
site_density = 0.0,
phases = [],
kinetics = 'Edge',
transport = 'None',
initial_state = None,
options = []):
self._type = 'edge'
phase.__init__(self, name, 2, elements, species, reactions,
initial_state, options)
self._pure = 0
self._kin = kinetics
self._tr = transport
self._phases = phases
self._sitedens = site_density
def build(self, p):
ph = phase.build(self, p)
e = ph.addChild("thermo")
e['model'] = 'Edge'
addFloat(e, 'site_density', self._sitedens, defunits = _umol+'/'+_ulen+'2')
k = ph.addChild("kinetics")
k['model'] = self._kin
t = ph.addChild('transport')
t['model'] = self._tr
p = ph.addChild('phaseArray',self._phases)
def conc_dim(self):
return (1, -1)
#------------------ equations of state --------------------------
@ -1185,6 +1308,7 @@ class SRI:
f = p.addChild('falloff', s)
f['type'] = 'SRI'
class Lindemann:
def __init__(self):
pass
@ -1240,7 +1364,10 @@ if __name__ == "__main__":
# $Revision$
# $Date$
# $Log$
# Revision 1.25 2003-11-24 16:39:33 dggoodwin
# Revision 1.26 2004-02-03 03:31:06 dggoodwin
# *** empty log message ***
#
# Revision 1.25 2003/11/24 16:39:33 dggoodwin
# -
#
# Revision 1.24 2003/11/13 12:29:45 dggoodwin

View file

@ -157,6 +157,11 @@ namespace Cantera {
m_ropt[HMAX] = hmax;
}
void CVodeInt::setMinStep(doublereal hmin) {
m_hmin = hmin;
m_ropt[HMIN] = hmin;
}
void CVodeInt::setIterator(IterType t) {
if (t == Newton_Iter)
m_iter = NEWTON;

View file

@ -63,6 +63,7 @@ namespace Cantera {
virtual void setMethod(MethodType t);
virtual void setIterator(IterType t);
virtual void setMaxStep(double hmax);
virtual void setMinStep(double hmin);
private:
@ -78,7 +79,7 @@ namespace Cantera {
double m_reltol;
double m_abstols;
int m_nabs;
double m_hmax;
double m_hmax, m_hmin;
vector_fp m_ropt;
long int* m_iopt;

View file

@ -114,22 +114,6 @@ namespace Cantera {
}
}
m_eloc = mneg;
// nneg = 0.0;
// if (nneg > 0) {
// for (k = 0; k < m_kk; k++) {
// m_comp[k*m_mm + mneg] = m_phase->nAtoms(k,mneg);
// for (m = 0; m < m_mm; m++) {
// if (m != mneg) {
// m_comp[k*m_mm + m] = m_phase->nAtoms(k,m);
// m_comp[k*m_mm + mneg] += m_phase->nAtoms(k,m)*(nneg + 1);
// }
// }
// cout << m_phase->speciesName(k) << " ";
// for (m = 0; m < m_mm; m++) cout << m_comp[k*m_mm + m] << " ";
// cout << endl;
// }
// }
// else {
for (k = 0; k < m_kk; k++) {
for (m = 0; m < m_mm; m++) {
m_comp[k*m_mm + m] = m_phase->nAtoms(k,m);
@ -177,16 +161,12 @@ namespace Cantera {
m_elementmolefracs[m] = 0.0;
for (k = 0; k < m_kk; k++) {
m_elementmolefracs[m] += nAtoms(k,m) * m_molefractions[k];
//if (nAtoms(k,m) < 0.0) {
// throw CanteraError("update","negative nAtoms");
//}
if (m_molefractions[k] < 0.0) {
throw CanteraError("update",
"negative mole fraction for "+m_phase->speciesName(k)+
": "+fp2str(m_molefractions[k]));
}
}
//cout << "update: " << m << " " << m_elementmolefracs[m] << endl;
sum += m_elementmolefracs[m];
}
@ -261,7 +241,6 @@ namespace Cantera {
for (int k = 0; k < kksp; k++) {
if (ip == ksp) {
m_molefractions[k] = aa(n+1, 0);
//cout << "initial " << m_phase->speciesName(k) << " " << m_molefractions[k] << endl;
}
ksp++;
}

View file

@ -21,7 +21,6 @@
#include "vec_functions.h"
#include "ctexceptions.h"
#include "ThermoPhase.h"
#include "PropertyCalculator.h"
#include "DenseMatrix.h"
namespace Cantera {
@ -61,7 +60,8 @@ namespace Cantera {
bool contin;
};
template<class M>
class PropertyCalculator;
/**
* Chemical equilibrium processor. Sets a mixture to a state of

View file

@ -16,6 +16,18 @@
namespace Cantera {
void ConstDensityThermo::getActivityConcentrations(doublereal* c) const {
getConcentrations(c);
}
doublereal ConstDensityThermo::standardConcentration(int k) const {
return molarDensity();
}
doublereal ConstDensityThermo::logStandardConc(int k) const {
return log(molarDensity());
}
void ConstDensityThermo::getChemPotentials(doublereal* mu) const {
doublereal vdp = (pressure() - m_spthermo->refPressure())/
molarDensity();
@ -28,6 +40,10 @@ namespace Cantera {
}
}
void ConstDensityThermo::getStandardChemPotentials(doublereal* mu0) const {
getPureGibbs(mu0);
}
void ConstDensityThermo::initThermo() {
m_kk = nSpecies();
m_mm = nElements();

View file

@ -75,7 +75,12 @@ namespace Cantera {
m_press = p;
}
virtual void getActivityConcentrations(doublereal* c) const;
virtual void getChemPotentials(doublereal* mu) const;
virtual void getStandardChemPotentials(doublereal* mu0) const;
virtual doublereal standardConcentration(int k=0) const;
virtual doublereal logStandardConc(int k=0) const;
// virtual void getPartialMolarEnthalpies(doublereal* hbar) const {
// const array_fp& _h = enthalpy_RT();

View file

@ -63,7 +63,6 @@ namespace Cantera {
m_pp[k] = -grt[k] + mu_RT[k];
m_pp[k] = m_p0 * exp(m_pp[k]);
pres += m_pp[k];
//cout <<"setToEquil: " << k << " " << grt[k] << " " << mu_RT[k] << endl;
}
// set state
setState_PX(pres, m_pp.begin());
@ -76,12 +75,8 @@ namespace Cantera {
m_spthermo->update(tnow, m_cp0_R.begin(), m_h0_RT.begin(),
m_s0_R.begin());
m_tlast = tnow;
// doublereal rrt = 1.0 / (GasConstant * tnow);
int k;
//doublereal deltaE;
for (k = 0; k < m_kk; k++) {
//deltaE = rrt * m_pe[k];
//m_h0_RT[k] += deltaE;
m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k];
}
m_logc0 = log(m_p0/(GasConstant * tnow));

View file

@ -63,8 +63,6 @@ namespace Cantera {
if (nt > ntmax) ntmax = nt;
}
m_integ = new CVodeInt;
//m_surfindex = kin.surfacePhaseIndex();
//m_surf = (SurfPhase*)&kin.thermo(m_surfindex);;
// use backward differencing, with a full Jacobian computed
// numerically, and use a Newton linear iterator
@ -72,7 +70,6 @@ namespace Cantera {
m_integ->setMethod(BDF_Method);
m_integ->setProblemType(DENSE + NOJAC);
m_integ->setIterator(Newton_Iter);
//m_nsp = m_surf->nSpecies();
m_work.resize(ntmax);
}

View file

@ -149,6 +149,10 @@ namespace Cantera {
virtual void setMaxStep(double hmax)
{ warn("setMaxStep"); }
/** Set the minimum step size */
virtual void setMinStep(double hmin)
{ warn("setMinStep"); }
private:
doublereal m_dummy;

View file

@ -108,10 +108,11 @@ namespace Cantera {
* First evaluate the coverage-dependent terms in the reaction
* rates.
*/
m_surf->getCoverages(m_conc.begin());
m_rates.update_C(m_conc.begin());
m_rates.update(m_kdata->m_temp,
m_kdata->m_logtemp, m_kdata->m_rfn.begin());
// UNCOMMENT and fix
//m_surf->getCoverages(m_conc.begin());
//m_rates.update_C(m_conc.begin());
//m_rates.update(m_kdata->m_temp,
// m_kdata->m_logtemp, m_kdata->m_rfn.begin());
int np = nPhases();
for (n = 0; n < np; n++) {
@ -136,9 +137,11 @@ namespace Cantera {
*/
void InterfaceKinetics::updateKc() {
int i, irxn;
vector_fp& m_rkc = m_kdata->m_rkcn;
fill(m_rkc.begin(), m_rkc.end(), 0.0);
static vector_fp mu(nTotalSpecies());
if (m_nrev > 0) {
int n, nsp, k, ik=0;
@ -161,6 +164,9 @@ namespace Cantera {
for (i = 0; i < m_nrev; i++) {
irxn = m_revindex[i];
if (irxn < 0 || irxn >= nReactions()) {
throw CanteraError("InterfaceKinetics","illegal value: irxn = "+int2str(irxn));
}
m_rkc[irxn] = exp(m_rkc[irxn]*rrt);
}
for (i = 0; i != m_nirrev; ++i) {
@ -170,6 +176,38 @@ namespace Cantera {
}
void InterfaceKinetics::checkPartialEquil() {
int i, irxn;
vector_fp dmu(nTotalSpecies(), 0.0);
vector_fp rmu(nReactions(), 0.0);
if (m_nrev > 0) {
int n, nsp, k, ik=0;
doublereal rt = GasConstant*thermo(0).temperature();
doublereal rrt = 1.0/rt;
int np = nPhases();
for (n = 0; n < np; n++) {
thermo(n).getChemPotentials(dmu.begin() + m_start[n]);
nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) {
dmu[ik] += Faraday * m_phi[n] * thermo(n).charge(k);
cout << thermo(n).speciesName(k) << " " << dmu[ik] << endl;
ik++;
}
}
// compute Delta mu^ for all reversible reactions
m_reactantStoich.decrementReactions(dmu.begin(), rmu.begin());
m_revProductStoich.incrementReactions(dmu.begin(), rmu.begin());
for (i = 0; i < m_nrev; i++) {
irxn = m_revindex[i];
cout << "Reaction " << reactionString(irxn) << " " << rmu[irxn] << endl;
}
}
}
/**
* Get the equilibrium constants of all reactions, whether
* reversible or not.
@ -249,6 +287,40 @@ namespace Cantera {
}
/**
* Update the rates of progress of the reactions in the reaciton
* mechanism. This routine operates on internal data.
*/
void InterfaceKinetics::getFwdRateConstants(doublereal* kfwd) {
_update_rates_T();
_update_rates_C();
const vector_fp& rf = m_kdata->m_rfn;
// copy rate coefficients into kfwd
copy(rf.begin(), rf.end(), kfwd);
// multiply by perturbation factor
multiply_each(kfwd, kfwd + nReactions(), m_perturb.begin());
}
/**
* Update the rates of progress of the reactions in the reaciton
* mechanism. This routine operates on internal data.
*/
void InterfaceKinetics::getRevRateConstants(doublereal* krev) {
getFwdRateConstants(krev);
const vector_fp& rkc = m_kdata->m_rkcn;
multiply_each(krev, krev + nReactions(), rkc.begin());
}
/**
* Update the rates of progress of the reactions in the reaciton
* mechanism. This routine operates on internal data.
@ -427,13 +499,11 @@ namespace Cantera {
if (r.reversible) {
m_revProductStoich.add(reactionNumber(), pk);
//m_dn.push_back(pk.size() - rk.size());
m_revindex.push_back(reactionNumber());
m_nrev++;
}
else {
m_irrevProductStoich.add(reactionNumber(), pk);
//m_dn.push_back(pk.size() - rk.size());
m_irrev.push_back( reactionNumber() );
m_nirrev++;
}
@ -502,6 +572,8 @@ namespace Cantera {
m_integrator->initialize();
}
m_integrator->integrate(0.0, tstep);
delete m_integrator;
m_integrator = 0;
}
}

View file

@ -258,6 +258,10 @@ namespace Cantera {
return m_rxneqn[i];
}
virtual void getFwdRateConstants(doublereal* kfwd);
virtual void getRevRateConstants(doublereal* krev);
//@}
/**
* @name Reaction Mechanism Construction
@ -301,7 +305,7 @@ namespace Cantera {
void _update_rates_C();
void advanceCoverages(doublereal tstep);
void checkPartialEquil();
protected:
/**
@ -309,6 +313,7 @@ namespace Cantera {
* that participate in the kinetics mechanism.
*/
int m_kk;
vector_int m_revindex;
Rate1<SurfaceArrhenius> m_rates;
//Rate1<Arrhenius> m_rates;
@ -346,7 +351,7 @@ namespace Cantera {
mutable vector<map<int, doublereal> > m_rrxn;
mutable vector<map<int, doublereal> > m_prxn;
vector_int m_revindex;
vector<string> m_rxneqn;
/**

View file

@ -557,7 +557,10 @@ namespace Cantera {
m_start.push_back(0);
}
// there should only be one surface phase
if (thermo.eosType() == cSurf) {
int ptype = -100;
if (type() == cEdgeKinetics) ptype = cEdge;
else if (type() == cInterfaceKinetics) ptype = cSurf;
if (thermo.eosType() == ptype) {
if (m_surfphase >= 0) {
throw CanteraError("Kinetics::addPhase",
"cannot add more than one surface phase");

View file

@ -20,15 +20,16 @@
#include "GasKinetics.h"
#include "GRI_30_Kinetics.h"
#include "InterfaceKinetics.h"
#include "EdgeKinetics.h"
#include "importCTML.h"
namespace Cantera {
KineticsFactory* KineticsFactory::__factory = 0;
static int ntypes = 4;
static string _types[] = {"none", "GasKinetics", "GRI30", "Interface"};
static int _itypes[] = {0, cGasKinetics, cGRI30, cInterfaceKinetics};
static int ntypes = 5;
static string _types[] = {"none", "GasKinetics", "GRI30", "Interface", "Edge"};
static int _itypes[] = {0, cGasKinetics, cGRI30, cInterfaceKinetics, cEdgeKinetics};
/**
* Return a new kinetics manager that implements a reaction
@ -96,6 +97,10 @@ namespace Cantera {
k = new InterfaceKinetics;
break;
case cEdgeKinetics:
k = new EdgeKinetics;
break;
default:
throw UnknownKineticsModel("KineticsFactory::newKinetics",
kintype);

View file

@ -33,7 +33,7 @@ KINETICS = GRI_30_Kinetics.o KineticsFactory.o GasKinetics.o FalloffFactory.o
ReactionStoichMgr.o $(THERMO)
# heterogeneous kinetics
HETEROKIN = InterfaceKinetics.o ImplicitSurfChem.o SurfPhase.o $(THERMO)
HETEROKIN = InterfaceKinetics.o ImplicitSurfChem.o SurfPhase.o EdgeKinetics.o $(THERMO)
# support for importing from Chemkin-compatible reaction mechanisms
CK = $(KINETICS)

View file

@ -4,12 +4,15 @@
* Declares class PureFluid
*/
// Copyright 2001 California Institute of Technology
// Copyright 2003 California Institute of Technology
#ifndef CT_EOS_TPX_H
#define CT_EOS_TPX_H
#include "ThermoPhase.h"
#ifdef INCL_PURE_FLUIDS
#include "../../ext/tpx/Sub.h"
#include "../../ext/tpx/utils.h"
@ -214,7 +217,8 @@ private:
};
}
#endif
#endif

View file

@ -105,7 +105,9 @@ namespace Cantera {
}
for (n = 0; n < m_nmcov; n++) {
k = m_msp[n];
th = fmaxx(theta[n], Tiny);
// changed n to k, dgg 1/22/04
th = fmaxx(theta[k], Tiny);
// th = fmaxx(theta[n], Tiny);
m_mcov += m_mc[n]*log(th);
}
}

View file

@ -26,12 +26,11 @@ namespace Cantera {
/**
* Manages the thermodynamic state. Class State manages the
* thermodynamic state of a multi-species solution. It
* holds values for the temperature, mass density, and mean
* molecular weight, and a vector of species mass
* fractions. For efficiency in mass/mole conversion, the vector
* of mass fractions divided by molecular weight \f$ Y_k/M_k \f$
* is also stored.
* thermodynamic state of a multi-species solution. It holds
* values for the temperature, mass density, and mean molecular
* weight, and a vector of species mass fractions. For efficiency
* in mass/mole conversion, the vector of mass fractions divided
* by molecular weight \f$ Y_k/M_k \f$ is also stored.
*
* Class State is not usually used directly in application
* programs. Its primary use is as a base class for class Phase.

View file

@ -13,10 +13,7 @@
#endif
#include "SurfPhase.h"
//#include "ReactionData.h"
//#include "StoichManager.h"
//#include "RateCoeffMgr.h"
#include "EdgePhase.h"
#include <iostream>
using namespace std;
@ -68,6 +65,17 @@ namespace Cantera {
copy(m_mu0.begin(), m_mu0.end(), mu0);
}
void SurfPhase::
getChemPotentials(doublereal* mu) const {
_updateThermo();
copy(m_mu0.begin(), m_mu0.end(), mu);
int k;
getActivityConcentrations(m_work.begin());
for (k = 0; k < m_kk; k++) {
mu[k] += GasConstant * temperature() * (log(m_work[k]) - logStandardConc(k));
}
}
void SurfPhase::
getActivityConcentrations(doublereal* c) const {
getConcentrations(c);
@ -141,8 +149,23 @@ namespace Cantera {
*/
void SurfPhase::
setCoverages(const doublereal* theta) {
double sum = 0.0;
for (int k = 0; k < m_kk; k++) sum += theta[k];
for (int k = 0; k < m_kk; k++) {
m_work[k] = m_n0*theta[k]/size(k);
m_work[k] = m_n0*theta[k]/(sum*size(k));
}
/*
* Call the State:: class function
* setConcentrations.
*/
setConcentrations(m_work.begin());
}
void SurfPhase::
setCoveragesNoNorm(const doublereal* theta) {
for (int k = 0; k < m_kk; k++) {
m_work[k] = m_n0*theta[k]/(size(k));
}
/*
* Call the State:: class function
@ -200,4 +223,8 @@ namespace Cantera {
}
}
EdgePhase::EdgePhase(doublereal n0) : SurfPhase(n0) {
setNDim(1);
}
}

View file

@ -16,11 +16,8 @@
#ifndef CT_SURFPHASE_H
#define CT_SURFPHASE_H
//#include "ct_defs.h"
#include "mix_defs.h"
#include "ThermoPhase.h"
//#include "ctvector.h"
//#include <iostream>
namespace Cantera {
@ -43,6 +40,7 @@ namespace Cantera {
virtual doublereal enthalpy_mole() const;
virtual doublereal intEnergy_mole() const;
virtual void getStandardChemPotentials(doublereal* mu0) const;
virtual void getChemPotentials(doublereal* mu) const;
virtual void getActivityConcentrations(doublereal* c) const;
virtual doublereal standardConcentration(int k = 0) const;
virtual doublereal logStandardConc(int k=0) const;
@ -52,7 +50,7 @@ namespace Cantera {
void setPotentialEnergy(int k, doublereal pe);
doublereal potentialEnergy(int k) {return m_pe[k];}
void setSiteDensity(doublereal n0);
void setElectricPotential(doublereal V);
//void setElectricPotential(doublereal V);
/**
* Pressure. Units: Pa.
@ -82,6 +80,7 @@ namespace Cantera {
* This is a dimensionless quantity.
*/
void setCoverages(const doublereal* theta);
void setCoveragesNoNorm(const doublereal* theta);
void setCoveragesByName(string cov);
void getCoverages(doublereal* theta) const;

View file

@ -22,6 +22,7 @@
#include "PureFluidPhase.h"
#include "ConstDensityThermo.h"
#include "SurfPhase.h"
#include "EdgePhase.h"
#include "MetalPhase.h"
#include "SolidCompound.h"
#include "importCTML.h"
@ -30,13 +31,13 @@ namespace Cantera {
ThermoFactory* ThermoFactory::__factory = 0;
static int ntypes = 6;
static int ntypes = 7;
static string _types[] = {"IdealGas", "Incompressible",
"Surface", "Metal", "SolidCompound",
"Surface", "Edge", "Metal", "SolidCompound",
"PureFluid"};
static int _itypes[] = {cIdealGas, cIncompressible,
cSurf, cMetal, cSolidCompound,
cSurf, cEdge, cMetal, cSolidCompound,
cPureFluid};
ThermoPhase* ThermoFactory::newThermoPhase(string model) {
@ -63,6 +64,10 @@ namespace Cantera {
th = new SurfPhase;
break;
case cEdge:
th = new EdgePhase;
break;
case cMetal:
th = new MetalPhase;
break;
@ -71,9 +76,11 @@ namespace Cantera {
th = new SolidCompound;
break;
#ifdef INCL_PURE_FLUIDS
case cPureFluid:
th = new PureFluid;
break;
#endif
default:
throw UnknownThermoPhaseModel("ThermoFactory::newThermoPhase",

View file

@ -151,7 +151,7 @@ namespace Cantera {
doublereal ThermoPhase::err(string msg) const {
throw CanteraError("ThermoPhase","Base class method "
+msg+" called.");
+msg+" called. Equation of state type: "+int2str(eosType()));
return 0;
}

View file

@ -24,7 +24,6 @@ namespace Cantera {
class XML_Node;
/**
* @defgroup thermoprops Thermodynamic Properties
*
@ -100,9 +99,11 @@ namespace Cantera {
const XML_Node* speciesData() {
if (m_speciesData)
return m_speciesData;
else
else {
throw CanteraError("ThermoPhase::speciesData",
"m_speciesData is NULL");
return 0;
}
}
@ -186,6 +187,7 @@ namespace Cantera {
return err("cv_mole");
}
/**
* @}
* @name Mechanical Properties
@ -607,7 +609,7 @@ namespace Cantera {
virtual void setState_satVapor() {
err("setState_satVapor");
}
/**
* @internal Install a species thermodynamic property
* manager. The species thermodynamic property manager

View file

@ -169,8 +169,6 @@ namespace ctml {
else {
ff = inname;
}
// rootPtr = &get_XML_File(ff)->child("ctml");
// rootPtr->write(cout);
ifstream fin(ff.c_str());
rootPtr->build(fin);
fin.close();

View file

@ -39,12 +39,14 @@ using namespace ct;
namespace ct {
ctvector_fp::ctvector_fp(size_t n) : _size(0), _alloc(0), _data(0) {
if (n > 0) resize(n);
// if (n > 0)
resize(n);
}
ctvector_fp::ctvector_fp(size_t n, value_type v0)
: _size(0), _alloc(0), _data(0) {
if (n > 0) resize(n, v0);
//if (n > 0)
resize(n, v0);
}
ctvector_fp::ctvector_fp(const ctvector_fp& x) {
@ -125,12 +127,14 @@ namespace ct {
ctvector_int::ctvector_int(size_t n) : _size(0), _alloc(0), _data(0) {
if (n > 0) resize(n);
// if (n > 0)
resize(n);
}
ctvector_int::ctvector_int(size_t n, value_type v0)
: _size(0), _alloc(0), _data(0) {
if (n > 0) resize(n, v0);
//if (n > 0)
resize(n, v0);
}
ctvector_int::ctvector_int(const ctvector_int& x) {

View file

@ -28,6 +28,7 @@
#include "speciesThermoTypes.h"
#include "ThermoPhase.h"
#include "SurfPhase.h"
#include "EdgePhase.h"
#include "ThermoFactory.h"
#include "SpeciesThermoFactory.h"
#include "KineticsFactory.h"
@ -531,7 +532,7 @@ namespace Cantera {
// from concentration units used in the law of mass action
// to coverages used in the sticking probability
// expression
if (p.eosType() == cSurf) {
if (p.eosType() == cSurf || p.eosType() == cEdge) {
f /= pow(p.standardConcentration(klocal), order);
}
// otherwise, increment the counter of bulk species
@ -702,6 +703,15 @@ namespace Cantera {
return t;
}
ThermoPhase* newPhase(string infile, string id) {
XML_Node* root = get_XML_File(infile);
if (id == "-") id = "";
XML_Node* x = get_XML_Node(string("#")+id, root);
if (x)
return newPhase(*x);
else
return 0;
}
/**
* Set the thermodynamic state.
@ -735,6 +745,11 @@ namespace Cantera {
SurfPhase* s = (SurfPhase*)th;
s->setCoveragesByName(comp);
}
if (th->eosType() == cEdge && state.hasChild("coverages")) {
comp = getString(state,"coverages");
EdgePhase* s = (EdgePhase*)th;
s->setCoveragesByName(comp);
}
}
/**
@ -789,6 +804,7 @@ namespace Cantera {
* the xml tree. EOS's that we don't know about don't create an
* error condition.
*/
bool eoserror = false;
if (phase.hasChild("thermo")) {
const XML_Node& eos = phase.child("thermo");
if (eos["model"] == "Incompressible") {
@ -798,8 +814,7 @@ namespace Cantera {
th->setParameters(1, &rho);
}
else {
throw CanteraError("importCTML",
"wrong equation of state type");
eoserror = true;
}
}
else if (eos["model"] == "SolidCompound") {
@ -808,8 +823,7 @@ namespace Cantera {
th->setDensity(rho);
}
else {
throw CanteraError("importCTML",
"wrong equation of state type");
eoserror = true;
}
}
else if (eos["model"] == "Surface") {
@ -821,10 +835,22 @@ namespace Cantera {
th->setParameters(1, &n);
}
else {
throw CanteraError("importCTML",
"wrong equation of state type");
eoserror = true;
}
}
else if (eos["model"] == "Edge") {
if (th->eosType() == cEdge) {
doublereal n = getFloat(eos, "site_density", "-");
if (n <= 0.0)
throw CanteraError("importCTML",
"missing or negative site density");
th->setParameters(1, &n);
}
else {
eoserror = true;
}
}
#ifdef INCL_PURE_FLUIDS
else if (eos["model"] == "PureFluid") {
if (th->eosType() == cPureFluid) {
subflag = atoi(eos["fluid_type"].c_str());
@ -840,10 +866,15 @@ namespace Cantera {
//th->setParameters(3, c);
}
else {
throw CanteraError("importCTML",
"wrong equation of state type");
eoserror = true;
}
}
#endif
if (eoserror) {
string msg = "Wrong equation of state type for phase "+phase["id"]+"\n";
msg += eos["model"]+" is not consistent with eos type "+int2str(th->eosType());
throw CanteraError("importCTML",msg);
}
}
@ -1138,6 +1169,9 @@ next:
else if (typ == "surface") {
rdata.reactionType = SURFACE_RXN;
}
else if (typ == "edge") {
rdata.reactionType = EDGE_RXN;
}
//else if (typ == "global") {
// rdata.reactionType = GLOBAL_RXN;
//}
@ -1306,11 +1340,24 @@ next:
const XML_Node& ii = *incl[nii];
string imin = ii["min"];
string imax = ii["max"];
string::size_type iwild = string::npos;
if (imax == imin) {
iwild = imin.find("*");
if (iwild != string::npos) {
imin = imin.substr(0,iwild);
imax = imin;
}
}
for (i = 0; i < nrxns; i++) {
const XML_Node* r = allrxns[i];
string rxid;
if (r) {
rxid = (*r)["id"];
if (iwild != string::npos) {
rxid = rxid.substr(0,iwild);
}
/*
* To decide whether the reaction is included or not
* we do a lexical min max and operation. This
@ -1364,6 +1411,8 @@ next:
bool importKinetics(const XML_Node& phase, vector<ThermoPhase*> th,
Kinetics* k) {
if (k == 0) return false;
Kinetics& kin = *k;
// This phase will be the default one

View file

@ -80,6 +80,7 @@ namespace Cantera {
bool installReactionArrays(const XML_Node& parent, Kinetics& kin,
string default_phase, bool check_for_duplicates = false);
ThermoPhase* newPhase(XML_Node& phase);
ThermoPhase* newPhase(string file, string id);
bool buildSolutionFromXML(XML_Node& root, string id, string nm,
ThermoPhase* th, Kinetics* k);

View file

@ -46,6 +46,7 @@ namespace Cantera {
const int cGRI30 = 3;
const int cInterfaceKinetics = 4;
const int cLineKinetics = 5;
const int cEdgeKinetics = 6;
}
#endif

View file

@ -50,6 +50,8 @@ namespace Cantera {
*/
const int SURFACE_RXN = 20;
const int EDGE_RXN = 22;
const int GLOBAL_RXN = 30;
//@}

View file

@ -470,19 +470,9 @@ namespace Cantera {
while (!f.eof()) {
attribs.clear();
nm = r.readTag(attribs);
#ifdef DEBUG_HKM
//if (nm == "EOF") {
// cout << "*** at XMLNode ";
// if (!node) cout << "NULL";
// cout << " : read " << nm << endl;
//} else {
// cout << "*** at XMLNode " << node->name()
// << " : read " << nm << endl;
//}
#endif
if (nm == "EOF") break;
if (nm == "--" && m_name == "--" && m_root == this) {
//cout << "*********special top condition " << endl;
continue;
}
int lnum = r.m_line;
@ -569,19 +559,7 @@ namespace Cantera {
node_dest->addAttribute(b->first, b->second);
}
const vector<XML_Node*> &vsc = node_dest->children();
#ifdef DEBUG_HKM
//cout << "*** dest: " << node_dest->name()
// << ", value = \"" << node_dest->value();
//cout << "\" *** src: " << m_name
// << ", value = \"" << m_value << "\"" << endl;
//cout << " ***** src: " << m_name
// << " has " << m_nchildren <<" children:";
//for (int n = 0; n < m_nchildren; n++) {
// sc = m_children[n];
// cout << " " << sc->name();
//}
//cout << endl;
#endif
for (int n = 0; n < m_nchildren; n++) {
sc = m_children[n];
ndc = node_dest->nChildren();
@ -605,15 +583,7 @@ namespace Cantera {
int iloc;
string cname;
map<string,XML_Node*>::const_iterator i;
#ifdef DEBUG_HKM
//if (loc == "elementArray") {
// i = m_childindex.begin();
// for ( ; i != m_childindex.end(); i++) {
// XML_Node*ccc = i->second;
// cout << i->first << " " << ccc->name() << endl;
// }
//}
#endif
while (1) {
iloc = loc.find('/');
if (iloc >= 0) {
@ -747,12 +717,6 @@ namespace Cantera {
*/
XML_Node* find_XML(string src, XML_Node* root, string id, string loc,
string name) {
#ifdef DEBUG_HKM
// cout << "find_XML src = " << src << endl;
// cout << "find_XML id = " << id << endl;
// cout << "find_XML loc = " << loc << endl;
// cout << "find_XML name = " << name << endl;
#endif
string file, id2;
split(src, file, id2);
src = file;

View file

@ -110,13 +110,8 @@ namespace Cantera {
bool hasChild(string ch) const {
return (m_childindex.find(ch) != m_childindex.end());
//return (m_childindex[ch] != 0);
}
bool hasAttrib(string a) const {
//cout << m_attribs.size() << endl;
// if (m_attribs.size() == 0) {
// cout << name() << " has zero length attribs " << endl;
// }
return (m_attribs.find(a) != m_attribs.end());
}

View file

@ -50,27 +50,19 @@ be created within your home directory if they don't exist already, and
cantera will be installed into these directories.
Configuring the Environment
---------------------------
The build process will create a shell script 'cantera.cfg' that
configures the environment for Cantera. This should be run by typing
configures the environment for Cantera. This script may be found in
directory 'cantera' within the installation directory
(i.e. '/usr/local/cantera'). This should be run by typing
source /usr/local/cantera/cantera.cfg
to set environment variables before using Cantera. This may not be
necessary if a default installation into /usr/local is done, but is
necessary if a custom installation is done.
If the HOME environment variable is set, the build process will copy
cantera.cfg to your home directory. You can insure that the latest
version of cantera.cfg is run every time you log in by adding the line
source cantera.cfg
to your shell login script.
to set environment variables before using Cantera. It is recommended
to add this line to your shell login script, so that Cantera will be
correctly configured each time you log in.
The Python Interface

View file

@ -67,6 +67,6 @@ typedef int ftnlen; // Fortran hidden string length type
// used to find data files
#undef CANTERA_ROOT
#undef INCL_PURE_FLUIDS
#endif

10
config/configure vendored
View file

@ -1613,6 +1613,10 @@ fi
if test "$ENABLE_TPX" = "y"
then KERNEL=$KERNEL' 'tpx
NEED_TPX=1
cat >>confdefs.h <<\_ACEOF
#define INCL_PURE_FLUIDS 1
_ACEOF
fi
@ -3216,7 +3220,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:3219:" \
echo "$as_me:3223:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -3393,7 +3397,7 @@ _ACEOF
# flags.
ac_save_FFLAGS=$FFLAGS
FFLAGS="$FFLAGS $ac_verb"
(eval echo $as_me:3396: \"$ac_link\") >&5
(eval echo $as_me:3400: \"$ac_link\") >&5
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
echo "$ac_f77_v_output" >&5
FFLAGS=$ac_save_FFLAGS
@ -3473,7 +3477,7 @@ _ACEOF
# flags.
ac_save_FFLAGS=$FFLAGS
FFLAGS="$FFLAGS $ac_cv_prog_f77_v"
(eval echo $as_me:3476: \"$ac_link\") >&5
(eval echo $as_me:3480: \"$ac_link\") >&5
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
echo "$ac_f77_v_output" >&5
FFLAGS=$ac_save_FFLAGS

View file

@ -279,6 +279,7 @@ fi
if test "$ENABLE_TPX" = "y"
then KERNEL=$KERNEL' 'tpx
NEED_TPX=1
AC_DEFINE(INCL_PURE_FLUIDS)
fi
AC_SUBST(KERNEL)

19
configure vendored
View file

@ -36,17 +36,19 @@ CANTERA_VERSION=${CANTERA_VERSION:="1.5.3"}
# g++ and g77 compilers.
USE_VISUAL_STUDIO=${USE_VISUAL_STUDIO:="y"}
#
# If you are using Visual Studio, set this to the location of the
# directory containing the Fortran libraries. This is only needed to
# build the Matlab interface.
FORTRAN_LIB_DIR="D:\Program Files\Microsoft Visual Studio\DF98\LIB"
#----------------------------------------------------------------------
# Language Interfaces
#----------------------------------------------------------------------
#
# Cantera provides interfaces for several languages. Set to 'y' to
# build the specified interface. If you only plan to use Cantera from
# C++, you do not need to build any of these.
# build the specified interface.
#------------ Python -------------------------------------------------
@ -87,7 +89,7 @@ BUILD_MATLAB_TOOLBOX=${BUILD_MATLAB_TOOLBOX:="y"}
# Cantera and build them automatically along with the rest of Cantera.
# All you need to do is specify the directory where your source code is
# located.
USER_SRC_DIR="Cantera/user"
USER_SRC_DIR="Cantera/user" # don't change this
@ -109,8 +111,9 @@ USER_SRC_DIR="Cantera/user"
# thermodynamic properties
ENABLE_THERMO='y'
# enable importing Chemkin input files
ENABLE_CK='n'
# if set to 'y', the ck2cti program that converts Chemkin input files
# to Cantera format will be built
ENABLE_CK='y'
# homogeneous and heterogeneous kinetics
ENABLE_KINETICS='y'
@ -176,7 +179,7 @@ LAPACK_FTN_STRING_LEN_AT_END='y'
CXX=${CXX:=g++}
# C++ compiler flags
CXXFLAGS=${CXXFLAGS:="-O2 -Wall"}
CXXFLAGS=${CXXFLAGS:="-O0 -g -Wall"}
# the C++ flags required for linking
#LCXX_FLAGS=
@ -208,7 +211,7 @@ F77=${F77:=g77}
F90=${F90:=f90}
# Fortran compiler flags
FFLAGS=${FFLAGS:='-O2'}
FFLAGS=${FFLAGS:='-O3 -g'}
# the additional Fortran flags required for linking, if any
#LFORT_FLAGS="-lF77 -lFI77"

File diff suppressed because it is too large Load diff

View file

@ -11,6 +11,8 @@ LOCAL_LIBS = -lcantera @math_libs@ @LAPACK_LIBRARY@ @BLAS_LIBRARY@ -lctcxx
LCXX_END_LIBS = @LCXX_END_LIBS@
#OBJS = ck2cti.o
OBJS = ck2cti.o cti2ctml.o
DEPENDS = $(OBJS:.o=.d)
CONVLIB_DEP = @buildlib@/libconverters.a