*** empty log message ***

This commit is contained in:
Dave Goodwin 2003-06-27 14:19:16 +00:00
parent 9dec06949a
commit 6f9256ec0c
11 changed files with 62 additions and 30 deletions

View file

@ -8,8 +8,11 @@
* $Revision$
*
* $Log$
* Revision 1.1 2003-04-14 17:57:51 dggoodwin
* Initial revision
* Revision 1.2 2003-06-27 14:19:16 dggoodwin
* *** empty log message ***
*
* Revision 1.1.1.1 2003/04/14 17:57:51 dggoodwin
* Initial import.
*
* Revision 1.21 2002/12/19 15:21:54 dgg
* Changed sense of ptr_Element in constructor. Now default is to create
@ -332,10 +335,7 @@ namespace Cantera {
* Electrical charge of one species k molecule, divided by
* \f$ e = 1.602 \times 10^{-19}\f$ Coulombs.
*/
doublereal Constituents::charge(int k) {
if (k < 0 || k >= nSpecies())
throw SpeciesRangeError("Constituents::charge",
k, nSpecies());
doublereal Constituents::charge(int k) const {
return m_speciesCharge[k];
}

View file

@ -7,8 +7,11 @@
* $Revision$
*
* $Log$
* Revision 1.1 2003-04-14 17:57:51 dggoodwin
* Initial revision
* Revision 1.2 2003-06-27 14:19:16 dggoodwin
* *** empty log message ***
*
* Revision 1.1.1.1 2003/04/14 17:57:51 dggoodwin
* Initial import.
*
* Revision 1.24 2002/12/19 15:19:32 dgg
* added log block, replaced include statement for Elements.h with
@ -144,7 +147,7 @@ namespace Cantera {
* Electrical charge of one species k molecule, divided by
* \f$ e = 1.602 \times 10^{-19}\f$ Coulombs.
*/
doublereal charge(int k);
doublereal charge(int k) const;
/**
* @name Adding Species
* These methods are used to add new species.

View file

@ -429,7 +429,7 @@ namespace Cantera {
if (e.hasAttrib("atomicWt"))
weight = atof(stripws(e["atomicWt"]).c_str());
string symbol = e["name"];
if (weight)
if (weight != 0.0)
addUniqueElement(symbol, weight);
else
addUniqueElement(symbol);

View file

@ -196,6 +196,17 @@ namespace Cantera {
else return 0.0;
}
doublereal Phase::chargeDensity() const {
int k;
int nsp = nSpecies();
doublereal cdens = 0.0;
for (k = 0; k < nsp; k++)
cdens += charge(k)*State::moleFraction(k);
cdens *= Faraday;
return cdens;
}
void Phase::update_T(int n) const {
m_T_updater.update(n);
}

View file

@ -149,6 +149,11 @@ namespace Cantera {
doublereal massFraction(string name) const;
/**
* Charge density [C/m^3].
*/
doublereal chargeDensity() const;
void update_T(int n) const;
void update_C(int n) const;

View file

@ -79,6 +79,7 @@ namespace Cantera {
const doublereal StefanBoltz = 5.67e-8;
const doublereal ElectronCharge = 1.602e-19;
const doublereal Faraday = ElectronCharge * Avogadro;
const doublereal epsilon_0 = 8.85e-12; // farads / m
const doublereal Pi = 3.1415926;
const doublereal SqrtPi = sqrt(Pi);

View file

@ -210,7 +210,9 @@ namespace ctml {
* 'units'.
*/
doublereal getFloat(XML_Node& parent, string name, string type) {
if (!parent.hasChild(name)) return Undef;
if (!parent.hasChild(name))
throw CanteraError("getFloat",
"no child element named "+name);
XML_Node& node = parent.child(name);
doublereal x, x0, x1, fctr = 1.0;
string units, vmin, vmax;

View file

@ -372,6 +372,7 @@ namespace Cantera {
}
}
/**
* Get the rate coefficient for a reaction.
*/
@ -448,12 +449,18 @@ namespace Cantera {
if (comp != "")
th->setMassFractionsByName(comp);
}
t = getFloat(state, "temperature", "temperature");
if (t > 0.0) th->setTemperature(t);
p = getFloat(state, "pressure", "pressure");
if (p > 0.0) th->setPressure(p);
rho = getFloat(state, "density", "density");
if (rho > 0.0) th->setDensity(rho);
if (state.hasChild("temperature")) {
t = getFloat(state, "temperature", "temperature");
th->setTemperature(t);
}
if (state.hasChild("pressure")) {
p = getFloat(state, "pressure", "pressure");
th->setPressure(p);
}
if (state.hasChild("density")) {
rho = getFloat(state, "density", "density");
th->setDensity(rho);
}
}
/**
@ -484,9 +491,9 @@ namespace Cantera {
XML_Node& eos = phase.child("thermo");
if (eos["model"] == "Incompressible") {
if (th->eosType() == cIncompressible) {
map<string, doublereal> d;
getFloats(eos, d);
doublereal rho = d["density"];
//map<string, doublereal> d;
doublereal rho = getFloat(eos, "density", "-");
//doublereal rho = d["density"];
th->setParameters(1, &rho);
}
else {

View file

@ -16,7 +16,8 @@ OBJDIR = .
CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT)
# stirred reactors
OBJS = TransportFactory.o MultiTransport.o MixTransport.o MMCollisionInt.o
OBJS = TransportFactory.o MultiTransport.o MixTransport.o MMCollisionInt.o \
SolidTransport.o
CXX_INCLUDES = -I..
LIB = @buildlib@/libtransport.a

View file

@ -46,6 +46,7 @@ namespace Cantera {
const int CK_Multicomponent = 202;
const int cMixtureAveraged = 210;
const int CK_MixtureAveraged = 211;
const int cSolidTransport = 300;
class XML_Writer;
@ -113,13 +114,6 @@ namespace Cantera {
{ return err("viscosity"); }
//virtual void getSpeciesViscosities(doublereal* visc)
// { err("getSpeciesViscosities"); }
//virtual void getSpeciesConductivities(doublereal* cond)
// { err("getSpeciesConductivities"); }
/**
* The bulk viscosity in Pa-s. The contribution of the bulk
* viscosity to the stress tensor is usually negligible, since
@ -252,6 +246,9 @@ namespace Cantera {
return sqrt(8.0 * GasConstant * t /(Pi * mw));
}
virtual void setParameters(int type, int k, doublereal* p)
{ err("setParameters"); }
virtual ~Transport(){} ///< Destructor.
friend class TransportFactory;
@ -285,7 +282,6 @@ namespace Cantera {
void setThermo(thermo_t& thermo) {
if (!ready()) {
m_thermo = &thermo;
//m_phase = &m_thermo->phase();
m_nmin = m_thermo->nSpecies();
}
else

View file

@ -16,8 +16,9 @@
// known transport models
#include "MultiTransport.h"
#include "MixTransport.h"
#include "SolidTransport.h"
#include "TransportFactory.h"
#include "polyfit.h"
@ -194,6 +195,7 @@ namespace Cantera {
TransportFactory::TransportFactory() : m_integrals(0) {
m_models["Mix"] = cMixtureAveraged;
m_models["Multi"] = cMulticomponent;
m_models["Solid"] = cSolidTransport;
m_models["None"] = 0;
}
@ -236,6 +238,10 @@ namespace Cantera {
tr = new MixTransport;
initTransport(tr, phase, CK_Mode, log_level);
break;
case cSolidTransport:
tr = new SolidTransport;
tr->setThermo(*phase);
break;
default:
throw CanteraError("newTransport","unknown transport model");
}