LiquidTransportParams.h TransportFactory.cpp
Filled out TransportFactory::getLiquidInteractionsTransportData to parse interaction parameters. About 220 lines of XML node extraction added. LiquidTransport.h LiquidTransport.cpp Near the end of LiquidTransport::initLiquid, added the copying of interaction parameters from the LiquidTransportParams object to members: + m_visc_Eij = tr.visc_Eij; + m_visc_Sij = tr.visc_Sij; + m_lambda_Aij = tr.thermalCond_Aij; + m_diff_Dij = tr.diff_Dij; + m_radius_Aij = tr.radius_Aij; Note that the last member was added to allow for hydrodynamic radius mixing rules.
This commit is contained in:
parent
a4b9fd56c4
commit
33cf246c25
4 changed files with 248 additions and 38 deletions
|
|
@ -325,37 +325,40 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Read the transport block in the phase XML Node
|
||||
* It's not an error if this block doesn't exist. Just use the defaults
|
||||
* Here we get interaction parameters from LiquidTransportParams
|
||||
* that were filled in TransportFactory::getLiquidInteractionsTransportData
|
||||
*/
|
||||
|
||||
//HERE WE NEED TO GET THINGS FROM
|
||||
//TransportFactory::getLiquidInteractionsTransportData
|
||||
/*
|
||||
* Viscosity mixing rules
|
||||
*/
|
||||
m_viscMixModel = tr.model_viscosity;
|
||||
m_visc_Eij.resize(m_nsp,m_nsp);
|
||||
m_visc_Sij.resize(m_nsp,m_nsp);
|
||||
|
||||
|
||||
m_visc_Eij = tr.visc_Eij;
|
||||
m_visc_Sij = tr.visc_Sij;
|
||||
|
||||
/*
|
||||
* Thermal conductivity mixing rules
|
||||
*/
|
||||
m_lambdaMixModel = tr.model_viscosity;
|
||||
m_lambdaMixModel = tr.model_thermalCond;
|
||||
m_lambda_Aij.resize(m_nsp,m_nsp);
|
||||
m_lambda_Aij = tr.thermalCond_Aij;
|
||||
|
||||
/*
|
||||
* Species Diffusivity binary diffusion coefficients
|
||||
* for Stefan Maxwell equation or "mixing rules"
|
||||
*/
|
||||
m_diffMixModel = tr.model_viscosity;
|
||||
m_diffMixModel = tr.model_speciesDiffusivity;
|
||||
m_diff_Dij.resize(m_nsp,m_nsp);
|
||||
m_diff_Dij = tr.diff_Dij;
|
||||
|
||||
/*
|
||||
* Hydrodynamic radius mixing model rules
|
||||
*/
|
||||
m_radiusMixModel = tr.model_radius;
|
||||
m_radius_Aij.resize(m_nsp,m_nsp);
|
||||
m_radius_Aij = tr.radius_Aij;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -612,6 +612,9 @@ namespace Cantera {
|
|||
*/
|
||||
LiquidTranMixingModel m_radiusMixModel;
|
||||
|
||||
//! Hydrodynamic radius mixing model interaction parameters
|
||||
DenseMatrix m_radius_Aij;
|
||||
|
||||
|
||||
//! Polynomial coefficients of the binary diffusion coefficients
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ namespace Cantera {
|
|||
* <viscosity>
|
||||
* <compositionDependence model="logMoleFractions">
|
||||
* <interaction>
|
||||
* <species1> LiCl(L) </species1>
|
||||
* <species2> KCl(L) </species2>
|
||||
* <speciesA> LiCl(L) </speciesA>
|
||||
* <speciesB> KCl(L) </speciesB>
|
||||
* <Eij units="J/kmol"> -1.0 </Eij>
|
||||
* <Sij units="J/kmol/K"> 1.0E-1 </Eij>
|
||||
* </interaction>
|
||||
|
|
@ -37,18 +37,18 @@ namespace Cantera {
|
|||
* <speciesDiffusivity>
|
||||
* <compositionDependence model="pairwiseInteraction">
|
||||
* <interaction>
|
||||
* <species1> Li+ </species1>
|
||||
* <species2> K+ </species2>
|
||||
* <speciesA> Li+ </speciesA>
|
||||
* <speciesB> K+ </speciesB>
|
||||
* <Dij units="m2/s"> 1.5 </Dij>
|
||||
* </interaction>
|
||||
* <interaction>
|
||||
* <species1> K+ </species1>
|
||||
* <species2> Cl- </species2>
|
||||
* <speciesA> K+ </speciesA>
|
||||
* <speciesB> Cl- </speciesB>
|
||||
* <Dij units="m2/s"> 1.0 </Dij>
|
||||
* </interaction>
|
||||
* <interaction>
|
||||
* <species1> Li+ </species1>
|
||||
* <species2> Cl- </species2>
|
||||
* <speciesA> Li+ </speciesA>
|
||||
* <speciesB> Cl- </speciesB>
|
||||
* <Dij units="m2/s"> 1.2 </Dij>
|
||||
* </interaction>
|
||||
* </compositionDependence>
|
||||
|
|
@ -140,6 +140,12 @@ namespace Cantera {
|
|||
//! Model for species interaction effects for hydrodynamic radius
|
||||
//! Takes enum LiquidTranMixingModel
|
||||
LiquidTranMixingModel model_hydroradius;
|
||||
|
||||
//! Interaction associated with hydrodynamic radius.
|
||||
/**
|
||||
* Not yet implemented
|
||||
*/
|
||||
DenseMatrix radius_Aij;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1124,30 +1124,228 @@ namespace Cantera {
|
|||
LiquidTransportParams& trParam)
|
||||
{
|
||||
|
||||
if ( transportNode.hasChild("viscosity")) {
|
||||
XML_Node& viscosityNode = transportNode.child("viscosity");
|
||||
if ( viscosityNode.hasChild("compositionDependence") ) {
|
||||
XML_Node& compositionNode = viscosityNode.child("compositionDependence");
|
||||
std::string compositionModel = compositionNode.attrib("model");
|
||||
if ( compositionModel == "" ) {
|
||||
std::string type;
|
||||
std::string speciesA;
|
||||
std::string speciesB;
|
||||
/*
|
||||
* Viscosity
|
||||
*/
|
||||
if ( transportNode.hasChild("viscosity")) {
|
||||
XML_Node& viscosityNode = transportNode.child("viscosity");
|
||||
if ( viscosityNode.hasChild("compositionDependence") ) {
|
||||
XML_Node& compositionNode = viscosityNode.child("compositionDependence");
|
||||
std::string compositionModel = compositionNode.attrib("model");
|
||||
if ( compositionModel == "" ) {
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"transport::viscosity XML node doesn't have a model string");
|
||||
} else if ( compositionModel == "none"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_NONE;
|
||||
} else if ( compositionModel == "solvent"){
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
} else if ( compositionModel == "none"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_NONE;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_NONE interactions not implemented for viscosity");
|
||||
} else if ( compositionModel == "solvent"){
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"solvent interactions not implemented");
|
||||
} else if ( compositionModel == "moleFractions"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_MOLEFRACS;
|
||||
} else if ( compositionModel == "massFractions"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_MASSFRACS;
|
||||
} else if ( compositionModel == "logMoleFractions"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_LOG_MOLEFRACS;
|
||||
} else if ( compositionModel == "pairwiseInteractionEnergy"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_PAIRWISE_INTERACTION;
|
||||
}
|
||||
} else if ( compositionModel == "moleFractions"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_MOLEFRACS;
|
||||
} else if ( compositionModel == "massFractions"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_MASSFRACS;
|
||||
} else if ( compositionModel == "logMoleFractions"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_LOG_MOLEFRACS;
|
||||
} else if ( compositionModel == "pairwiseInteractionEnergy"){
|
||||
trParam.model_viscosity = LTR_MIXMODEL_PAIRWISE_INTERACTION;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_PAIRWISE_INTERACTION interactions not implemented for viscosity");
|
||||
}
|
||||
int num = compositionNode.nChildren();
|
||||
for (int iChild = 0; iChild < num; iChild++) {
|
||||
XML_Node &xmlChild = compositionNode.child(iChild);
|
||||
std::string nodeName = lowercase( xmlChild.name() );
|
||||
if ( nodeName != "interaction" )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"expected <interaction> element and got " + nodeName );
|
||||
getString( xmlChild, "speciesA", speciesA, type );
|
||||
getString( xmlChild, "speciesB", speciesB, type );
|
||||
int iSpecies = trParam.thermo->speciesIndex( speciesA );
|
||||
if ( iSpecies < 0 )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"Unknown species " + speciesA );
|
||||
int jSpecies = trParam.thermo->speciesIndex( speciesB );
|
||||
if ( jSpecies < 0 )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"Unknown species " + speciesB );
|
||||
trParam.visc_Eij(iSpecies,jSpecies) = getFloat( xmlChild, "Eij", "toSI" );
|
||||
trParam.visc_Eij(jSpecies,iSpecies) = trParam.visc_Eij(iSpecies,jSpecies) ;
|
||||
trParam.visc_Sij(iSpecies,jSpecies) = getFloat( xmlChild, "Sij", "toSI" );
|
||||
trParam.visc_Sij(jSpecies,iSpecies) = trParam.visc_Sij(iSpecies,jSpecies) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Thermal conductivity
|
||||
*/
|
||||
if ( transportNode.hasChild("thermalConductivity")) {
|
||||
XML_Node& thermCondNode = transportNode.child("thermalConductivity");
|
||||
if ( thermCondNode.hasChild("compositionDependence") ) {
|
||||
XML_Node& compositionNode = thermCondNode.child("compositionDependence");
|
||||
std::string compositionModel = compositionNode.attrib("model");
|
||||
if ( compositionModel == "" ) {
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"transport::thermalConductivity XML node doesn't have a model string");
|
||||
} else if ( compositionModel == "none"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_NONE;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_NONE interactions not implemented for thermalConductivity");
|
||||
} else if ( compositionModel == "solvent"){
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"solvent interactions not implemented");
|
||||
} else if ( compositionModel == "moleFractions"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_MOLEFRACS;
|
||||
} else if ( compositionModel == "massFractions"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_MASSFRACS;
|
||||
} else if ( compositionModel == "logMoleFractions"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_LOG_MOLEFRACS;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_LOG_MOLEFRACS interactions not implemented for thermalConductivity");
|
||||
} else if ( compositionModel == "pairwiseInteractionEnergy"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_PAIRWISE_INTERACTION;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_PAIRWISE_INTERACTION interactions not implemented for thermalConductivity");
|
||||
}
|
||||
int num = compositionNode.nChildren();
|
||||
for (int iChild = 0; iChild < num; iChild++) {
|
||||
XML_Node &xmlChild = compositionNode.child(iChild);
|
||||
std::string nodeName = lowercase( xmlChild.name() );
|
||||
if ( nodeName != "interaction" )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"expected <interaction> element and got <" + nodeName + ">" );
|
||||
getString( xmlChild, "speciesA", speciesA, type );
|
||||
getString( xmlChild, "speciesB", speciesB, type );
|
||||
int iSpecies = trParam.thermo->speciesIndex( speciesA );
|
||||
if ( iSpecies < 0 )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"Unknown species " + speciesA );
|
||||
int jSpecies = trParam.thermo->speciesIndex( speciesB );
|
||||
if ( jSpecies < 0 )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"Unknown species " + speciesB );
|
||||
trParam.thermalCond_Aij(iSpecies,jSpecies) = getFloat( xmlChild, "Aij", "toSI" );
|
||||
trParam.thermalCond_Aij(jSpecies,iSpecies) = trParam.thermalCond_Aij(iSpecies,jSpecies) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Species Diffusivity
|
||||
*/
|
||||
if ( transportNode.hasChild("speciesDiffusivity")) {
|
||||
XML_Node& diffusivityNode = transportNode.child("speciesDiffusivity");
|
||||
if ( diffusivityNode.hasChild("compositionDependence") ) {
|
||||
XML_Node& compositionNode = diffusivityNode.child("compositionDependence");
|
||||
std::string compositionModel = compositionNode.attrib("model");
|
||||
if ( compositionModel == "" ) {
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"transport::speciesDiffusivity XML node doesn't have a model string");
|
||||
} else if ( compositionModel == "none"){
|
||||
trParam.model_speciesDiffusivity = LTR_MIXMODEL_NONE;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_NONE interactions not implemented for speciesDiffusivity");
|
||||
} else if ( compositionModel == "solvent"){
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"solvent interactions not implemented");
|
||||
} else if ( compositionModel == "moleFractions"){
|
||||
trParam.model_speciesDiffusivity = LTR_MIXMODEL_MOLEFRACS;
|
||||
} else if ( compositionModel == "massFractions"){
|
||||
trParam.model_speciesDiffusivity = LTR_MIXMODEL_MASSFRACS;
|
||||
} else if ( compositionModel == "logMoleFractions"){
|
||||
trParam.model_speciesDiffusivity = LTR_MIXMODEL_LOG_MOLEFRACS;
|
||||
} else if ( compositionModel == "pairwiseInteractionEnergy"){
|
||||
trParam.model_speciesDiffusivity = LTR_MIXMODEL_PAIRWISE_INTERACTION;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_PAIRWISE_INTERACTION interactions not implemented for speciesDiffusivity");
|
||||
}
|
||||
int num = compositionNode.nChildren();
|
||||
for (int iChild = 0; iChild < num; iChild++) {
|
||||
XML_Node &xmlChild = compositionNode.child(iChild);
|
||||
std::string nodeName = lowercase( xmlChild.name() );
|
||||
if ( nodeName != "interaction" )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"expected <interaction> element and got " + nodeName );
|
||||
getString( xmlChild, "speciesA", speciesA, type );
|
||||
getString( xmlChild, "speciesB", speciesB, type );
|
||||
int iSpecies = trParam.thermo->speciesIndex( speciesA );
|
||||
if ( iSpecies < 0 )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"Unknown species " + speciesA );
|
||||
int jSpecies = trParam.thermo->speciesIndex( speciesB );
|
||||
if ( jSpecies < 0 )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"Unknown species " + speciesB );
|
||||
trParam.diff_Dij(iSpecies,jSpecies) = getFloat( xmlChild, "Dij", "toSI" );
|
||||
trParam.diff_Dij(jSpecies,iSpecies) = trParam.diff_Dij(iSpecies,jSpecies) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Hydrodynamic radius
|
||||
*/
|
||||
if ( transportNode.hasChild("hydrodynamicRadius")) {
|
||||
XML_Node& radiusNode = transportNode.child("hydrodynamicRadius");
|
||||
if ( radiusNode.hasChild("compositionDependence") ) {
|
||||
XML_Node& compositionNode = radiusNode.child("compositionDependence");
|
||||
std::string compositionModel = compositionNode.attrib("model");
|
||||
if ( compositionModel == "" ) {
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"transport::hydrodynamicRadius XML node doesn't have a model string");
|
||||
} else if ( compositionModel == "none"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_NONE;
|
||||
} else if ( compositionModel == "solvent"){
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"solvent interactions not implemented");
|
||||
} else if ( compositionModel == "moleFractions"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_MOLEFRACS;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_MOLEFRACS interactions not implemented for hydrodynamicRadius");
|
||||
} else if ( compositionModel == "massFractions"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_MASSFRACS;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_MASSFRACS interactions not implemented for hydrodynamicRadius");
|
||||
} else if ( compositionModel == "logMoleFractions"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_LOG_MOLEFRACS;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_LOG_MOLEFRACS interactions not implemented for hydrodynamicRadius");
|
||||
} else if ( compositionModel == "pairwiseInteractionEnergy"){
|
||||
trParam.model_thermalCond = LTR_MIXMODEL_PAIRWISE_INTERACTION;
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"LTR_MIXMODEL_PAIRWISE_INTERACTION interactions not implemented for hydrodynamicRadius");
|
||||
}
|
||||
int num = compositionNode.nChildren();
|
||||
for (int iChild = 0; iChild < num; iChild++) {
|
||||
XML_Node &xmlChild = compositionNode.child(iChild);
|
||||
std::string nodeName = lowercase( xmlChild.name() );
|
||||
if ( nodeName != "interaction" )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"expected <interaction> element and got <" + nodeName + ">" );
|
||||
getString( xmlChild, "speciesA", speciesA, type );
|
||||
getString( xmlChild, "speciesB", speciesB, type );
|
||||
int iSpecies = trParam.thermo->speciesIndex( speciesA );
|
||||
if ( iSpecies < 0 )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"Unknown species " + speciesA );
|
||||
int jSpecies = trParam.thermo->speciesIndex( speciesB );
|
||||
if ( jSpecies < 0 )
|
||||
throw CanteraError("LiquidTransport::getLiquidInteractionsTransportData",
|
||||
"Unknown species " + speciesB );
|
||||
trParam.radius_Aij(iSpecies,jSpecies) = getFloat( xmlChild, "Aij", "toSI" );
|
||||
trParam.radius_Aij(jSpecies,iSpecies) = trParam.radius_Aij(iSpecies,jSpecies) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue