本文整理汇总了C++中Transport::getMixDiffCoeffs方法的典型用法代码示例。如果您正苦于以下问题:C++ Transport::getMixDiffCoeffs方法的具体用法?C++ Transport::getMixDiffCoeffs怎么用?C++ Transport::getMixDiffCoeffs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transport
的用法示例。
在下文中一共展示了Transport::getMixDiffCoeffs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Dref
TEST_F(TransportFromScratch, mixDiffCoeffs)
{
Transport* trRef = newTransportMgr("Mix", ref.get());
MixTransport trTest;
trTest.init(test.get());
size_t K = ref->nSpecies();
vector_fp Dref(3);
vector_fp Dtest(3);
ref->setState_TPX(400, 5e5, "H2:0.5, O2:0.3, H2O:0.2");
test->setState_TPX(400, 5e5, "H2:0.5, O2:0.3, H2O:0.2");
trRef->getMixDiffCoeffs(&Dref[0]);
trTest.getMixDiffCoeffs(&Dtest[0]);
for (size_t k=0; k < K; k++) {
EXPECT_DOUBLE_EQ(Dref[k], Dtest[k]) << "k = " << k;
}
}
示例2: transport_example1
int transport_example1(int job)
{
try {
cout << "Mixture-averaged transport properties." << endl;
if (job > 0) {
cout << "Viscosity, thermal conductivity, and mixture-averaged\n"
<< "diffusion coefficients at 2 atm for a "
<< "range of temperatures" << endl;
}
if (job <= 1) {
return 0;
}
// create a gas mixture, and set its state
IdealGasMix gas("gri30.xml", "gri30");
doublereal temp = 500.0;
doublereal pres = 2.0*OneAtm;
gas.setState_TPX(temp, pres, "H2:1.0, CH4:0.1");
// create a transport manager that implements
// mixture-averaged transport properties
Transport* tr = newTransportMgr("Mix", &gas);
size_t nsp = gas.nSpecies();
// create a 2D array to hold the outputs
int ntemps = 20;
Array2D output(nsp+3, ntemps);
// main loop
for (int i = 0; i < ntemps; i++) {
temp = 500.0 + 100.0*i;
gas.setState_TP(temp, pres);
output(0,i) = temp;
output(1,i) = tr->viscosity();
output(2,i) = tr->thermalConductivity();
tr->getMixDiffCoeffs(&output(3,i));
}
// make a Tecplot data file and an Excel spreadsheet
std::string plotTitle = "transport example 1: "
"mixture-averaged transport properties";
plotTransportSoln("tr1.dat", "TEC", plotTitle, gas, output);
plotTransportSoln("tr1.csv", "XL", plotTitle, gas, output);
// print final temperature
cout << "Output files:" << endl
<< " tr1.csv (Excel CSV file)" << endl
<< " tr1.dat (Tecplot data file)" << endl;
} catch (CanteraError& err) {
// handle exceptions thrown by Cantera
std::cout << err.what() << std::endl;
cout << " terminating... " << endl;
appdelete();
return -1;
}
return 0;
}