Added parsing of velocityBasis from XML

<transport> 
	<speciesDiffusivity>
		<velocityBasis basis="mass">
Other valid values are "mole" or a species name.
This is loaded into LiquidTransportParams and then copied into
LiquidTransport in the initLiquidTransport() method.
This commit is contained in:
John Hewson 2009-11-30 23:41:38 +00:00
parent 4cee810c18
commit 2cfa85402c
3 changed files with 31 additions and 1 deletions

View file

@ -185,6 +185,7 @@ namespace Cantera {
int k;
// constant substance attributes
m_thermo = tr.thermo;
m_velocityBasis = tr.velocityBasis;
m_nsp = m_thermo->nSpecies();
m_tmin = m_thermo->minTemp();
m_tmax = m_thermo->maxTemp();

View file

@ -1116,6 +1116,31 @@ namespace Cantera {
throw TransportDBError( linenum,
"missing <compositionDependence> node for <"
+ tranTypeNode.name() + "> node." );
}
/* Allow a switch between mass-averaged, mole-averaged
* and solvent specified reference velocities.
* XML code within the transportProperty node
* (i.e. within <viscosity>) should read as follows
* <velocityBasis basis="mass"> <!-- mass averaged -->
* <velocityBasis basis="mole"> <!-- mole averaged -->
* <velocityBasis basis="H2O"> <!-- H2O solvent -->
*/
if ( tranTypeNode.hasChild("velocityBasis")) {
std::string velocityBasis =
tranTypeNode.child("velocityBasis").attrib("basis");
if ( velocityBasis == "mass" )
trParam.velocityBasis = VB_MASSAVG;
else if ( velocityBasis == "mole" )
trParam.velocityBasis = VB_MOLEAVG;
else if ( trParam.thermo->speciesIndex( velocityBasis ) > 0 )
trParam.velocityBasis = trParam.thermo->speciesIndex( velocityBasis ) ;
else {
int linenum;
throw TransportDBError( linenum, "Unknown attribute " + velocityBasis + " for <velocityBasis> node. ");
}
}
}
}

View file

@ -19,7 +19,7 @@ namespace Cantera {
public:
TransportParams() : thermo(0), xml(0) {}
TransportParams() : thermo(0), xml(0), velocityBasis(VB_MASSAVG) {}
virtual ~TransportParams();
int nsp_;
@ -27,6 +27,10 @@ namespace Cantera {
thermo_t* thermo;
vector_fp mw;
//! A basis for the average velocity can be specified.
//! Valid bases include "mole" "mass" and species names.
int velocityBasis;
//minimum and maximum temperatures for parameter fits
doublereal tmax, tmin;
int mode_;