Modified the cxx_ex tests to generate consistent output
This commit is contained in:
parent
d7a384e25d
commit
9ff2c93615
8 changed files with 141 additions and 55 deletions
|
|
@ -17,7 +17,6 @@
|
|||
#endif
|
||||
|
||||
#include <cantera/Cantera.h>
|
||||
#include <time.h>
|
||||
#include "example_utils.h"
|
||||
#include <cantera/equilibrium.h>
|
||||
|
||||
|
|
@ -84,7 +83,6 @@ int equil_example1(int job) {
|
|||
doublereal tlow = 500.0;
|
||||
doublereal dt = (thigh - tlow)/(ntemps);
|
||||
doublereal pres = 0.01*OneAtm;
|
||||
clock_t t0 = clock();
|
||||
for (int i = 0; i < ntemps; i++) {
|
||||
temp = tlow + dt*i;
|
||||
if (temp > gas.maxTemp()) break;
|
||||
|
|
@ -97,7 +95,6 @@ int equil_example1(int job) {
|
|||
gas.getMoleFractions(&output(2,i));
|
||||
|
||||
}
|
||||
clock_t t1 = clock();
|
||||
|
||||
// make a Tecplot data file and an Excel spreadsheet
|
||||
string plotTitle = "equilibrium example 1: "
|
||||
|
|
@ -105,10 +102,6 @@ int equil_example1(int job) {
|
|||
plotEquilSoln("eq1.dat", "TEC", plotTitle, gas, output);
|
||||
plotEquilSoln("eq1.csv", "XL", plotTitle, gas, output);
|
||||
|
||||
// print timing data
|
||||
doublereal tmm = 1.0*(t1 - t0)/CLOCKS_PER_SEC;
|
||||
cout << " time = " << tmm << endl << endl;
|
||||
|
||||
cout << "Output files:" << endl
|
||||
<< " eq1.csv (Excel CSV file)" << endl
|
||||
<< " eq1.dat (Tecplot data file)" << endl;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include <cantera/Cantera.h>
|
||||
#include <cantera/zerodim.h>
|
||||
#include <cantera/IdealGasMix.h>
|
||||
#include <time.h>
|
||||
#include "example_utils.h"
|
||||
using namespace Cantera;
|
||||
using namespace Cantera_CXX;
|
||||
|
|
@ -101,29 +100,21 @@ int kinetics_example1(int job) {
|
|||
saveSoln(0, 0.0, gas, soln);
|
||||
|
||||
// main loop
|
||||
clock_t t0 = clock();
|
||||
for (int i = 1; i <= nsteps; i++) {
|
||||
tm = i*dt;
|
||||
sim_ptr->advance(tm);
|
||||
saveSoln(tm, gas, soln);
|
||||
}
|
||||
clock_t t1 = clock();
|
||||
|
||||
|
||||
// make a Tecplot data file and an Excel spreadsheet
|
||||
string plotTitle = "kinetics example 1: constant-pressure ignition";
|
||||
plotSoln("kin1.dat", "TEC", plotTitle, gas, soln);
|
||||
plotSoln("kin1.csv", "XL", plotTitle, gas, soln);
|
||||
|
||||
|
||||
// print final temperature and timing data
|
||||
doublereal tmm = 1.0*(t1 - t0)/CLOCKS_PER_SEC;
|
||||
// print final temperature
|
||||
cout << " Tfinal = " << r.temperature() << endl;
|
||||
cout << " time = " << tmm << endl;
|
||||
cout << " number of residual function evaluations = "
|
||||
<< sim_ptr->integrator().nEvals() << endl;
|
||||
cout << " time per evaluation = " << tmm/sim_ptr->integrator().nEvals()
|
||||
<< endl << endl;
|
||||
cout << "Output files:" << endl
|
||||
<< " kin1.csv (Excel CSV file)" << endl
|
||||
<< " kin1.dat (Tecplot data file)" << endl;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include <cantera/Cantera.h>
|
||||
#include <cantera/GRI30.h>
|
||||
#include <cantera/zerodim.h>
|
||||
#include <time.h>
|
||||
#include "example_utils.h"
|
||||
|
||||
using namespace Cantera;
|
||||
|
|
@ -91,14 +90,11 @@ int kinetics_example2(int job) {
|
|||
saveSoln(0, 0.0, gas, soln);
|
||||
|
||||
// main loop
|
||||
clock_t t0 = clock();
|
||||
for (int i = 1; i <= nsteps; i++) {
|
||||
tm = i*dt;
|
||||
sim.advance(tm);
|
||||
saveSoln(tm, gas, soln);
|
||||
}
|
||||
clock_t t1 = clock();
|
||||
|
||||
|
||||
// make a Tecplot data file and an Excel spreadsheet
|
||||
string plotTitle = "kinetics example 2: constant-pressure ignition";
|
||||
|
|
@ -106,14 +102,10 @@ int kinetics_example2(int job) {
|
|||
plotSoln("kin2.csv", "XL", plotTitle, gas, soln);
|
||||
|
||||
|
||||
// print final temperature and timing data
|
||||
doublereal tmm = 1.0*(t1 - t0)/CLOCKS_PER_SEC;
|
||||
// print final temperature
|
||||
cout << " Tfinal = " << r.temperature() << endl;
|
||||
cout << " time = " << tmm << endl;
|
||||
cout << " number of residual function evaluations = "
|
||||
<< sim.integrator().nEvals() << endl;
|
||||
cout << " time per evaluation = " << tmm/sim.integrator().nEvals()
|
||||
<< endl << endl;
|
||||
|
||||
cout << "Output files:" << endl
|
||||
<< " kin2.csv (Excel CSV file)" << endl
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include <cantera/Cantera.h>
|
||||
#include <cantera/zerodim.h>
|
||||
#include <cantera/IdealGasMix.h>
|
||||
#include <time.h>
|
||||
#include "example_utils.h"
|
||||
|
||||
using namespace Cantera;
|
||||
|
|
@ -96,14 +95,11 @@ int kinetics_example3(int job) {
|
|||
saveSoln(0, 0.0, gas, soln);
|
||||
|
||||
// main loop
|
||||
clock_t t0 = clock();
|
||||
for (int i = 1; i <= nsteps; i++) {
|
||||
tm = i*dt;
|
||||
sim.advance(tm);
|
||||
saveSoln(tm, gas, soln);
|
||||
}
|
||||
clock_t t1 = clock();
|
||||
|
||||
|
||||
// make a Tecplot data file and an Excel spreadsheet
|
||||
string plotTitle = "kinetics example 3: constant-pressure ignition";
|
||||
|
|
@ -111,14 +107,10 @@ int kinetics_example3(int job) {
|
|||
plotSoln("kin3.csv", "XL", plotTitle, gas, soln);
|
||||
|
||||
|
||||
// print final temperature and timing data
|
||||
doublereal tmm = 1.0*(t1 - t0)/CLOCKS_PER_SEC;
|
||||
// print final temperature
|
||||
cout << " Tfinal = " << r.temperature() << endl;
|
||||
cout << " time = " << tmm << endl;
|
||||
cout << " number of residual function evaluations = "
|
||||
<< sim.integrator().nEvals() << endl;
|
||||
cout << " time per evaluation = " << tmm/sim.integrator().nEvals()
|
||||
<< endl << endl;
|
||||
cout << "Output files:" << endl
|
||||
<< " kin3.csv (Excel CSV file)" << endl
|
||||
<< " kin3.dat (Tecplot data file)" << endl;
|
||||
|
|
|
|||
135
test_problems/cxx_ex/output_blessed.txt
Normal file
135
test_problems/cxx_ex/output_blessed.txt
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
|
||||
-----------------------------------
|
||||
Cantera C++ examples
|
||||
-----------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>> example 1
|
||||
|
||||
Description:
|
||||
Ignition simulation using class IdealGasMix with file gri30.cti.
|
||||
Constant-pressure ignition of a hydrogen/oxygen/nitrogen mixture
|
||||
beginning at T = 1001 K and P = 1 atm.
|
||||
|
||||
Cantera version 1.8.x
|
||||
Copyright California Institute of Technology, 2002.
|
||||
http://www.cantera.org
|
||||
|
||||
Tfinal = 2663.78
|
||||
number of residual function evaluations = 1876
|
||||
Output files:
|
||||
kin1.csv (Excel CSV file)
|
||||
kin1.dat (Tecplot data file)
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>> example 2
|
||||
|
||||
Description:
|
||||
Ignition simulation using class GRI30.
|
||||
Constant-pressure ignition of a hydrogen/oxygen/nitrogen mixture
|
||||
beginning at T = 1001 K and P = 1 atm.
|
||||
|
||||
Cantera version 1.8.x
|
||||
Copyright California Institute of Technology, 2002.
|
||||
http://www.cantera.org
|
||||
|
||||
Tfinal = 2663.78
|
||||
number of residual function evaluations = 1970
|
||||
Output files:
|
||||
kin2.csv (Excel CSV file)
|
||||
kin2.dat (Tecplot data file)
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>> example 3
|
||||
|
||||
Description:
|
||||
Ignition simulation using class IdealGasMix with file gri30.cti.
|
||||
Constant-pressure ignition of a hydrogen/oxygen/nitrogen mixture
|
||||
beginning at T = 1001 K and P = 1 atm.
|
||||
|
||||
Cantera version 1.8.x
|
||||
Copyright California Institute of Technology, 2002.
|
||||
http://www.cantera.org
|
||||
|
||||
Tfinal = 2663.78
|
||||
number of residual function evaluations = 1980
|
||||
Output files:
|
||||
kin3.csv (Excel CSV file)
|
||||
kin3.dat (Tecplot data file)
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>> example 4
|
||||
|
||||
Description:
|
||||
Chemical equilibrium.
|
||||
Equilibrium composition and pressure for a range of temperatures at constant density.
|
||||
|
||||
Cantera version 1.8.x
|
||||
Copyright California Institute of Technology, 2002.
|
||||
http://www.cantera.org
|
||||
|
||||
|
||||
|
||||
**** WARNING ****
|
||||
For species SI2H6, discontinuity in s/R detected at Tmid = 1000
|
||||
Value computed using low-temperature polynomial: 49.5493.
|
||||
Value computed using high-temperature polynomial: 49.7214.
|
||||
|
||||
|
||||
**** WARNING ****
|
||||
For species SI3H8, discontinuity in s/R detected at Tmid = 1000
|
||||
Value computed using low-temperature polynomial: 65.9731.
|
||||
Value computed using high-temperature polynomial: 66.2781.
|
||||
|
||||
|
||||
**** WARNING ****
|
||||
For species SI2, discontinuity in s/R detected at Tmid = 1000
|
||||
Value computed using low-temperature polynomial: 32.8813.
|
||||
Value computed using high-temperature polynomial: 32.9489.
|
||||
Output files:
|
||||
eq1.csv (Excel CSV file)
|
||||
eq1.dat (Tecplot data file)
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>> example 5
|
||||
|
||||
Description:
|
||||
Mixture-averaged transport properties.
|
||||
Viscosity, thermal conductivity, and mixture-averaged
|
||||
diffusion coefficients at 2 atm for a range of temperatures
|
||||
|
||||
Cantera version 1.8.x
|
||||
Copyright California Institute of Technology, 2002.
|
||||
http://www.cantera.org
|
||||
|
||||
Output files:
|
||||
tr1.csv (Excel CSV file)
|
||||
tr1.dat (Tecplot data file)
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>> example 6
|
||||
|
||||
Description:
|
||||
Multicomponent transport properties.
|
||||
Viscosity, thermal conductivity, and thermal diffusion
|
||||
coefficients at 2 atm for a range of temperatures
|
||||
|
||||
Cantera version 1.8.x
|
||||
Copyright California Institute of Technology, 2002.
|
||||
http://www.cantera.org
|
||||
|
||||
Output files:
|
||||
tr2.csv (Excel CSV file)
|
||||
tr2.dat (Tecplot data file)
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <cantera/Cantera.h>
|
||||
#include <cantera/zerodim.h>
|
||||
#include <time.h>
|
||||
#include "example_utils.h"
|
||||
#include <cantera/reactionpaths.h>
|
||||
#include <cantera/IdealGasMix.h>
|
||||
|
|
@ -142,17 +141,13 @@ int rxnpath_example1(int job) {
|
|||
b.init(rplog, gas); // initialize
|
||||
|
||||
// main loop
|
||||
clock_t t0 = clock();
|
||||
for (int i = 1; i <= nsteps; i++) {
|
||||
tm = i*dt;
|
||||
sim.advance(tm);
|
||||
writeRxnPathDiagram(tm, b, gas, rplog, rplot);
|
||||
}
|
||||
clock_t t1 = clock();
|
||||
|
||||
// print final temperature and timing data
|
||||
doublereal tmm = 1.0*(t1 - t0)/CLOCKS_PER_SEC;
|
||||
cout << " time = " << tmm << endl;
|
||||
// print final temperature
|
||||
cout << "Output files:" << endl
|
||||
<< " rp1.log (log file)" << endl
|
||||
<< " rp1.dot (input file for dot)" << endl;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <cantera/Cantera.h>
|
||||
#include <cantera/transport.h>
|
||||
#include <time.h>
|
||||
#include "example_utils.h"
|
||||
#include <cantera/IdealGasMix.h>
|
||||
|
||||
|
|
@ -81,7 +80,6 @@ int transport_example1(int job) {
|
|||
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);
|
||||
|
|
@ -90,7 +88,6 @@ int transport_example1(int job) {
|
|||
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: "
|
||||
|
|
@ -98,10 +95,7 @@ int transport_example1(int job) {
|
|||
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;
|
||||
|
||||
// print final temperature
|
||||
cout << "Output files:" << endl
|
||||
<< " tr1.csv (Excel CSV file)" << endl
|
||||
<< " tr1.dat (Tecplot data file)" << endl;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <cantera/Cantera.h>
|
||||
#include <cantera/transport.h>
|
||||
#include <time.h>
|
||||
#include "example_utils.h"
|
||||
#include <cantera/equilibrium.h>
|
||||
#include <cantera/IdealGasMix.h>
|
||||
|
|
@ -83,7 +82,6 @@ int transport_example2(int job) {
|
|||
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);
|
||||
|
|
@ -92,7 +90,6 @@ int transport_example2(int job) {
|
|||
output(2,i) = tr->thermalConductivity();
|
||||
tr->getThermalDiffCoeffs(&output(3,i));
|
||||
}
|
||||
clock_t t1 = clock();
|
||||
|
||||
// make a Tecplot data file and an Excel spreadsheet
|
||||
string plotTitle = "transport example 2: "
|
||||
|
|
@ -100,10 +97,7 @@ int transport_example2(int job) {
|
|||
plotTransportSoln("tr2.dat", "TEC", plotTitle, gas, output);
|
||||
plotTransportSoln("tr2.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;
|
||||
|
||||
// print final temperature
|
||||
cout << "Output files:" << endl
|
||||
<< " tr2.csv (Excel CSV file)" << endl
|
||||
<< " tr2.dat (Tecplot data file)" << endl;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue