Fixed compiler warnings in the test suite
This commit is contained in:
parent
9b2d97f41e
commit
16da33ad42
36 changed files with 219 additions and 299 deletions
|
|
@ -56,7 +56,7 @@ ThermoPhase* PdepTest::thermo_ = NULL;
|
||||||
Kinetics* PdepTest::kin_ = NULL;
|
Kinetics* PdepTest::kin_ = NULL;
|
||||||
|
|
||||||
TEST_F(PdepTest, reactionCounts) {
|
TEST_F(PdepTest, reactionCounts) {
|
||||||
EXPECT_EQ(6, kin_->nReactions());
|
EXPECT_EQ((size_t) 6, kin_->nReactions());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(PdepTest, PlogLowPressure) {
|
TEST_F(PdepTest, PlogLowPressure) {
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ protected:
|
||||||
EXPECT_DOUBLE_EQ(s_R1, s_R2);
|
EXPECT_DOUBLE_EQ(s_R1, s_R2);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double> tpow_;
|
|
||||||
NasaPoly1 poly;
|
NasaPoly1 poly;
|
||||||
|
std::vector<double> tpow_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(NasaPoly1Test, Initialization)
|
TEST_F(NasaPoly1Test, Initialization)
|
||||||
|
|
@ -58,7 +58,7 @@ TEST_F(NasaPoly1Test, Initialization)
|
||||||
EXPECT_EQ(poly.minTemp(), 200.0);
|
EXPECT_EQ(poly.minTemp(), 200.0);
|
||||||
EXPECT_EQ(poly.maxTemp(), 1000.0);
|
EXPECT_EQ(poly.maxTemp(), 1000.0);
|
||||||
EXPECT_EQ(poly.refPressure(), 101325.0);
|
EXPECT_EQ(poly.refPressure(), 101325.0);
|
||||||
EXPECT_EQ(poly.speciesIndex(), 0);
|
EXPECT_EQ(poly.speciesIndex(), (size_t) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(NasaPoly1Test, Copy)
|
TEST_F(NasaPoly1Test, Copy)
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ int main(int argc, char** argv)
|
||||||
IdealGasMix g("gri30.xml", "gri30_mix");
|
IdealGasMix g("gri30.xml", "gri30_mix");
|
||||||
double pres = OneAtm;
|
double pres = OneAtm;
|
||||||
|
|
||||||
int kk = g.nSpecies();
|
size_t kk = g.nSpecies();
|
||||||
vector_fp Xmol(kk, 0.0);
|
vector_fp Xmol(kk, 0.0);
|
||||||
int iCH4 = g.speciesIndex("CH4");
|
size_t iCH4 = g.speciesIndex("CH4");
|
||||||
int iO2 = g.speciesIndex("O2");
|
size_t iO2 = g.speciesIndex("O2");
|
||||||
int iN2 = g.speciesIndex("N2");
|
size_t iN2 = g.speciesIndex("N2");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do an initial calculation that can be debugged
|
* Do an initial calculation that can be debugged
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,11 @@ int main(int argc, char** argv)
|
||||||
int nj = 6;
|
int nj = 6;
|
||||||
int ni = 7;
|
int ni = 7;
|
||||||
FILE* FF = fopen("table.csv","w");
|
FILE* FF = fopen("table.csv","w");
|
||||||
int kk = gas->nSpecies();
|
size_t kk = gas->nSpecies();
|
||||||
std::vector<double> Xmol(kk, 0.0);
|
std::vector<double> Xmol(kk, 0.0);
|
||||||
const std::vector<string> &snames = gas->speciesNames();
|
const std::vector<string> &snames = gas->speciesNames();
|
||||||
fprintf(FF,"Temperature, Pressure,");
|
fprintf(FF,"Temperature, Pressure,");
|
||||||
for (int k = 0; k < kk; k++) {
|
for (size_t k = 0; k < kk; k++) {
|
||||||
fprintf(FF, "%11s", snames[k].c_str());
|
fprintf(FF, "%11s", snames[k].c_str());
|
||||||
if (k < kk-1) {
|
if (k < kk-1) {
|
||||||
fprintf(FF,",");
|
fprintf(FF,",");
|
||||||
|
|
@ -64,7 +64,7 @@ int main(int argc, char** argv)
|
||||||
printf("Final T = %g, pres = %g atm\n", tkelvin, pres/OneAtm);
|
printf("Final T = %g, pres = %g atm\n", tkelvin, pres/OneAtm);
|
||||||
gas->getMoleFractions(DATA_PTR(Xmol));
|
gas->getMoleFractions(DATA_PTR(Xmol));
|
||||||
fprintf(FF,"%10.4g, %10.4g,", tkelvin, pres);
|
fprintf(FF,"%10.4g, %10.4g,", tkelvin, pres);
|
||||||
for (int k = 0; k < kk; k++) {
|
for (size_t k = 0; k < kk; k++) {
|
||||||
if (fabs(Xmol[k]) < 1.0E-130) {
|
if (fabs(Xmol[k]) < 1.0E-130) {
|
||||||
fprintf(FF," %10.4g", 0.0);
|
fprintf(FF," %10.4g", 0.0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,10 @@ int main(int argc, char** argv)
|
||||||
bool doFormMatrix = true;
|
bool doFormMatrix = true;
|
||||||
vector_fp formRxnMatrix;
|
vector_fp formRxnMatrix;
|
||||||
|
|
||||||
int nc = BasisOptimize(&usedZeroedSpecies, doFormMatrix,
|
size_t nc = BasisOptimize(&usedZeroedSpecies, doFormMatrix,
|
||||||
&mphase, orderVectorSpecies,
|
&mphase, orderVectorSpecies,
|
||||||
orderVectorElements,
|
orderVectorElements,
|
||||||
formRxnMatrix);
|
formRxnMatrix);
|
||||||
|
|
||||||
cout << "number of components = " << nc << endl;
|
cout << "number of components = " << nc << endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,9 @@ int main(int argc, char** argv)
|
||||||
// Initialize the individual phases
|
// Initialize the individual phases
|
||||||
|
|
||||||
HMWSoln hmw(inputFile, "");
|
HMWSoln hmw(inputFile, "");
|
||||||
int kk = hmw.nSpecies();
|
size_t kk = hmw.nSpecies();
|
||||||
vector_fp Xmol(kk, 0.0);
|
vector_fp Xmol(kk, 0.0);
|
||||||
int iH2OL = hmw.speciesIndex("H2O(L)");
|
size_t iH2OL = hmw.speciesIndex("H2O(L)");
|
||||||
Xmol[iH2OL] = 1.0;
|
Xmol[iH2OL] = 1.0;
|
||||||
hmw.setState_TPX(T, pres, DATA_PTR(Xmol));
|
hmw.setState_TPX(T, pres, DATA_PTR(Xmol));
|
||||||
|
|
||||||
|
|
@ -100,10 +100,10 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
kk = gas->nSpecies();
|
kk = gas->nSpecies();
|
||||||
Xmol.resize(kk, 0.0);
|
Xmol.resize(kk, 0.0);
|
||||||
for (int i = 0; i < kk; i++) {
|
for (size_t i = 0; i < kk; i++) {
|
||||||
Xmol[i] = 0.0;
|
Xmol[i] = 0.0;
|
||||||
}
|
}
|
||||||
int iN2 = gas->speciesIndex("N2");
|
size_t iN2 = gas->speciesIndex("N2");
|
||||||
Xmol[iN2] = 1.0;
|
Xmol[iN2] = 1.0;
|
||||||
gas->setState_TPX(T, pres, DATA_PTR(Xmol));
|
gas->setState_TPX(T, pres, DATA_PTR(Xmol));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
int retn = 0;
|
int retn = 0;
|
||||||
int i;
|
size_t i;
|
||||||
string fName = "DH_graph_1.log";
|
string fName = "DH_graph_1.log";
|
||||||
fileLog* fl = new fileLog(fName);
|
fileLog* fl = new fileLog(fName);
|
||||||
try {
|
try {
|
||||||
|
|
@ -35,7 +35,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
DebyeHuckel* DH = new DebyeHuckel(iFile, "NaCl_electrolyte");
|
DebyeHuckel* DH = new DebyeHuckel(iFile, "NaCl_electrolyte");
|
||||||
|
|
||||||
int nsp = DH->nSpecies();
|
size_t nsp = DH->nSpecies();
|
||||||
double acMol[100];
|
double acMol[100];
|
||||||
double mf[100];
|
double mf[100];
|
||||||
double moll[100];
|
double moll[100];
|
||||||
|
|
@ -44,9 +44,9 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
DH->setState_TP(298.15, 1.01325E5);
|
DH->setState_TP(298.15, 1.01325E5);
|
||||||
|
|
||||||
int i1 = DH->speciesIndex("Na+");
|
size_t i1 = DH->speciesIndex("Na+");
|
||||||
int i2 = DH->speciesIndex("Cl-");
|
size_t i2 = DH->speciesIndex("Cl-");
|
||||||
int i3 = DH->speciesIndex("H2O(L)");
|
size_t i3 = DH->speciesIndex("H2O(L)");
|
||||||
for (i = 1; i < nsp; i++) {
|
for (i = 1; i < nsp; i++) {
|
||||||
moll[i] = 0.0;
|
moll[i] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +57,7 @@ int main(int argc, char** argv)
|
||||||
double ISQRTbot = sqrt(Ibot);
|
double ISQRTbot = sqrt(Ibot);
|
||||||
double ISQRT;
|
double ISQRT;
|
||||||
double Is = 0.0;
|
double Is = 0.0;
|
||||||
int its = 100;
|
size_t its = 100;
|
||||||
printf(" Is, sqrtIs, meanAc,"
|
printf(" Is, sqrtIs, meanAc,"
|
||||||
" log10(meanAC), acMol_Na+,"
|
" log10(meanAC), acMol_Na+,"
|
||||||
", acMol_Cl-, ac_Water\n");
|
", acMol_Cl-, ac_Water\n");
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
int retn = 0;
|
int retn = 0;
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ int main(int argc, char** argv)
|
||||||
Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)");
|
Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)");
|
||||||
|
|
||||||
|
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
double mf[100];
|
double mf[100];
|
||||||
double moll[100];
|
double moll[100];
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
|
|
@ -57,8 +57,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
HMW->setState_TP(298.15, 1.01325E5);
|
HMW->setState_TP(298.15, 1.01325E5);
|
||||||
|
|
||||||
int i1 = HMW->speciesIndex("Na+");
|
size_t i1 = HMW->speciesIndex("Na+");
|
||||||
int i2 = HMW->speciesIndex("Cl-");
|
size_t i2 = HMW->speciesIndex("Cl-");
|
||||||
//int i3 = HMW->speciesIndex("H2O(L)");
|
//int i3 = HMW->speciesIndex("H2O(L)");
|
||||||
for (i = 0; i < nsp; i++) {
|
for (i = 0; i < nsp; i++) {
|
||||||
moll[i] = 0.0;
|
moll[i] = 0.0;
|
||||||
|
|
@ -242,14 +242,12 @@ int main(int argc, char** argv)
|
||||||
//double AL = HMW->ADebye_L(T,pres);
|
//double AL = HMW->ADebye_L(T,pres);
|
||||||
double AJ = HMW->ADebye_J(T, pres);
|
double AJ = HMW->ADebye_J(T, pres);
|
||||||
|
|
||||||
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
|
||||||
Cp0_R[k] *= GasConstant * 1.0E-6;
|
Cp0_R[k] *= GasConstant * 1.0E-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
molarCp0 = 0.0;
|
molarCp0 = 0.0;
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molarCp0 += Xmol[k] * Cp0_R[k];
|
molarCp0 += Xmol[k] * Cp0_R[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
int retn = 0;
|
int retn = 0;
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ int main(int argc, char** argv)
|
||||||
Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)");
|
Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)");
|
||||||
|
|
||||||
|
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
double mf[100];
|
double mf[100];
|
||||||
double moll[100];
|
double moll[100];
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
|
|
@ -58,8 +58,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
HMW->setState_TP(298.15, 1.01325E5);
|
HMW->setState_TP(298.15, 1.01325E5);
|
||||||
|
|
||||||
int i1 = HMW->speciesIndex("Na+");
|
size_t i1 = HMW->speciesIndex("Na+");
|
||||||
int i2 = HMW->speciesIndex("Cl-");
|
size_t i2 = HMW->speciesIndex("Cl-");
|
||||||
//int i3 = HMW->speciesIndex("H2O(L)");
|
//int i3 = HMW->speciesIndex("H2O(L)");
|
||||||
for (i = 0; i < nsp; i++) {
|
for (i = 0; i < nsp; i++) {
|
||||||
moll[i] = 0.0;
|
moll[i] = 0.0;
|
||||||
|
|
@ -223,14 +223,12 @@ int main(int argc, char** argv)
|
||||||
//double AL = HMW->ADebye_L(T,pres);
|
//double AL = HMW->ADebye_L(T,pres);
|
||||||
double AJ = HMW->ADebye_J(T, pres);
|
double AJ = HMW->ADebye_J(T, pres);
|
||||||
|
|
||||||
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
|
||||||
Cp0_R[k] *= GasConstant * 1.0E-6;
|
Cp0_R[k] *= GasConstant * 1.0E-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
molarCp0 = 0.0;
|
molarCp0 = 0.0;
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molarCp0 += Xmol[k] * Cp0_R[k];
|
molarCp0 += Xmol[k] * Cp0_R[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
int retn = 0;
|
int retn = 0;
|
||||||
int i;
|
size_t i;
|
||||||
string commandFile;
|
string commandFile;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte");
|
HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte");
|
||||||
|
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
double acMol[100];
|
double acMol[100];
|
||||||
double act[100];
|
double act[100];
|
||||||
double mf[100];
|
double mf[100];
|
||||||
|
|
@ -68,9 +68,9 @@ int main(int argc, char** argv)
|
||||||
ff = fopen(fname, "w");
|
ff = fopen(fname, "w");
|
||||||
HMW->setState_TP(Temp, 1.01325E5);
|
HMW->setState_TP(Temp, 1.01325E5);
|
||||||
printf(" Temperature = %g K\n", Temp);
|
printf(" Temperature = %g K\n", Temp);
|
||||||
int i1 = HMW->speciesIndex("Na+");
|
size_t i1 = HMW->speciesIndex("Na+");
|
||||||
int i2 = HMW->speciesIndex("Cl-");
|
size_t i2 = HMW->speciesIndex("Cl-");
|
||||||
int i3 = HMW->speciesIndex("H2O(L)");
|
size_t i3 = HMW->speciesIndex("H2O(L)");
|
||||||
for (i = 1; i < nsp; i++) {
|
for (i = 1; i < nsp; i++) {
|
||||||
moll[i] = 0.0;
|
moll[i] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +81,7 @@ int main(int argc, char** argv)
|
||||||
double ISQRTbot = sqrt(Ibot);
|
double ISQRTbot = sqrt(Ibot);
|
||||||
double ISQRT;
|
double ISQRT;
|
||||||
double Is = 0.0;
|
double Is = 0.0;
|
||||||
int its = 100;
|
size_t its = 100;
|
||||||
bool doneSp = false;
|
bool doneSp = false;
|
||||||
fprintf(ff," Is, sqrtIs, meanAc,"
|
fprintf(ff," Is, sqrtIs, meanAc,"
|
||||||
" log10(meanAC), acMol_Na+,"
|
" log10(meanAC), acMol_Na+,"
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
int retn = 0;
|
int retn = 0;
|
||||||
int i;
|
size_t i;
|
||||||
int extraCols = 1;
|
int extraCols = 1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -46,7 +46,7 @@ int main(int argc, char** argv)
|
||||||
string id = "NaCl(S)";
|
string id = "NaCl(S)";
|
||||||
Cantera::ThermoPhase* solid = Cantera::newPhase(nacl_s, id);
|
Cantera::ThermoPhase* solid = Cantera::newPhase(nacl_s, id);
|
||||||
|
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
double acMol[100];
|
double acMol[100];
|
||||||
double act[100];
|
double act[100];
|
||||||
double mf[100];
|
double mf[100];
|
||||||
|
|
@ -65,8 +65,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
HMW->setState_TP(298.15, 1.01325E5);
|
HMW->setState_TP(298.15, 1.01325E5);
|
||||||
|
|
||||||
int i1 = HMW->speciesIndex("Na+");
|
size_t i1 = HMW->speciesIndex("Na+");
|
||||||
int i2 = HMW->speciesIndex("Cl-");
|
size_t i2 = HMW->speciesIndex("Cl-");
|
||||||
//int i3 = HMW->speciesIndex("H2O(L)");
|
//int i3 = HMW->speciesIndex("H2O(L)");
|
||||||
for (i = 1; i < nsp; i++) {
|
for (i = 1; i < nsp; i++) {
|
||||||
moll[i] = 0.0;
|
moll[i] = 0.0;
|
||||||
|
|
@ -167,7 +167,7 @@ int main(int argc, char** argv)
|
||||||
mu_NaCl = mu[0] * 1.0E-6;
|
mu_NaCl = mu[0] * 1.0E-6;
|
||||||
|
|
||||||
HMW->getChemPotentials(mu);
|
HMW->getChemPotentials(mu);
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
mu[k] *= 1.0E-6;
|
mu[k] *= 1.0E-6;
|
||||||
}
|
}
|
||||||
mu_Naplus = mu[i1];
|
mu_Naplus = mu[i1];
|
||||||
|
|
@ -184,16 +184,14 @@ int main(int argc, char** argv)
|
||||||
double molecWater = HMW->molecularWeight(0);
|
double molecWater = HMW->molecularWeight(0);
|
||||||
double Mo = molecWater / 1000.;
|
double Mo = molecWater / 1000.;
|
||||||
double Gibbs_kgWater = molarGibbs / (Xmol[0] * Mo);
|
double Gibbs_kgWater = molarGibbs / (Xmol[0] * Mo);
|
||||||
|
|
||||||
|
|
||||||
double Aphi = HMW->A_Debye_TP() / 3.0;
|
double Aphi = HMW->A_Debye_TP() / 3.0;
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
mu0_RT[k] *= RT * 1.0E-6;
|
mu0_RT[k] *= RT * 1.0E-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
molarGibbs0 = 0.0;
|
molarGibbs0 = 0.0;
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molarGibbs0 += Xmol[k] * mu0_RT[k];
|
molarGibbs0 += Xmol[k] * mu0_RT[k];
|
||||||
}
|
}
|
||||||
double Gibbs0_kgWater = molarGibbs0 / (Xmol[0] * Mo);
|
double Gibbs0_kgWater = molarGibbs0 / (Xmol[0] * Mo);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
int retn = 0;
|
int retn = 0;
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ int main(int argc, char** argv)
|
||||||
Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)");
|
Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)");
|
||||||
|
|
||||||
|
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
double mf[100];
|
double mf[100];
|
||||||
double moll[100];
|
double moll[100];
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
|
|
@ -58,8 +58,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
HMW->setState_TP(298.15, 1.01325E5);
|
HMW->setState_TP(298.15, 1.01325E5);
|
||||||
|
|
||||||
int i1 = HMW->speciesIndex("Na+");
|
size_t i1 = HMW->speciesIndex("Na+");
|
||||||
int i2 = HMW->speciesIndex("Cl-");
|
size_t i2 = HMW->speciesIndex("Cl-");
|
||||||
//int i3 = HMW->speciesIndex("H2O(L)");
|
//int i3 = HMW->speciesIndex("H2O(L)");
|
||||||
for (i = 1; i < nsp; i++) {
|
for (i = 1; i < nsp; i++) {
|
||||||
moll[i] = 0.0;
|
moll[i] = 0.0;
|
||||||
|
|
@ -206,20 +206,16 @@ int main(int argc, char** argv)
|
||||||
* units of kJ/gmolSaltAdded
|
* units of kJ/gmolSaltAdded
|
||||||
*/
|
*/
|
||||||
double phiL = L / Xmol[i1];
|
double phiL = L / Xmol[i1];
|
||||||
|
|
||||||
|
|
||||||
double Aphi = HMW->A_Debye_TP() / 3.0;
|
double Aphi = HMW->A_Debye_TP() / 3.0;
|
||||||
double AL = HMW->ADebye_L();
|
double AL = HMW->ADebye_L();
|
||||||
double LrelMol = HMW->relative_molal_enthalpy() * 1.0E-6;
|
double LrelMol = HMW->relative_molal_enthalpy() * 1.0E-6;
|
||||||
|
|
||||||
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
|
||||||
Enth0_RT[k] *= RT * 1.0E-6;
|
Enth0_RT[k] *= RT * 1.0E-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
molarEnth0 = 0.0;
|
molarEnth0 = 0.0;
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molarEnth0 += Xmol[k] * Enth0_RT[k];
|
molarEnth0 += Xmol[k] * Enth0_RT[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
int retn = 0;
|
int retn = 0;
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ int main(int argc, char** argv)
|
||||||
Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)");
|
Cantera::ThermoPhase* solid = newPhase("NaCl_Solid.xml","NaCl(S)");
|
||||||
|
|
||||||
|
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
//double acMol[100];
|
//double acMol[100];
|
||||||
//double act[100];
|
//double act[100];
|
||||||
double mf[100];
|
double mf[100];
|
||||||
|
|
@ -55,8 +55,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
HMW->setState_TP(298.15, 1.01325E5);
|
HMW->setState_TP(298.15, 1.01325E5);
|
||||||
|
|
||||||
int i1 = HMW->speciesIndex("Na+");
|
size_t i1 = HMW->speciesIndex("Na+");
|
||||||
int i2 = HMW->speciesIndex("Cl-");
|
size_t i2 = HMW->speciesIndex("Cl-");
|
||||||
//int i3 = HMW->speciesIndex("H2O(L)");
|
//int i3 = HMW->speciesIndex("H2O(L)");
|
||||||
for (i = 0; i < nsp; i++) {
|
for (i = 0; i < nsp; i++) {
|
||||||
moll[i] = 0.0;
|
moll[i] = 0.0;
|
||||||
|
|
@ -226,9 +226,8 @@ int main(int argc, char** argv)
|
||||||
//double AL = HMW->ADebye_L(T,pres);
|
//double AL = HMW->ADebye_L(T,pres);
|
||||||
double Av = HMW->ADebye_V(T, pres) * 1.0E3;
|
double Av = HMW->ADebye_V(T, pres) * 1.0E3;
|
||||||
|
|
||||||
|
|
||||||
molarV0 = 0.0;
|
molarV0 = 0.0;
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molarV0 += Xmol[k] * V0[k];
|
molarV0 += Xmol[k] * V0[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ void printUsage()
|
||||||
|
|
||||||
void pAtable(HMWSoln* HMW)
|
void pAtable(HMWSoln* HMW)
|
||||||
{
|
{
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
double acMol[100];
|
double acMol[100];
|
||||||
double mf[100];
|
double mf[100];
|
||||||
double activities[100];
|
double activities[100];
|
||||||
|
|
@ -32,7 +32,7 @@ void pAtable(HMWSoln* HMW)
|
||||||
string sName;
|
string sName;
|
||||||
printf(" Name Activity ActCoeffMolal "
|
printf(" Name Activity ActCoeffMolal "
|
||||||
" MoleFract Molality\n");
|
" MoleFract Molality\n");
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
sName = HMW->speciesName(k);
|
sName = HMW->speciesName(k);
|
||||||
printf("%16s %13g %13g %13g %13g\n",
|
printf("%16s %13g %13g %13g %13g\n",
|
||||||
sName.c_str(), activities[k], acMol[k], mf[k], moll[k]);
|
sName.c_str(), activities[k], acMol[k], mf[k], moll[k]);
|
||||||
|
|
@ -64,7 +64,7 @@ int main(int argc, char** argv)
|
||||||
HMW->m_debugCalc = 0;
|
HMW->m_debugCalc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
|
|
||||||
double a1 = HMW->AionicRadius(1);
|
double a1 = HMW->AionicRadius(1);
|
||||||
printf("a1 = %g\n", a1);
|
printf("a1 = %g\n", a1);
|
||||||
|
|
@ -92,27 +92,22 @@ int main(int argc, char** argv)
|
||||||
HMW->setState_TP(298.15, 1.01325E5);
|
HMW->setState_TP(298.15, 1.01325E5);
|
||||||
HMW->getStandardChemPotentials(mu0);
|
HMW->getStandardChemPotentials(mu0);
|
||||||
// translate from J/kmol to kJ/gmol
|
// translate from J/kmol to kJ/gmol
|
||||||
int k;
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
for (k = 0; k < nsp; k++) {
|
|
||||||
mu0[k] *= 1.0E-6;
|
mu0[k] *= 1.0E-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" Species Standard chemical potentials (kJ/gmol) \n");
|
printf(" Species Standard chemical potentials (kJ/gmol) \n");
|
||||||
printf("------------------------------------------------------------\n");
|
printf("------------------------------------------------------------\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
sName = HMW->speciesName(k);
|
sName = HMW->speciesName(k);
|
||||||
printf("%16s %16.9g\n", sName.c_str(), mu0[k]);
|
printf("%16s %16.9g\n", sName.c_str(), mu0[k]);
|
||||||
}
|
}
|
||||||
printf("------------------------------------------------------------\n");
|
printf("------------------------------------------------------------\n");
|
||||||
printf(" Some DeltaSS values: Delta(mu_0)\n");
|
printf(" Some DeltaSS values: Delta(mu_0)\n");
|
||||||
double deltaG;
|
double deltaG;
|
||||||
int i1, i2, j1;
|
size_t i1, i2, j1;
|
||||||
double RT = 8.314472E-3 * 298.15;
|
double RT = 8.314472E-3 * 298.15;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
i1 = HMW->speciesIndex("Na+");
|
i1 = HMW->speciesIndex("Na+");
|
||||||
i2 = HMW->speciesIndex("Cl-");
|
i2 = HMW->speciesIndex("Cl-");
|
||||||
deltaG = -432.6304 - mu0[i1] - mu0[i2];
|
deltaG = -432.6304 - mu0[i1] - mu0[i2];
|
||||||
|
|
@ -129,7 +124,7 @@ int main(int argc, char** argv)
|
||||||
i1 = HMW->speciesIndex("H+");
|
i1 = HMW->speciesIndex("H+");
|
||||||
i2 = HMW->speciesIndex("H2O(L)");
|
i2 = HMW->speciesIndex("H2O(L)");
|
||||||
j1 = HMW->speciesIndex("OH-");
|
j1 = HMW->speciesIndex("OH-");
|
||||||
if (i1 < 0 || i2 < 0 || j1 < 0) {
|
if (i1 == npos || i2 == npos || j1 == npos) {
|
||||||
printf("problems\n");
|
printf("problems\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ void printUsage()
|
||||||
|
|
||||||
void pAtable(HMWSoln* HMW)
|
void pAtable(HMWSoln* HMW)
|
||||||
{
|
{
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
double acMol[100];
|
double acMol[100];
|
||||||
double mf[100];
|
double mf[100];
|
||||||
double activities[100];
|
double activities[100];
|
||||||
|
|
@ -28,7 +28,7 @@ void pAtable(HMWSoln* HMW)
|
||||||
string sName;
|
string sName;
|
||||||
printf(" Name Activity ActCoeffMolal "
|
printf(" Name Activity ActCoeffMolal "
|
||||||
" MoleFract Molality\n");
|
" MoleFract Molality\n");
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
sName = HMW->speciesName(k);
|
sName = HMW->speciesName(k);
|
||||||
printf("%16s %13g %13g %13g %13g\n",
|
printf("%16s %13g %13g %13g %13g\n",
|
||||||
sName.c_str(), activities[k], acMol[k], mf[k], moll[k]);
|
sName.c_str(), activities[k], acMol[k], mf[k], moll[k]);
|
||||||
|
|
@ -47,7 +47,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
HMWSoln* HMW = new HMWSoln("HMW_NaCl_tc.xml");
|
HMWSoln* HMW = new HMWSoln("HMW_NaCl_tc.xml");
|
||||||
|
|
||||||
int nsp = HMW->nSpecies();
|
size_t nsp = HMW->nSpecies();
|
||||||
|
|
||||||
double a1 = HMW->AionicRadius(1);
|
double a1 = HMW->AionicRadius(1);
|
||||||
printf("a1 = %g\n", a1);
|
printf("a1 = %g\n", a1);
|
||||||
|
|
@ -91,25 +91,22 @@ int main(int argc, char** argv)
|
||||||
HMW->setState_TP(Temp, 1.01325E5);
|
HMW->setState_TP(Temp, 1.01325E5);
|
||||||
HMW->getStandardChemPotentials(mu0);
|
HMW->getStandardChemPotentials(mu0);
|
||||||
// translate from J/kmol to kJ/gmol
|
// translate from J/kmol to kJ/gmol
|
||||||
int k;
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
for (k = 0; k < nsp; k++) {
|
|
||||||
mu0[k] *= 1.0E-6;
|
mu0[k] *= 1.0E-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" Species Standard chemical potentials (kJ/gmol) \n");
|
printf(" Species Standard chemical potentials (kJ/gmol) \n");
|
||||||
printf("------------------------------------------------------------\n");
|
printf("------------------------------------------------------------\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
sName = HMW->speciesName(k);
|
sName = HMW->speciesName(k);
|
||||||
printf("%16s %16.9g\n", sName.c_str(), mu0[k]);
|
printf("%16s %16.9g\n", sName.c_str(), mu0[k]);
|
||||||
}
|
}
|
||||||
printf("------------------------------------------------------------\n");
|
printf("------------------------------------------------------------\n");
|
||||||
printf(" Some DeltaSS values: Delta(mu_0)\n");
|
printf(" Some DeltaSS values: Delta(mu_0)\n");
|
||||||
double deltaG;
|
double deltaG;
|
||||||
int i1, i2, j1;
|
size_t i1, i2, j1;
|
||||||
double RT = 8.314472E-3 * 298.15;
|
double RT = 8.314472E-3 * 298.15;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
i1 = HMW->speciesIndex("Na+");
|
i1 = HMW->speciesIndex("Na+");
|
||||||
i2 = HMW->speciesIndex("Cl-");
|
i2 = HMW->speciesIndex("Cl-");
|
||||||
deltaG = -432.6304 - mu0[i1] - mu0[i2];
|
deltaG = -432.6304 - mu0[i1] - mu0[i2];
|
||||||
|
|
@ -123,7 +120,7 @@ int main(int argc, char** argv)
|
||||||
i1 = HMW->speciesIndex("H+");
|
i1 = HMW->speciesIndex("H+");
|
||||||
i2 = HMW->speciesIndex("H2O(L)");
|
i2 = HMW->speciesIndex("H2O(L)");
|
||||||
j1 = HMW->speciesIndex("OH-");
|
j1 = HMW->speciesIndex("OH-");
|
||||||
if (i1 < 0 || i2 < 0 || j1 < 0) {
|
if (i1 == npos || i2 == npos || j1 == npos) {
|
||||||
printf("problems\n");
|
printf("problems\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ int main(int argc, char** argv)
|
||||||
for (int j = 1; j < argc; j++) {
|
for (int j = 1; j < argc; j++) {
|
||||||
tok = string(argv[j]);
|
tok = string(argv[j]);
|
||||||
if (tok[0] == '-') {
|
if (tok[0] == '-') {
|
||||||
int nopt = tok.size();
|
size_t nopt = tok.size();
|
||||||
for (int n = 1; n < nopt; n++) {
|
for (size_t n = 1; n < nopt; n++) {
|
||||||
if (tok[n] == 'h') {
|
if (tok[n] == 'h') {
|
||||||
printUsage();
|
printUsage();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
@ -101,7 +101,7 @@ int main(int argc, char** argv)
|
||||||
double mmw = issp.meanMolecularWeight();
|
double mmw = issp.meanMolecularWeight();
|
||||||
printf("mean molecular weight = %13.5g kg kmol-1\n", mmw);
|
printf("mean molecular weight = %13.5g kg kmol-1\n", mmw);
|
||||||
|
|
||||||
int n = issp.nSpecies();
|
size_t n = issp.nSpecies();
|
||||||
|
|
||||||
double HiSS[20], muiSS[20],SiSS[20], CpiSS[20], VoliSS[20];
|
double HiSS[20], muiSS[20],SiSS[20], CpiSS[20], VoliSS[20];
|
||||||
double RT = GasConstant * Tkelvin;
|
double RT = GasConstant * Tkelvin;
|
||||||
|
|
@ -112,7 +112,7 @@ int main(int argc, char** argv)
|
||||||
issp.getStandardVolumes(VoliSS);
|
issp.getStandardVolumes(VoliSS);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
HiSS[i] *= RT;
|
HiSS[i] *= RT;
|
||||||
SiSS[i] *= RT;
|
SiSS[i] *= RT;
|
||||||
CpiSS[i] *= GasConstant;
|
CpiSS[i] *= GasConstant;
|
||||||
|
|
@ -121,7 +121,7 @@ int main(int argc, char** argv)
|
||||||
printf(" Printout of standard state properties\n");
|
printf(" Printout of standard state properties\n");
|
||||||
printf(" Name mu_i H_i_SS "
|
printf(" Name mu_i H_i_SS "
|
||||||
" S_i_SS Cp_i_SS Vol_i_SS\n");
|
" S_i_SS Cp_i_SS Vol_i_SS\n");
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
string sn = issp.speciesName(i);
|
string sn = issp.speciesName(i);
|
||||||
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), muiSS[i],
|
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), muiSS[i],
|
||||||
HiSS[i], SiSS[i], CpiSS[i], VoliSS[i]);
|
HiSS[i], SiSS[i], CpiSS[i], VoliSS[i]);
|
||||||
|
|
@ -139,7 +139,7 @@ int main(int argc, char** argv)
|
||||||
printf(" Printout of Partial molar properties\n");
|
printf(" Printout of Partial molar properties\n");
|
||||||
printf(" Name mu_i H_i_PM "
|
printf(" Name mu_i H_i_PM "
|
||||||
" S_i_PM Cp_i_PM Vol_i_PM\n");
|
" S_i_PM Cp_i_PM Vol_i_PM\n");
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
string sn = issp.speciesName(i);
|
string sn = issp.speciesName(i);
|
||||||
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), mui[i],
|
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), mui[i],
|
||||||
HiPM[i], SiPM[i], CpiPM[i], VoliPM[i]);
|
HiPM[i], SiPM[i], CpiPM[i], VoliPM[i]);
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ int main(int argc, char** argv)
|
||||||
for (int j = 1; j < argc; j++) {
|
for (int j = 1; j < argc; j++) {
|
||||||
tok = string(argv[j]);
|
tok = string(argv[j]);
|
||||||
if (tok[0] == '-') {
|
if (tok[0] == '-') {
|
||||||
int nopt = tok.size();
|
size_t nopt = tok.size();
|
||||||
for (int n = 1; n < nopt; n++) {
|
for (size_t n = 1; n < nopt; n++) {
|
||||||
if (tok[n] == 'h') {
|
if (tok[n] == 'h') {
|
||||||
printUsage();
|
printUsage();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
@ -99,7 +99,7 @@ int main(int argc, char** argv)
|
||||||
double mmw = ims.meanMolecularWeight();
|
double mmw = ims.meanMolecularWeight();
|
||||||
printf("mean molecular weight = %13.5g kg kmol-1\n", mmw);
|
printf("mean molecular weight = %13.5g kg kmol-1\n", mmw);
|
||||||
|
|
||||||
int n = ims.nSpecies();
|
size_t n = ims.nSpecies();
|
||||||
|
|
||||||
double HiSS[20], muiSS[20],SiSS[20], CpiSS[20], VoliSS[20];
|
double HiSS[20], muiSS[20],SiSS[20], CpiSS[20], VoliSS[20];
|
||||||
double RT = GasConstant * Tkelvin;
|
double RT = GasConstant * Tkelvin;
|
||||||
|
|
@ -110,7 +110,7 @@ int main(int argc, char** argv)
|
||||||
ims.getStandardVolumes(VoliSS);
|
ims.getStandardVolumes(VoliSS);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
HiSS[i] *= RT;
|
HiSS[i] *= RT;
|
||||||
SiSS[i] *= RT;
|
SiSS[i] *= RT;
|
||||||
CpiSS[i] *= GasConstant;
|
CpiSS[i] *= GasConstant;
|
||||||
|
|
@ -119,7 +119,7 @@ int main(int argc, char** argv)
|
||||||
printf(" Printout of standard state properties\n");
|
printf(" Printout of standard state properties\n");
|
||||||
printf(" Name mu_i H_i_SS "
|
printf(" Name mu_i H_i_SS "
|
||||||
" S_i_SS Cp_i_SS Vol_i_SS\n");
|
" S_i_SS Cp_i_SS Vol_i_SS\n");
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
string sn = ims.speciesName(i);
|
string sn = ims.speciesName(i);
|
||||||
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), muiSS[i],
|
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), muiSS[i],
|
||||||
HiSS[i], SiSS[i], CpiSS[i], VoliSS[i]);
|
HiSS[i], SiSS[i], CpiSS[i], VoliSS[i]);
|
||||||
|
|
@ -137,7 +137,7 @@ int main(int argc, char** argv)
|
||||||
printf(" Printout of Partial molar properties\n");
|
printf(" Printout of Partial molar properties\n");
|
||||||
printf(" Name mu_i H_i_PM "
|
printf(" Name mu_i H_i_PM "
|
||||||
" S_i_PM Cp_i_PM Vol_i_PM\n");
|
" S_i_PM Cp_i_PM Vol_i_PM\n");
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
string sn = ims.speciesName(i);
|
string sn = ims.speciesName(i);
|
||||||
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), mui[i],
|
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), mui[i],
|
||||||
HiPM[i], SiPM[i], CpiPM[i], VoliPM[i]);
|
HiPM[i], SiPM[i], CpiPM[i], VoliPM[i]);
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ int main(int argc, char** argv)
|
||||||
for (int j = 1; j < argc; j++) {
|
for (int j = 1; j < argc; j++) {
|
||||||
tok = string(argv[j]);
|
tok = string(argv[j]);
|
||||||
if (tok[0] == '-') {
|
if (tok[0] == '-') {
|
||||||
int nopt = tok.size();
|
size_t nopt = tok.size();
|
||||||
for (int n = 1; n < nopt; n++) {
|
for (size_t n = 1; n < nopt; n++) {
|
||||||
if (tok[n] == 'h') {
|
if (tok[n] == 'h') {
|
||||||
printUsage();
|
printUsage();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
@ -101,7 +101,7 @@ int main(int argc, char** argv)
|
||||||
double mmw = issp.meanMolecularWeight();
|
double mmw = issp.meanMolecularWeight();
|
||||||
printf("mean molecular weight = %13.5g kg kmol-1\n", mmw);
|
printf("mean molecular weight = %13.5g kg kmol-1\n", mmw);
|
||||||
|
|
||||||
int n = issp.nSpecies();
|
size_t n = issp.nSpecies();
|
||||||
|
|
||||||
double HiSS[20], muiSS[20],SiSS[20], CpiSS[20], VoliSS[20];
|
double HiSS[20], muiSS[20],SiSS[20], CpiSS[20], VoliSS[20];
|
||||||
double RT = GasConstant * Tkelvin;
|
double RT = GasConstant * Tkelvin;
|
||||||
|
|
@ -112,7 +112,7 @@ int main(int argc, char** argv)
|
||||||
issp.getStandardVolumes(VoliSS);
|
issp.getStandardVolumes(VoliSS);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
HiSS[i] *= RT;
|
HiSS[i] *= RT;
|
||||||
SiSS[i] *= RT;
|
SiSS[i] *= RT;
|
||||||
CpiSS[i] *= GasConstant;
|
CpiSS[i] *= GasConstant;
|
||||||
|
|
@ -121,7 +121,7 @@ int main(int argc, char** argv)
|
||||||
printf(" Printout of standard state properties\n");
|
printf(" Printout of standard state properties\n");
|
||||||
printf(" Name mu_i H_i_SS "
|
printf(" Name mu_i H_i_SS "
|
||||||
" S_i_SS Cp_i_SS Vol_i_SS\n");
|
" S_i_SS Cp_i_SS Vol_i_SS\n");
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
string sn = issp.speciesName(i);
|
string sn = issp.speciesName(i);
|
||||||
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), muiSS[i],
|
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), muiSS[i],
|
||||||
HiSS[i], SiSS[i], CpiSS[i], VoliSS[i]);
|
HiSS[i], SiSS[i], CpiSS[i], VoliSS[i]);
|
||||||
|
|
@ -139,7 +139,7 @@ int main(int argc, char** argv)
|
||||||
printf(" Printout of Partial molar properties\n");
|
printf(" Printout of Partial molar properties\n");
|
||||||
printf(" Name mu_i H_i_PM "
|
printf(" Name mu_i H_i_PM "
|
||||||
" S_i_PM Cp_i_PM Vol_i_PM\n");
|
" S_i_PM Cp_i_PM Vol_i_PM\n");
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
string sn = issp.speciesName(i);
|
string sn = issp.speciesName(i);
|
||||||
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), mui[i],
|
printf(" %15s %12.5g %12.5g %12.5g %12.5g %12.5g\n", sn.c_str(), mui[i],
|
||||||
HiPM[i], SiPM[i], CpiPM[i], VoliPM[i]);
|
HiPM[i], SiPM[i], CpiPM[i], VoliPM[i]);
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,6 @@ void printUsage()
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
int retn = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//Cantera::ThermoPhase *tp = 0;
|
//Cantera::ThermoPhase *tp = 0;
|
||||||
char iFile[80], file_ID[80];
|
char iFile[80], file_ID[80];
|
||||||
|
|
@ -39,7 +35,6 @@ int main(int argc, char** argv)
|
||||||
XML_Node* xm = get_XML_NameID("phase", file_ID, 0);
|
XML_Node* xm = get_XML_NameID("phase", file_ID, 0);
|
||||||
StoichSubstanceSSTP* solid = new StoichSubstanceSSTP(*xm);
|
StoichSubstanceSSTP* solid = new StoichSubstanceSSTP(*xm);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load in and initialize the
|
* Load in and initialize the
|
||||||
*/
|
*/
|
||||||
|
|
@ -47,8 +42,7 @@ int main(int argc, char** argv)
|
||||||
//string id = "NaCl(S)";
|
//string id = "NaCl(S)";
|
||||||
//Cantera::ThermoPhase *solid = Cantera::newPhase(nacl_s, id);
|
//Cantera::ThermoPhase *solid = Cantera::newPhase(nacl_s, id);
|
||||||
|
|
||||||
|
size_t nsp = solid->nSpecies();
|
||||||
int nsp = solid->nSpecies();
|
|
||||||
if (nsp != 1) {
|
if (nsp != 1) {
|
||||||
throw CanteraError("","Should just be one species");
|
throw CanteraError("","Should just be one species");
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +77,6 @@ int main(int argc, char** argv)
|
||||||
printf(" Data from http://webbook.nist.gov\n");
|
printf(" Data from http://webbook.nist.gov\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
printf(" T, Pres, molarGibbs0, Enthalpy, Entropy, Cp ,"
|
printf(" T, Pres, molarGibbs0, Enthalpy, Entropy, Cp ,"
|
||||||
" -(G-H298)/T, H-H298 ");
|
" -(G-H298)/T, H-H298 ");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
@ -92,15 +85,13 @@ int main(int argc, char** argv)
|
||||||
" J/gmolK, J/gmol");
|
" J/gmolK, J/gmol");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
for (i = 0; i < TTable.NPoints; i++) {
|
for (size_t i = 0; i < TTable.NPoints; i++) {
|
||||||
T = TTable.T[i];
|
T = TTable.T[i];
|
||||||
|
|
||||||
// GasConstant is in J/kmol
|
// GasConstant is in J/kmol
|
||||||
RT = GasConstant * T;
|
RT = GasConstant * T;
|
||||||
|
|
||||||
pres = OneAtm;
|
pres = OneAtm;
|
||||||
|
|
||||||
|
|
||||||
solid->setState_TP(T, pres);
|
solid->setState_TP(T, pres);
|
||||||
/*
|
/*
|
||||||
* Get the Standard State DeltaH
|
* Get the Standard State DeltaH
|
||||||
|
|
@ -110,7 +101,6 @@ int main(int argc, char** argv)
|
||||||
solid->getEnthalpy_RT(enth_RT);
|
solid->getEnthalpy_RT(enth_RT);
|
||||||
enth_NaCl = enth_RT[0] * RT * 1.0E-6;
|
enth_NaCl = enth_RT[0] * RT * 1.0E-6;
|
||||||
|
|
||||||
|
|
||||||
solid->getChemPotentials(mu);
|
solid->getChemPotentials(mu);
|
||||||
mu_NaCl = mu[0] * 1.0E-6;
|
mu_NaCl = mu[0] * 1.0E-6;
|
||||||
|
|
||||||
|
|
@ -122,11 +112,6 @@ int main(int argc, char** argv)
|
||||||
solid->getCp_R(cp_r);
|
solid->getCp_R(cp_r);
|
||||||
cp_NaCl = cp_r[0] * GasConstant * 1.0E-3;
|
cp_NaCl = cp_r[0] * GasConstant * 1.0E-3;
|
||||||
|
|
||||||
/*
|
|
||||||
* Need the gas constant in kJ/gmolK
|
|
||||||
*/
|
|
||||||
// double rgas = 8.314472 * 1.0E-3;
|
|
||||||
|
|
||||||
double pbar = pres * 1.0E-5;
|
double pbar = pres * 1.0E-5;
|
||||||
|
|
||||||
printf("%10g, %10g, %12g, %12g, %12g, %12g, %12g, %12g",
|
printf("%10g, %10g, %12g, %12g, %12g, %12g, %12g, %12g",
|
||||||
|
|
@ -134,14 +119,9 @@ int main(int argc, char** argv)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
delete solid;
|
delete solid;
|
||||||
solid = 0;
|
solid = 0;
|
||||||
Cantera::appdelete();
|
Cantera::appdelete();
|
||||||
|
|
||||||
return retn;
|
|
||||||
|
|
||||||
} catch (CanteraError& err) {
|
} catch (CanteraError& err) {
|
||||||
std::cout << err.what() << std::endl;
|
std::cout << err.what() << std::endl;
|
||||||
Cantera::appdelete();
|
Cantera::appdelete();
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,11 @@ using namespace Cantera;
|
||||||
template<class G, class V>
|
template<class G, class V>
|
||||||
void makeEquilDataLabels(const G& gas, V& names)
|
void makeEquilDataLabels(const G& gas, V& names)
|
||||||
{
|
{
|
||||||
int nsp = gas.nSpecies();
|
size_t nsp = gas.nSpecies();
|
||||||
names.resize(nsp + 2);
|
names.resize(nsp + 2);
|
||||||
names[0] = "Temperature (K)";
|
names[0] = "Temperature (K)";
|
||||||
names[1] = "Pressure (Pa)";
|
names[1] = "Pressure (Pa)";
|
||||||
int k;
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
for (k = 0; k < nsp; k++) {
|
|
||||||
names[2+k] = gas.speciesName(k);
|
names[2+k] = gas.speciesName(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +62,7 @@ int equil_example1(int job)
|
||||||
|
|
||||||
//IdealGasMix gas("silane.cti", "silane");
|
//IdealGasMix gas("silane.cti", "silane");
|
||||||
IdealGasMix gas("silane.xml", "silane");
|
IdealGasMix gas("silane.xml", "silane");
|
||||||
int nsp = gas.nSpecies();
|
size_t nsp = gas.nSpecies();
|
||||||
|
|
||||||
int ntemps = 50; // number of temperatures
|
int ntemps = 50; // number of temperatures
|
||||||
Array2D output(nsp+2, ntemps);
|
Array2D output(nsp+2, ntemps);
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ void saveSoln(double time, const G& gas, A& soln)
|
||||||
soln(1,back) = gas.temperature();
|
soln(1,back) = gas.temperature();
|
||||||
soln(2,back) = gas.density();
|
soln(2,back) = gas.density();
|
||||||
soln(3,back) = gas.pressure();
|
soln(3,back) = gas.pressure();
|
||||||
int nsp = gas.nSpecies();
|
size_t nsp = gas.nSpecies();
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
soln(4+k,back) = gas.moleFraction(k);
|
soln(4+k,back) = gas.moleFraction(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -35,14 +35,13 @@ void saveSoln(double time, const G& gas, A& soln)
|
||||||
template<class G, class V>
|
template<class G, class V>
|
||||||
void makeDataLabels(const G& gas, V& names)
|
void makeDataLabels(const G& gas, V& names)
|
||||||
{
|
{
|
||||||
int nsp = gas.nSpecies();
|
size_t nsp = gas.nSpecies();
|
||||||
names.resize(nsp + 4);
|
names.resize(nsp + 4);
|
||||||
names[0] = "time (s)";
|
names[0] = "time (s)";
|
||||||
names[1] = "Temperature (K)";
|
names[1] = "Temperature (K)";
|
||||||
names[2] = "Density (kg/m3)";
|
names[2] = "Density (kg/m3)";
|
||||||
names[3] = "Pressure (Pa)";
|
names[3] = "Pressure (Pa)";
|
||||||
int k;
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
for (k = 0; k < nsp; k++) {
|
|
||||||
names[4+k] = gas.speciesName(k);
|
names[4+k] = gas.speciesName(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,15 +64,12 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
if (example_num == 0) {
|
if (example_num == 0) {
|
||||||
int j;
|
for (int j = 0; j < NUM_EXAMPLES; j++) {
|
||||||
for (j = 0; j < NUM_EXAMPLES; j++) {
|
run_example(j, fex[j], 2);
|
||||||
i = run_example(j, fex[j], 2);
|
|
||||||
}
|
}
|
||||||
} else if (example_num > 0 && example_num <= NUM_EXAMPLES) {
|
} else if (example_num > 0 && example_num <= NUM_EXAMPLES) {
|
||||||
i = run_example(example_num-1, fex[example_num-1], 2);
|
run_example(example_num-1, fex[example_num-1], 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ int kinetics_example1(int job)
|
||||||
|
|
||||||
// set the state
|
// set the state
|
||||||
gas.setState_TPX(1001.0, OneAtm, "H2:2.0, O2:1.0, N2:4.0");
|
gas.setState_TPX(1001.0, OneAtm, "H2:2.0, O2:1.0, N2:4.0");
|
||||||
int kk = gas.nSpecies();
|
size_t kk = gas.nSpecies();
|
||||||
|
|
||||||
// create a reactor
|
// create a reactor
|
||||||
Reactor r;
|
Reactor r;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ int kinetics_example2(int job)
|
||||||
// create a GRI30 object
|
// create a GRI30 object
|
||||||
GRI30 gas;
|
GRI30 gas;
|
||||||
gas.setState_TPX(1001.0, OneAtm, "H2:2.0, O2:1.0, N2:4.0");
|
gas.setState_TPX(1001.0, OneAtm, "H2:2.0, O2:1.0, N2:4.0");
|
||||||
int kk = gas.nSpecies();
|
size_t kk = gas.nSpecies();
|
||||||
|
|
||||||
// create a reactor
|
// create a reactor
|
||||||
Reactor r;
|
Reactor r;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ int kinetics_example3(int job)
|
||||||
|
|
||||||
// set the state
|
// set the state
|
||||||
gas.setState_TPX(1001.0, OneAtm, "H2:2.0, O2:1.0, N2:4.0");
|
gas.setState_TPX(1001.0, OneAtm, "H2:2.0, O2:1.0, N2:4.0");
|
||||||
int kk = gas.nSpecies();
|
size_t kk = gas.nSpecies();
|
||||||
|
|
||||||
// create a reactor
|
// create a reactor
|
||||||
ConstPressureReactor r;
|
ConstPressureReactor r;
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,12 @@ using std::endl;
|
||||||
template<class G, class V>
|
template<class G, class V>
|
||||||
void makeTransportDataLabels(const G& gas, V& names)
|
void makeTransportDataLabels(const G& gas, V& names)
|
||||||
{
|
{
|
||||||
int nsp = gas.nSpecies();
|
size_t nsp = gas.nSpecies();
|
||||||
names.resize(nsp + 3);
|
names.resize(nsp + 3);
|
||||||
names[0] = "Temperature (K)";
|
names[0] = "Temperature (K)";
|
||||||
names[1] = "Viscosity ()";
|
names[1] = "Viscosity ()";
|
||||||
names[2] = "Thermal Conductivity (W/m-K)";
|
names[2] = "Thermal Conductivity (W/m-K)";
|
||||||
int k;
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
for (k = 0; k < nsp; k++) {
|
|
||||||
names[3+k] = gas.speciesName(k);
|
names[3+k] = gas.speciesName(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +62,7 @@ int transport_example1(int job)
|
||||||
|
|
||||||
Transport* tr = newTransportMgr("Mix", &gas);
|
Transport* tr = newTransportMgr("Mix", &gas);
|
||||||
|
|
||||||
int nsp = gas.nSpecies();
|
size_t nsp = gas.nSpecies();
|
||||||
|
|
||||||
|
|
||||||
// create a 2D array to hold the outputs
|
// create a 2D array to hold the outputs
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,12 @@ using std::endl;
|
||||||
template<class G, class V>
|
template<class G, class V>
|
||||||
void makeTransportDataLabels(const G& gas, V& names)
|
void makeTransportDataLabels(const G& gas, V& names)
|
||||||
{
|
{
|
||||||
int nsp = gas.nSpecies();
|
size_t nsp = gas.nSpecies();
|
||||||
names.resize(nsp + 3);
|
names.resize(nsp + 3);
|
||||||
names[0] = "Temperature (K)";
|
names[0] = "Temperature (K)";
|
||||||
names[1] = "Viscosity ()";
|
names[1] = "Viscosity ()";
|
||||||
names[2] = "Thermal Conductivity (W/m-K)";
|
names[2] = "Thermal Conductivity (W/m-K)";
|
||||||
int k;
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
for (k = 0; k < nsp; k++) {
|
|
||||||
names[3+k] = gas.speciesName(k);
|
names[3+k] = gas.speciesName(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -64,7 +63,7 @@ int transport_example2(int job)
|
||||||
// multicomponent transport properties
|
// multicomponent transport properties
|
||||||
|
|
||||||
Transport* tr = newTransportMgr("Multi", &gas);
|
Transport* tr = newTransportMgr("Multi", &gas);
|
||||||
int nsp = gas.nSpecies();
|
size_t nsp = gas.nSpecies();
|
||||||
|
|
||||||
// create a 2D array to hold the outputs
|
// create a 2D array to hold the outputs
|
||||||
int ntemps = 20;
|
int ntemps = 20;
|
||||||
|
|
|
||||||
|
|
@ -50,18 +50,18 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
XML_Node* const xg = xc->findNameID("phase", "gas");
|
XML_Node* const xg = xc->findNameID("phase", "gas");
|
||||||
ThermoPhase* gasTP = newPhase(*xg);
|
ThermoPhase* gasTP = newPhase(*xg);
|
||||||
int nsp = gasTP->nSpecies();
|
size_t nsp = gasTP->nSpecies();
|
||||||
cout << "Number of species = " << nsp << endl;
|
cout << "Number of species = " << nsp << endl;
|
||||||
|
|
||||||
XML_Node* const xd = xc->findNameID("phase", "diamond");
|
XML_Node* const xd = xc->findNameID("phase", "diamond");
|
||||||
ThermoPhase* diamondTP = newPhase(*xd);
|
ThermoPhase* diamondTP = newPhase(*xd);
|
||||||
int nsp_diamond = diamondTP->nSpecies();
|
size_t nsp_diamond = diamondTP->nSpecies();
|
||||||
cout << "Number of species in diamond = " << nsp_diamond << endl;
|
cout << "Number of species in diamond = " << nsp_diamond << endl;
|
||||||
|
|
||||||
|
|
||||||
XML_Node* const xs = xc->findNameID("phase", "diamond_100");
|
XML_Node* const xs = xc->findNameID("phase", "diamond_100");
|
||||||
ThermoPhase* diamond100TP = newPhase(*xs);
|
ThermoPhase* diamond100TP = newPhase(*xs);
|
||||||
int nsp_d100 = diamond100TP->nSpecies();
|
size_t nsp_d100 = diamond100TP->nSpecies();
|
||||||
cout << "Number of species in diamond_100 = " << nsp_d100 << endl;
|
cout << "Number of species in diamond_100 = " << nsp_d100 << endl;
|
||||||
|
|
||||||
vector<ThermoPhase*> phaseList;
|
vector<ThermoPhase*> phaseList;
|
||||||
|
|
@ -70,7 +70,7 @@ int main(int argc, char** argv)
|
||||||
phaseList.push_back(diamond100TP);
|
phaseList.push_back(diamond100TP);
|
||||||
InterfaceKinetics* iKin_ptr = new InterfaceKinetics();
|
InterfaceKinetics* iKin_ptr = new InterfaceKinetics();
|
||||||
importKinetics(*xs, phaseList, iKin_ptr);
|
importKinetics(*xs, phaseList, iKin_ptr);
|
||||||
int nr = iKin_ptr->nReactions();
|
size_t nr = iKin_ptr->nReactions();
|
||||||
cout << "Number of reactions = " << nr << endl;
|
cout << "Number of reactions = " << nr << endl;
|
||||||
|
|
||||||
double x[20];
|
double x[20];
|
||||||
|
|
@ -88,9 +88,9 @@ int main(int argc, char** argv)
|
||||||
for (i = 0; i < 20; i++) {
|
for (i = 0; i < 20; i++) {
|
||||||
x[i] = 0.0;
|
x[i] = 0.0;
|
||||||
}
|
}
|
||||||
int i0 = diamond100TP->speciesIndex("c6H*");
|
size_t i0 = diamond100TP->speciesIndex("c6H*");
|
||||||
x[i0] = 0.1;
|
x[i0] = 0.1;
|
||||||
int i1 = diamond100TP->speciesIndex("c6HH");
|
size_t i1 = diamond100TP->speciesIndex("c6HH");
|
||||||
x[i1] = 0.9;
|
x[i1] = 0.9;
|
||||||
diamond100TP->setState_TX(1200., x);
|
diamond100TP->setState_TX(1200., x);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ int main(int argc, char** argv)
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
_set_output_format(_TWO_DIGIT_EXPONENT);
|
_set_output_format(_TWO_DIGIT_EXPONENT);
|
||||||
#endif
|
#endif
|
||||||
int i, k;
|
|
||||||
string infile = "frac.xml";
|
string infile = "frac.xml";
|
||||||
double x[10], kc[10];
|
double x[10], kc[10];
|
||||||
double cdot[10], ddot[10];
|
double cdot[10], ddot[10];
|
||||||
|
|
@ -46,26 +45,23 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
XML_Node* const xg = xc->findNameID("phase", "gas");
|
XML_Node* const xg = xc->findNameID("phase", "gas");
|
||||||
ThermoPhase* gasTP = newPhase(*xg);
|
ThermoPhase* gasTP = newPhase(*xg);
|
||||||
int nsp = gasTP->nSpecies();
|
size_t nsp = gasTP->nSpecies();
|
||||||
cout << "Number of species = " << nsp << endl;
|
cout << "Number of species = " << nsp << endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vector<ThermoPhase*> phaseList;
|
vector<ThermoPhase*> phaseList;
|
||||||
phaseList.push_back(gasTP);
|
phaseList.push_back(gasTP);
|
||||||
GasKinetics* iKin_ptr = new GasKinetics();
|
GasKinetics* iKin_ptr = new GasKinetics();
|
||||||
importKinetics(*xg, phaseList, iKin_ptr);
|
importKinetics(*xg, phaseList, iKin_ptr);
|
||||||
int nr = iKin_ptr->nReactions();
|
size_t nr = iKin_ptr->nReactions();
|
||||||
cout << "Number of reactions = " << nr << endl;
|
cout << "Number of reactions = " << nr << endl;
|
||||||
|
|
||||||
int iH2 = gasTP->speciesIndex("H2");
|
size_t iH2 = gasTP->speciesIndex("H2");
|
||||||
int iH = gasTP->speciesIndex("H");
|
size_t iH = gasTP->speciesIndex("H");
|
||||||
int iO2 = gasTP->speciesIndex("O2");
|
size_t iO2 = gasTP->speciesIndex("O2");
|
||||||
int iOH = gasTP->speciesIndex("OH");
|
size_t iOH = gasTP->speciesIndex("OH");
|
||||||
int iH2O = gasTP->speciesIndex("H2O");
|
size_t iH2O = gasTP->speciesIndex("H2O");
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
for (i = 0; i < nsp; i++) {
|
|
||||||
x[i] = 0.0;
|
x[i] = 0.0;
|
||||||
}
|
}
|
||||||
x[iH2O] = 1.0/2.0;
|
x[iH2O] = 1.0/2.0;
|
||||||
|
|
@ -80,7 +76,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
|
|
||||||
double src[20];
|
double src[20];
|
||||||
for (i = 0; i < 20; i++) {
|
for (size_t i = 0; i < 20; i++) {
|
||||||
src[i] = 0.0;
|
src[i] = 0.0;
|
||||||
}
|
}
|
||||||
iKin_ptr->getNetProductionRates(src);
|
iKin_ptr->getNetProductionRates(src);
|
||||||
|
|
@ -93,7 +89,7 @@ int main(int argc, char** argv)
|
||||||
iKin_ptr->getCreationRates(cdot);
|
iKin_ptr->getCreationRates(cdot);
|
||||||
iKin_ptr->getDestructionRates(ddot);
|
iKin_ptr->getDestructionRates(ddot);
|
||||||
|
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = gasTP->speciesName(k);
|
string sss = gasTP->speciesName(k);
|
||||||
cout << k << " " << sss << " ";
|
cout << k << " " << sss << " ";
|
||||||
printDbl(src[k]);
|
printDbl(src[k]);
|
||||||
|
|
@ -101,7 +97,7 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Creation Rates: \n");
|
printf("Creation Rates: \n");
|
||||||
for (k = 0; k < nsp - 1; k++) {
|
for (size_t k = 0; k < nsp - 1; k++) {
|
||||||
string sss = gasTP->speciesName(k);
|
string sss = gasTP->speciesName(k);
|
||||||
cout << k << " " << sss << " ";
|
cout << k << " " << sss << " ";
|
||||||
cout << cdot[k] << " ";
|
cout << cdot[k] << " ";
|
||||||
|
|
@ -116,7 +112,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
|
|
||||||
printf("Destruction Rates: \n");
|
printf("Destruction Rates: \n");
|
||||||
for (k = 0; k < nsp-1; k++) {
|
for (size_t k = 0; k < nsp-1; k++) {
|
||||||
string sss = gasTP->speciesName(k);
|
string sss = gasTP->speciesName(k);
|
||||||
cout << k << " " << sss << " ";
|
cout << k << " " << sss << " ";
|
||||||
cout << ddot[k] << " ";
|
cout << ddot[k] << " ";
|
||||||
|
|
@ -155,7 +151,6 @@ int main(int argc, char** argv)
|
||||||
printf("Kc[0] = %g\n", kc[0]);
|
printf("Kc[0] = %g\n", kc[0]);
|
||||||
printf("Kc[1] = %g\n", kc[1]);
|
printf("Kc[1] = %g\n", kc[1]);
|
||||||
|
|
||||||
|
|
||||||
delete(iKin_ptr);
|
delete(iKin_ptr);
|
||||||
iKin_ptr = 0;
|
iKin_ptr = 0;
|
||||||
delete(gasTP);
|
delete(gasTP);
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,11 @@ int main(int argc, char** argv)
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
_set_output_format(_TWO_DIGIT_EXPONENT);
|
_set_output_format(_TWO_DIGIT_EXPONENT);
|
||||||
#endif
|
#endif
|
||||||
int k;
|
|
||||||
string infile = "diamond.xml";
|
string infile = "diamond.xml";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
IdealGasMix g("gri30.xml", "gri30_mix");
|
IdealGasMix g("gri30.xml", "gri30_mix");
|
||||||
int nsp = g.nSpecies();
|
size_t nsp = g.nSpecies();
|
||||||
double pres = 1.0E5;
|
double pres = 1.0E5;
|
||||||
vector_fp Xset(nsp, 0.0);
|
vector_fp Xset(nsp, 0.0);
|
||||||
Xset[0] = 0.269205 ;
|
Xset[0] = 0.269205 ;
|
||||||
|
|
@ -101,10 +98,10 @@ int main(int argc, char** argv)
|
||||||
double T1 = 1500.;
|
double T1 = 1500.;
|
||||||
|
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
sum += Xset[k];
|
sum += Xset[k];
|
||||||
}
|
}
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
Xset[k] /= sum;
|
Xset[k] /= sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,11 +124,9 @@ int main(int argc, char** argv)
|
||||||
double T3 = 1400.;
|
double T3 = 1400.;
|
||||||
|
|
||||||
vector_fp grad_T(3, 0.0);
|
vector_fp grad_T(3, 0.0);
|
||||||
|
|
||||||
Array2D grad_X(nsp, 2, 0.0);
|
Array2D grad_X(nsp, 2, 0.0);
|
||||||
|
|
||||||
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
for (k = 0; k < nsp; k++) {
|
|
||||||
grad_X(k,0) = (X2set[k] - Xset[k])/dist;
|
grad_X(k,0) = (X2set[k] - Xset[k])/dist;
|
||||||
grad_X(k,1) = (X3set[k] - Xset[k])/dist;
|
grad_X(k,1) = (X3set[k] - Xset[k])/dist;
|
||||||
}
|
}
|
||||||
|
|
@ -141,28 +136,23 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
int log_level = 0;
|
int log_level = 0;
|
||||||
Transport* tran = newTransportMgr("Mix", &g, log_level=0);
|
Transport* tran = newTransportMgr("Mix", &g, log_level=0);
|
||||||
|
|
||||||
MixTransport* tranMix = dynamic_cast<MixTransport*>(tran);
|
MixTransport* tranMix = dynamic_cast<MixTransport*>(tran);
|
||||||
|
|
||||||
|
|
||||||
g.setState_TPX(1500.0, pres, DATA_PTR(Xset));
|
g.setState_TPX(1500.0, pres, DATA_PTR(Xset));
|
||||||
|
|
||||||
|
|
||||||
vector_fp mixDiffs(nsp, 0.0);
|
vector_fp mixDiffs(nsp, 0.0);
|
||||||
|
|
||||||
tranMix->getMixDiffCoeffs(DATA_PTR(mixDiffs));
|
tranMix->getMixDiffCoeffs(DATA_PTR(mixDiffs));
|
||||||
printf(" Dump of the mixture Diffusivities:\n");
|
printf(" Dump of the mixture Diffusivities:\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" %15s %13.5g\n", sss.c_str(), mixDiffs[k]);
|
printf(" %15s %13.5g\n", sss.c_str(), mixDiffs[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vector_fp specVisc(nsp, 0.0);
|
vector_fp specVisc(nsp, 0.0);
|
||||||
|
|
||||||
tranMix->getSpeciesViscosities(DATA_PTR(specVisc));
|
tranMix->getSpeciesViscosities(DATA_PTR(specVisc));
|
||||||
printf(" Dump of the species viscosities:\n");
|
printf(" Dump of the species viscosities:\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" %15s %13.5g\n", sss.c_str(), specVisc[k]);
|
printf(" %15s %13.5g\n", sss.c_str(), specVisc[k]);
|
||||||
}
|
}
|
||||||
|
|
@ -170,13 +160,13 @@ int main(int argc, char** argv)
|
||||||
vector_fp thermDiff(nsp, 0.0);
|
vector_fp thermDiff(nsp, 0.0);
|
||||||
tranMix->getThermalDiffCoeffs(DATA_PTR(thermDiff));
|
tranMix->getThermalDiffCoeffs(DATA_PTR(thermDiff));
|
||||||
printf(" Dump of the Thermal Diffusivities :\n");
|
printf(" Dump of the Thermal Diffusivities :\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" %15s %13.5g\n", sss.c_str(), thermDiff[k]);
|
printf(" %15s %13.5g\n", sss.c_str(), thermDiff[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Viscosity and thermal Cond vs. T\n");
|
printf("Viscosity and thermal Cond vs. T\n");
|
||||||
for (k = 0; k < 10; k++) {
|
for (size_t k = 0; k < 10; k++) {
|
||||||
T1 = 400. + 100. * k;
|
T1 = 400. + 100. * k;
|
||||||
g.setState_TPX(T1, pres, DATA_PTR(Xset));
|
g.setState_TPX(T1, pres, DATA_PTR(Xset));
|
||||||
double visc = tran->viscosity();
|
double visc = tran->viscosity();
|
||||||
|
|
@ -190,7 +180,7 @@ int main(int argc, char** argv)
|
||||||
printf("Binary Diffusion Coefficients H2 vs species\n");
|
printf("Binary Diffusion Coefficients H2 vs species\n");
|
||||||
|
|
||||||
tranMix->getBinaryDiffCoeffs(nsp, Bdiff.ptrColumn(0));
|
tranMix->getBinaryDiffCoeffs(nsp, Bdiff.ptrColumn(0));
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" H2 - %15s %13.5g %13.5g\n", sss.c_str(), Bdiff(0,k), Bdiff(k,0));
|
printf(" H2 - %15s %13.5g %13.5g\n", sss.c_str(), Bdiff(0,k), Bdiff(k,0));
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +190,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
tranMix->getMobilities(DATA_PTR(specMob));
|
tranMix->getMobilities(DATA_PTR(specMob));
|
||||||
printf(" Dump of the species mobilities:\n");
|
printf(" Dump of the species mobilities:\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" %15s %13.5g\n", sss.c_str(), specMob[k]);
|
printf(" %15s %13.5g\n", sss.c_str(), specMob[k]);
|
||||||
}
|
}
|
||||||
|
|
@ -214,7 +204,7 @@ int main(int argc, char** argv)
|
||||||
double sum2 = 0.0;
|
double sum2 = 0.0;
|
||||||
double max1 = 0.0;
|
double max1 = 0.0;
|
||||||
double max2 = 0.0;
|
double max2 = 0.0;
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" %15s %13.5g %13.5g\n", sss.c_str(), fluxes(k,0), fluxes(k,1));
|
printf(" %15s %13.5g %13.5g\n", sss.c_str(), fluxes(k,0), fluxes(k,1));
|
||||||
sum1 += fluxes(k,0);
|
sum1 += fluxes(k,0);
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,11 @@ int main(int argc, char** argv)
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
_set_output_format(_TWO_DIGIT_EXPONENT);
|
_set_output_format(_TWO_DIGIT_EXPONENT);
|
||||||
#endif
|
#endif
|
||||||
int k;
|
|
||||||
string infile = "diamond.xml";
|
string infile = "diamond.xml";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
IdealGasMix g("gri30.xml", "gri30_mix");
|
IdealGasMix g("gri30.xml", "gri30_mix");
|
||||||
int nsp = g.nSpecies();
|
size_t nsp = g.nSpecies();
|
||||||
double pres = 1.0E5;
|
double pres = 1.0E5;
|
||||||
vector_fp Xset(nsp, 0.0);
|
vector_fp Xset(nsp, 0.0);
|
||||||
Xset[0] = 0.269205 ;
|
Xset[0] = 0.269205 ;
|
||||||
|
|
@ -109,10 +106,10 @@ int main(int argc, char** argv)
|
||||||
double T1 = 1500.;
|
double T1 = 1500.;
|
||||||
|
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
sum += Xset[k];
|
sum += Xset[k];
|
||||||
}
|
}
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
Xset[k] /= sum;
|
Xset[k] /= sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,11 +132,9 @@ int main(int argc, char** argv)
|
||||||
double T3 = 1400.;
|
double T3 = 1400.;
|
||||||
|
|
||||||
vector_fp grad_T(3, 0.0);
|
vector_fp grad_T(3, 0.0);
|
||||||
|
|
||||||
Array2D grad_X(nsp, 2, 0.0);
|
Array2D grad_X(nsp, 2, 0.0);
|
||||||
|
|
||||||
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
for (k = 0; k < nsp; k++) {
|
|
||||||
grad_X(k,0) = (X2set[k] - Xset[k])/dist;
|
grad_X(k,0) = (X2set[k] - Xset[k])/dist;
|
||||||
grad_X(k,1) = (X3set[k] - Xset[k])/dist;
|
grad_X(k,1) = (X3set[k] - Xset[k])/dist;
|
||||||
}
|
}
|
||||||
|
|
@ -149,28 +144,21 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
int log_level = 0;
|
int log_level = 0;
|
||||||
Transport* tran = newTransportMgr("Multi", &g, log_level=0);
|
Transport* tran = newTransportMgr("Multi", &g, log_level=0);
|
||||||
|
|
||||||
MultiTransport* tranMix = dynamic_cast<MultiTransport*>(tran);
|
MultiTransport* tranMix = dynamic_cast<MultiTransport*>(tran);
|
||||||
|
|
||||||
|
|
||||||
g.setState_TPX(1500.0, pres, DATA_PTR(Xset));
|
g.setState_TPX(1500.0, pres, DATA_PTR(Xset));
|
||||||
|
|
||||||
|
|
||||||
vector_fp mixDiffs(nsp, 0.0);
|
vector_fp mixDiffs(nsp, 0.0);
|
||||||
|
|
||||||
tranMix->getMixDiffCoeffs(DATA_PTR(mixDiffs));
|
tranMix->getMixDiffCoeffs(DATA_PTR(mixDiffs));
|
||||||
printf(" Dump of the mixture Diffusivities:\n");
|
printf(" Dump of the mixture Diffusivities:\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" %15s %13.5g\n", sss.c_str(), mixDiffs[k]);
|
printf(" %15s %13.5g\n", sss.c_str(), mixDiffs[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vector_fp specVisc(nsp, 0.0);
|
vector_fp specVisc(nsp, 0.0);
|
||||||
|
|
||||||
tranMix->getSpeciesViscosities(DATA_PTR(specVisc));
|
tranMix->getSpeciesViscosities(DATA_PTR(specVisc));
|
||||||
printf(" Dump of the species viscosities:\n");
|
printf(" Dump of the species viscosities:\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" %15s %13.5g\n", sss.c_str(), specVisc[k]);
|
printf(" %15s %13.5g\n", sss.c_str(), specVisc[k]);
|
||||||
}
|
}
|
||||||
|
|
@ -178,14 +166,14 @@ int main(int argc, char** argv)
|
||||||
vector_fp thermDiff(nsp, 0.0);
|
vector_fp thermDiff(nsp, 0.0);
|
||||||
tranMix->getThermalDiffCoeffs(DATA_PTR(thermDiff));
|
tranMix->getThermalDiffCoeffs(DATA_PTR(thermDiff));
|
||||||
printf(" Dump of the Thermal Diffusivities :\n");
|
printf(" Dump of the Thermal Diffusivities :\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
double ddd = cutoff(thermDiff[k]);
|
double ddd = cutoff(thermDiff[k]);
|
||||||
printf(" %15s %13.5g\n", sss.c_str(), ddd);
|
printf(" %15s %13.5g\n", sss.c_str(), ddd);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Viscosity and thermal Cond vs. T\n");
|
printf("Viscosity and thermal Cond vs. T\n");
|
||||||
for (k = 0; k < 10; k++) {
|
for (size_t k = 0; k < 10; k++) {
|
||||||
T1 = 400. + 100. * k;
|
T1 = 400. + 100. * k;
|
||||||
g.setState_TPX(T1, pres, DATA_PTR(Xset));
|
g.setState_TPX(T1, pres, DATA_PTR(Xset));
|
||||||
double visc = tran->viscosity();
|
double visc = tran->viscosity();
|
||||||
|
|
@ -199,23 +187,21 @@ int main(int argc, char** argv)
|
||||||
printf("Binary Diffusion Coefficients H2 vs species\n");
|
printf("Binary Diffusion Coefficients H2 vs species\n");
|
||||||
|
|
||||||
tranMix->getBinaryDiffCoeffs(nsp, Bdiff.ptrColumn(0));
|
tranMix->getBinaryDiffCoeffs(nsp, Bdiff.ptrColumn(0));
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" H2 - %15s %13.5g %13.5g\n", sss.c_str(), Bdiff(0,k), Bdiff(k,0));
|
printf(" H2 - %15s %13.5g %13.5g\n", sss.c_str(), Bdiff(0,k), Bdiff(k,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vector_fp specMob(nsp, 0.0);
|
vector_fp specMob(nsp, 0.0);
|
||||||
|
|
||||||
//tranMix->getMobilities(DATA_PTR(specMob));
|
//tranMix->getMobilities(DATA_PTR(specMob));
|
||||||
printf(" Dump of the species mobilities:\n");
|
printf(" Dump of the species mobilities:\n");
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" %15s %13.5g\n", sss.c_str(), specMob[k]);
|
printf(" %15s %13.5g\n", sss.c_str(), specMob[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Array2D fluxes(nsp, 2, 0.0);
|
Array2D fluxes(nsp, 2, 0.0);
|
||||||
|
|
||||||
tranMix->getSpeciesFluxes(2, DATA_PTR(grad_T), nsp,
|
tranMix->getSpeciesFluxes(2, DATA_PTR(grad_T), nsp,
|
||||||
grad_X.ptrColumn(0), nsp, fluxes.ptrColumn(0));
|
grad_X.ptrColumn(0), nsp, fluxes.ptrColumn(0));
|
||||||
printf(" Dump of the species fluxes:\n");
|
printf(" Dump of the species fluxes:\n");
|
||||||
|
|
@ -223,7 +209,7 @@ int main(int argc, char** argv)
|
||||||
double sum2 = 0.0;
|
double sum2 = 0.0;
|
||||||
double max1 = 0.0;
|
double max1 = 0.0;
|
||||||
double max2 = 0.0;
|
double max2 = 0.0;
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
double ddd = cutoff(fluxes(k,0));
|
double ddd = cutoff(fluxes(k,0));
|
||||||
double eee = cutoff(fluxes(k,1));
|
double eee = cutoff(fluxes(k,1));
|
||||||
|
|
@ -251,17 +237,15 @@ int main(int argc, char** argv)
|
||||||
printf("sum in y direction = 0\n");
|
printf("sum in y direction = 0\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Array2D MDdiff(nsp, nsp, 0.0);
|
Array2D MDdiff(nsp, nsp, 0.0);
|
||||||
printf("Multicomponent Diffusion Coefficients H2 vs species\n");
|
printf("Multicomponent Diffusion Coefficients H2 vs species\n");
|
||||||
|
|
||||||
tranMix->getMultiDiffCoeffs(nsp, MDdiff.ptrColumn(0));
|
tranMix->getMultiDiffCoeffs(nsp, MDdiff.ptrColumn(0));
|
||||||
for (k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
string sss = g.speciesName(k);
|
string sss = g.speciesName(k);
|
||||||
printf(" H2 - %15s %13.5g %13.5g\n", sss.c_str(), MDdiff(0,k), MDdiff(k,0));
|
printf(" H2 - %15s %13.5g %13.5g\n", sss.c_str(), MDdiff(0,k), MDdiff(k,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (CanteraError& err) {
|
} catch (CanteraError& err) {
|
||||||
std::cout << err.what() << std::endl;
|
std::cout << err.what() << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
std::string infile(argv[1]);
|
std::string infile(argv[1]);
|
||||||
|
|
||||||
int i;
|
size_t i;
|
||||||
double x[20];
|
double x[20];
|
||||||
double cdot[20], ddot[20];
|
double cdot[20], ddot[20];
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
XML_Node* const xg = xc->findNameID("phase", "air");
|
XML_Node* const xg = xc->findNameID("phase", "air");
|
||||||
ThermoPhase* gasTP = newPhase(*xg);
|
ThermoPhase* gasTP = newPhase(*xg);
|
||||||
int nsp = gasTP->nSpecies();
|
size_t nsp = gasTP->nSpecies();
|
||||||
cout << "Number of species = " << nsp << endl;
|
cout << "Number of species = " << nsp << endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -36,15 +36,15 @@ int main(int argc, char** argv)
|
||||||
phaseList.push_back(gasTP);
|
phaseList.push_back(gasTP);
|
||||||
GasKinetics* iKin_ptr = new GasKinetics();
|
GasKinetics* iKin_ptr = new GasKinetics();
|
||||||
importKinetics(*xg, phaseList, iKin_ptr);
|
importKinetics(*xg, phaseList, iKin_ptr);
|
||||||
int nr = iKin_ptr->nReactions();
|
size_t nr = iKin_ptr->nReactions();
|
||||||
cout << "Number of reactions = " << nr << endl;
|
cout << "Number of reactions = " << nr << endl;
|
||||||
|
|
||||||
int iH = gasTP->speciesIndex("H");
|
size_t iH = gasTP->speciesIndex("H");
|
||||||
int iO2 = gasTP->speciesIndex("O2");
|
size_t iO2 = gasTP->speciesIndex("O2");
|
||||||
int iH2O = gasTP->speciesIndex("H2O");
|
size_t iH2O = gasTP->speciesIndex("H2O");
|
||||||
int iNH = gasTP->speciesIndex("NH");
|
size_t iNH = gasTP->speciesIndex("NH");
|
||||||
int iNO = gasTP->speciesIndex("NO");
|
size_t iNO = gasTP->speciesIndex("NO");
|
||||||
int iN2O = gasTP->speciesIndex("N2O");
|
size_t iN2O = gasTP->speciesIndex("N2O");
|
||||||
|
|
||||||
for (i = 0; i < nsp; i++) {
|
for (i = 0; i < nsp; i++) {
|
||||||
x[i] = 0.0;
|
x[i] = 0.0;
|
||||||
|
|
@ -69,10 +69,10 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
for (i = 0; i < nsp; i++) {
|
for (i = 0; i < nsp; i++) {
|
||||||
string sSt = gasTP->speciesName(i);
|
string sSt = gasTP->speciesName(i);
|
||||||
printf("rop [ %d:%s ] = %g \n", i, sSt.c_str(), src[i]);
|
printf("rop [ %d:%s ] = %g \n", (int) i, sSt.c_str(), src[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nReactions = iKin_ptr->nReactions();
|
size_t nReactions = iKin_ptr->nReactions();
|
||||||
cout << "number of reactions = " << nReactions << endl;
|
cout << "number of reactions = " << nReactions << endl;
|
||||||
|
|
||||||
double fwd_rop[20];
|
double fwd_rop[20];
|
||||||
|
|
@ -80,8 +80,8 @@ int main(int argc, char** argv)
|
||||||
iKin_ptr->getFwdRatesOfProgress(fwd_rop);
|
iKin_ptr->getFwdRatesOfProgress(fwd_rop);
|
||||||
iKin_ptr->getRevRatesOfProgress(rev_rop);
|
iKin_ptr->getRevRatesOfProgress(rev_rop);
|
||||||
for (i = 0; i < nReactions; i++) {
|
for (i = 0; i < nReactions; i++) {
|
||||||
printf("fwd_rop[%3d] = %13g rev_rop[%3d] = %13g\n", i, fwd_rop[i],
|
printf("fwd_rop[%3d] = %13g rev_rop[%3d] = %13g\n", (int) i,
|
||||||
i, rev_rop[i]);
|
fwd_rop[i], (int) i, rev_rop[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,9 @@ void saveState(F& fluid, string name)
|
||||||
|
|
||||||
void printStates()
|
void printStates()
|
||||||
{
|
{
|
||||||
string name;
|
size_t nStates = states.size();
|
||||||
int n;
|
for (size_t n = 0; n < nStates; n++) {
|
||||||
int nStates = states.size();
|
string name = states[n];
|
||||||
for (n = 0; n < nStates; n++) {
|
|
||||||
name = states[n];
|
|
||||||
printf(" %5s %10.6g %10.6g %12.6g %12.6g %5.2g \n",
|
printf(" %5s %10.6g %10.6g %12.6g %12.6g %5.2g \n",
|
||||||
name.c_str(), T[name], P[name], h[name], s[name], x[name]);
|
name.c_str(), T[name], P[name], h[name], s[name], x[name]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,23 +23,23 @@ class TemperatureTable
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int NPoints;
|
size_t NPoints;
|
||||||
bool Include298;
|
bool Include298;
|
||||||
double Tlow; //!< Min temperature for thermo data fit
|
double Tlow; //!< Min temperature for thermo data fit
|
||||||
double Thigh; //!< Max temperature for thermo table
|
double Thigh; //!< Max temperature for thermo table
|
||||||
double DeltaT;
|
double DeltaT;
|
||||||
vector<double> T;
|
vector<double> T;
|
||||||
int numAddedTs;
|
size_t numAddedTs;
|
||||||
vector<double> AddedTempVector;
|
vector<double> AddedTempVector;
|
||||||
public:
|
public:
|
||||||
/*
|
/*
|
||||||
* Default constructor for TemperatureTable()
|
* Default constructor for TemperatureTable()
|
||||||
*/
|
*/
|
||||||
TemperatureTable(const int nPts = 14,
|
TemperatureTable(const size_t nPts = 14,
|
||||||
const bool inc298 = true,
|
const bool inc298 = true,
|
||||||
const double tlow = 300.,
|
const double tlow = 300.,
|
||||||
const double deltaT = 100.,
|
const double deltaT = 100.,
|
||||||
const int numAdded = 0,
|
const size_t numAdded = 0,
|
||||||
const double* addedTempVector = 0) :
|
const double* addedTempVector = 0) :
|
||||||
NPoints(nPts),
|
NPoints(nPts),
|
||||||
Include298(inc298),
|
Include298(inc298),
|
||||||
|
|
@ -48,14 +48,13 @@ public:
|
||||||
T(0),
|
T(0),
|
||||||
numAddedTs(numAdded) {
|
numAddedTs(numAdded) {
|
||||||
/****************************/
|
/****************************/
|
||||||
int i;
|
|
||||||
AddedTempVector.resize(numAdded, 0.0);
|
AddedTempVector.resize(numAdded, 0.0);
|
||||||
for (int i = 0; i < numAdded; i++) {
|
for (size_t i = 0; i < numAdded; i++) {
|
||||||
AddedTempVector[i] = addedTempVector[i];
|
AddedTempVector[i] = addedTempVector[i];
|
||||||
}
|
}
|
||||||
T.resize(NPoints, 0.0);
|
T.resize(NPoints, 0.0);
|
||||||
double TCurrent = Tlow;
|
double TCurrent = Tlow;
|
||||||
for (i = 0; i < NPoints; i++) {
|
for (size_t i = 0; i < NPoints; i++) {
|
||||||
T[i] = TCurrent;
|
T[i] = TCurrent;
|
||||||
TCurrent += DeltaT;
|
TCurrent += DeltaT;
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +64,7 @@ public:
|
||||||
}
|
}
|
||||||
if (numAdded > 0) {
|
if (numAdded > 0) {
|
||||||
T.resize(NPoints+numAdded, 0.0);
|
T.resize(NPoints+numAdded, 0.0);
|
||||||
for (i = 0; i < numAdded; i++) {
|
for (size_t i = 0; i < numAdded; i++) {
|
||||||
T[i+NPoints] = addedTempVector[i];
|
T[i+NPoints] = addedTempVector[i];
|
||||||
}
|
}
|
||||||
NPoints += numAdded;
|
NPoints += numAdded;
|
||||||
|
|
@ -97,7 +96,7 @@ public:
|
||||||
/*
|
/*
|
||||||
* size()
|
* size()
|
||||||
*/
|
*/
|
||||||
int size() {
|
size_t size() {
|
||||||
return NPoints;
|
return NPoints;
|
||||||
}
|
}
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ void printGas(ostream& oooo, ThermoPhase* gasTP, InterfaceKinetics* iKin_ptr, do
|
||||||
double p = gasTP->pressure();
|
double p = gasTP->pressure();
|
||||||
oooo << "Gas Temperature = " << Temp << endl;
|
oooo << "Gas Temperature = " << Temp << endl;
|
||||||
oooo << "Gas Pressure = " << p << endl;
|
oooo << "Gas Pressure = " << p << endl;
|
||||||
int kstart = iKin_ptr->kineticsSpeciesIndex(0, 0);
|
size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 0);
|
||||||
oooo << "Gas Phase: " << gasPhaseName << " "
|
oooo << "Gas Phase: " << gasPhaseName << " "
|
||||||
<< "(" << kstart << ")" << endl;
|
<< "(" << kstart << ")" << endl;
|
||||||
oooo << " Name "
|
oooo << " Name "
|
||||||
|
|
@ -63,11 +63,11 @@ void printGas(ostream& oooo, ThermoPhase* gasTP, InterfaceKinetics* iKin_ptr, do
|
||||||
oooo << " "
|
oooo << " "
|
||||||
<< " (kmol/m^3) (kmol/m^2/s) " << endl;
|
<< " (kmol/m^3) (kmol/m^2/s) " << endl;
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
int nspGas = gasTP->nSpecies();
|
size_t nspGas = gasTP->nSpecies();
|
||||||
for (int k = 0; k < nspGas; k++) {
|
for (size_t k = 0; k < nspGas; k++) {
|
||||||
kstart = iKin_ptr->kineticsSpeciesIndex(k, 0);
|
kstart = iKin_ptr->kineticsSpeciesIndex(k, 0);
|
||||||
sprintf(buf, "%4d %24s %14.3g %14.3g %14.3e\n",
|
sprintf(buf, "%4d %24s %14.3g %14.3g %14.3e\n",
|
||||||
k, gasTP->speciesName(k).c_str(),
|
(int) k, gasTP->speciesName(k).c_str(),
|
||||||
C[k], x[k], src[kstart]);
|
C[k], x[k], src[kstart]);
|
||||||
oooo << buf;
|
oooo << buf;
|
||||||
sum += x[k];
|
sum += x[k];
|
||||||
|
|
@ -86,7 +86,7 @@ void printBulk(ostream& oooo,
|
||||||
string bulkParticlePhaseName = bulkPhaseTP->id();
|
string bulkParticlePhaseName = bulkPhaseTP->id();
|
||||||
bulkPhaseTP->getMoleFractions(x);
|
bulkPhaseTP->getMoleFractions(x);
|
||||||
bulkPhaseTP->getConcentrations(C);
|
bulkPhaseTP->getConcentrations(C);
|
||||||
int kstart = iKin_ptr->kineticsSpeciesIndex(0, 1);
|
size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 1);
|
||||||
double dens = bulkPhaseTP->density();
|
double dens = bulkPhaseTP->density();
|
||||||
oooo << "Bulk Phase: " << bulkParticlePhaseName << " "
|
oooo << "Bulk Phase: " << bulkParticlePhaseName << " "
|
||||||
<< "(" << kstart << ")" << endl;
|
<< "(" << kstart << ")" << endl;
|
||||||
|
|
@ -101,11 +101,11 @@ void printBulk(ostream& oooo,
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
double Wsum = 0.0;
|
double Wsum = 0.0;
|
||||||
const vector_fp& molecW = bulkPhaseTP->molecularWeights();
|
const vector_fp& molecW = bulkPhaseTP->molecularWeights();
|
||||||
int nspBulk = bulkPhaseTP->nSpecies();
|
size_t nspBulk = bulkPhaseTP->nSpecies();
|
||||||
for (int k = 0; k < nspBulk; k++) {
|
for (size_t k = 0; k < nspBulk; k++) {
|
||||||
kstart = iKin_ptr->kineticsSpeciesIndex(k, 1);
|
kstart = iKin_ptr->kineticsSpeciesIndex(k, 1);
|
||||||
sprintf(buf, "%4d %24s %14.3g %14.3g %14.3e\n",
|
sprintf(buf, "%4d %24s %14.3g %14.3g %14.3e\n",
|
||||||
k, bulkPhaseTP->speciesName(k).c_str(),
|
(int) k, bulkPhaseTP->speciesName(k).c_str(),
|
||||||
C[k], x[k], src[kstart]);
|
C[k], x[k], src[kstart]);
|
||||||
oooo << buf;
|
oooo << buf;
|
||||||
sum += x[k];
|
sum += x[k];
|
||||||
|
|
@ -131,7 +131,7 @@ void printSurf(ostream& oooo,
|
||||||
char buf[256];
|
char buf[256];
|
||||||
string surfParticlePhaseName = surfPhaseTP->id();
|
string surfParticlePhaseName = surfPhaseTP->id();
|
||||||
surfPhaseTP->getMoleFractions(x);
|
surfPhaseTP->getMoleFractions(x);
|
||||||
int kstart = iKin_ptr->kineticsSpeciesIndex(0, 2);
|
size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 2);
|
||||||
oooo << "Surface Phase: " << surfParticlePhaseName
|
oooo << "Surface Phase: " << surfParticlePhaseName
|
||||||
<< " (" << kstart << ")" << endl;
|
<< " (" << kstart << ")" << endl;
|
||||||
double Temp = surfPhaseTP->temperature();
|
double Temp = surfPhaseTP->temperature();
|
||||||
|
|
@ -141,15 +141,15 @@ void printSurf(ostream& oooo,
|
||||||
oooo << " Name "
|
oooo << " Name "
|
||||||
<< " Coverage SrcRate " << endl;
|
<< " Coverage SrcRate " << endl;
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
int nspSurf = surfPhaseTP->nSpecies();
|
size_t nspSurf = surfPhaseTP->nSpecies();
|
||||||
for (int k = 0; k < nspSurf; k++) {
|
for (size_t k = 0; k < nspSurf; k++) {
|
||||||
kstart = iKin_ptr->kineticsSpeciesIndex(0, 2);
|
kstart = iKin_ptr->kineticsSpeciesIndex(0, 2);
|
||||||
double srcK = src[kstart];
|
double srcK = src[kstart];
|
||||||
if (fabs(srcK) < 1.0E-7) {
|
if (fabs(srcK) < 1.0E-7) {
|
||||||
srcK = 0.0;
|
srcK = 0.0;
|
||||||
}
|
}
|
||||||
sprintf(buf, "%4d %24s %14.3g %14.3e\n",
|
sprintf(buf, "%4d %24s %14.3g %14.3e\n",
|
||||||
k, surfPhaseTP->speciesName(k).c_str(),
|
(int) k, surfPhaseTP->speciesName(k).c_str(),
|
||||||
x[k], srcK);
|
x[k], srcK);
|
||||||
oooo << buf;
|
oooo << buf;
|
||||||
sum += x[k];
|
sum += x[k];
|
||||||
|
|
@ -236,7 +236,7 @@ int main(int argc, char** argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ThermoPhase* gasTP = newPhase(*xg);
|
ThermoPhase* gasTP = newPhase(*xg);
|
||||||
int nspGas = gasTP->nSpecies();
|
size_t nspGas = gasTP->nSpecies();
|
||||||
cout << "Number of species = " << nspGas << endl;
|
cout << "Number of species = " << nspGas << endl;
|
||||||
|
|
||||||
XML_Node* const xd =
|
XML_Node* const xd =
|
||||||
|
|
@ -247,7 +247,7 @@ int main(int argc, char** argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ThermoPhase* bulkPhaseTP = newPhase(*xd);
|
ThermoPhase* bulkPhaseTP = newPhase(*xd);
|
||||||
int nspBulk = bulkPhaseTP->nSpecies();
|
size_t nspBulk = bulkPhaseTP->nSpecies();
|
||||||
cout << "Number of species in bulk phase named " <<
|
cout << "Number of species in bulk phase named " <<
|
||||||
bulkParticlePhaseName << " = " << nspBulk << endl;
|
bulkParticlePhaseName << " = " << nspBulk << endl;
|
||||||
|
|
||||||
|
|
@ -260,7 +260,7 @@ int main(int argc, char** argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ThermoPhase* surfPhaseTP = newPhase(*xs);
|
ThermoPhase* surfPhaseTP = newPhase(*xs);
|
||||||
int nsp_d100 = surfPhaseTP->nSpecies();
|
size_t nsp_d100 = surfPhaseTP->nSpecies();
|
||||||
cout << "Number of species in surface phase, " << surfParticlePhaseName
|
cout << "Number of species in surface phase, " << surfParticlePhaseName
|
||||||
<< " = " << nsp_d100 << endl;
|
<< " = " << nsp_d100 << endl;
|
||||||
|
|
||||||
|
|
@ -271,7 +271,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
InterfaceKinetics* iKin_ptr = new InterfaceKinetics();
|
InterfaceKinetics* iKin_ptr = new InterfaceKinetics();
|
||||||
importKinetics(*xs, phaseList, iKin_ptr);
|
importKinetics(*xs, phaseList, iKin_ptr);
|
||||||
int nr = iKin_ptr->nReactions();
|
size_t nr = iKin_ptr->nReactions();
|
||||||
cout << "Number of reactions = " << nr << endl;
|
cout << "Number of reactions = " << nr << endl;
|
||||||
|
|
||||||
double x[MSSIZE], p = OneAtm;
|
double x[MSSIZE], p = OneAtm;
|
||||||
|
|
@ -301,12 +301,12 @@ int main(int argc, char** argv)
|
||||||
x[i] = 0.0;
|
x[i] = 0.0;
|
||||||
}
|
}
|
||||||
if (ProblemNumber == 0) {
|
if (ProblemNumber == 0) {
|
||||||
int i0 = surfPhaseTP->speciesIndex("c6H*");
|
size_t i0 = surfPhaseTP->speciesIndex("c6H*");
|
||||||
if (i0 >= 0) {
|
if (i0 != npos) {
|
||||||
x[i0] = 0.1;
|
x[i0] = 0.1;
|
||||||
}
|
}
|
||||||
int i1 = surfPhaseTP->speciesIndex("c6HH");
|
size_t i1 = surfPhaseTP->speciesIndex("c6HH");
|
||||||
if (i1 >= 0) {
|
if (i1 != npos) {
|
||||||
x[i1] = 0.9;
|
x[i1] = 0.9;
|
||||||
}
|
}
|
||||||
surfPhaseTP->setState_TX(1200., x);
|
surfPhaseTP->setState_TX(1200., x);
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ void printGas(ostream& oooo, ThermoPhase* gasTP, InterfaceKinetics* iKin_ptr, do
|
||||||
double p = gasTP->pressure();
|
double p = gasTP->pressure();
|
||||||
oooo << "Gas Temperature = " << Temp << endl;
|
oooo << "Gas Temperature = " << Temp << endl;
|
||||||
oooo << "Gas Pressure = " << p << endl;
|
oooo << "Gas Pressure = " << p << endl;
|
||||||
int kstart = iKin_ptr->kineticsSpeciesIndex(0, 0);
|
size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 0);
|
||||||
oooo << "Gas Phase: " << gasPhaseName << " "
|
oooo << "Gas Phase: " << gasPhaseName << " "
|
||||||
<< "(" << kstart << ")" << endl;
|
<< "(" << kstart << ")" << endl;
|
||||||
oooo << " Name "
|
oooo << " Name "
|
||||||
|
|
@ -61,11 +61,11 @@ void printGas(ostream& oooo, ThermoPhase* gasTP, InterfaceKinetics* iKin_ptr, do
|
||||||
oooo << " "
|
oooo << " "
|
||||||
<< " (kmol/m^3) (kmol/m^2/s) " << endl;
|
<< " (kmol/m^3) (kmol/m^2/s) " << endl;
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
int nspGas = gasTP->nSpecies();
|
size_t nspGas = gasTP->nSpecies();
|
||||||
for (int k = 0; k < nspGas; k++) {
|
for (size_t k = 0; k < nspGas; k++) {
|
||||||
kstart = iKin_ptr->kineticsSpeciesIndex(k, 0);
|
kstart = iKin_ptr->kineticsSpeciesIndex(k, 0);
|
||||||
sprintf(buf, "%4d %24s %14g %14g %14e\n",
|
sprintf(buf, "%4d %24s %14g %14g %14e\n",
|
||||||
k, gasTP->speciesName(k).c_str(),
|
(int) k, gasTP->speciesName(k).c_str(),
|
||||||
C[k], x[k], src[kstart]);
|
C[k], x[k], src[kstart]);
|
||||||
oooo << buf;
|
oooo << buf;
|
||||||
sum += x[k];
|
sum += x[k];
|
||||||
|
|
@ -85,7 +85,7 @@ void printBulk(ostream& oooo,ThermoPhase* bulkPhaseTP, InterfaceKinetics* iKin_p
|
||||||
string bulkParticlePhaseName = bulkPhaseTP->id();
|
string bulkParticlePhaseName = bulkPhaseTP->id();
|
||||||
bulkPhaseTP->getMoleFractions(x);
|
bulkPhaseTP->getMoleFractions(x);
|
||||||
bulkPhaseTP->getConcentrations(C);
|
bulkPhaseTP->getConcentrations(C);
|
||||||
int kstart = iKin_ptr->kineticsSpeciesIndex(0, 1);
|
size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 1);
|
||||||
double dens = bulkPhaseTP->density();
|
double dens = bulkPhaseTP->density();
|
||||||
oooo << "Bulk Phase: " << bulkParticlePhaseName << " "
|
oooo << "Bulk Phase: " << bulkParticlePhaseName << " "
|
||||||
<< "(" << kstart << ")" << endl;
|
<< "(" << kstart << ")" << endl;
|
||||||
|
|
@ -100,11 +100,11 @@ void printBulk(ostream& oooo,ThermoPhase* bulkPhaseTP, InterfaceKinetics* iKin_p
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
double Wsum = 0.0;
|
double Wsum = 0.0;
|
||||||
const vector_fp& molecW = bulkPhaseTP->molecularWeights();
|
const vector_fp& molecW = bulkPhaseTP->molecularWeights();
|
||||||
int nspBulk = bulkPhaseTP->nSpecies();
|
size_t nspBulk = bulkPhaseTP->nSpecies();
|
||||||
for (int k = 0; k < nspBulk; k++) {
|
for (size_t k = 0; k < nspBulk; k++) {
|
||||||
kstart = iKin_ptr->kineticsSpeciesIndex(k, 1);
|
kstart = iKin_ptr->kineticsSpeciesIndex(k, 1);
|
||||||
sprintf(buf, "%4d %24s %14g %14g %14e\n",
|
sprintf(buf, "%4d %24s %14g %14g %14e\n",
|
||||||
k, bulkPhaseTP->speciesName(k).c_str(),
|
(int) k, bulkPhaseTP->speciesName(k).c_str(),
|
||||||
C[k], x[k], src[kstart]);
|
C[k], x[k], src[kstart]);
|
||||||
oooo << buf;
|
oooo << buf;
|
||||||
sum += x[k];
|
sum += x[k];
|
||||||
|
|
@ -130,7 +130,7 @@ void printSurf(ostream& oooo, ThermoPhase* surfPhaseTP,
|
||||||
oooo.precision(3);
|
oooo.precision(3);
|
||||||
string surfParticlePhaseName = surfPhaseTP->id();
|
string surfParticlePhaseName = surfPhaseTP->id();
|
||||||
surfPhaseTP->getMoleFractions(x);
|
surfPhaseTP->getMoleFractions(x);
|
||||||
int kstart = iKin_ptr->kineticsSpeciesIndex(0, 2);
|
size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 2);
|
||||||
oooo << "Surface Phase: " << surfParticlePhaseName
|
oooo << "Surface Phase: " << surfParticlePhaseName
|
||||||
<< " (" << kstart << ")" << endl;
|
<< " (" << kstart << ")" << endl;
|
||||||
double Temp = surfPhaseTP->temperature();
|
double Temp = surfPhaseTP->temperature();
|
||||||
|
|
@ -140,15 +140,15 @@ void printSurf(ostream& oooo, ThermoPhase* surfPhaseTP,
|
||||||
oooo << " Name "
|
oooo << " Name "
|
||||||
<< " Coverage SrcRate " << endl;
|
<< " Coverage SrcRate " << endl;
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
int nspSurf = surfPhaseTP->nSpecies();
|
size_t nspSurf = surfPhaseTP->nSpecies();
|
||||||
for (int k = 0; k < nspSurf; k++) {
|
for (size_t k = 0; k < nspSurf; k++) {
|
||||||
kstart = iKin_ptr->kineticsSpeciesIndex(0, 2);
|
kstart = iKin_ptr->kineticsSpeciesIndex(0, 2);
|
||||||
double srcK = src[kstart];
|
double srcK = src[kstart];
|
||||||
if (fabs(srcK) < 1.0E-8) {
|
if (fabs(srcK) < 1.0E-8) {
|
||||||
srcK = 0.0;
|
srcK = 0.0;
|
||||||
}
|
}
|
||||||
sprintf(buf, "%4d %24s %14g %14e\n",
|
sprintf(buf, "%4d %24s %14g %14e\n",
|
||||||
k, surfPhaseTP->speciesName(k).c_str(),
|
(int) k, surfPhaseTP->speciesName(k).c_str(),
|
||||||
x[k], srcK);
|
x[k], srcK);
|
||||||
oooo << buf;
|
oooo << buf;
|
||||||
sum += x[k];
|
sum += x[k];
|
||||||
|
|
@ -232,7 +232,7 @@ int main(int argc, char** argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ThermoPhase* gasTP = newPhase(*xg);
|
ThermoPhase* gasTP = newPhase(*xg);
|
||||||
int nspGas = gasTP->nSpecies();
|
size_t nspGas = gasTP->nSpecies();
|
||||||
cout << "Number of species = " << nspGas << endl;
|
cout << "Number of species = " << nspGas << endl;
|
||||||
|
|
||||||
XML_Node* const xd =
|
XML_Node* const xd =
|
||||||
|
|
@ -243,7 +243,7 @@ int main(int argc, char** argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ThermoPhase* bulkPhaseTP = newPhase(*xd);
|
ThermoPhase* bulkPhaseTP = newPhase(*xd);
|
||||||
int nspBulk = bulkPhaseTP->nSpecies();
|
size_t nspBulk = bulkPhaseTP->nSpecies();
|
||||||
cout << "Number of species in bulk phase named " <<
|
cout << "Number of species in bulk phase named " <<
|
||||||
bulkParticlePhaseName << " = " << nspBulk << endl;
|
bulkParticlePhaseName << " = " << nspBulk << endl;
|
||||||
|
|
||||||
|
|
@ -257,7 +257,7 @@ int main(int argc, char** argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ThermoPhase* surfPhaseTP = newPhase(*xs);
|
ThermoPhase* surfPhaseTP = newPhase(*xs);
|
||||||
int nsp_d100 = surfPhaseTP->nSpecies();
|
size_t nsp_d100 = surfPhaseTP->nSpecies();
|
||||||
cout << "Number of species in surface phase, " << surfParticlePhaseName
|
cout << "Number of species in surface phase, " << surfParticlePhaseName
|
||||||
<< " = " << nsp_d100 << endl;
|
<< " = " << nsp_d100 << endl;
|
||||||
|
|
||||||
|
|
@ -270,7 +270,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
InterfaceKinetics* iKin_ptr = new InterfaceKinetics();
|
InterfaceKinetics* iKin_ptr = new InterfaceKinetics();
|
||||||
importKinetics(*xs, phaseList, iKin_ptr);
|
importKinetics(*xs, phaseList, iKin_ptr);
|
||||||
int nr = iKin_ptr->nReactions();
|
size_t nr = iKin_ptr->nReactions();
|
||||||
cout << "Number of reactions = " << nr << endl;
|
cout << "Number of reactions = " << nr << endl;
|
||||||
|
|
||||||
ofstream ofile("results2.txt");
|
ofstream ofile("results2.txt");
|
||||||
|
|
@ -279,7 +279,7 @@ int main(int argc, char** argv)
|
||||||
// create a second copy of the same surface phase
|
// create a second copy of the same surface phase
|
||||||
// (this is a made up problem btw to check the software capability)
|
// (this is a made up problem btw to check the software capability)
|
||||||
ThermoPhase* surfPhaseTP2 = newPhase(*xs);
|
ThermoPhase* surfPhaseTP2 = newPhase(*xs);
|
||||||
int nsp2 = surfPhaseTP2->nSpecies();
|
size_t nsp2 = surfPhaseTP2->nSpecies();
|
||||||
string pname = surfPhaseTP2->id();
|
string pname = surfPhaseTP2->id();
|
||||||
cout << "Number of species in 2nd surface phase, " << pname
|
cout << "Number of species in 2nd surface phase, " << pname
|
||||||
<< " = " << nsp2 << endl;
|
<< " = " << nsp2 << endl;
|
||||||
|
|
@ -322,12 +322,12 @@ int main(int argc, char** argv)
|
||||||
x[i] = 0.0;
|
x[i] = 0.0;
|
||||||
}
|
}
|
||||||
if (ProblemNumber == 0) {
|
if (ProblemNumber == 0) {
|
||||||
int i0 = surfPhaseTP->speciesIndex("c6H*");
|
size_t i0 = surfPhaseTP->speciesIndex("c6H*");
|
||||||
if (i0 >= 0) {
|
if (i0 != npos) {
|
||||||
x[i0] = 0.1;
|
x[i0] = 0.1;
|
||||||
}
|
}
|
||||||
int i1 = surfPhaseTP->speciesIndex("c6HH");
|
size_t i1 = surfPhaseTP->speciesIndex("c6HH");
|
||||||
if (i1 >= 0) {
|
if (i1 != npos) {
|
||||||
x[i1] = 0.9;
|
x[i1] = 0.9;
|
||||||
}
|
}
|
||||||
surfPhaseTP->setState_TX(1200., x);
|
surfPhaseTP->setState_TX(1200., x);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue