*** empty log message ***

This commit is contained in:
Dave Goodwin 2003-08-07 17:50:36 +00:00
parent 26086b13c7
commit 98c282ca68
3 changed files with 44 additions and 15 deletions

View file

@ -340,7 +340,7 @@ class Arrhenius(writer):
E = 0.0):
self._c = [A, n, E]
def build(self, p, units = '', name = ''):
def build(self, p, units = '', gas_species = [], name = ''):
a = p.addChild('Arrhenius')
if name: a['name'] = name
if isnum(self._c[0]):
@ -354,24 +354,27 @@ class Arrhenius(writer):
addFloat(a,'E',self._c[2], fmt = '%f')
class sticking_prob(writer):
class stick(writer):
def __init__(self,
A = 0.0,
n = 0.0,
E = 0.0,
species = ''):
E = 0.0):
self._c = [A, n, E]
self._sp = species
def build(self, p):
def build(self, p, units = '', gas_species = [], name = ''):
a = p.addChild('Stick')
a['species'] = self._sp
addFloat(a,'A',self._c[0],fmt = '%14.6E')
a.addChild('n',`self._c[1]`)
ngas = len(gas_species)
if ngas <> 1:
raise 'sticking probabilities can only be used for reactions with one gas-phase reactant'
a['species'] = gas_species[0]
if name: a['name'] = name
addFloat(a,'A',self._c[0], fmt = '%14.6E')
a.addChild('b',`self._c[1]`)
if isnum(self._c[2]):
addFloat(a,'E',(self._c[2],_ue), fmt = '%f')
else:
addFloat(a,'E',self._c[2], fmt = '%f')
addFloat(a,'E',self._c[2], fmt = '%f')
class reaction(writer):
@ -490,7 +493,7 @@ class reaction(writer):
k = kf
else:
k = Arrhenius(A = kf[0], n = kf[1], E = kf[2])
k.build(kfnode, units = ku, name = nm)
k.build(kfnode, units = ku, gas_species = self._igspecies, name = nm)
# set values for low-pressure rate coeff if falloff rxn
mdim += 1
@ -604,8 +607,12 @@ class surface_reaction(reaction):
def __init__(self,
equation = '',
kf = None,
stick = None,
id = ''):
reaction.__init__(self, equation, kf, id)
if stick:
reaction.__init__(self, equation, stick, id)
else:
reaction.__init__(self, equation, kf, id)
self._type = 'surface'
#--------------
@ -826,6 +833,8 @@ class pure_solid(phase):
self._pure = 0
self._tr = transport
def conc_dim(self):
return (0,0)
def build(self, p):
ph = phase.build(self, p)
@ -838,6 +847,7 @@ class pure_solid(phase):
k = ph.addChild("kinetics")
k['model'] = 'none'
class ideal_interface(phase):
"""An ideal interface."""
def __init__(self,

View file

@ -471,6 +471,17 @@ namespace Cantera {
"illegal species index: "+int2str(k));
}
int speciesPhaseIndex(int k) {
int np = m_start.size();
for (int n = np-1; n >= 0; n--) {
if (k >= m_start[n]) {
return n;
}
}
throw CanteraError("speciesPhaseIndex",
"illegal species index: "+int2str(k));
}
/**
* Prepare the class for the addition of reactions. This function

View file

@ -355,14 +355,21 @@ namespace Cantera {
void getStick(XML_Node& node, doublereal mw, Kinetics& kin,
ReactionData& r, doublereal& A, doublereal& b, doublereal& E) {
int nr = r.reactants.size();
int k, ns, not_surf = 0;
int k, klocal, ns, not_surf = 0;
int np = 0;
doublereal f = 1.0;
for (int n = 0; n < nr; n++) {
k = r.reactants[n];
ns = r.rstoich[n];
const ThermoPhase& p = kin.speciesPhase(k);
if (p.eosType() == cSurf)
f /= pow(p.standardConcentration(k),ns);
//const ThermoPhase& p =
np = kin.speciesPhaseIndex(k);
const ThermoPhase& p = kin.thermo(np);
klocal = p.speciesIndex(kin.kineticsSpeciesName(k));
if (p.eosType() == cSurf) {
cout << "f before = " << f << endl;
f /= pow(p.standardConcentration(klocal),ns);
cout << "f, k, klocal = " << f << " " << k << " " << klocal << endl;
}
else
not_surf++;
}
@ -376,6 +383,7 @@ namespace Cantera {
b = getFloat(node, "b") + 0.5;
E = getFloat(node, "E", "actEnergy");
E /= GasConstant;
cout << "A, cbar, f, b, E: " << A << " " << cbar << " " << f << " " << b << " " << E << endl;
}