Removed deprecated 'GasTransportData' struct

Simplified implementation of TransportFactory::getTransportData,
and removed data members of MixTransport and MultiTransport that
were only used to fill in the GasTransportData structure.
This commit is contained in:
Ray Speth 2012-07-16 22:18:58 +00:00
parent cfe5824a7d
commit 8611f43eb0
6 changed files with 65 additions and 326 deletions

View file

@ -216,16 +216,6 @@ public:
friend class TransportFactory;
//! Return a structure containing all of the pertinent parameters about a species that was
//! used to construct the Transport properties in this object.
/*!
* @param kspec Species number to obtain the properties from.
*
* @return GasTransportData returned structure.
* @deprecated
*/
DEPRECATED(struct GasTransportData getGasTransportData(int kspec) const);
private:
//! Calculate the pressure from the ideal gas law
@ -271,68 +261,6 @@ private:
//! Update boolean for the mixture rule for the mixture thermal conductivity
bool m_condmix_ok;
//! Lennard-Jones well-depth of the species in the current phase
/*!
* Not used in this routine -> just a passthrough
*
* length is the number of species in the phase
* Units are Joules (Note this is not Joules/kmol) (note, no kmol -> this is a per molecule amount)
*/
vector_fp m_eps;
//! hard-sphere diameter for (i,j) collision
/*!
* Not used in this routine -> just a passthrough
*
* diam(i,j) = 0.5*(tr.sigma[i] + tr.sigma[j]);
* Units are m (note, no kmol -> this is a per molecule amount)
*
* Length nsp * nsp. This is a symmetric matrix.
*/
DenseMatrix m_diam;
//! The effective dipole moment for (i,j) collisions
/*!
* tr.dipoleMoment has units of Debye's. A Debye is 10-18 cm3/2 erg1/2
*
* Not used in this routine -> just a passthrough
*
* tr.dipole(i,i) = 1.e-25 * SqrtTen * trdat.dipoleMoment;
* tr.dipole(i,j) = sqrt(tr.dipole(i,i)*tr.dipole(j,j));
* Units are in Debye (note, no kmol -> this is a per molecule amount)
*
* Length nsp. We store only the diagonal component here.
*/
vector_fp m_dipoleDiag;
//! Polarizability of each species in the phase
/*!
* Not used in this routine -> just a passthrough
*
* Length = nsp
* Units = m^3
*/
vector_fp m_alpha;
//! Dimensionless rotational heat capacity of the species in the current phase
/*!
* Not used in this routine -> just a passthrough
*
* These values are 0, 1 and 1.5 for single-molecule, linear, and nonlinear species respectively
* length is the number of species in the phase
* units are dimensionless (Cr / R)
*/
vector_fp m_crot;
//! Rotational relaxation number for the species in the current phase
/*!
* Not used in this routine -> just a passthrough
*
* length is the number of species in the phase
* units are dimensionless
*/
vector_fp m_zrot;
//! Debug flag - turns on more printing
bool m_debug;
};

View file

@ -141,14 +141,6 @@ public:
friend class TransportFactory;
//! Return a structure containing all of the pertinent parameters
//! about a species that was used to construct the Transport properties in this object
/*!
* @param k Species index
* @deprecated
*/
DEPRECATED(struct GasTransportData getGasTransportData(int k));
protected:
//! Update basic temperature-dependent quantities if the temperature has changed.
@ -191,8 +183,6 @@ private:
vector_fp m_crot;
vector_fp m_cinternal;
vector_fp m_eps;
vector_fp m_alpha;
vector_fp m_dipoleDiag;
vector_fp m_sqrt_eps_k;
DenseMatrix m_log_eps_k;
@ -247,8 +237,6 @@ private:
}
void solveLMatrixEquation();
DenseMatrix m_epsilon;
DenseMatrix m_diam;
DenseMatrix incl;
bool m_debug;
};

View file

