本文整理汇总了C++中ThermoPhase类的典型用法代码示例。如果您正苦于以下问题:C++ ThermoPhase类的具体用法?C++ ThermoPhase怎么用?C++ ThermoPhase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ThermoPhase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: phase_setmassfractionsbyname_
status_t phase_setmassfractionsbyname_(const integer* n, char* y, ftnlen leny)
{
try {
ThermoPhase* p = _fph(n);
p->setMassFractionsByName(f2string(y, leny));
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
示例2: phase_getmassfractions_
status_t phase_getmassfractions_(const integer* n, doublereal* y)
{
try {
ThermoPhase* p = _fph(n);
p->getMassFractions(y);
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
示例3: phase_setmolefractionsbyname_
status_t phase_setmolefractionsbyname_(const integer* n, char* x, ftnlen lx)
{
try {
ThermoPhase* p = _fph(n);
p->setMoleFractionsByName(f2string(x, lx));
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
示例4: phase_setmassfractionsbyname_
status_t phase_setmassfractionsbyname_(const integer* n, char* y, ftnlen leny)
{
try {
ThermoPhase* p = _fph(n);
compositionMap yy = parseCompString(f2string(y, leny), p->speciesNames());
p->setMassFractionsByName(yy);
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
示例5: phase_getmolecularweights_
status_t phase_getmolecularweights_(const integer* n, doublereal* mw)
{
try {
ThermoPhase* p = _fph(n);
const vector_fp& wt = p->molecularWeights();
copy(wt.begin(), wt.end(), mw);
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
示例6: phase_setmolefractionsbyname_
status_t phase_setmolefractionsbyname_(const integer* n, char* x, ftnlen lx)
{
try {
ThermoPhase* p = _fph(n);
compositionMap xx = parseCompString(f2string(x, lx), p->speciesNames());
p->setMoleFractionsByName(xx);
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
示例7: phase_setmolefractionsbyname_
status_t DLL_EXPORT phase_setmolefractionsbyname_(const integer* n, char* x, ftnlen lx) {
try {
ThermoPhase* p = _fph(n);
compositionMap xx;
int nsp = p->nSpecies();
for (int nn = 0; nn < nsp; nn++) {
xx[p->speciesName(nn)] = -1;
}
parseCompString(f2string(x, lx), xx);
p->setMoleFractionsByName(xx);
return 0;
}
catch (CanteraError) {handleError(); return -1;}
}
示例8: CanteraError
//====================================================================================================================
void Kinetics::assignShallowPointers(const std::vector<thermo_t*> & tpVector) {
size_t ns = tpVector.size();
if (ns != m_thermo.size()) {
throw CanteraError(" Kinetics::assignShallowPointers",
" Number of ThermoPhase objects arent't the same");
}
for (size_t i = 0; i < ns; i++) {
ThermoPhase *ntp = tpVector[i];
ThermoPhase *otp = m_thermo[i];
if (ntp->id() != otp->id()) {
throw CanteraError(" Kinetics::assignShallowPointers",
" id() of the ThermoPhase objects isn't the same");
}
if (ntp->eosType() != otp->eosType()) {
throw CanteraError(" Kinetics::assignShallowPointers",
" eosType() of the ThermoPhase objects isn't the same");
}
if (ntp->nSpecies() != otp->nSpecies()) {
throw CanteraError(" Kinetics::assignShallowPointers",
" Number of ThermoPhase objects isn't the same");
}
m_thermo[i] = tpVector[i];
}
}
示例9: phase_setmolefractions_
status_t phase_setmolefractions_(const integer* n, double* x, const integer* norm)
{
try {
ThermoPhase* p = _fph(n);
if (*norm) {
p->setMoleFractions(x);
} else {
p->setMoleFractions_NoNorm(x);
}
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
示例10: phase_setmassfractionsbyname_
status_t DLL_EXPORT phase_setmassfractionsbyname_(const integer* n, char* y, ftnlen leny) {
try {
ThermoPhase* p = _fph(n);
compositionMap yy;
int nsp = p->nSpecies();
for (int nn = 0; nn < nsp; nn++) {
yy[p->speciesName(nn)] = -1;
}
parseCompString(f2string(y, leny), yy);
p->setMassFractionsByName(yy);
return 0;
}
catch (CanteraError) {handleError(); return -1;}
}
示例11: phase_setmassfractions_
status_t phase_setmassfractions_(const integer* n, doublereal* y, const integer* norm)
{
try {
ThermoPhase* p = _fph(n);
if (*norm) {
p->setMassFractions(y);
} else {
p->setMassFractions_NoNorm(y);
}
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
示例12: simple_demo
// The actual code is put into a function that
// can be called from the main program.
void simple_demo() {
// Create a new phase
ThermoPhase* gas = newPhase("h2o2.cti","ohmech");
// Set its state by specifying T (500 K) P (2 atm) and the mole
// fractions. Note that the mole fractions do not need to sum to
// 1.0 - they will be normalized internally. Also, the values for
// any unspecified species will be set to zero.
gas->setState_TPX(500.0, 2.0*OneAtm, "H2O:1.0, H2:8.0, AR:1.0");
// Print a summary report of the state of the gas
cout << report(*gas) << endl;
// Clean up
delete gas;
}
示例13: setThermoMgr
void IdealGasReactor::setThermoMgr(ThermoPhase& thermo)
{
//! @TODO: Add a method to ThermoPhase that indicates whether a given
//! subclass is compatible with this reactor model
if (thermo.eosType() != cIdealGas) {
throw CanteraError("IdealGasReactor::setThermoMgr",
"Incompatible phase type provided");
}
Reactor::setThermoMgr(thermo);
}
示例14: main
int main(int argc, char** argv)
{
#ifdef _MSC_VER
_set_output_format(_TWO_DIGIT_EXPONENT);
#endif
try {
IdealSolnGasVPSS gg("silane.xml", "silane");
ThermoPhase* g = ≫
cout.precision(4);
g->setState_TPX(1500.0, 100.0, "SIH4:0.01, H2:0.99");
g->equilibrate("TP");
cout << g->report(true, 0.0) << endl;
return 0;
} catch (CanteraError& err) {
std::cerr << err.what() << std::endl;
cerr << "program terminating." << endl;
return -1;
}
}
示例15: 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");
//.........这里部分代码省略.........