当前位置: 首页>>代码示例>>C++>>正文


C++ Transport::thermalConductivity方法代码示例

本文整理汇总了C++中Transport::thermalConductivity方法的典型用法代码示例。如果您正苦于以下问题:C++ Transport::thermalConductivity方法的具体用法?C++ Transport::thermalConductivity怎么用?C++ Transport::thermalConductivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transport的用法示例。


在下文中一共展示了Transport::thermalConductivity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: transport_example2

int transport_example2(int job)
{
    try {
        cout << "Multicomponent transport properties." << endl;
        if (job > 0) {
            cout << "Viscosity, thermal conductivity, and thermal diffusion\n"
                 " 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.cti", "gri30");
        doublereal temp = 2000.0;
        doublereal pres = 2.0*OneAtm;
        gas.setState_TPX(temp, pres, "H2:1.0, O2:0.5, CH4:0.1, N2:0.2");
        equilibrate(gas,"TP");

        // create a transport manager that implements
        // multicomponent transport properties

        Transport* tr = newTransportMgr("Multi",  &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->getThermalDiffCoeffs(&output(3,i));
        }

        // make a Tecplot data file and an Excel spreadsheet
        std::string plotTitle = "transport example 2: "
                                "multicomponent transport properties";
        plotTransportSoln("tr2.dat", "TEC", plotTitle, gas, output);
        plotTransportSoln("tr2.csv", "XL", plotTitle, gas, output);

        // print final temperature
        cout << "Output files:" << endl
             << "  tr2.csv    (Excel CSV file)" << endl
             << "  tr2.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;
}
开发者ID:anujg1991,项目名称:cantera,代码行数:60,代码来源:transport_example2.cpp

示例2: newTransportMgr

TEST_F(TransportFromScratch, thermalConductivityMulti)
{
    Transport* trRef = newTransportMgr("Multi", ref.get());
    MultiTransport trTest;
    trTest.init(test.get());

    for (int i = 0; i < 10; i++) {
        double T = 300 + 111*i;
        ref->setState_TPX(T, 5e5, "H2:0.5, O2:0.3, H2O:0.2");
        test->setState_TPX(T, 5e5, "H2:0.5, O2:0.3, H2O:0.2");
        EXPECT_DOUBLE_EQ(trRef->thermalConductivity(),
                         trTest.thermalConductivity()) << "T = " << T;
    }
}
开发者ID:wbessler,项目名称:cantera,代码行数:14,代码来源:transportFromScratch.cpp

示例3: 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;

        // header
        writeCanteraHeader(cout);


        // create a gas mixture, and set its state

        IdealGasMix gas("gri30.cti", "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);

        int nsp = gas.nSpecies();


        // create a 2D array to hold the outputs
        int ntemps = 20;
        Array2D output(nsp+3, ntemps);

        // main loop
        clock_t t0 = clock();
        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));
        }
        clock_t t1 = clock();

        // make a Tecplot data file and an Excel spreadsheet
        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 and timing data
        doublereal tmm = 1.0*(t1 - t0)/CLOCKS_PER_SEC;
        cout << " time = " << tmm << endl << endl;

        cout << "Output files:" << endl
             << "  tr1.csv    (Excel CSV file)" << endl
             << "  tr1.dat    (Tecplot data file)" << endl;

        return 0;
    }

    // handle exceptions thrown by Cantera
    catch (CanteraError) {
        showErrors(cout);
        cout << " terminating... " << endl;
        appdelete();
        return -1;
    }
}
开发者ID:hkmoffat,项目名称:cantera,代码行数:72,代码来源:transport_example1.cpp

示例4: main


//.........这里部分代码省略.........
        MultiTransport* tranMix = dynamic_cast<MultiTransport*>(tran);
        g.setState_TPX(1500.0, pres, DATA_PTR(Xset));
        vector_fp mixDiffs(nsp, 0.0);

        tranMix->getMixDiffCoeffs(DATA_PTR(mixDiffs));
        printf(" Dump of the mixture Diffusivities:\n");
        for (size_t k = 0; k < nsp; k++) {
            string sss = g.speciesName(k);
            printf("    %15s %13.2g\n", sss.c_str(), mixDiffs[k]);
        }

        vector_fp specVisc(nsp, 0.0);
        tranMix->getSpeciesViscosities(DATA_PTR(specVisc));
        printf(" Dump of the species viscosities:\n");
        for (size_t k = 0; k < nsp; k++) {
            string sss = g.speciesName(k);
            printf("    %15s %13.4g\n", sss.c_str(), specVisc[k]);
        }

        vector_fp thermDiff(nsp, 0.0);
        tranMix->getThermalDiffCoeffs(DATA_PTR(thermDiff));
        printf(" Dump of the Thermal Diffusivities :\n");
        for (size_t k = 0; k < nsp; k++) {
            string sss = g.speciesName(k);
            double ddd = cutoff(thermDiff[k]);
            printf("    %15s %13.4g\n", sss.c_str(), ddd);
        }

        printf("Viscosity and thermal Cond vs. T\n");
        for (size_t k = 0; k < 10; k++) {
            T1 = 400. + 100. * k;
            g.setState_TPX(T1, pres, DATA_PTR(Xset));
            double visc = tran->viscosity();
            double cond = tran->thermalConductivity();
            printf("    %13g %13.4g %13.4g\n", T1, visc, cond);
        }

        g.setState_TPX(T1, pres, DATA_PTR(Xset));

        Array2D Bdiff(nsp, nsp, 0.0);
        printf("Binary Diffusion Coefficients H2 vs species\n");

        tranMix->getBinaryDiffCoeffs(nsp, Bdiff.ptrColumn(0));
        for (size_t k = 0; k < nsp; k++) {
            string sss = g.speciesName(k);
            printf(" H2 -   %15s %13.4g %13.4g\n", sss.c_str(), Bdiff(0,k), Bdiff(k,0));
        }

        vector_fp specMob(nsp, 0.0);

        printf(" Dump of the species mobilities:\n");
        for (size_t k = 0; k < nsp; k++) {
            string sss = g.speciesName(k);
            printf("    %15s %13.4g\n", sss.c_str(), specMob[k]);
        }

        Array2D fluxes(nsp, 2, 0.0);
        tranMix->getSpeciesFluxes(2, DATA_PTR(grad_T), nsp,
                                  grad_X.ptrColumn(0), nsp, fluxes.ptrColumn(0));
        printf(" Dump of the species fluxes:\n");
        double sum1 = 0.0;
        double sum2 = 0.0;
        double max1 = 0.0;
        double max2 = 0.0;
        for (size_t k = 0; k < nsp; k++) {
            string sss = g.speciesName(k);
开发者ID:gitnmr,项目名称:cantera,代码行数:67,代码来源:multiGasTransport.cpp


注:本文中的Transport::thermalConductivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。