@ -25,69 +25,13 @@
//======================================================================================================================
namespace Cantera
{
//====================================================================================================================
//! Struct to hold data read from a transport property database file for gas-phase species
struct GasTransportData {
//! Default constructor
GasTransportData() :
speciesName("-"),
geometry(-1),
wellDepth(-1.0),
diameter(-1.0),
dipoleMoment(-1.0),
polarizability(-1.0),
rotRelaxNumber(-1.0) {
}
//! gas phase species name
std::string speciesName;
//! Geometry of the molecule
/*!
* 0 - single atom
* 1 - linear atom
* 2 - non-linear geom
*/
int geometry;
//! well-depth parameter
/*!
* units - temperature (CHECK)
*/
doublereal wellDepth;
//! Lennard-Jones diameter of the molecule
/*!
* units - Angstroms
*/
doublereal diameter;
//! dipole Moment of the molecule
/*!
* units = Debye (a debye is 10-18 cm3/2 erg1/2)
*/
doublereal dipoleMoment;
//! Polarizability of the molecule
/*!
* units = A**3
*/
doublereal polarizability;
//! Rotational relaxation number
/*!
* Number of collisions it takes to equilibrate the rotational dofs with the temperature
*/
doublereal rotRelaxNumber;
};
//====================================================================================================================
// forward references
class MMCollisionInt;
class GasTransportParams;
class LiquidTransportParams;
class XML_Node;
//====================================================================================================================
//! The purpose of the TransportFactory class is to create new instances of
//! 'transport managers', which are classes that provide transport
//! properties and which are derived from the base class, %Transport.
@ -256,7 +200,6 @@ private:
XML_Node& log, const std::vector<std::string>& names,
GasTransportParams& tr);
//! Read transport property data from a file for a list of species that comprise
//! the phase.
/*!

View file

@ -33,12 +33,6 @@ MixTransport::MixTransport() :
m_lambda(0.0),
m_spcond_ok(false),
m_condmix_ok(false),
m_eps(0),
m_diam(0, 0),
m_dipoleDiag(0),
m_alpha(0),
m_crot(0),
m_zrot(0),
m_debug(false)
{
}
@ -50,12 +44,6 @@ MixTransport::MixTransport(const MixTransport& right) :
m_lambda(0.0),
m_spcond_ok(false),
m_condmix_ok(false),
m_eps(0),
m_diam(0, 0),
m_dipoleDiag(0),
m_alpha(0),
m_crot(0),
m_zrot(0),
m_debug(false)
{
*this = right;
@ -80,12 +68,6 @@ MixTransport& MixTransport::operator=(const MixTransport& right)
m_lambda = right.m_lambda;
m_spcond_ok = right.m_spcond_ok;
m_condmix_ok = right.m_condmix_ok;
m_eps = right.m_eps;
m_diam = right.m_diam;
m_dipoleDiag = right.m_dipoleDiag;
m_alpha = right.m_alpha;
m_crot = right.m_crot;
m_zrot = right.m_zrot;
m_debug = right.m_debug;
return *this;
@ -114,16 +96,6 @@ bool MixTransport::initGas(GasTransportParams& tr)
// copy polynomials and parameters into local storage
m_condcoeffs = tr.condcoeffs;
m_zrot = tr.zrot;
m_crot = tr.crot;
m_diam = tr.diam;
m_eps = tr.eps;
m_alpha = tr.alpha;
m_dipoleDiag.resize(m_nsp);
for (size_t i = 0; i < m_nsp; i++) {
m_dipoleDiag[i] = tr.dipole(i,i);
}
m_cond.resize(m_nsp);
// set flags all false
@ -314,29 +286,4 @@ void MixTransport::updateCond_T()
m_condmix_ok = false;
}
//====================================================================================================================
/*
* This function returns a Transport data object for a given species.
*
*/
struct GasTransportData MixTransport::getGasTransportData(int kSpecies) const {
struct GasTransportData td;
td.speciesName = m_thermo->speciesName(kSpecies);
td.geometry = 2;
if (m_crot[kSpecies] == 0.0) {
td.geometry = 0;
} else if (m_crot[kSpecies] == 1.0) {
td.geometry = 1;
}
td.wellDepth = m_eps[kSpecies] / Boltzmann;
td.dipoleMoment = m_dipoleDiag[kSpecies] * 1.0E25 / SqrtTen;
td.diameter = m_diam(kSpecies, kSpecies) * 1.0E10;
td.polarizability = m_alpha[kSpecies] * 1.0E30;
td.rotRelaxNumber = m_zrot[kSpecies];
return td;
}
//====================================================================================================================
}

