diff --git a/test_problems/cathermo/wtWater/Makefile b/test_problems/cathermo/wtWater/Makefile new file mode 100644 index 000000000..ec802b6a1 --- /dev/null +++ b/test_problems/cathermo/wtWater/Makefile @@ -0,0 +1,112 @@ +#!/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 = wtWater + +# the object files to be linked together. List those generated from Fortran +# and from C/C++ separately +OBJS = wtWater.o + +# additional flags to be passed to the linker. If your program +# requires other external libraries, put them here +LINK_OPTIONS = + +############################################################################# + +# Check to see whether we are in the msvc++ environment +os_is_win = 0 + +# Fortran libraries +ifeq (0, 0) +FORT_LIBS = +else +FORT_LIBS = +endif + +# the C++ compiler +CXX = /home/sntools/extras/compilers/gcc-4.2.4/bin/gcc + +# C++ compile flags +CXX_FLAGS = -g -Wall -DDEBUG_HKM -DDEBUG_HKM_EPEQUIL + +# Ending C++ linking libraries +LCXX_END_LIBS = -lctf2c -lgfortran -lm -lstdc++ + +# the directory where the Cantera libraries are located +CANTERA_LIBDIR=/ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu + +# required Cantera libraries +CANTERA_LIBS = -luser -loneD -lzeroD -lequil -lVCSnonideal -lkinetics -ltransport -lthermo -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lsundials_cvodes -lsundials_nvecserial -lctlapack -lctblas -lctf2c -lctcxx + +# Dependencies for CANTERA_LIBS +CANTERA_LIBS_DEP = /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libuser.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/liboneD.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libzeroD.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libequil.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libVCSnonideal.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libkinetics.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libtransport.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libthermo.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libctnumerics.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libctmath.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libtpx.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libctspectra.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libconverters.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libctbase.a /ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu/libctf2c.a $(CANTERA_LIBDIR)/libctcxx.a + +# the directory where Cantera include files may be found. +CANTERA_INCDIR=/ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/include/cantera +INCLUDES=-I$(CANTERA_INCDIR) -I$(CANTERA_INCDIR)/kernel + +# flags passed to the C++ compiler/linker for the linking step +LCXX_FLAGS = -L$(CANTERA_LIBDIR) -L/ascldap/users/hkmoffa/Cantera/gc/canteraDevelop/build/lib/x86_64-unknown-linux-gnu -L/home/hkmoffa/arch/linux64/sundials/lib -g -Wall -DDEBUG_HKM -DDEBUG_HKM_EPEQUIL + +# How to compile C++ source files to object files +.cpp.o: + $(CXX) -c $< $(INCLUDES) $(CXX_FLAGS) + +# How to compile the dependency file +.cpp.d: + /home/sntools/extras/compilers/gcc-4.2.4/bin/g++ -MM $(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_LIBS_DEP) + $(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(LINK_OPTIONS) \ + $(CANTERA_LIBS) $(FORT_LIBS) \ + $(LCXX_END_LIBS) + +# Add an additional target for stability: +$(OBJS): $(CANTERA_LIBDIR)/libctbase.a $(CANTERA_LIBDIR)/libthermo.a + +# depends target -> forces recalculation of dependencies +depends: + gmake .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 + @ gmake -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 + diff --git a/test_problems/cathermo/wtWater/Makefile.in b/test_problems/cathermo/wtWater/Makefile.in new file mode 100755 index 000000000..dd68816ac --- /dev/null +++ b/test_problems/cathermo/wtWater/Makefile.in @@ -0,0 +1,112 @@ +#!/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 = testWaterPDSS + +# the object files to be linked together. List those generated from Fortran +# and from C/C++ separately +OBJS = testWaterPDSS.o + +# 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 +ifeq (@build_with_f2c@, 0) +FORT_LIBS = @FLIBS@ +else +FORT_LIBS = +endif + +# the C++ compiler +CXX = @CXX@ + +# C++ compile flags +CXX_FLAGS = @CXXFLAGS@ + +# 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 + +# Dependencies for CANTERA_LIBS +CANTERA_LIBS_DEP = @LOCAL_LIBS_DEP@ $(CANTERA_LIBDIR)/libctcxx.a + +# the directory where Cantera include files may be found. +CANTERA_INCDIR=@ctroot@/build/include/cantera +INCLUDES=-I$(CANTERA_INCDIR) -I$(CANTERA_INCDIR)/kernel + +# 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_LIBS_DEP) + $(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)/libctbase.a $(CANTERA_LIBDIR)/libthermo.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 + diff --git a/test_problems/cathermo/wtWater/runtest b/test_problems/cathermo/wtWater/runtest new file mode 100755 index 000000000..e97266c9c --- /dev/null +++ b/test_problems/cathermo/wtWater/runtest @@ -0,0 +1,33 @@ +#!/bin/sh +# +# +temp_success="1" +/bin/rm -f output.txt outputa.txt + +testName=testWaterPDSS +################################################################# +# +################################################################# +CANTERA_DATA=${CANTERA_DATA:=../../../data/inputs}; export CANTERA_DATA + +CANTERA_BIN=${CANTERA_BIN:=../../../bin} +./testWaterPDSS > 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 + diff --git a/test_problems/cathermo/wtWater/waterTPphase.xml b/test_problems/cathermo/wtWater/waterTPphase.xml new file mode 100644 index 000000000..a58b5a2ba --- /dev/null +++ b/test_problems/cathermo/wtWater/waterTPphase.xml @@ -0,0 +1,54 @@ + + + + + + + O H + H2O + + 300.0 + 101325.0 + + + + + + + + + + + + + H:2 O:1 + + + + 4.198640560E+00, -2.036434100E-03, 6.520402110E-06, -5.487970620E-09, + 1.771978170E-12, -3.029372670E+04, -8.490322080E-01 + + + + 3.033992490E+00, 2.176918040E-03, -1.640725180E-07, -9.704198700E-11, + 1.682009920E-14, -3.000429710E+04, 4.966770100E+00 + + + + + + + + H:2 C:2 F:4 + + + 273.14999999999998 + 23083414.8686 + 167025.46599999999 + 0.0 + + + + + + diff --git a/test_problems/cathermo/wtWater/wtWater.cpp b/test_problems/cathermo/wtWater/wtWater.cpp new file mode 100644 index 000000000..07376449c --- /dev/null +++ b/test_problems/cathermo/wtWater/wtWater.cpp @@ -0,0 +1,57 @@ +/* + * $Id: testWaterPDSS.cpp,v 1.6 2008/12/17 17:31:13 hkmoffa Exp $ + */ +#include "ct_defs.h" +#include "ctexceptions.h" +#include "global.h" +#include "xml.h" +#include "ctml.h" +#include "ThermoPhase.h" +#include "VPStandardStateTP.h" + +#include "WaterSSTP.h" +#include "WaterTransport.h" +#include + +#include + +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 { + + WaterSSTP * w = new WaterSSTP("waterTPphase.xml", ""); + + WaterTransport *wtTran = new WaterTransport(w, 3); + + //double T = 273.15 + 150.0; + double T = 273.15 + 100.0; + + w->setState_TP(T, 1.0E7); + + double visc = wtTran->viscosity(); + + printf("visc = %g\n", visc); + + delete w; + } catch (CanteraError) { + + showErrors(); + Cantera::appdelete(); + return -1; + } + + + return 0; +}