Fixed how IonsFromNeutralVPSSTP.cpp calculates the density...now calculates the neutralmolecule_ density and sets its own.

Fixed some issues in liquid transport w/ zeroing m_prop properly
This commit is contained in:
Christopher Lueth 2010-03-10 16:37:40 +00:00
parent 01f915d01a
commit 7080a151a6
4 changed files with 18 additions and 8 deletions

View file

@ -677,7 +677,10 @@ namespace Cantera {
/*
* Calculate the partial molar volumes, and then the density of the fluid
*/
calcDensity();
//calcDensity();
double dd = neutralMoleculePhase_->density();
State::setDensity(dd);
}
// Calculate ion mole fractions from neutral molecule

View file

@ -1616,7 +1616,10 @@ namespace Cantera {
grad_X.assign(m_Grad_X.begin()+m_nsp*k,m_Grad_X.begin()+m_nsp*(k+1));
m_thermo->getdlnActCoeff( grad_T, DATA_PTR(grad_X), DATA_PTR(grad_lnAC) );
for ( int i = 0; i < m_nsp; i++ )
grad_lnAC[i] += grad_X[i]/m_molefracs[i];
if (m_molefracs[i] < 1.e-15)
grad_lnAC[i] = 0;
else
grad_lnAC[i] += grad_X[i]/m_molefracs[i];
copy(grad_lnAC.begin(),grad_lnAC.end(),m_Grad_lnAC.begin()+m_nsp*k);
// std::cout << k << " m_Grad_lnAC = " << m_Grad_lnAC[k] << std::endl;
}

View file

@ -239,13 +239,15 @@ namespace Cantera {
* adjusted internally according to the information provided.
*/
doublereal LTPspecies_Arrhenius::getSpeciesTransProp( ) {
doublereal t = m_thermo->temperature();
//m_coeffs[0] holds A
//m_coeffs[1] holds n
//m_coeffs[2] holds Tact
//m_coeffs[3] holds log(A)
if (t != m_temp) {
if (t != m_temp) {
m_prop = 0;
m_logProp = 0;
m_temp = t;
m_logt = log(m_temp);
//For viscosity the sign convention on positive activation energy is swithced
@ -321,6 +323,7 @@ namespace Cantera {
doublereal t = m_thermo->temperature();
if (t != m_temp) {
m_prop = 0;
m_temp=t;
double tempN = 1.0;
for (int i = 0; i < (int) m_coeffs.size() ; i++) {
@ -393,6 +396,7 @@ namespace Cantera {
doublereal t = m_thermo->temperature();
if (t != m_temp) {
m_prop = 0;
m_temp=t;
m_prop=m_coeffs[0];
double tempN = 1.0;

View file

@ -721,7 +721,7 @@ namespace Cantera {
cout << "anion 0: " << speciesNames[anion[0]] << endl;
*/
doublereal kappa = m_ionCondMixModel->getMixTransProp(m_ionCondSpecies);
m_ionCondMix = m_ionCondMixModel->getMixTransProp(m_ionCondSpecies);
MargulesVPSSTP * marg_thermo = dynamic_cast<MargulesVPSSTP *> (ions_thermo->neutralMoleculePhase_);
doublereal vol = m_thermo->molarVolume();
@ -801,9 +801,9 @@ namespace Cantera {
throw CanteraError("LTI_StefanMaxwell_PPN::getMixTransProp","Dissociation reactions don't make sense: cationIndex = " + cationIndex);
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/kappa/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/kappa/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/kappa/vol;
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;
/*
for ( i = 0; i < nsp; i++ ) {