本文整理汇总了C++中ThermoPhase::duplMyselfAsThermoPhase方法的典型用法代码示例。如果您正苦于以下问题:C++ ThermoPhase::duplMyselfAsThermoPhase方法的具体用法?C++ ThermoPhase::duplMyselfAsThermoPhase怎么用?C++ ThermoPhase::duplMyselfAsThermoPhase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThermoPhase
的用法示例。
在下文中一共展示了ThermoPhase::duplMyselfAsThermoPhase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
int retn = 0;
int i;
try {
char iFile[80];
strcpy(iFile, "HMW_NaCl.xml");
if (argc > 1) {
strcpy(iFile, argv[1]);
}
double Cp0_R[20], pmCp[20];
//fileLog *fl = new fileLog("HMW_graph_1.log");
//setLogger(fl);
HMWSoln *HMW = new HMWSoln(iFile, "NaCl_electrolyte");
/*
* Load in and initialize the
*/
Cantera::ThermoPhase *solid = newPhase("NaCl_Solid.xml","NaCl(S)");
int nsp = HMW->nSpecies();
double acMol[100];
double act[100];
double mf[100];
double moll[100];
for (i = 0; i < 100; i++) {
acMol[i] = 1.0;
act[i] = 1.0;
mf[i] = 0.0;
act[i] = 0.0;
}
HMW->getMoleFractions(mf);
string sName;
TemperatureTable TTable(15, false, 273.15, 25., 0, 0);
HMW->setState_TP(298.15, 1.01325E5);
int i1 = HMW->speciesIndex("Na+");
int i2 = HMW->speciesIndex("Cl-");
//int i3 = HMW->speciesIndex("H2O(L)");
for (i = 0; i < nsp; i++) {
moll[i] = 0.0;
}
HMW->setMolalities(moll);
double ISQRT;
double Is = 0.0;
/*
* Set the Pressure
*/
double pres = OneAtm;
/*
* Fix the molality
*/
Is = 6.146;
ISQRT = sqrt(Is);
moll[i1] = Is;
moll[i2] = Is;
HMW->setState_TPM(298.15, pres, moll);
double Xmol[30];
HMW->getMoleFractions(Xmol);
ThermoPhase *hmwtb = (ThermoPhase *)HMW;
ThermoPhase *hmwtbDupl = hmwtb->duplMyselfAsThermoPhase();
//ThermoPhase *hmwtbDupl = 0;
HMWSoln *HMW1 = HMW;
HMWSoln *HMW2 = dynamic_cast<HMWSoln *>(hmwtbDupl);
for (int itherms = 0; itherms < 2; itherms++) {
if (itherms ==0) {
HMW = HMW1;
} else {
HMW = HMW2;
}
/*
* ThermoUnknowns
*/
double T;
double Cp0_NaCl = 0.0, Cp0_Naplus = 0.0, Cp0_Clminus = 0.0, Delta_Cp0s = 0.0, Cp0_H2O = 0.0;
double Cp_NaCl = 0.0, Cp_Naplus = 0.0, Cp_Clminus = 0.0, Cp_H2O = 0.0;
double molarCp0;
#ifdef DEBUG_HKM
FILE *ttt;
if (itherms ==0) {
ttt = fopen("table1.csv","w");
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
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;
}
/*********************************************************************************/
/*
* OK NOW DUPLICATE EVERYTHING AND RECALCULATE
*/
ThermoPhase* gasTP_dupl = gasTP->duplMyselfAsThermoPhase();
ThermoPhase* diamondTP_dupl = diamondTP->duplMyselfAsThermoPhase();
ThermoPhase* diamond100TP_dupl = diamond100TP->duplMyselfAsThermoPhase();
vector<ThermoPhase*> phaseList_dupl { gasTP_dupl, diamondTP_dupl,
diamond100TP_dupl };
InterfaceKinetics* iKin_ptr_dupl = new InterfaceKinetics();
importKinetics(*xs, phaseList_dupl, iKin_ptr_dupl);
int nr_dupl = iKin_ptr_dupl->nReactions();
cout << "Number of reactions = " << nr_dupl << endl;
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;
p = 20.0*OneAtm/760.0;
gasTP_dupl->setState_TPX(1200., p, x);
for (i = 0; i < 20; i++) {
x[i] = 0.0;
}
i0 = diamond100TP_dupl->speciesIndex("c6H*");
x[i0] = 0.1;
i1 = diamond100TP_dupl->speciesIndex("c6HH");
x[i1] = 0.9;
diamond100TP_dupl->setState_TX(1200., x);
for (i = 0; i < 20; i++) {