Added the first test for IAPWS
This commit is contained in:
parent
29bd558cc2
commit
b6b3789a6f
7 changed files with 205 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ ifeq ($(test_issp),1)
|
|||
endif
|
||||
ifeq ($(test_electrolytes),1)
|
||||
cd ims; @MAKE@ all
|
||||
cd testIAPWS; @MAKE@ all
|
||||
endif
|
||||
|
||||
test:
|
||||
|
|
@ -21,6 +22,7 @@ ifeq ($(test_issp),1)
|
|||
endif
|
||||
ifeq ($(test_electrolytes),1)
|
||||
cd ims; @MAKE@ test
|
||||
cd testIAPWS; @MAKE@ test
|
||||
endif
|
||||
|
||||
clean:
|
||||
|
|
@ -34,4 +36,5 @@ ifeq ($(test_issp),1)
|
|||
endif
|
||||
ifeq ($(test_electrolytes),1)
|
||||
cd ims; @MAKE@ depends
|
||||
cd testIAPWS; @MAKE@ depends
|
||||
endif
|
||||
|
|
|
|||
10
test_problems/cathermo/testIAPWS/.cvsignore
Normal file
10
test_problems/cathermo/testIAPWS/.cvsignore
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
testIAPWSphi
|
||||
Makefile
|
||||
output.txt
|
||||
outputa.txt
|
||||
*.d
|
||||
.depends
|
||||
csvCode.txt
|
||||
diff_test.out
|
||||
test.diff
|
||||
test.out
|
||||
112
test_problems/cathermo/testIAPWS/Makefile.in
Executable file
112
test_problems/cathermo/testIAPWS/Makefile.in
Executable file
|
|
@ -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 = testIAPWSphi
|
||||
|
||||
# the object files to be linked together. List those generated from Fortran
|
||||
# and from C/C++ separately
|
||||
OBJS = testIAPWSphi.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:
|
||||
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_LIBDIR)/libcantera.a \
|
||||
$(CANTERA_LIBDIR)/libcaThermo.a
|
||||
$(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(LINK_OPTIONS) \
|
||||
$(CANTERA_LIBS) @LIBS@ $(FORT_LIBS) \
|
||||
$(LCXX_END_LIBS)
|
||||
|
||||
# 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@ $(PROGRAM)
|
||||
endif
|
||||
./runtest
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(PROGRAM) $(DEPENDS) .depends
|
||||
../../../bin/rm_cvsignore
|
||||
(if test -d SunWS_cache ; then \
|
||||
$(RM) -rf SunWS_cache ; \
|
||||
fi )
|
||||
|
||||
15
test_problems/cathermo/testIAPWS/README
Normal file
15
test_problems/cathermo/testIAPWS/README
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
This test is used to make sure that the basic functions in
|
||||
the water property routine satisfies the derivative tests
|
||||
specified in the paper:
|
||||
|
||||
W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the
|
||||
Thermodynamic Properties of Ordinary Water Substance
|
||||
for General and Scientific Use," J. Phys. Chem.
|
||||
Ref. Data, v. 31, 387 - 442, 2002.
|
||||
|
||||
On page 436 of that reference, value for phi, the nondimensional
|
||||
helmholtz free energy and its first and second derivatives,
|
||||
are given at 2 representative points. This test makes sure
|
||||
that the values agree with the paper's values.
|
||||
|
||||
14
test_problems/cathermo/testIAPWS/output_blessed.txt
Normal file
14
test_problems/cathermo/testIAPWS/output_blessed.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
T = 500 K, rho = 838.025 kg m-3
|
||||
nau = 2.0479773347960e+00 res = -3.4269320568156e+00
|
||||
nau_d = 3.8423674711375e-01 res_d = -3.6436665036388e-01
|
||||
nau_dd = -1.4763787783256e-01 res_dd = 8.5606370097461e-01
|
||||
nau_t = 9.0461110617524e+00 res_t = -5.8140343523842e+00
|
||||
nau_tt = -1.9324918501305e+00 res_tt = -2.2344073688434e+00
|
||||
nau_dt = 0.0000000000000e+00 res_dt = -1.1217691467031e+00
|
||||
T = 647 K, rho = 358.0 kg m-3
|
||||
nau = -1.5631960505252e+00 res = -1.2120265650415e+00
|
||||
nau_d = 8.9944134078212e-01 res_d = -7.1401202437128e-01
|
||||
nau_dd = -8.0899472550794e-01 res_dd = 4.7573069564569e-01
|
||||
nau_t = 9.8034391793901e+00 res_t = -3.2172250077517e+00
|
||||
nau_tt = -3.4331633414307e+00 res_tt = -9.9602950655930e+00
|
||||
nau_dt = 0.0000000000000e+00 res_dt = -1.3321472043614e+00
|
||||
33
test_problems/cathermo/testIAPWS/runtest
Executable file
33
test_problems/cathermo/testIAPWS/runtest
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
temp_success="1"
|
||||
/bin/rm -f output.txt outputa.txt
|
||||
|
||||
testName=testIAPWSphi
|
||||
#################################################################
|
||||
#
|
||||
#################################################################
|
||||
CANTERA_DATA=${CANTERA_DATA:=../../../data/inputs}; export CANTERA_DATA
|
||||
|
||||
CANTERA_BIN=${CANTERA_BIN:=../../../bin}
|
||||
./testIAPWSphi > 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
|
||||
|
||||
18
test_problems/cathermo/testIAPWS/testIAPWSphi.cpp
Normal file
18
test_problems/cathermo/testIAPWS/testIAPWSphi.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* $Id$
|
||||
*/
|
||||
#include "stdio.h"
|
||||
#include "WaterPropsIAPWSphi.h"
|
||||
#include <new>
|
||||
using namespace std;
|
||||
|
||||
int main () {
|
||||
|
||||
WaterPropsIAPWSphi *phi = new WaterPropsIAPWSphi();
|
||||
|
||||
phi->check1();
|
||||
phi->check2();
|
||||
|
||||
delete phi;
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue