More work with LatticeSolidPhase.
Still not ready for prime time.
This commit is contained in:
parent
6e9d490dc1
commit
1f2afb41e2
5 changed files with 69 additions and 5 deletions
|
|
@ -249,6 +249,38 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
void LatticeSolidPhase::installSlavePhases(Cantera::XML_Node* phaseNode)
|
||||
{
|
||||
int m, k;
|
||||
for (int n = 0; n < m_nlattice; n++) {
|
||||
LatticePhase *lp = m_lattice[n];
|
||||
int nsp = lp->nSpecies();
|
||||
vector<doublereal> constArr(lp->nElements());
|
||||
for (k = 0; k < nsp; k++) {
|
||||
std::string sname = lp->speciesName(k);
|
||||
std::map<std::string, double> comp;
|
||||
lp->getAtoms(k, DATA_PTR(constArr));
|
||||
for (m = 0; m < lp->nElements(); m++) {
|
||||
if (constArr[m] != 0.0) {
|
||||
std::string ename = lp->elementName(m);
|
||||
comp[ename] = constArr[m];
|
||||
}
|
||||
}
|
||||
int nel = nElements();
|
||||
vector_fp ecomp(nel, 0.0);
|
||||
for (m = 0; m < nel; m++) {
|
||||
double anum = comp[elementName(m)];
|
||||
if (anum != 0.0) {
|
||||
ecomp[m] = anum;
|
||||
}
|
||||
}
|
||||
double chrg = lp->charge(k);
|
||||
double sz = lp->size(k);
|
||||
addUniqueSpecies(sname, &ecomp[0], chrg, sz);
|
||||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
void LatticeSolidPhase::initThermo() {
|
||||
m_kk = nSpecies();
|
||||
m_mm = nElements();
|
||||
|
|
|
|||
|
|
@ -274,6 +274,12 @@ namespace Cantera {
|
|||
|
||||
virtual void initThermo();
|
||||
|
||||
//! Add in species from Slave phases
|
||||
/*!
|
||||
* This hook is used for cSS_CONVENTION_SLAVE phases
|
||||
*/
|
||||
virtual void installSlavePhases(Cantera::XML_Node* phaseNode);
|
||||
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
|
||||
void setLatticeMoleFractions(int n, std::string x);
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@ namespace Cantera {
|
|||
// file.
|
||||
db = get_XML_Node(speciesArray["datasrc"], &phase.root());
|
||||
if (db == 0) {
|
||||
throw CanteraError("importPhase",
|
||||
throw CanteraError("importPhase()",
|
||||
" Can not find XML node for species database: "
|
||||
+ speciesArray["datasrc"]);
|
||||
}
|
||||
|
|
@ -597,17 +597,29 @@ namespace Cantera {
|
|||
|
||||
// install it in the phase object
|
||||
th->setSpeciesThermo(spth);
|
||||
} else {
|
||||
} else if (ssConvention == cSS_CONVENTION_SLAVE) {
|
||||
/*
|
||||
* No species thermo manager for this type
|
||||
*/
|
||||
} else if (ssConvention == cSS_CONVENTION_VPSS) {
|
||||
vp_spth = newVPSSMgr(vpss_ptr, &phase, spDataNodeList);
|
||||
vpss_ptr->setVPSSMgr(vp_spth);
|
||||
spth = vp_spth->SpeciesThermoMgr();
|
||||
th->setSpeciesThermo(spth);
|
||||
} else {
|
||||
throw CanteraError("importPhase()", "unknown convention");
|
||||
}
|
||||
|
||||
|
||||
int k = 0;
|
||||
|
||||
int nsp = spDataNodeList.size();
|
||||
if (ssConvention == cSS_CONVENTION_SLAVE) {
|
||||
if (nsp > 0) {
|
||||
throw CanteraError("importPhase()", "For Slave standard states, number of species must be zero: "
|
||||
+ int2str(nsp));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < nsp; i++) {
|
||||
XML_Node *s = spDataNodeList[i];
|
||||
AssertTrace(s != 0);
|
||||
|
|
@ -619,6 +631,10 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
if (ssConvention == cSS_CONVENTION_SLAVE) {
|
||||
th->installSlavePhases(&phase);
|
||||
}
|
||||
|
||||
// done adding species.
|
||||
th->freezeSpecies();
|
||||
|
||||
|
|
|
|||
|
|
@ -941,16 +941,20 @@ namespace Cantera {
|
|||
}
|
||||
xMol_Ref.resize(m_kk, 0.0);
|
||||
}
|
||||
//====================================================================================================================
|
||||
void ThermoPhase::installSlavePhases(Cantera::XML_Node* phaseNode) {
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
void ThermoPhase::saveSpeciesData(const int k, const XML_Node* const data) {
|
||||
if ((int) m_speciesData.size() < (k + 1)) {
|
||||
m_speciesData.resize(k+1, 0);
|
||||
}
|
||||
m_speciesData[k] = new XML_Node(*data);
|
||||
}
|
||||
|
||||
//! Return a pointer to the XML tree containing the species
|
||||
/// data for this phase.
|
||||
//====================================================================================================================
|
||||
// Return a pointer to the XML tree containing the species
|
||||
// data for this phase.
|
||||
const std::vector<const XML_Node *> & ThermoPhase::speciesData() const {
|
||||
if ((int) m_speciesData.size() != m_kk) {
|
||||
throw CanteraError("ThermoPhase::speciesData",
|
||||
|
|
|
|||
|
|
@ -2016,6 +2016,12 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//! Add in species from Slave phases
|
||||
/*!
|
||||
* This hook is used for cSS_CONVENTION_SLAVE phases
|
||||
*/
|
||||
virtual void installSlavePhases(Cantera::XML_Node* phaseNode);
|
||||
|
||||
// The following methods are used by the clib interface
|
||||
// library, and should not be used by application programs.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue