cantera/doc/doxygen/demoequil.cpp
Ray Speth 54efbaa320 Rewrote exception handling to be more general and more explicit
CanteraError inerits from std:exception, so now it has a what() method
that is used to print a message describing the exception. Adding an
exception to the Cantera error stack now requires explicitly calling
the .save() method.
2012-03-05 20:45:56 +00:00

23 lines
442 B
C++

#include <cantera/equilibrium.h>
#include <cantera/thermo.h>
using namespace Cantera;
void equil_demo()
{
ThermoPhase* gas = newPhase("h2o2.cti","ohmech");
gas->setState_TPX(1500.0, 2.0*OneAtm, "O2:1.0, H2:3.0, AR:1.0");
equilibrate(*gas, "TP");
std::cout << report(*gas) << std::endl;
}
int main()
{
try {
equil_demo();
} catch (CanteraError& err) {
std::cout << err.what() << std::endl;
}
}