diff --git a/samples/cxx/rankine/output_0_blessed.txt b/samples/cxx/rankine/output_0_blessed.txt index 1aec97b1a..d3d9cce1b 100644 --- a/samples/cxx/rankine/output_0_blessed.txt +++ b/samples/cxx/rankine/output_0_blessed.txt @@ -1,7 +1,7 @@ - 1 300 101325 -1.58581e+07 3913.25 0 - 2s 300.014 800000 -1.58574e+07 3913.25 0 - 2 300.126 800000 -1.58569e+07 3914.81 0 - 3 443.624 800000 -1.32016e+07 10183 1 - 4s 373.177 101325 -1.3553e+07 10183 0.89 - 4 373.177 101325 -1.34827e+07 10371.4 0.92 + 1 300 101325 -1.58581e+07 3913.17 0 + 2s 300.014 800000 -1.58574e+07 3913.17 0 + 2 300.126 800000 -1.58569e+07 3914.73 0 + 3 443.624 800000 -1.32016e+07 10182.9 1 + 4s 373.177 101325 -1.3553e+07 10182.9 0.89 + 4 373.177 101325 -1.34827e+07 10371.3 0.92 efficiency = 0.105873 diff --git a/samples/cxx/rankine/rankine.cpp b/samples/cxx/rankine/rankine.cpp index e564ed8be..51601470c 100644 --- a/samples/cxx/rankine/rankine.cpp +++ b/samples/cxx/rankine/rankine.cpp @@ -1,7 +1,6 @@ // An open Rankine cycle -#include "cantera/PureFluid.h" // defines class Water -#include +#include "cantera/thermo/PureFluidPhase.h" using namespace Cantera; @@ -24,18 +23,19 @@ void printStates() int nStates = states.size(); for (int n = 0; n < nStates; n++) { std::string name = states[n]; - writelog(" {:5s} {:10.6g} {:10.6g} {:12.6g} {:12.6g} {:5.2g}\n", + writelog(" {:5s} {:10.6g} {:10.6g} {:12.6g} {:12.6g} {:5.2g}\n", name, T[name], P[name], h[name], s[name], x[name]); } } -int openRankine(int np, void* p) +int openRankine() { double etap = 0.6; // pump isentropic efficiency double etat = 0.8; // turbine isentropic efficiency double phigh = 8.0e5; // high pressure - Water w; + PureFluidPhase w; + w.initThermoFile("liquidvapor.yaml", "water"); // begin with water at 300 K, 1 atm w.setState_TP(300.0, OneAtm); @@ -65,16 +65,16 @@ int openRankine(int np, void* p) double heat_in = h["3"] - h["2"]; double efficiency = work/heat_in; - std::cout << "efficiency = " << efficiency << std::endl; + writelog("efficiency = {:8.6g}\n", efficiency); return 0; } int main() { try { - return openRankine(0, 0); + return openRankine(); } catch (CanteraError& err) { - std::cout << err.what() << std::endl; + writelog(err.what()); return -1; } }