本文整理汇总了C++中ThermoPhase::density方法的典型用法代码示例。如果您正苦于以下问题:C++ ThermoPhase::density方法的具体用法?C++ ThermoPhase::density怎么用?C++ ThermoPhase::density使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThermoPhase
的用法示例。
在下文中一共展示了ThermoPhase::density方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
cout.precision(4);
cout << "Number of species = " << nsp << endl;
XML_Node* const xd = xc->findNameID("phase", "diamond");
ThermoPhase* diamondTP = newPhase(*xd);
size_t nsp_diamond = diamondTP->nSpecies();
cout << "Number of species in diamond = " << nsp_diamond << endl;
XML_Node* const xs = xc->findNameID("phase", "diamond_100");
ThermoPhase* diamond100TP = newPhase(*xs);
size_t nsp_d100 = diamond100TP->nSpecies();
cout << "Number of species in diamond_100 = " << nsp_d100 << endl;
vector<ThermoPhase*> phaseList { gasTP, diamondTP, diamond100TP };
InterfaceKinetics* iKin_ptr = new InterfaceKinetics();
importKinetics(*xs, phaseList, iKin_ptr);
size_t nr = iKin_ptr->nReactions();
cout << "Number of reactions = " << nr << endl;
double x[20];
for (i = 0; i < 20; i++) {
x[i] = 0.0;
}
x[0] = 0.0010;
x[1] = 0.9888;
x[2] = 0.0002;
x[3] = 0.0100;
double p = 20.0*OneAtm/760.0;
gasTP->setState_TPX(1200., p, x);
for (i = 0; i < 20; i++) {
x[i] = 0.0;
}
size_t i0 = diamond100TP->speciesIndex("c6H*");
x[i0] = 0.1;
size_t i1 = diamond100TP->speciesIndex("c6HH");
x[i1] = 0.9;
diamond100TP->setState_TX(1200., x);
for (i = 0; i < 20; i++) {
x[i] = 0.0;
}
x[0] = 1.0;
diamondTP->setState_TPX(1200., p, x);
iKin_ptr->advanceCoverages(100.);
// Throw some asserts in here to test that they compile
AssertTrace(p == p);
AssertThrow(p == p, "main");
AssertThrowMsg(i == 20, "main", "are you kidding");
double src[20];
for (i = 0; i < 20; i++) {
src[i] = 0.0;
}
iKin_ptr->getNetProductionRates(src);
double sum = 0.0;
double naH = 0.0;
for (k = 0; k < 13; k++) {
if (k < 4) {
naH = gasTP->nAtoms(k, 0);
} else if (k == 4) {
naH = 0;
} else if (k > 4) {
int itp = k - 5;
naH = diamond100TP->nAtoms(itp, 0);
}
cout << k << " " << naH << " " ;
printDbl(src[k]);
cout << endl;
sum += naH * src[k];
}
cout << "sum = ";
printDbl(sum);
cout << endl;
double mwd = diamondTP->molecularWeight(0);
double dens = diamondTP->density();
double gr = src[4] * mwd / dens;
gr *= 1.0E6 * 3600.;
cout << "growth rate = " << gr << " microns per hour" << endl;
diamond100TP->getMoleFractions(x);
cout << "Coverages:" << endl;
for (k = 0; k < 8; k++) {
cout << k << " " << diamond100TP->speciesName(k)
<< " "
<< x[k] << endl;
}
} catch (CanteraError& err) {
std::cout << err.what() << std::endl;
}
return 0;
}
示例2: main
int main(int argc, char** argv) {
int i, k;
string infile = "diamond.xml";
try {
XML_Node *xc = new XML_Node();
string path = findInputFile(infile);
ctml::get_CTML_Tree(xc, path);
XML_Node * const xg = xc->findNameID("phase", "gas");
ThermoPhase *gasTP = newPhase(*xg);
int nsp = gasTP->nSpecies();
cout << "Number of species = " << nsp << endl;
XML_Node * const xd = xc->findNameID("phase", "diamond");
ThermoPhase *diamondTP = newPhase(*xd);
int nsp_diamond = diamondTP->nSpecies();
cout << "Number of species in diamond = " << nsp_diamond << endl;
XML_Node * const xs = xc->findNameID("phase", "diamond_100");
ThermoPhase *diamond100TP = newPhase(*xs);
//SurfPhase *diamond100TP = new SurfPhase(*xs);
int nsp_d100 = diamond100TP->nSpecies();
cout << "Number of species in diamond_100 = " << nsp_d100 << endl;
vector<ThermoPhase *> phaseList;
phaseList.push_back(gasTP);
phaseList.push_back(diamondTP);
phaseList.push_back(diamond100TP);
InterfaceKinetics *iKin_ptr = new InterfaceKinetics();
importKinetics(*xs, phaseList, iKin_ptr);
int nr = iKin_ptr->nReactions();
cout << "Number of reactions = " << nr << endl;
double x[20];
for (i = 0; i < 20; i++) x[i] = 0.0;
x[0] = 0.0010;
x[1] = 0.9888;
x[2] = 0.0002;
x[3] = 0.0100;
double p = 20.0*OneAtm/760.0;
gasTP->setState_TPX(1200., p, x);
for (i = 0; i < 20; i++) x[i] = 0.0;
int i0 = diamond100TP->speciesIndex("c6H*");
x[i0] = 0.1;
int i1 = diamond100TP->speciesIndex("c6HH");
x[i1] = 0.9;
diamond100TP->setState_TX(1200., x);
for (i = 0; i < 20; i++) x[i] = 0.0;
x[0] = 1.0;
diamondTP->setState_TPX(1200., p, x);
iKin_ptr->advanceCoverages(100.);
// Throw some asserts in here to test that they compile
AssertTrace(p == p);
AssertThrow(p == p, "main");
AssertThrowMsg(i == 20, "main", "are you kidding");
double src[20];
for (i = 0; i < 20; i++) src[i] = 0.0;
iKin_ptr->getNetProductionRates(src);
double sum = 0.0;
double naH = 0.0;
for (k = 0; k < 13; k++) {
if (k < 4) {
naH = gasTP->nAtoms(k, 0);
} else if (k == 4) {
naH = 0;
} else if (k > 4) {
int itp = k - 5;
naH = diamond100TP->nAtoms(itp, 0);
}
cout << k << " " << naH << " " ;
printDbl(src[k]);
cout << endl;
sum += naH * src[k];
}
cout << "sum = ";
printDbl(sum);
cout << endl;
double mwd = diamondTP->molecularWeight(0);
double dens = diamondTP->density();
double gr = src[4] * mwd / dens;
gr *= 1.0E6 * 3600.;
cout << "growth rate = " << gr << " microns per hour" << endl;
diamond100TP->getMoleFractions(x);
cout << "Coverages:" << endl;
for (k = 0; k < 8; k++) {
cout << k << " " << diamond100TP->speciesName(k)
<< " "
<< x[k] << endl;
//.........这里部分代码省略.........
示例3: main
int main(int argc, char** argv)
{
int i, k;
string infile = "diamond.xml";
try {
XML_Node* xc = get_XML_File(infile);
cout.precision(3);
XML_Node* const xg = xc->findNameID("phase", "gas");
ThermoPhase* gasTP = newPhase(*xg);
int nsp = gasTP->nSpecies();
cout << "Number of species = " << nsp << endl;
XML_Node* const xd = xc->findNameID("phase", "diamond");
ThermoPhase* diamondTP = newPhase(*xd);
int nsp_diamond = diamondTP->nSpecies();
cout << "Number of species in diamond = " << nsp_diamond << endl;
XML_Node* const xs = xc->findNameID("phase", "diamond_100");
ThermoPhase* diamond100TP = newPhase(*xs);
int nsp_d100 = diamond100TP->nSpecies();
cout << "Number of species in diamond_100 = " << nsp_d100 << endl;
vector<ThermoPhase*> phaseList { gasTP, diamondTP, diamond100TP };
InterfaceKinetics* iKin_ptr = new InterfaceKinetics();
importKinetics(*xs, phaseList, iKin_ptr);
int nr = iKin_ptr->nReactions();
cout << "Number of reactions = " << nr << endl;
double x[20];
for (i = 0; i < 20; i++) {
x[i] = 0.0;
}
x[0] = 0.0010;
x[1] = 0.9888;
x[2] = 0.0002;
x[3] = 0.0100;
double p = 20.0*OneAtm/760.0;
gasTP->setState_TPX(1200., p, x);
for (i = 0; i < 20; i++) {
x[i] = 0.0;
}
int i0 = diamond100TP->speciesIndex("c6H*");
x[i0] = 0.1;
int i1 = diamond100TP->speciesIndex("c6HH");
x[i1] = 0.9;
diamond100TP->setState_TX(1200., x);
for (i = 0; i < 20; i++) {
x[i] = 0.0;
}
x[0] = 1.0;
diamondTP->setState_TPX(1200., p, x);
iKin_ptr->advanceCoverages(100.);
// Throw some asserts in here to test that they compile
AssertTrace(p == p);
AssertThrow(p == p, "main");
AssertThrowMsg(i == 20, "main", "are you kidding");
double src[20];
for (i = 0; i < 20; i++) {
src[i] = 0.0;
}
iKin_ptr->getNetProductionRates(src);
double sum = 0.0;
double naH = 0.0;
for (k = 0; k < 13; k++) {
if (k < 4) {
naH = gasTP->nAtoms(k, 0);
} else if (k == 4) {
naH = 0;
} else if (k > 4) {
int itp = k - 5;
naH = diamond100TP->nAtoms(itp, 0);
}
cout << k << " " << naH << " " ;
printDbl(src[k]);
cout << endl;
sum += naH * src[k];
}
cout << "sum = ";
printDbl(sum);
cout << endl;
double mwd = diamondTP->molecularWeight(0);
double dens = diamondTP->density();
double gr = src[4] * mwd / dens;
gr *= 1.0E6 * 3600.;
cout << "growth rate = " << gr << " microns per hour" << endl;
diamond100TP->getMoleFractions(x);
cout << "Coverages:" << endl;
//.........这里部分代码省略.........