View file

@ -73,14 +73,7 @@ bool MultiTransport::initGas(GasTransportParams& tr)
m_om22_poly = tr.omega22_poly;
m_zrot = tr.zrot;
m_crot = tr.crot;
m_epsilon = tr.epsilon;
m_diam = tr.diam;
m_eps = tr.eps;
m_alpha = tr.alpha;
m_dipoleDiag.resize(m_nsp);
for (size_t i = 0; i < m_nsp; i++) {
m_dipoleDiag[i] = tr.dipole(i,i);
}
// the L matrix
m_Lmatrix.resize(3*m_nsp, 3*m_nsp);
@ -660,29 +653,4 @@ void MultiTransport::updateThermal_T()
m_thermal_tlast = m_thermo->temperature();
}
//====================================================================================================================
/*
* This function returns a Transport data object for a given species.
*
*/
struct GasTransportData MultiTransport::
getGasTransportData(int kSpecies) {
struct GasTransportData td;
td.speciesName = m_thermo->speciesName(kSpecies);
td.geometry = 2;
if (m_crot[kSpecies] == 0.0) {
td.geometry = 0;
} else if (m_crot[kSpecies] == 1.0) {
td.geometry = 1;
}
td.wellDepth = m_eps[kSpecies] / Boltzmann;
td.dipoleMoment = m_dipoleDiag[kSpecies] * 1.0E25 / SqrtTen;
td.diameter = m_diam(kSpecies, kSpecies) * 1.0E10;
td.polarizability = m_alpha[kSpecies] * 1.0E30;
td.rotRelaxNumber = m_zrot[kSpecies];
return td;
}
//====================================================================================================================
}

View file

