fixed errors
This commit is contained in:
parent
bbccc4bd96
commit
f8111bc15c
2 changed files with 33 additions and 25 deletions
|
|
@ -5,41 +5,49 @@
|
|||
|
||||
#include "Cantera.h"
|
||||
#include "IdealGasMix.h"
|
||||
#include "equilibrium.h"
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
main() {
|
||||
int main() {
|
||||
|
||||
IdealGasMix gas("h2o2.xml");
|
||||
gas.setState_TPX_String(1200.0, OneAtm,
|
||||
"H2:2, O2:1, OH:0.01, H:0.01, O:0.01");
|
||||
double temp = 1200.0;
|
||||
double pres = OneAtm;
|
||||
gas.setState_TPX(temp, pres, "H2:2, O2:1, OH:0.01, H:0.01, O:0.01");
|
||||
equilibrate(gas,"HP");
|
||||
|
||||
printf("**** C++ Test Program ****\n\n");
|
||||
printf("\n\n**** C++ Test Program ****\n\n");
|
||||
|
||||
|
||||
// Thermodynamic properties
|
||||
|
||||
printf(
|
||||
"Temperature: 14.5g K\n"
|
||||
"Pressure: 14.5g Pa\n"
|
||||
"Density: 14.5g kg/m3\n"
|
||||
"Molar Enthalpy: 14.5g J/kmol\n"
|
||||
"Molar Entropy: 14.5g J/kmol-K\n"
|
||||
"Molar cp: 14.5g J/kmol-K\n",
|
||||
"Temperature: %14.5g K\n"
|
||||
"Pressure: %14.5g Pa\n"
|
||||
"Density: %14.5g kg/m3\n"
|
||||
"Molar Enthalpy: %14.5g J/kmol\n"
|
||||
"Molar Entropy: %14.5g J/kmol-K\n"
|
||||
"Molar cp: %14.5g J/kmol-K\n",
|
||||
gas.temperature(), gas.pressure(), gas.density(),
|
||||
gas.enthalpy_mole(), gas.entropy_mole(), gas.cp_mole());
|
||||
|
||||
|
||||
// Reaction information
|
||||
|
||||
int irxns = gas.nReactions();
|
||||
double* qf = new double[irxns];
|
||||
double* qr = new double[irxns];
|
||||
double* q = new double[irxns];
|
||||
|
||||
gas.getFwdRatesOfProgress(qf);
|
||||
gas.getRevRatesOfProgress(qr);
|
||||
gas.getNetRatesOfProgress(q);
|
||||
|
||||
for (int i = 0; i < irxns; i++) {
|
||||
printf("%30s %14.5g %14.5g %14.5g \n",
|
||||
gas.reactionString(i).c_str(), qf[i], qr[i], q[i]);
|
||||
}
|
||||
|
||||
// c
|
||||
// c Reaction information
|
||||
// c
|
||||
// irxns = nReactions()
|
||||
// call getFwdRatesOfProgress(qf)
|
||||
// call getRevRatesOfProgress(qr)
|
||||
// call getNetRatesOfProgress(q)
|
||||
// do i = 1,irxns
|
||||
// call getReactionEqn(i,eq)
|
||||
// write(*,20) eq,qf(i),qr(i),q(i)
|
||||
// 20 format(a20,3g14.5,' kmol/m3/s')
|
||||
// end do
|
||||
// stop
|
||||
// end
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ DEPENDS = $(OBJS:.o=.d)
|
|||
all: $(PROGRAM)
|
||||
|
||||
$(PROGRAM): $(OBJS)
|
||||
$(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(CANTERA_LIBS) $(LINK_OPTIONS) $(EXT_LIBS) @LIBS@
|
||||
$(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(CANTERA_LIBS) $(LINK_OPTIONS) $(EXT_LIBS) @LIBS@ @FLIBS@
|
||||
|
||||
%.d:
|
||||
g++ -MM $*.cpp > $*.d
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue