*** empty log message ***

This commit is contained in:
Dave Goodwin 2004-06-16 21:56:14 +00:00
parent 75c6495d06
commit 14496a260a
7 changed files with 45 additions and 17 deletions

View file

@ -1,10 +1,9 @@
""" Cantera provides a set of classes for 'transport managers' that
manage the computation of various transport properties of a phase of
matter. Every object
representing a phase of matter for which transport properties are needed
has a transport manager assigned to
it. The transport manager has only one job: to compute the values
of the transport properties of its assigned phase.
matter. Every object representing a phase of matter for which
transport properties are needed has a transport manager assigned to
it. The transport manager has only one job: to compute the values of
the transport properties of its assigned phase.
A transport manager may do additional things not apparent to the user
in order to improve the speed of transport property evaluation. For
@ -26,6 +25,15 @@ class Transport:
"""Transport property manager.
A transport property manager is responsible for computing transport
properties.
In the C++ kernel, a transport manager implements a single
transport model, and is an instance of a subclass of the base
class 'Transport'. The structure in Python is a little
different. A single class 'Transport' represents any kernel-level
transport manager. In addition, multiple kernel-kevel transport
managers may be associated with one Python transport manager,
allowing the model used to compute transport properties to be
switched at any time.
"""
def __init__(self, xml_phase=None,
phase=None, model = "", loglevel=0):
@ -54,6 +62,7 @@ class Transport:
self._models[self.model] = self.__tr_id
def __del__(self):
"""Delete all installed transport models."""
if hasattr(self,'_models'):
for m in self._models.keys():
try:
@ -62,12 +71,14 @@ class Transport:
pass
def addTransportModel(self, model, loglevel=1):
"""Add a new transport model to this transport manager."""
new_id = _cantera.Transport(model,
self._phase_id, loglevel)
self._models[model] = new_id
def switchTransportModel(self, model):
"""Switch to a different transport model."""
if self._models.has_key(model):
self.__tr_id = self._models[model]
else:
@ -92,25 +103,33 @@ class Transport:
return _cantera.tran_viscosity(self.__tr_id)
def thermalConductivity(self):
"""Thermal conductivity. [W/m/K]."""
return _cantera.tran_thermalConductivity(self.__tr_id)
def thermalDiffCoeffs(self):
"""Return a one-dimensional array of the species thermal diffusion
coefficients. Not implemented in all transport models."""
return _cantera.tran_thermalDiffCoeffs(self.__tr_id,
self.trnsp)
def binaryDiffCoeffs(self):
"""Two-dimensional array of species binary diffusion coefficients."""
return _cantera.tran_binaryDiffCoeffs(self.__tr_id,
self.trnsp)
def mixDiffCoeffs(self):
"""Mixture-averaged diffusion coefficients."""
return _cantera.tran_mixDiffCoeffs(self.__tr_id,
self.trnsp)
def multiDiffCoeffs(self):
"""Two-dimensional array of species multicomponent diffusion
coefficients."""
return _cantera.tran_multiDiffCoeffs(self.__tr_id,
self.trnsp)
def setParameters(self, type, k, params):
"""Set model-specific parameters."""
return _cantera.tran_setParameters(self.__tr_id,
type, k, asarray(params))

View file

@ -16,7 +16,7 @@
#include "SurfPhase.h"
#include "ReactionData.h"
#include "StoichManager.h"
//#include "StoichManager.h"
#include "RateCoeffMgr.h"
#include <iostream>

View file

@ -16,7 +16,7 @@
#include "SurfPhase.h"
#include "ReactionData.h"
#include "StoichManager.h"
//#include "StoichManager.h"
#include "RateCoeffMgr.h"
#include "ImplicitSurfChem.h"

View file

@ -92,7 +92,7 @@ namespace Cantera {
vector_fp delta_order(nr,0.0);
for (n = 0; n < nr; n++) {
delta_order[n] = r.order[n] - r.rstoich[n];
cout << "rxn stoich " << r.reactants[n] << " " << r.order[n] << " " << delta_order[n] << endl;
//cout << "rxn stoich " << r.reactants[n] << " " << r.order[n] << " " << delta_order[n] << endl;
}
m_global->add(rxn, r.reactants, delta_order);
}

View file

@ -98,6 +98,12 @@ namespace Cantera {
*
*/
static doublereal ppow(doublereal x, doublereal order) {
if (x > 0.0)
return pow(x, order);
else
return 0.0;
}
/**
* Handles one species in a reaction.
@ -121,7 +127,7 @@ namespace Cantera {
*(output + m_rxn) *= *(input + m_ic0);
}
void power(const doublereal* input, doublereal* output) const {
output[m_rxn] *= pow(input[m_ic0], m_order);
output[m_rxn] *= ppow(input[m_ic0], m_order);
}
void incrementSpecies(const doublereal* input,
doublereal* output) const {
@ -169,8 +175,8 @@ namespace Cantera {
}
void power(const doublereal* input, doublereal* output) const {
output[m_rxn] *= pow(input[m_ic0],m_order0) *
pow(input[m_ic1],m_order1);
output[m_rxn] *= ppow(input[m_ic0],m_order0) *
ppow(input[m_ic1],m_order1);
}
void incrementSpecies(const doublereal* input,
@ -238,9 +244,9 @@ namespace Cantera {
* (*(input + m_ic2));
}
void power(const doublereal* input, doublereal* output) const {
output[m_rxn] *= pow(input[m_ic0],m_order0) *
pow(input[m_ic1],m_order1) *
pow(input[m_ic2],m_order2);
output[m_rxn] *= ppow(input[m_ic0],m_order0) *
ppow(input[m_ic1],m_order1) *
ppow(input[m_ic2],m_order2);
}
void incrementSpecies(const doublereal* input,
doublereal* output) const {
@ -300,7 +306,7 @@ namespace Cantera {
void power(const doublereal* input, doublereal* output) const {
for (int n = 0; n < m_n; n++) output[m_rxn]
*= pow(input[m_ic[n]],m_order[n]);
*= ppow(input[m_ic[n]],m_order[n]);
}
void multiply(const doublereal* input, doublereal* output) const {

View file

@ -260,9 +260,9 @@ docs:
depends:
cd Cantera; @MAKE@ depends
cd tools; @MAKE@ depends
ifeq ($(build_particles ,1)
ifeq ($(build_particles),1)
cd Cantera/cads; @MAKE@ depends
endif
endif
changes:
cvs2cl.pl --prune

View file

@ -36,6 +36,9 @@ depends: $(DEPENDS)
cat *.d &> .depends
$(RM) $(DEPENDS)
TAGS:
etags *.h *.cpp
ifeq ($(wildcard .depends), .depends)
include .depends
endif