@ -791,119 +791,84 @@ void TransportFactory::fitCollisionIntegrals(ostream& logfile,
void TransportFactory::getTransportData(const std::vector<const XML_Node*> &xspecies,
XML_Node& log, const std::vector<std::string> &names, GasTransportParams& tr)
{
std::string name;
int geom;
std::map<std::string, GasTransportData> datatable;
doublereal welldepth, diam, dipole, polar, rot;
size_t nsp = xspecies.size();
// read all entries in database into 'datatable' and check for
// errors. Note that this procedure validates all entries, not
// only those for the species listed in 'names'.
std::string val, type;
map<std::string, int> gindx;
gindx["atom"] = 100;
gindx["linear"] = 101;
gindx["nonlinear"] = 102;
int linenum = 0;
for (size_t i = 0; i < nsp; i++) {
const XML_Node& sp = *xspecies[i];
name = sp["name"];
// std::cout << "Processing node for " << name << std::endl;
// put in a try block so that species with no 'transport'
// child are skipped, instead of throwing an exception.
try {
XML_Node& tr = sp.child("transport");
ctml::getString(tr, "geometry", val, type);
geom = gindx[val] - 100;
map<std::string, doublereal> fv;
welldepth = ctml::getFloat(tr, "LJ_welldepth");
diam = ctml::getFloat(tr, "LJ_diameter");
dipole = ctml::getFloat(tr, "dipoleMoment");
polar = ctml::getFloat(tr, "polarizability");
rot = ctml::getFloat(tr, "rotRelax");
GasTransportData data;
data.speciesName = name;
data.geometry = geom;
if (welldepth >= 0.0) {
data.wellDepth = welldepth;
} else throw TransportDBError(linenum,
"negative well depth");
if (diam > 0.0) {
data.diameter = diam;
} else throw TransportDBError(linenum,
"negative or zero diameter");
if (dipole >= 0.0) {
data.dipoleMoment = dipole;
} else throw TransportDBError(linenum,
"negative dipole moment");
if (polar >= 0.0) {
data.polarizability = polar;
} else throw TransportDBError(linenum,
"negative polarizability");
if (rot >= 0.0) {
data.rotRelaxNumber = rot;
} else throw TransportDBError(linenum,
"negative rotation relaxation number");
datatable[name] = data;
} catch (CanteraError& err) {
err.save();
}
std::map<std::string, size_t> speciesIndices;
for (size_t i = 0; i < names.size(); i++) {
speciesIndices[names[i]] = i;
}
for (size_t i = 0; i < tr.nsp_; i++) {
for (size_t i = 0; i < xspecies.size(); i++) {
const XML_Node& sp = *xspecies[i];
GasTransportData& trdat = datatable[names[i]];
// 'datatable' returns a default TransportData object if
// the species name is not one in the transport database.
// This can be detected by examining 'geometry'.
if (trdat.geometry < 0) {
throw TransportDBError(0,"no transport data found for species "
+ names[i]);
// Find the index for this species in 'names'
std::map<std::string, size_t>::const_iterator iter =
speciesIndices.find(sp["name"]);
size_t j;
if (iter != speciesIndices.end()) {
j = iter->second;
} else {
// Don't need transport data for this species
continue;
}
XML_Node& node = sp.child("transport");
// parameters are converted to SI units before storing
// rotational heat capacity / R
switch (trdat.geometry) {
case 0:
tr.crot[i] = 0.0; // monatomic
break;
case 1:
tr.crot[i] = 1.0; // linear
break;
default:
tr.crot[i] = 1.5; // nonlinear
}
tr.dipole(i,i) = 1.e-25 * SqrtTen * trdat.dipoleMoment;
if (trdat.dipoleMoment > 0.0) {
tr.polar[i] = true;
// Molecular geometry; rotational heat capacity / R
std::string geom, type;
ctml::getString(node, "geometry", geom, type);
if (geom == "atom") {
tr.crot[j] = 0.0;
} else if (geom == "linear") {
tr.crot[j] = 1.0;
} else if (geom == "nonlinear") {
tr.crot[j] = 1.5;
} else {
tr.polar[i] = false;
throw TransportDBError(i, "invalid geometry");
}
// A^3 -> m^3
tr.alpha[i] = 1.e-30 * trdat.polarizability;
// Well-depth parameter in Kelvin (converted to Joules)
double welldepth = ctml::getFloat(node, "LJ_welldepth");
if (welldepth >= 0.0) {
tr.eps[j] = Boltzmann * welldepth;
} else {
throw TransportDBError(i, "negative well depth");
}
tr.sigma[i] = 1.e-10 * trdat.diameter;
// Lennard-Jones diameter of the molecule, given in Angstroms.
double diam = ctml::getFloat(node, "LJ_diameter");
if (diam > 0.0) {
tr.sigma[j] = 1.e-10 * diam; // A -> m
} else {
throw TransportDBError(i, "negative or zero diameter");
}
tr.eps[i] = Boltzmann * trdat.wellDepth;
tr.zrot[i] = std::max(1.0, trdat.rotRelaxNumber);
// Dipole moment of the molecule.
// Given in Debye (a debye is 10-18 cm3/2 erg1/2)
double dipole = ctml::getFloat(node, "dipoleMoment");
if (dipole >= 0.0) {
tr.dipole(j,j) = 1.e-25 * SqrtTen * dipole;
tr.polar[j] = (dipole > 0.0);
} else {
throw TransportDBError(i, "negative dipole moment");
}
// Polarizability of the molecule, given in cubic Angstroms.
double polar = ctml::getFloat(node, "polarizability");
if (polar >= 0.0) {
tr.alpha[j] = 1.e-30 * polar; // A^3 -> m^3
} else {
throw TransportDBError(i, "negative polarizability");
}
// Rotational relaxation number. (Number of collisions it takes to
// equilibrate the rotational dofs with the temperature)
double rot = ctml::getFloat(node, "rotRelax");
if (rot >= 0.0) {
tr.zrot[j] = std::max(1.0, rot);
} else {
throw TransportDBError(i, "negative rotation relaxation number");
}
}
}