Fixed a compilation error

Added doxygen info
This commit is contained in:
Harry Moffat 2010-04-02 17:40:52 +00:00
parent 58719349cb
commit d906ca5951
3 changed files with 110 additions and 85 deletions

View file

@ -685,7 +685,9 @@ namespace Cantera {
IonsFromNeutralVPSSTP * ions_thermo = dynamic_cast<IonsFromNeutralVPSSTP *>(m_thermo);
int i, j, k;
int nsp = m_thermo->nSpecies();
if (nsp != 3) throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Function may only be called with a 3-ion system");
if (nsp != 3) {
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Function may only be called with a 3-ion system");
}
int nsp2 = nsp*nsp;
doublereal temp = m_thermo->temperature();
doublereal molefracs[nsp];
@ -705,12 +707,15 @@ namespace Cantera {
std::vector<int> neutMolIndex(3);
ions_thermo->getDissociationCoeffs(viS,charges,neutMolIndex);
if ((int)anion.size() != 1)
if ((int)anion.size() != 1) {
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Must have one anion only for StefanMaxwell_PPN");
if ((int)cation.size() != 2)
}
if ((int)cation.size() != 2) {
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Must have two cations of equal charge for StefanMaxwell_PPN");
if (charges[cation[0]] != charges[cation[1]])
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Cations must be of equal charge for StefanMaxwell_PPN")
}
if (charges[cation[0]] != charges[cation[1]]) {
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Cations must be of equal charge for StefanMaxwell_PPN");
}
m_ionCondMix = m_ionCondMixModel->getMixTransProp(m_ionCondSpecies);
@ -718,18 +723,20 @@ namespace Cantera {
doublereal vol = m_thermo->molarVolume();
k = 0;
for ( j = 0; j < nsp; j++ ) {
for ( i = 0; i < nsp; i++ ) {
for (j = 0; j < nsp; j++) {
for (i = 0; i < nsp; i++) {
if (m_mobRatMixModel[k]) {
m_mobRatMix(i,j) = m_mobRatMixModel[k]->getMixTransProp( m_mobRatSpecies[k] );
if ( m_mobRatMix(i,j) > 0 ) m_mobRatMix(j,i) = 1.0/m_mobRatMix(i,j);
if (m_mobRatMix(i,j) > 0) {
m_mobRatMix(j,i) = 1.0/m_mobRatMix(i,j);
}
}
k++;
}
}
for ( k = 0; k < nsp; k++ ){
for (k = 0; k < nsp; k++) {
m_selfDiffMix[k] = m_selfDiffMixModel[k]->getMixTransProp( m_selfDiffSpecies[k] );
}
@ -750,8 +757,8 @@ namespace Cantera {
mat.resize( nsp, nsp, 0.0 );
mat(cation[0],cation[1]) = mat(cation[1],cation[0]) = (1+vM/vP)*(1+eps*xB)*(1-eps*xA)*inv_vP_vM_MutualDiff-zP*zP*Faraday*Faraday/GasConstant/temp/m_ionCondMix/vol;
mat(cation[0],anion[0]) = mat(anion[0],cation[0]) = (1+vP/vM)*(-eps*xB*(1-eps*xA)*inv_vP_vM_MutualDiff)-zP*zM*Faraday*Faraday/GasConstant/temp/m_ionCondMix/vol;
mat(cation[1],anion[0]) = mat(anion[0],cation[1]) = (1+vP/vM)*(eps*xA*(1+eps*xB)*inv_vP_vM_MutualDiff)-zP*zM*Faraday*Faraday/GasConstant/temp/m_ionCondMix/vol;
mat(cation[0],anion[0]) = mat(anion[0],cation[0]) = (1+vP/vM)*(-eps*xB*(1-eps*xA)*inv_vP_vM_MutualDiff)-zP*zM*Faraday*Faraday/GasConstant/temp/m_ionCondMix/vol;
mat(cation[1],anion[0]) = mat(anion[0],cation[1]) = (1+vP/vM)*(eps*xA*(1+eps*xB)*inv_vP_vM_MutualDiff)-zP*zM*Faraday*Faraday/GasConstant/temp/m_ionCondMix/vol;
}

View file

@ -487,14 +487,23 @@ namespace Cantera {
return newTransport(transportModel, phase,log_level);
}
/*
Prepare to build a new kinetic-theory-based transport manager
for low-density gases. Uses polynomial fits to Monchick & Mason
collision integrals.
*/
void TransportFactory::setupMM(std::ostream &flog,
const std::vector<const XML_Node*> &transport_database,
//====================================================================================================================
// Prepare to build a new kinetic-theory-based transport manager for low-density gases
/*
* This class fills up the GastransportParams structure for the current phase
*
* Uses polynomial fits to Monchick & Mason collision integrals. store then in tr
*
* @param flog Reference to the ostream for writing log info
* @param transport_database Reference to a vector of pointers containing the
* transport database for each species
* @param thermo Pointer to the %ThermoPhase object
* @param mode Mode -> Either it's CK_Mode, chemkin compatibility mode, or it is not
* We usually run with chemkin compatibility mode turned off.
* @param log_level log level
* @param tr GasTransportParams structure to be filled up with information
*/
void TransportFactory::setupMM(std::ostream &flog, const std::vector<const XML_Node*> &transport_database,
thermo_t* thermo, int mode, int log_level, GasTransportParams& tr) {
// constant mixture attributes
@ -507,8 +516,7 @@ namespace Cantera {
tr.mw.resize(nsp);
tr.log_level = log_level;
copy(tr.thermo->molecularWeights().begin(),
tr.thermo->molecularWeights().end(), tr.mw.begin());
copy(tr.thermo->molecularWeights().begin(), tr.thermo->molecularWeights().end(), tr.mw.begin());
tr.mode_ = mode;
tr.epsilon.resize(nsp, nsp, 0.0);
@ -525,8 +533,7 @@ namespace Cantera {
tr.eps.resize(nsp);
XML_Node root, log;
getTransportData(transport_database, log,
tr.thermo->speciesNames(), tr);
getTransportData(transport_database, log, tr.thermo->speciesNames(), tr);
int i, j;
for (i = 0; i < nsp; i++) tr.poly[i].resize(nsp);
@ -537,47 +544,44 @@ namespace Cantera {
DenseMatrix& diam = tr.diam;
DenseMatrix& epsilon = tr.epsilon;
for (i = 0; i < nsp; i++)
{
for (j = i; j < nsp; j++)
{
// the reduced mass
tr.reducedMass(i,j) =
tr.mw[i] * tr.mw[j] / (Avogadro * (tr.mw[i] + tr.mw[j]));
for (i = 0; i < nsp; i++) {
for (j = i; j < nsp; j++) {
// the reduced mass
tr.reducedMass(i,j) = tr.mw[i] * tr.mw[j] / (Avogadro * (tr.mw[i] + tr.mw[j]));
// hard-sphere diameter for (i,j) collisions
diam(i,j) = 0.5*(tr.sigma[i] + tr.sigma[j]);
// hard-sphere diameter for (i,j) collisions
diam(i,j) = 0.5*(tr.sigma[i] + tr.sigma[j]);
// the effective well depth for (i,j) collisions
epsilon(i,j) = sqrt(tr.eps[i]*tr.eps[j]);
// the effective well depth for (i,j) collisions
epsilon(i,j) = sqrt(tr.eps[i]*tr.eps[j]);
// The polynomial fits of collision integrals vs. T*
// will be done for the T* from tstar_min to tstar_max
ts1 = Boltzmann * tr.tmin/epsilon(i,j);
ts2 = Boltzmann * tr.tmax/epsilon(i,j);
if (ts1 < tstar_min) tstar_min = ts1;
if (ts2 > tstar_max) tstar_max = ts2;
// The polynomial fits of collision integrals vs. T*
// will be done for the T* from tstar_min to tstar_max
ts1 = Boltzmann * tr.tmin/epsilon(i,j);
ts2 = Boltzmann * tr.tmax/epsilon(i,j);
if (ts1 < tstar_min) tstar_min = ts1;
if (ts2 > tstar_max) tstar_max = ts2;
// the effective dipole moment for (i,j) collisions
tr.dipole(i,j) = sqrt(tr.dipole(i,i)*tr.dipole(j,j));
// the effective dipole moment for (i,j) collisions
tr.dipole(i,j) = sqrt(tr.dipole(i,i)*tr.dipole(j,j));
// reduced dipole moment delta* (nondimensional)
doublereal d = diam(i,j);
tr.delta(i,j) = 0.5 * tr.dipole(i,j)*tr.dipole(i,j)
/ (epsilon(i,j) * d * d * d);
// reduced dipole moment delta* (nondimensional)
doublereal d = diam(i,j);
tr.delta(i,j) = 0.5 * tr.dipole(i,j)*tr.dipole(i,j)
/ (epsilon(i,j) * d * d * d);
makePolarCorrections(i, j, tr, f_eps, f_sigma);
tr.diam(i,j) *= f_sigma;
epsilon(i,j) *= f_eps;
makePolarCorrections(i, j, tr, f_eps, f_sigma);
tr.diam(i,j) *= f_sigma;
epsilon(i,j) *= f_eps;
// properties are symmetric
tr.reducedMass(j,i) = tr.reducedMass(i,j);
diam(j,i) = diam(i,j);
epsilon(j,i) = epsilon(i,j);
tr.dipole(j,i) = tr.dipole(i,j);
tr.delta(j,i) = tr.delta(i,j);
}
// properties are symmetric
tr.reducedMass(j,i) = tr.reducedMass(i,j);
diam(j,i) = diam(i,j);
epsilon(j,i) = epsilon(i,j);
tr.dipole(j,i) = tr.dipole(i,j);
tr.delta(j,i) = tr.delta(i,j);
}
}
// Chemkin fits the entire T* range in the Monchick and Mason tables,
// so modify tstar_min and tstar_max if in Chemkin compatibility mode
@ -617,14 +621,17 @@ namespace Cantera {
#endif
}
//====================================================================================================================
// Prepare to build a new transport manager for liquids assuming that
// viscosity transport data is provided in Arhennius form.
/*
Prepare to build a new transport manager for liquids assuming that
viscosity transport data is provided in Arhennius form.
*/
void TransportFactory::setupLiquidTransport(std::ostream &flog,
thermo_t* thermo, int log_level, LiquidTransportParams& trParam) {
* @param flog Reference to the ostream for writing log info
* @param thermo Pointer to the %ThermoPhase object
* @param log_level log level
* @param trParam LiquidTransportParams structure to be filled up with information
*/
void TransportFactory::setupLiquidTransport(std::ostream &flog, thermo_t* thermo, int log_level,
LiquidTransportParams& trParam) {
const std::vector<const XML_Node*> & species_database = thermo->speciesData();
const XML_Node* phase_database = &thermo->xml();
@ -668,6 +675,7 @@ namespace Cantera {
trParam.thermo->speciesNames(), trParam);
}
}
//====================================================================================================================
void TransportFactory::initTransport(Transport* tran,

View file

@ -86,10 +86,10 @@ namespace Cantera {
class TransportFactory : FactoryBase {
public:
/**
* Return a pointer to a TransportFactory
* instance. TransportFactory is implemented as a 'singleton',
//! Return a pointer to a TransportFactory instance.
/*!
* TransportFactory is implemented as a 'singleton',
* which means that at most one instance may be created. The
* constructor is private. When a TransportFactory instance is
* required, call static method factory() to return a pointer
@ -111,11 +111,10 @@ namespace Cantera {
}
/**
* This static function deletes the statically malloced instance.
*/
//! Deletes the statically malloced instance.
virtual void deleteFactory();
/*!
* Destructor
*
@ -159,8 +158,7 @@ namespace Cantera {
* @param thermo ThermoPhase object
* @param log_level log level
*/
virtual Transport*
newTransport(std::string model, thermo_t* thermo, int log_level=0);
virtual Transport* newTransport(std::string model, thermo_t* thermo, int log_level=0);
//! Build a new transport manager using the default transport manager
//! in the phase description and return a base class pointer to it
@ -272,23 +270,35 @@ namespace Cantera {
void fitCollisionIntegrals(std::ostream & logfile,
GasTransportParams& tr);
/**
* Prepare to build a new kinetic-theory-based transport manager
* for low-density gases. Uses polynomial fits to Monchick & Mason
* collision integrals.
//! Prepare to build a new kinetic-theory-based transport manager for low-density gases
/*!
* This class fills up the GastransportParams structure for the current phase
*
* Uses polynomial fits to Monchick & Mason collision integrals. store then in tr
*
* @param flog Reference to the ostream for writing log info
* @param transport_database Reference to a vector of pointers containing the
* transport database for each species
* @param thermo Pointer to the %ThermoPhase object
* @param mode Mode -> Either it's CK_Mode, chemkin compatibility mode, or it is not
* We usually run with chemkin compatibility mode turned off.
* @param log_level log level
* @param tr GasTransportParams structure to be filled up with information
*/
void setupMM(std::ostream &flog, const std::vector<const XML_Node*> &transport_database,
thermo_t* thermo, int mode, int log_level,
GasTransportParams& tr);
thermo_t* thermo, int mode, int log_level, GasTransportParams& tr);
/**
* Prepare to build a new transport manager for liquids assuming that
* viscosity transport data is provided in Arhennius form.
//! Prepare to build a new transport manager for liquids assuming that
//! viscosity transport data is provided in Arhennius form.
/*!
* @param flog Reference to the ostream for writing log info
* @param thermo Pointer to the %ThermoPhase object
* @param log_level log level
* @param trParam LiquidTransportParams structure to be filled up with information
*/
void setupLiquidTransport(std::ostream &flog,
thermo_t* thermo, int log_level,
LiquidTransportParams& tr);
void setupLiquidTransport(std::ostream &flog, thermo_t* thermo, int log_level, LiquidTransportParams& trParam);
//! Second-order correction to the binary diffusion coefficients