The "cantera/kernel" directory is now part of the include path only when building the Cantera kernel. All other modules include files in this directory as "kernel/header.h". This fixes a problem distinguishing between kernel/Kinetics.h and kinetics.h on Windows.
90 lines
2 KiB
C++
90 lines
2 KiB
C++
|
|
#include "kernel/WaterPropsIAPWS.h"
|
|
#include <new>
|
|
|
|
#include <cstdio>
|
|
#include <cmath>
|
|
|
|
using namespace std;
|
|
using namespace Cantera;
|
|
|
|
int main () {
|
|
|
|
double dens, u, s, h, cv, cp, pres;
|
|
WaterPropsIAPWS *water = new WaterPropsIAPWS();
|
|
|
|
double T;
|
|
|
|
/*
|
|
* Print out the triple point conditions
|
|
*/
|
|
T = 273.16;
|
|
pres = water->psat(T);
|
|
printf("psat(%g) = %g\n", T, pres);
|
|
|
|
dens = water->density(T, pres, WATER_LIQUID);
|
|
printf("dens (liquid) = %g kg m-3\n", dens);
|
|
|
|
u = water->intEnergy();
|
|
if (fabs(u) < 5.0E-7) {
|
|
printf("intEng (liquid) = ~0.0 J/kmol (fabs(u) < 5.0E-7)\n");
|
|
} else {
|
|
printf("intEng (liquid) = %g J/kmol\n", u);
|
|
}
|
|
|
|
s = water->entropy();
|
|
if (fabs(s) < 5.0E-9) {
|
|
printf("S (liquid) = ~0.0 J/kmolK (fabs(s) < 5.0E-9)\n");
|
|
} else {
|
|
printf("S (liquid) = %g J/kmolK\n", s);
|
|
}
|
|
|
|
h = water->enthalpy();
|
|
printf("h (liquid) = %g J/kmol\n", h);
|
|
printf("h (liquid) = %g J/kg\n", (h)/18.015268);
|
|
|
|
double g_liq = water->Gibbs();
|
|
printf("g (liquid) = %g J/kmol\n", g_liq);
|
|
|
|
|
|
cv = water->cv();
|
|
printf("cv (liquid) = %g J/kmolK\n", cv);
|
|
|
|
cp = water->cp();
|
|
printf("cp (liquid) = %g J/kmolK\n", cp);
|
|
|
|
|
|
dens = water->density(T, pres, WATER_GAS);
|
|
printf("dens (gas) = %g kg m-3\n", dens);
|
|
|
|
|
|
u = water->intEnergy();
|
|
printf("intEng (gas) = %g J/kmol\n", u);
|
|
|
|
s = water->entropy();
|
|
printf("S (gas) = %g J/kmolK\n", s);
|
|
|
|
h = water->enthalpy();
|
|
printf("h (gas) = %g J/kmol\n", h);
|
|
printf("h (gas) = %g J/kg\n", (h)/18.015268);
|
|
|
|
double g_gas = water->Gibbs();
|
|
printf("g (gas) = %g J/kmol\n", g_gas);
|
|
|
|
|
|
cv = water->cv();
|
|
printf("cv (gas) = %g J/kmolK\n", cv);
|
|
|
|
cp = water->cp();
|
|
printf("cp (gas) = %g J/kmolK\n", cp);
|
|
|
|
printf("\n");
|
|
double deltaG = g_liq - g_gas;
|
|
if (fabs(deltaG) < 1.0E-5) {
|
|
printf("Delta g = ~0.0 J/kmol ( < 1.0E-5)\n");
|
|
} else {
|
|
printf("Delta g = %g J/kmol\n", g_liq - g_gas);
|
|
}
|
|
delete water;
|
|
return 0;
|
|
}
|