[Samples] Update to not use PureFluid wrapper

Update rankine.cpp sample to avoid using the deprecated PureFluid wrapper
classes. Update the small changes in the blessed output.
This commit is contained in:
Bryan W. Weber 2019-06-27 14:51:34 -04:00 committed by Ray Speth
parent 386c215b3b
commit ed59ae9516
2 changed files with 14 additions and 14 deletions

View file

@ -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

View file

@ -1,7 +1,6 @@
// An open Rankine cycle
#include "cantera/PureFluid.h" // defines class Water
#include <cstdio>
#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;
}
}