Test Suite Update

-> Added a pureFluidTest problem that only gets carried out if
     the WIT_PURE_FLUIDS conditional compile takes place.
  -> added more to testWaterTP, so that it queries the unstable
     water region up to the spinodal curve.
This commit is contained in:
Harry Moffat 2007-03-14 15:17:17 +00:00
parent a0b5f3241d
commit 581de52fbe
15 changed files with 822 additions and 23 deletions

View file

@ -265,6 +265,7 @@ namespace Cantera {
* for %Cantera. A new %IdealGasPhase may be created by the following code snippet:
*
* @code
* XML_Node *xc = get_XML_File("silane.xml");
* XML_Node * const xs = xc->findNameID("phase", "silane");
* ThermoPhase *silane_tp = newPhase(*xs);
* IdealGasPhase *silaneGas = dynamic_cast <IdealGasPhase *>(silane_tp);
@ -273,6 +274,7 @@ namespace Cantera {
* or by the following constructor:
*
* @code
* XML_Node *xc = get_XML_File("silane.xml");
* XML_Node * const xs = xc->findNameID("phase", "silane");
* IdealGasPhase *silaneGas = new IdealGasPhase(*xs);
* @endcode

View file

@ -105,6 +105,7 @@ namespace Cantera {
* for Cantera. A new SurfPhase may be created by the following code snippet:
*
* @code
* XML_Node *xc = get_XML_File("diamond.xml");
* XML_Node * const xs = xc->findNameID("phase", "diamond_100");
* ThermoPhase *diamond100TP_tp = newPhase(*xs);
* SurfPhase *diamond100TP = dynamic_cast <SurfPhase *>(diamond100TP_tp);
@ -113,6 +114,7 @@ namespace Cantera {
* or by the following constructor:
*
* @code
* XML_Node *xc = get_XML_File("diamond.xml");
* XML_Node * const xs = xc->findNameID("phase", "diamond_100");
* SurfPhase *diamond100TP = new SurfPhase(*xs);
* @endcode

View file

@ -375,34 +375,48 @@ namespace Cantera {
}
// critical temperature
doublereal WaterTP::critTemperature() const { return m_sub->Tcrit(); }
// critical temperature
doublereal WaterTP::critTemperature() const { return m_sub->Tcrit(); }
// critical pressure
doublereal WaterTP::critPressure() const { return m_sub->Pcrit(); }
// critical pressure
doublereal WaterTP::critPressure() const { return m_sub->Pcrit(); }
// critical density
doublereal WaterTP::critDensity() const { return m_sub->Rhocrit(); }
// critical density
doublereal WaterTP::critDensity() const { return m_sub->Rhocrit(); }
void WaterTP::setTemperature(double temp) {
State::setTemperature(temp);
doublereal dd = density();
m_sub->setState(temp, dd);
}
void WaterTP::setTemperature(double temp) {
State::setTemperature(temp);
doublereal dd = density();
m_sub->setState(temp, dd);
}
// saturation pressure
doublereal WaterTP::satPressure(doublereal t){
doublereal pp = m_sub->psat(t);
double dens = density();
setTemperature(t);
setDensity(dens);
return pp;
// saturation pressure
doublereal WaterTP::satPressure(doublereal t){
doublereal pp = m_sub->psat(t);
double dens = density();
setTemperature(t);
setDensity(dens);
return pp;
}
// Return the fraction of vapor at the current conditions
doublereal WaterTP::vaporFraction() const {
if (temperature() >= m_sub->Tcrit()) {
double dens = density();
if (dens >= m_sub->Rhocrit()) {
return 0.0;
}
return 1.0;
}
/*
* If below tcrit we always return 0 from this class
*/
return 0.0;
}
}

View file

@ -168,6 +168,13 @@ namespace Cantera {
*/
virtual doublereal satPressure(doublereal t);
//! Return the fraction of vapor at the current conditions
/*!
* Below Tcrit, this routine will always return 0, by definition
* of the functionality of the routine. Above Tcrit, we query
* the density to toggle between 0 and 1.
*/
virtual doublereal vaporFraction() const;
virtual void setTemperature(double temp);

13
configure vendored
View file

@ -308,7 +308,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BITCOMPILE BITHARDWARE BITCHANGE ldemulationarg CVF_LIBDIR USE_CLIB_DLL local_inst local_python_inst python_prefix python_win_prefix ctversion homedir ct_libdir ct_bindir ct_incdir ct_incroot ct_datadir ct_demodir ct_templdir ct_tutdir ct_docdir ct_dir ct_mandir COMPACT_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os username ctroot buildinc buildlib buildbin MAKE GRAPHVIZDIR ARCHIVE DO_RANLIB RANLIB CXX_DEPENDS USERDIR INCL_USER_CODE CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT use_sundials CVODE_LIBS IDA_LIBS sundials_include CANTERA_DEBUG_MODE phase_object_files phase_header_files COMPILE_IDEAL_SOLUTIONS COMPILE_ELECTROLYTES NEED_CATHERMO WITH_REACTORS KERNEL KERNEL_OBJ BUILD_CK LIB_DIR build_lapack build_blas BLAS_LAPACK_LIBS BLAS_LAPACK_DIR build_with_f2c build_f2c_lib LOCAL_LIB_DIRS LOCAL_LIBS CT_SHARED_LIB PYTHON_CMD BUILD_PYTHON NUMARRAY_INC_DIR NUMARRAY_HOME CANTERA_PYTHON_HOME CVSTAG MATLAB_CMD BUILD_MATLAB BUILD_CLIB export_name INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CC CFLAGS ac_ct_CC CXXCPP EGREP SOEXT SHARED PIC CXX_INCLUDES LCXX_FLAGS LCXX_END_LIBS HAVE_STRIPSYMBOLS F77 FFLAGS ac_ct_F77 F90 BUILD_F90 F90FLAGS F90BUILDFLAGS precompile_headers FLIBS OS_IS_DARWIN OS_IS_WIN OS_IS_CYGWIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT math_libs SO LDSHARED EXTRA_LINK TSCOMPARE_abs INSTALL_abs INSTALL_VERBOSE LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BITCOMPILE BITHARDWARE BITCHANGE ldemulationarg CVF_LIBDIR USE_CLIB_DLL local_inst local_python_inst python_prefix python_win_prefix ctversion homedir ct_libdir ct_bindir ct_incdir ct_incroot ct_datadir ct_demodir ct_templdir ct_tutdir ct_docdir ct_dir ct_mandir COMPACT_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os username ctroot buildinc buildlib buildbin MAKE GRAPHVIZDIR ARCHIVE DO_RANLIB RANLIB CXX_DEPENDS USERDIR INCL_USER_CODE CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT use_sundials CVODE_LIBS IDA_LIBS sundials_include CANTERA_DEBUG_MODE COMPILE_PURE_FLUIDS phase_object_files phase_header_files COMPILE_IDEAL_SOLUTIONS COMPILE_ELECTROLYTES NEED_CATHERMO WITH_REACTORS KERNEL KERNEL_OBJ BUILD_CK LIB_DIR build_lapack build_blas BLAS_LAPACK_LIBS BLAS_LAPACK_DIR build_with_f2c build_f2c_lib LOCAL_LIB_DIRS LOCAL_LIBS CT_SHARED_LIB PYTHON_CMD BUILD_PYTHON NUMARRAY_INC_DIR NUMARRAY_HOME CANTERA_PYTHON_HOME CVSTAG MATLAB_CMD BUILD_MATLAB BUILD_CLIB export_name INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CC CFLAGS ac_ct_CC CXXCPP EGREP SOEXT SHARED PIC CXX_INCLUDES LCXX_FLAGS LCXX_END_LIBS HAVE_STRIPSYMBOLS F77 FFLAGS ac_ct_F77 F90 BUILD_F90 F90FLAGS F90BUILDFLAGS precompile_headers FLIBS OS_IS_DARWIN OS_IS_WIN OS_IS_CYGWIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT math_libs SO LDSHARED EXTRA_LINK TSCOMPARE_abs INSTALL_abs INSTALL_VERBOSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -2498,14 +2498,19 @@ _ACEOF
hdrs=$hdrs' StoichSubstance.h'
objs=$objs' StoichSubstance.o'
fi
COMPILE_PURE_FLUIDS=
if test "$WITH_PURE_FLUIDS" = "y"; then
cat >>confdefs.h <<\_ACEOF
#define WITH_PURE_FLUIDS 1
_ACEOF
COMPILE_PURE_FLUIDS=1
hdrs=$hdrs' PureFluidPhase.h'
objs=$objs' PureFluidPhase.o'
fi
if test "$WITH_LATTICE_SOLID" = "y"; then
cat >>confdefs.h <<\_ACEOF
#define WITH_LATTICE_SOLID 1
@ -8286,7 +8291,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:8289:" \
echo "$as_me:8294:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -8753,7 +8758,7 @@ fi
ac_config_files="$ac_config_files Makefile Cantera/Makefile Cantera/src/Makefile Cantera/src/zeroD/Makefile Cantera/src/oneD/Makefile Cantera/src/converters/Makefile Cantera/src/transport/Makefile Cantera/src/thermo/Makefile Cantera/clib/src/Makefile Cantera/fortran/src/Makefile Cantera/fortran/f77demos/f77demos.mak Cantera/fortran/f77demos/isentropic.dsp Cantera/matlab/Makefile Cantera/matlab/setup_matlab.py Cantera/matlab/setup_winmatlab.py Cantera/python/Makefile Cantera/python/setup.py Cantera/cxx/Makefile Cantera/cxx/src/Makefile Cantera/cxx/demos/Makefile Cantera/user/Makefile Cantera/python/src/Makefile ext/lapack/Makefile ext/blas/Makefile ext/cvode/Makefile ext/math/Makefile ext/recipes/Makefile ext/tpx/Makefile ext/Makefile ext/f2c_libs/Makefile ext/f2c_blas/Makefile ext/f2c_lapack/Makefile ext/f2c_math/Makefile examples/Makefile examples/cxx/Makefile tools/Makefile tools/doc/Cantera.cfg tools/doc/Makefile tools/src/Makefile tools/src/sample.mak tools/src/finish_install.py tools/src/package4mac tools/templates/f77/demo.mak tools/templates/f90/demo.mak tools/templates/cxx/demo.mak tools/testtools/Makefile data/inputs/Makefile test_problems/Makefile test_problems/cxx_ex/Makefile test_problems/silane_equil/Makefile test_problems/surfkin/Makefile test_problems/diamondSurf/Makefile test_problems/ChemEquil_gri_matrix/Makefile test_problems/ChemEquil_gri_pairs/Makefile test_problems/ChemEquil_ionizedGas/Makefile test_problems/ChemEquil_red1/Makefile test_problems/fracCoeff/Makefile test_problems/negATest/Makefile test_problems/ck2cti_test/Makefile test_problems/ck2cti_test/runtest test_problems/min_python/Makefile test_problems/min_python/minDiamond/Makefile test_problems/min_python/negATest/Makefile test_problems/python/Makefile test_problems/cathermo/Makefile test_problems/cathermo/issp/Makefile test_problems/cathermo/ims/Makefile test_problems/cathermo/testIAPWS/Makefile test_problems/cathermo/testIAPWSPres/Makefile test_problems/cathermo/testIAPWSTripP/Makefile test_problems/cathermo/testWaterPDSS/Makefile test_problems/cathermo/testWaterTP/Makefile test_problems/cathermo/HMW_test_1/Makefile test_problems/cathermo/HMW_test_3/Makefile test_problems/cathermo/HMW_graph_GvT/Makefile test_problems/cathermo/HMW_graph_GvI/Makefile test_problems/cathermo/HMW_graph_HvT/Makefile test_problems/cathermo/HMW_graph_CpvT/Makefile test_problems/cathermo/HMW_graph_VvT/Makefile test_problems/cathermo/DH_graph_1/Makefile test_problems/cathermo/DH_graph_acommon/Makefile test_problems/cathermo/DH_graph_NM/Makefile test_problems/cathermo/DH_graph_Pitzer/Makefile test_problems/cathermo/DH_graph_bdotak/Makefile bin/install_tsc"
ac_config_files="$ac_config_files Makefile Cantera/Makefile Cantera/src/Makefile Cantera/src/zeroD/Makefile Cantera/src/oneD/Makefile Cantera/src/converters/Makefile Cantera/src/transport/Makefile Cantera/src/thermo/Makefile Cantera/clib/src/Makefile Cantera/fortran/src/Makefile Cantera/fortran/f77demos/f77demos.mak Cantera/fortran/f77demos/isentropic.dsp Cantera/matlab/Makefile Cantera/matlab/setup_matlab.py Cantera/matlab/setup_winmatlab.py Cantera/python/Makefile Cantera/python/setup.py Cantera/cxx/Makefile Cantera/cxx/src/Makefile Cantera/cxx/demos/Makefile Cantera/user/Makefile Cantera/python/src/Makefile ext/lapack/Makefile ext/blas/Makefile ext/cvode/Makefile ext/math/Makefile ext/recipes/Makefile ext/tpx/Makefile ext/Makefile ext/f2c_libs/Makefile ext/f2c_blas/Makefile ext/f2c_lapack/Makefile ext/f2c_math/Makefile examples/Makefile examples/cxx/Makefile tools/Makefile tools/doc/Cantera.cfg tools/doc/Makefile tools/src/Makefile tools/src/sample.mak tools/src/finish_install.py tools/src/package4mac tools/templates/f77/demo.mak tools/templates/f90/demo.mak tools/templates/cxx/demo.mak tools/testtools/Makefile data/inputs/Makefile test_problems/Makefile test_problems/cxx_ex/Makefile test_problems/silane_equil/Makefile test_problems/surfkin/Makefile test_problems/diamondSurf/Makefile test_problems/ChemEquil_gri_matrix/Makefile test_problems/ChemEquil_gri_pairs/Makefile test_problems/ChemEquil_ionizedGas/Makefile test_problems/ChemEquil_red1/Makefile test_problems/fracCoeff/Makefile test_problems/negATest/Makefile test_problems/ck2cti_test/Makefile test_problems/ck2cti_test/runtest test_problems/min_python/Makefile test_problems/min_python/minDiamond/Makefile test_problems/min_python/negATest/Makefile test_problems/pureFluidTest/Makefile test_problems/python/Makefile test_problems/cathermo/Makefile test_problems/cathermo/issp/Makefile test_problems/cathermo/ims/Makefile test_problems/cathermo/testIAPWS/Makefile test_problems/cathermo/testIAPWSPres/Makefile test_problems/cathermo/testIAPWSTripP/Makefile test_problems/cathermo/testWaterPDSS/Makefile test_problems/cathermo/testWaterTP/Makefile test_problems/cathermo/HMW_test_1/Makefile test_problems/cathermo/HMW_test_3/Makefile test_problems/cathermo/HMW_graph_GvT/Makefile test_problems/cathermo/HMW_graph_GvI/Makefile test_problems/cathermo/HMW_graph_HvT/Makefile test_problems/cathermo/HMW_graph_CpvT/Makefile test_problems/cathermo/HMW_graph_VvT/Makefile test_problems/cathermo/DH_graph_1/Makefile test_problems/cathermo/DH_graph_acommon/Makefile test_problems/cathermo/DH_graph_NM/Makefile test_problems/cathermo/DH_graph_Pitzer/Makefile test_problems/cathermo/DH_graph_bdotak/Makefile bin/install_tsc"
test "x$prefix" = xNONE && prefix=$ac_default_prefix
@ -9289,6 +9294,7 @@ do
"test_problems/min_python/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/min_python/Makefile" ;;
"test_problems/min_python/minDiamond/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/min_python/minDiamond/Makefile" ;;
"test_problems/min_python/negATest/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/min_python/negATest/Makefile" ;;
"test_problems/pureFluidTest/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/pureFluidTest/Makefile" ;;
"test_problems/python/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/python/Makefile" ;;
"test_problems/cathermo/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/cathermo/Makefile" ;;
"test_problems/cathermo/issp/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/cathermo/issp/Makefile" ;;
@ -9457,6 +9463,7 @@ s,@CVODE_LIBS@,$CVODE_LIBS,;t t
s,@IDA_LIBS@,$IDA_LIBS,;t t
s,@sundials_include@,$sundials_include,;t t
s,@CANTERA_DEBUG_MODE@,$CANTERA_DEBUG_MODE,;t t
s,@COMPILE_PURE_FLUIDS@,$COMPILE_PURE_FLUIDS,;t t
s,@phase_object_files@,$phase_object_files,;t t
s,@phase_header_files@,$phase_header_files,;t t
s,@COMPILE_IDEAL_SOLUTIONS@,$COMPILE_IDEAL_SOLUTIONS,;t t

View file

@ -420,11 +420,16 @@ if test "$WITH_STOICH_SUBSTANCE" = "y"; then
hdrs=$hdrs' StoichSubstance.h'
objs=$objs' StoichSubstance.o'
fi
COMPILE_PURE_FLUIDS=
if test "$WITH_PURE_FLUIDS" = "y"; then
AC_DEFINE(WITH_PURE_FLUIDS)
COMPILE_PURE_FLUIDS=1
hdrs=$hdrs' PureFluidPhase.h'
objs=$objs' PureFluidPhase.o'
fi
AC_SUBST(COMPILE_PURE_FLUIDS)
if test "$WITH_LATTICE_SOLID" = "y"; then
AC_DEFINE(WITH_LATTICE_SOLID)
hdrs=$hdrs' LatticeSolidPhase.h'
@ -1377,6 +1382,7 @@ AC_OUTPUT(Makefile \
test_problems/min_python/Makefile \
test_problems/min_python/minDiamond/Makefile \
test_problems/min_python/negATest/Makefile \
test_problems/pureFluidTest/Makefile \
test_problems/python/Makefile \
test_problems/cathermo/Makefile \
test_problems/cathermo/issp/Makefile \

View file

@ -7,6 +7,7 @@
test_python=@BUILD_PYTHON@
test_ck=@BUILD_CK@
test_cathermo=@NEED_CATHERMO@
test_pure_fluids=@COMPILE_PURE_FLUIDS@
all:
cd cxx_ex; @MAKE@ all
@ -18,6 +19,9 @@ all:
cd ChemEquil_gri_pairs; @MAKE@ all
cd ChemEquil_ionizedGas; @MAKE@ all
cd ChemEquil_red1; @MAKE@ all
ifeq ($(test_cathermo),1)
cd pureFluidTest; @MAKE@ all
endif
ifeq ($(test_python),1)
cd min_python; @MAKE@ all
endif
@ -41,6 +45,9 @@ test:
@ cd ChemEquil_gri_pairs; @MAKE@ -s test
@ cd ChemEquil_ionizedGas; @MAKE@ -s test
@ cd ChemEquil_red1; @MAKE@ -s test
ifeq ($(test_cathermo),1)
@ cd pureFluidTest; @MAKE@ -s test
endif
ifeq ($(test_ck),1)
@ cd ck2cti_test; @MAKE@ -s test
endif
@ -66,6 +73,7 @@ clean:
cd ChemEquil_gri_pairs; @MAKE@ clean
cd ChemEquil_ionizedGas; @MAKE@ clean
cd ChemEquil_red1; @MAKE@ clean
cd pureFluidTest; @MAKE@ clean
cd ck2cti_test; @MAKE@ clean
cd min_python; @MAKE@ clean
cd python; @MAKE@ clean
@ -81,6 +89,9 @@ depends:
cd ChemEquil_gri_pairs; @MAKE@ depends
cd ChemEquil_ionizedGas; @MAKE@ depends
cd ChemEquil_red1; @MAKE@ depends
ifeq ($(test_cathermo),1)
cd pureFluidTest; @MAKE@ depends
endif
ifeq ($(test_ck),1)
cd ck2cti_test; @MAKE@ depends
endif

View file

@ -37,3 +37,28 @@ Liquid Densities:
373.15 1.01621 1.01418 958.349 0.0187982
400 2.46261 2.45769 937.486 0.0192166
500 26.4447 26.392 831.318 0.0216707
Table of increasing Enthalpy at 1 atm
Enthalpy, Temperature, x_Vapor, Density, Entropy_mass, Gibbs_mass
-1.58671e+07, 298, 0, 997.09, 3879.2, -1.7023e+07
-1.58671e+07, 298, 0, 997.09, 3879.2, -1.7023e+07
-1.57671e+07, 321.924, 0, 988.58, 4202, -1.712e+07
-1.56671e+07, 345.815, 0, 976.22, 4501.6, -1.7224e+07
-1.55671e+07, 369.62, 0, 960.86, 4781.2, -1.7334e+07
-1.54671e+07, 393.28, 0, 942.95, 5043.5, -1.7451e+07
-1.53671e+07, 416.718, 0, 922.76, 5290.4, -1.7572e+07
-1.52671e+07, 439.848, 0, 900.41, 5524, -1.7697e+07
-1.51671e+07, 462.563, 0, 875.92, 5745.6, -1.7825e+07
-1.50671e+07, 484.741, 0, 849.2, 5956.8, -1.7955e+07
-1.49671e+07, 506.233, 0, 820.07, 6158.6, -1.8085e+07
-1.48671e+07, 526.848, 0, 788.18, 6352.2, -1.8214e+07
-1.47671e+07, 546.325, 0, 752.98, 6538.5, -1.8339e+07
-1.46671e+07, 564.272, 0, 713.51, 6718.6, -1.8458e+07
-1.45671e+07, 580.026, 0, 667.86, 6893.3, -1.8565e+07
-1.44671e+07, -> Failed to converge, beyond the spinodal probably
Critical Temp = 647 K
Critical Pressure = 218 atm
Critical Dens = 322 kg/m3

View file

@ -142,8 +142,50 @@ int main () {
}
printf("\n\nTable of increasing Enthalpy at 1 atm\n\n");
double dens;
printf(" Enthalpy, Temperature, x_Vapor, Density, Entropy_mass, Gibbs_mass\n");
w->setState_TP(298., OneAtm);
double Hset = w->enthalpy_mass();
double vapFrac = w->vaporFraction();
double Tcalc = w->temperature();
double Scalc = w->entropy_mass();
double Gcalc = w->gibbs_mass();
dens = w->density();
printf(" %10g, %10g, %10g, %11.5g, %11.5g, %11.5g\n", Hset , Tcalc, vapFrac, dens, Scalc, Gcalc);
w->setState_HP(Hset, OneAtm);
vapFrac = w->vaporFraction();
Tcalc = w->temperature();
dens = w->density();
Scalc = w->entropy_mass();
Gcalc = w->gibbs_mass();
printf(" %10g, %10g, %10g, %11.5g, %11.5g, %11.5g\n", Hset , Tcalc, vapFrac, dens, Scalc, Gcalc);
delete w;
double deltaH = 100000.;
for (int i = 0; i < 40; i++) {
Hset += deltaH;
try {
w->setState_HP(Hset, OneAtm);
} catch (CanteraError) {
printf(" %10g, -> Failed to converge, beyond the spinodal probably \n\n", Hset);
popError();
break;
}
vapFrac = w->vaporFraction();
Tcalc = w->temperature();
dens = w->density();
Scalc = w->entropy_mass();
Gcalc = w->gibbs_mass();
printf(" %10g, %10g, %10g, %11.5g, %11.5g, %11.5g\n", Hset , Tcalc, vapFrac, dens, Scalc, Gcalc);
}
printf("Critical Temp = %10.3g K\n", w->critTemperature());
printf("Critical Pressure = %10.3g atm\n", w->critPressure()/OneAtm);
printf("Critical Dens = %10.3g kg/m3\n", w->critDensity());
delete w;
} catch (CanteraError) {
showErrors();

View file

@ -0,0 +1,9 @@
Makefile
diff_test.out
output.txt
outputa.txt
.depends
csvCode.txt
testPureWater
testPureWater.d

View file

@ -0,0 +1,122 @@
#!/bin/sh
############################################################################
#
# Makefile to compile and link a C++ application to
# Cantera.
#
#############################################################################
# addition to suffixes
.SUFFIXES : .d
# the name of the executable program to be created
PROG_NAME = testPureWater
# the object files to be linked together. List those generated from Fortran
# and from C/C++ separately
OBJS = testPureWater.o
# Location of the current build. Will assume that tests are run
# in the source directory tree location
src_dir_tree = 1
# additional flags to be passed to the linker. If your program
# requires other external libraries, put them here
LINK_OPTIONS = @EXTRA_LINK@
#############################################################################
# Check to see whether we are in the msvc++ environment
os_is_win = @OS_IS_WIN@
# Fortran libraries
FORT_LIBS = @FLIBS@
# the C++ compiler
CXX = @CXX@
# C++ compile flags
ifeq ($(src_dir_tree), 1)
CXX_FLAGS = -DSRCDIRTREE @CXXFLAGS@
else
CXX_FLAGS = @CXXFLAGS@
endif
# Ending C++ linking libraries
LCXX_END_LIBS = @LCXX_END_LIBS@
# the directory where the Cantera libraries are located
CANTERA_LIBDIR=@buildlib@
# required Cantera libraries
CANTERA_LIBS = @LOCAL_LIBS@ -lctcxx
# the directory where Cantera include files may be found.
ifeq ($(src_dir_tree), 1)
CANTERA_INCDIR=../../Cantera/src
INCLUDES=-I$(CANTERA_INCDIR) -I$(CANTERA_INCDIR)/thermo
else
CANTERA_INCDIR=@ctroot@/build/include/cantera
INCLUDES=-I$(CANTERA_INCDIR) -I$(CANTERA_INCDIR)/kernel
endif
# flags passed to the C++ compiler/linker for the linking step
LCXX_FLAGS = -L$(CANTERA_LIBDIR) @LOCAL_LIB_DIRS@ @CXXFLAGS@
# How to compile C++ source files to object files
.@CXX_EXT@.@OBJ_EXT@:
$(CXX) -c $< $(INCLUDES) $(CXX_FLAGS)
# How to compile the dependency file
.cpp.d:
@CXX_DEPENDS@ $(INCLUDES) $(CXX_FLAGS) $*.cpp > $*.d
# List of dependency files to be created
DEPENDS=$(OBJS:.o=.d)
# Program Name
PROGRAM = $(PROG_NAME)$(EXE_EXT)
all: $(PROGRAM) .depends
$(PROGRAM): $(OBJS) $(CANTERA_LIBDIR)/libcantera.a \
$(CANTERA_LIBDIR)/libcaThermo.a
$(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(LINK_OPTIONS) \
$(CANTERA_LIBS) @LIBS@ $(FORT_LIBS) \
$(LCXX_END_LIBS)
# Add an additional target for stability:
$(OBJS): $(CANTERA_LIBDIR)/libcantera.a $(CANTERA_LIBDIR)/libcaThermo.a
# depends target -> forces recalculation of dependencies
depends:
@MAKE@ .depends
.depends: $(DEPENDS)
cat $(DEPENDS) > .depends
# Do the test -> For the windows vc++ environment, we have to skip checking on
# whether the program is uptodate, because we don't utilize make
# in that environment to build programs.
test:
ifeq ($(os_is_win), 1)
else
@ @MAKE@ -s $(PROGRAM)
endif
@ ./runtest
clean:
$(RM) $(OBJS) $(PROGRAM) $(DEPENDS) .depends
../../bin/rm_cvsignore
(if test -d SunWS_cache ; then \
$(RM) -rf SunWS_cache ; \
fi )
ifeq ($(wildcard .depends), .depends)
include .depends
endif

View file

@ -0,0 +1,237 @@
<?xml version="1.0"?>
<ctml>
<validate reactions="yes" species="yes"/>
<!-- phase water -->
<phase dim="3" id="water">
<elementArray datasrc="elements.xml">O H </elementArray>
<speciesArray datasrc="#species_data">H2O</speciesArray>
<state>
<temperature units="K">300.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="PureFluid" fluid_type="0"/>
<kinetics model="none"/>
</phase>
<!-- phase nitrogen -->
<phase dim="3" id="nitrogen">
<elementArray datasrc="elements.xml">N </elementArray>
<speciesArray datasrc="#species_data">N2</speciesArray>
<state>
<temperature units="K">300.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="PureFluid" fluid_type="1"/>
<kinetics model="none"/>
</phase>
<!-- phase methane -->
<phase dim="3" id="methane">
<elementArray datasrc="elements.xml">C H </elementArray>
<speciesArray datasrc="#species_data">CH4</speciesArray>
<state>
<temperature units="K">300.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="PureFluid" fluid_type="2"/>
<kinetics model="none"/>
</phase>
<!-- phase hydrogen -->
<phase dim="3" id="hydrogen">
<elementArray datasrc="elements.xml">H </elementArray>
<speciesArray datasrc="#species_data">H2</speciesArray>
<state>
<temperature units="K">300.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="PureFluid" fluid_type="3"/>
<kinetics model="none"/>
</phase>
<!-- phase oxygen -->
<phase dim="3" id="oxygen">
<elementArray datasrc="elements.xml">O </elementArray>
<speciesArray datasrc="#species_data">O2</speciesArray>
<state>
<temperature units="K">300.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="PureFluid" fluid_type="4"/>
<kinetics model="none"/>
</phase>
<!-- phase carbondioxide -->
<phase dim="3" id="carbondioxide">
<elementArray datasrc="elements.xml">C O </elementArray>
<speciesArray datasrc="#species_data">CO2</speciesArray>
<state>
<temperature units="K">280.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="PureFluid" fluid_type="7"/>
<kinetics model="none"/>
</phase>
<!-- phase heptane -->
<phase dim="3" id="heptane">
<elementArray datasrc="elements.xml">C H </elementArray>
<speciesArray datasrc="#species_data">C7H16</speciesArray>
<state>
<temperature units="K">300.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="PureFluid" fluid_type="8"/>
<kinetics model="none"/>
</phase>
<!-- phase hfc134a -->
<phase dim="3" id="hfc134a">
<elementArray datasrc="elements.xml">C F H </elementArray>
<speciesArray datasrc="#species_data">C2F4H2</speciesArray>
<state>
<temperature units="K">300.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="PureFluid" fluid_type="5"/>
<kinetics model="none"/>
</phase>
<!-- species definitions -->
<speciesData id="species_data">
<!-- species H2O -->
<species name="H2O">
<atomArray>H:2 O:1 </atomArray>
<thermo>
<NASA Tmax="1000.0" Tmin="273.16000000000003" P0="100000.0">
<floatArray name="coeffs" size="7">
4.198640560E+00, -2.036434100E-03, 6.520402110E-06, -5.487970620E-09,
1.771978170E-12, -3.029372670E+04, -8.490322080E-01</floatArray>
</NASA>
<NASA Tmax="1600.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.033992490E+00, 2.176918040E-03, -1.640725180E-07, -9.704198700E-11,
1.682009920E-14, -3.000429710E+04, 4.966770100E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species N2 -->
<species name="N2">
<atomArray>N:2 </atomArray>
<thermo>
<NASA Tmax="1000.0" Tmin="63.149999999999999" P0="100000.0">
<floatArray name="coeffs" size="7">
3.298677000E+00, 1.408240400E-03, -3.963222000E-06, 5.641515000E-09,
-2.444854000E-12, -1.020899900E+03, 3.950372000E+00</floatArray>
</NASA>
<NASA Tmax="2000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.926640000E+00, 1.487976800E-03, -5.684760000E-07, 1.009703800E-10,
-6.753351000E-15, -9.227977000E+02, 5.980528000E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species CH4 -->
<species name="CH4">
<atomArray>H:4 C:1 </atomArray>
<thermo>
<NASA Tmax="1000.0" Tmin="90.680000000000007" P0="100000.0">
<floatArray name="coeffs" size="7">
5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08,
1.666939560E-11, -1.024664760E+04, -4.641303760E+00</floatArray>
</NASA>
<NASA Tmax="1700.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09,
-1.018152300E-13, -9.468344590E+03, 1.843731800E+01</floatArray>
</NASA>
</thermo>
</species>
<!-- species O2 -->
<species name="O2">
<atomArray>O:2 </atomArray>
<thermo>
<NASA Tmax="1000.0" Tmin="54.340000000000003" P0="100000.0">
<floatArray name="coeffs" size="7">
3.782456360E+00, -2.996734160E-03, 9.847302010E-06, -9.681295090E-09,
3.243728370E-12, -1.063943560E+03, 3.657675730E+00</floatArray>
</NASA>
<NASA Tmax="2000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.282537840E+00, 1.483087540E-03, -7.579666690E-07, 2.094705550E-10,
-2.167177940E-14, -1.088457720E+03, 5.453231290E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species H2 -->
<species name="H2">
<atomArray>H:2 </atomArray>
<thermo>
<NASA Tmax="1000.0" Tmin="13.800000000000001" P0="100000.0">
<floatArray name="coeffs" size="7">
2.344331120E+00, 7.980520750E-03, -1.947815100E-05, 2.015720940E-08,
-7.376117610E-12, -9.179351730E+02, 6.830102380E-01</floatArray>
</NASA>
<NASA Tmax="5000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.337279200E+00, -4.940247310E-05, 4.994567780E-07, -1.795663940E-10,
2.002553760E-14, -9.501589220E+02, -3.205023310E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species CO2 -->
<species name="CO2">
<atomArray>C:1 O:2 </atomArray>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.356773520E+00, 8.984596770E-03, -7.123562690E-06, 2.459190220E-09,
-1.436995480E-13, -4.837196970E+04, 9.901052220E+00</floatArray>
</NASA>
<NASA Tmax="3500.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.857460290E+00, 4.414370260E-03, -2.214814040E-06, 5.234901880E-10,
-4.720841640E-14, -4.875916600E+04, 2.271638060E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species C7H16 -->
<species name="C7H16">
<atomArray>H:16 C:7 </atomArray>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
1.115324840E+01, -9.494154330E-03, 1.955711810E-04, -2.497525200E-07,
9.848732130E-11, -2.677117350E+04, -1.590961100E+01</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
1.853547040E+01, 3.914204680E-02, -1.380302680E-05, 2.224038740E-09,
-1.334525800E-13, -3.195007830E+04, -7.019028400E+01</floatArray>
</NASA>
</thermo>
</species>
<!-- species C2F4H2 -->
<species name="C2F4H2">
<atomArray>H:2 C:2 F:4 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">273.14999999999998</t0>
<h0 units="J/kmol">23083414.8686</h0>
<s0 units="J/kmol/K">167025.46599999999</s0>
<cp0 units="J/kmol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
</speciesData>
<reactionData id="reaction_data"/>
</ctml>

View file

@ -0,0 +1,87 @@
psat(273.16) = 610.157
Comparisons to NIST: (see http://webbook.nist.gov):
H0(298.15) = -2.41825e+08 J/kmol
S0(298.15) = 188939 J/kmolK
Ideal Gas Standard State:
T Cp0 S0 -(G0-H298)/T H0-H298
(K) (J/molK) (J/molK) (J/molK) (kJ/mol)
298.15 33.5708 188.939 188.939 0
500 35.2032 206.633 192.788 6.92212
600 36.2894 213.145 195.652 10.4959
1000 41.2083 232.81 206.832 25.9778
H_liq(298.15, onebar) = -2.85839e+08 J/kmol
S_liq(298.15, onebar) = 70035.2 J/kmolK
Liquid 1bar or psat Standard State
T press psat Cp0 S0 -(G0-H298)/T H0-H298
(K) (bar) (bar) (J/molK) (J/molK) (J/molK) (kJ/mol)
273.19 1 0.00611488 75.6592 63.4258 70.3324 -1.88682
298.15 1 0.0316222 75.3497 70.0352 70.0352 0
300 1 0.0352821 75.3212 70.5012 70.0366 0.13937
373.15 1.01429 1.01227 75.9509 86.9605 71.7971 5.65822
400 2.45845 2.45354 76.7271 92.2602 72.9877 7.70899
500 26.4023 26.3496 83.779 109.915 78.552 15.6817
Liquid Densities:
T press psat Density molarVol
(K) (bar) (bar) (kg/m3) (m3/kmol)
273.19 1 0.00611488 999.824 0.0180192
298.15 1 0.0316222 997.121 0.018068
300 1 0.0352821 996.633 0.0180769
373.15 1.01429 1.01227 958.305 0.0187999
400 2.45845 2.45354 937.491 0.0192172
500 26.4023 26.3496 831.472 0.0216676
Table of increasing Enthalpy at 1 atm
Enthalpy, Temperature, x_Vapor, Density, Entropy_mass, Gibbs_mass
-1.58665e+07, 298, 0, 997.16, 3885.3, -1.7024e+07
-1.58665e+07, 298, 0, 997.16, 3885.3, -1.7024e+07
-1.57665e+07, 321.939, 0, 988.59, 4208.1, -1.7121e+07
-1.56665e+07, 345.851, 0, 976.14, 4507.7, -1.7225e+07
-1.55665e+07, 369.663, 0, 960.78, 4787.3, -1.7336e+07
-1.54665e+07, 373.177, 0.0377465, 15.583, 5055.4, -1.7353e+07
-1.53665e+07, 373.177, 0.0820536, 7.2323, 5323.4, -1.7353e+07
-1.52665e+07, 373.177, 0.126361, 4.7088, 5591.4, -1.7353e+07
-1.51665e+07, 373.177, 0.170668, 3.4908, 5859.4, -1.7353e+07
-1.50665e+07, 373.177, 0.214975, 2.7734, 6127.3, -1.7353e+07
-1.49665e+07, 373.177, 0.259282, 2.3006, 6395.3, -1.7353e+07
-1.48665e+07, 373.177, 0.303589, 1.9655, 6663.3, -1.7353e+07
-1.47665e+07, 373.177, 0.347897, 1.7157, 6931.2, -1.7353e+07
-1.46665e+07, 373.177, 0.392204, 1.5222, 7199.2, -1.7353e+07
-1.45665e+07, 373.177, 0.436511, 1.3679, 7467.2, -1.7353e+07
-1.44665e+07, 373.177, 0.480818, 1.242, 7735.1, -1.7353e+07
-1.43665e+07, 373.177, 0.525125, 1.1373, 8003.1, -1.7353e+07
-1.42665e+07, 373.177, 0.569432, 1.0489, 8271.1, -1.7353e+07
-1.41665e+07, 373.177, 0.613739, 0.97328, 8539, -1.7353e+07
-1.40665e+07, 373.177, 0.658047, 0.90781, 8807, -1.7353e+07
-1.39665e+07, 373.177, 0.702354, 0.85059, 9075, -1.7353e+07
-1.38665e+07, 373.177, 0.746661, 0.80016, 9343, -1.7353e+07
-1.37665e+07, 373.177, 0.790968, 0.75537, 9610.9, -1.7353e+07
-1.36665e+07, 373.177, 0.835275, 0.71533, 9878.9, -1.7353e+07
-1.35665e+07, 373.177, 0.879582, 0.67932, 10147, -1.7353e+07
-1.34665e+07, 373.177, 0.923889, 0.64677, 10415, -1.7353e+07
-1.33665e+07, 373.177, 0.968197, 0.61719, 10683, -1.7353e+07
-1.32665e+07, 387.127, 1, 0.57458, 10949, -1.7505e+07
-1.31665e+07, 437.296, 1, 0.50581, 11192, -1.8061e+07
-1.30665e+07, 487.872, 1, 0.45212, 11409, -1.8632e+07
-1.29665e+07, 538.231, 1, 0.40919, 11604, -1.9212e+07
-1.28665e+07, 588.078, 1, 0.37417, 11781, -1.9795e+07
-1.27665e+07, 637.288, 1, 0.34507, 11945, -2.0379e+07
-1.26665e+07, 685.81, 1, 0.32053, 12096, -2.0962e+07
-1.25665e+07, 733.632, 1, 0.29955, 12237, -2.1544e+07
-1.24665e+07, 780.758, 1, 0.28141, 12369, -2.2124e+07
-1.23665e+07, 827.199, 1, 0.26557, 12493, -2.2701e+07
-1.22665e+07, 872.973, 1, 0.25162, 12611, -2.3276e+07
-1.21665e+07, 918.101, 1, 0.23923, 12723, -2.3847e+07
-1.20665e+07, 962.603, 1, 0.22815, 12829, -2.4416e+07
-1.19665e+07, 1006.5, 1, 0.21819, 12931, -2.4981e+07
-1.18665e+07, 1049.82, 1, 0.20918, 13028, -2.5544e+07
Critical Temp = 647 K
Critical Pressure = 218 atm
Critical Dens = 317 kg/m3

View file

@ -0,0 +1,33 @@
#!/bin/sh
#
#
temp_success="1"
/bin/rm -f output.txt outputa.txt
testName=pureFluidTest_Water
#################################################################
#
#################################################################
CANTERA_DATA=${CANTERA_DATA:=../../../data/inputs}; export CANTERA_DATA
CANTERA_BIN=${CANTERA_BIN:=../../../bin}
./testPureWater > output.txt
retnStat=$?
if [ $retnStat != "0" ]
then
temp_success="0"
echo "$testName returned with bad status, $retnStat, check output"
fi
$CANTERA_BIN/exp3to2.sh output.txt > outputa.txt
diff -w outputa.txt output_blessed.txt > diff_test.out
retnStat=$?
if [ $retnStat = "0" ]
then
echo "successful diff comparison on $testName test"
else
echo "unsuccessful diff comparison on $testName test"
echo "FAILED" > csvCode.txt
temp_success="0"
fi

View file

@ -0,0 +1,195 @@
/*
* $Id$
*/
#include "stdio.h"
#include "math.h"
#include "PureFluidPhase.h"
#include "importCTML.h"
#include <new>
using namespace std;
using namespace Cantera;
double tvalue(double val, double atol = 1.0E-9) {
double rval = val;
if (fabs(val) < atol) {
rval = 0.0;
}
return rval;
}
int main () {
double pres;
try {
XML_Node *xc = get_XML_File("liquidvapor.xml");
XML_Node * const xs = xc->findNameID("phase", "water");
ThermoPhase *water_tp = newPhase(*xs);
PureFluidPhase *w = dynamic_cast <PureFluidPhase *>(water_tp);
/*
* Print out the triple point conditions
*/
double temp = 273.16;
pres = w->satPressure(temp);
printf("psat(%g) = %g\n", temp, pres);
double presLow = 1.0E-2;
temp = 298.15;
double oneBar = 1.0E5;
printf("Comparisons to NIST: (see http://webbook.nist.gov):\n\n");
w->setDensity(1.0E-8);
w->setState_TP(temp, presLow);
double h = w->enthalpy_mole();
printf("H0(298.15) = %g J/kmol\n", h);
double h298 = h;
double s = w->entropy_mole();
s -= GasConstant * log(oneBar/presLow);
printf("S0(298.15) = %g J/kmolK\n", s);
double T[20];
T[0] = 298.15;
T[1] = 500.;
T[2] = 600.;
T[3] = 1000.;
double Cp0, delh0, delg0, g;
printf("\nIdeal Gas Standard State:\n");
printf (" T Cp0 S0 "
" -(G0-H298)/T H0-H298\n");
printf (" (K) (J/molK) (J/molK) "
" (J/molK) (kJ/mol)\n");
for (int i = 0; i < 4; i++) {
temp = T[i];
w->setState_TP(temp, presLow);
h = w->enthalpy_mole();
delh0 = tvalue(h - h298, 1.0E-6);
g = w->gibbs_mole();
delg0 = (g - h298)/temp + GasConstant * log(oneBar/presLow);
Cp0 = w->cp_mole();
s = w->entropy_mole();
s -= GasConstant * log(oneBar/presLow);
printf("%10g %10g %13g %13g %13g\n", temp, Cp0*1.0E-3, s*1.0E-3,
-delg0*1.0E-3, delh0*1.0E-6);
}
printf("\n\n");
temp = 298.15;
w->setDensity(1000.);
w->setState_TP(temp, oneBar);
h = w->enthalpy_mole();
printf("H_liq(298.15, onebar) = %g J/kmol\n", h);
double h298l = h;
s = w->entropy_mole();
printf("S_liq(298.15, onebar) = %g J/kmolK\n", s);
T[0] = 273.19;
T[1] = 298.15;
T[2] = 300.;
T[3] = 373.15;
T[4] = 400.;
T[5] = 500.;
printf("\nLiquid 1bar or psat Standard State\n");
printf (" T press psat Cp0 S0 "
" -(G0-H298)/T H0-H298\n");
printf (" (K) (bar) (bar) (J/molK) (J/molK)"
" (J/molK) (kJ/mol)\n");
for (int i = 0; i < 6; i++) {
temp = T[i];
double psat = w->satPressure(temp);
double press = oneBar;
if (psat > press) {
press = psat*1.002;
}
w->setState_TP(temp, press);
h = w->enthalpy_mole();
delh0 = tvalue(h - h298l, 1.0E-6);
g = w->gibbs_mole();
delg0 = (g - h298l)/temp;
Cp0 = w->cp_mole();
s = w->entropy_mole();
printf("%10g %10g %12g %13g %13g %13g %13g\n", temp, press*1.0E-5,
psat*1.0E-5,
Cp0*1.0E-3, s*1.0E-3,
-delg0*1.0E-3, delh0*1.0E-6);
}
printf("\nLiquid Densities:\n");
printf (" T press psat Density molarVol "
"\n");
printf (" (K) (bar) (bar) (kg/m3) (m3/kmol)"
"\n");
for (int i = 0; i < 6; i++) {
temp = T[i];
double psat = w->satPressure(temp);
double press = oneBar;
if (psat > press) {
press = psat*1.002;
}
w->setState_TP(temp, press);
double d = w->density();
double mw = w->molecularWeight(0);
double vbar = mw/d;
// not implemented
//w.getPartialMolarVolumes(&vbar);
printf("%10g %10g %12g %13g %13g\n", temp, press*1.0E-5,
psat*1.0E-5, d, vbar);
}
printf("\n\nTable of increasing Enthalpy at 1 atm\n\n");
double dens;
printf(" Enthalpy, Temperature, x_Vapor, Density, Entropy_mass, Gibbs_mass\n");
w->setState_TP(298., OneAtm);
double Hset = w->enthalpy_mass();
double vapFrac = w->vaporFraction();
double Tcalc = w->temperature();
double Scalc = w->entropy_mass();
double Gcalc = w->gibbs_mass();
dens = w->density();
printf(" %10g, %10g, %10g, %11.5g, %11.5g, %11.5g\n", Hset , Tcalc, vapFrac, dens, Scalc, Gcalc);
w->setState_HP(Hset, OneAtm);
vapFrac = w->vaporFraction();
Tcalc = w->temperature();
dens = w->density();
Scalc = w->entropy_mass();
Gcalc = w->gibbs_mass();
printf(" %10g, %10g, %10g, %11.5g, %11.5g, %11.5g\n", Hset , Tcalc, vapFrac, dens, Scalc, Gcalc);
double deltaH = 100000.;
for (int i = 0; i < 40; i++) {
Hset += deltaH;
w->setState_HP(Hset, OneAtm);
vapFrac = w->vaporFraction();
Tcalc = w->temperature();
dens = w->density();
Scalc = w->entropy_mass();
Gcalc = w->gibbs_mass();
printf(" %10g, %10g, %10g, %11.5g, %11.5g, %11.5g\n", Hset , Tcalc, vapFrac, dens, Scalc, Gcalc);
}
printf("Critical Temp = %10.3g K\n", w->critTemperature());
printf("Critical Pressure = %10.3g atm\n", w->critPressure()/OneAtm);
printf("Critical Dens = %10.3g kg/m3\n", w->critDensity());
delete w;
} catch (CanteraError) {
showErrors();
Cantera::appdelete();
return -1;
}
return 0;
}