Added 2 new tests associated with NASA9 polynomial capability.

This commit is contained in:
Harry Moffat 2007-09-13 15:12:45 +00:00
parent c5fe9d121f
commit c5dee4adae
14 changed files with 6796 additions and 0 deletions

View file

@ -34,6 +34,7 @@ ifeq ($(test_python),2)
endif
ifeq ($(test_ck),1)
cd ck2cti_test; @MAKE@ all
cd nasa9_reader; @MAKE@ all
endif
ifeq ($(test_cathermo),1)
cd cathermo; @MAKE@ all
@ -47,6 +48,7 @@ test:
@ cd diamondSurf; @MAKE@ -s test
@ cd diamondSurf_dupl; @MAKE@ -s test
@ cd surfSolverTest; @MAKE@ -s test
@ cd NASA9poly_test; @MAKE@ -s test
@ cd ChemEquil_gri_matrix; @MAKE@ -s test
@ cd ChemEquil_gri_pairs; @MAKE@ -s test
@ cd ChemEquil_ionizedGas; @MAKE@ -s test
@ -58,6 +60,7 @@ ifeq ($(test_cathermo),1)
endif
ifeq ($(test_ck),1)
@ cd ck2cti_test; @MAKE@ -s test
@ cd nasa9_reader; @MAKE@ -s test
endif
ifeq ($(test_python),1)
cd min_python; @MAKE@ -s test
@ -79,6 +82,7 @@ clean:
cd diamondSurf; $(RM) .depends ; @MAKE@ clean
cd diamondSurf_dupl; $(RM) .depends ; @MAKE@ clean
cd surfSolverTest; $(RM) .depends ; @MAKE@ clean
cd NASA9poly_test; $(RM) .depends ; @MAKE@ clean
cd ChemEquil_gri_matrix; $(RM) .depends ; @MAKE@ clean
cd ChemEquil_gri_pairs; $(RM) .depends ; @MAKE@ clean
cd ChemEquil_ionizedGas; $(RM) .depends ; @MAKE@ clean
@ -87,6 +91,7 @@ clean:
cd multiGasTransport; $(RM) .depends ; @MAKE@ clean
cd pureFluidTest; $(RM) .depends ; @MAKE@ clean
cd ck2cti_test; $(RM) .depends ; @MAKE@ clean
cd nasa9_reader; $(RM) .depends ; @MAKE@ clean
cd min_python; @MAKE@ clean
cd python; @MAKE@ clean
cd cathermo; @MAKE@ clean
@ -99,6 +104,7 @@ depends:
cd diamondSurf; @MAKE@ depends
cd diamondSurf_dupl; @MAKE@ depends
cd surfSolverTest; @MAKE@ depends
cd NASA9poly_test; @MAKE@ depends
cd ChemEquil_gri_matrix; @MAKE@ depends
cd ChemEquil_gri_pairs; @MAKE@ depends
cd ChemEquil_ionizedGas; @MAKE@ depends
@ -110,6 +116,7 @@ ifeq ($(test_cathermo),1)
endif
ifeq ($(test_ck),1)
cd ck2cti_test; @MAKE@ depends
cd nasa9_reader; @MAKE@ depends
endif
ifeq ($(test_python),1)
cd min_python; @MAKE@ depends

View file

@ -0,0 +1,7 @@
csvCode.txt
Makefile
NASA9poly_test
diff_test.out
output.txt
outputa.txt
transport_log.xml

View file

@ -0,0 +1,138 @@
#!/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 = NASA9poly_test
# the object files to be linked together. List those generated from Fortran
# and from C/C++ separately
OBJS = NASA9poly_test.o
# Location of the current build. Will assume that tests are run
# in the source directory tree location
src_dir_tree = 0
# 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
# Cantera library Dependencies
CANTERA_LIB_DEPS = $(CANTERA_LIBDIR)/liboneD.a \
$(CANTERA_LIBDIR)/libzeroD.a \
$(CANTERA_LIBDIR)/libkinetics.a \
$(CANTERA_LIBDIR)/libtransport.a \
$(CANTERA_LIBDIR)/libthermo.a \
$(CANTERA_LIBDIR)/libctnumerics.a \
$(CANTERA_LIBDIR)/libcvode.a \
$(CANTERA_LIBDIR)/libctbase.a \
$(CANTERA_LIBDIR)/libctlapack.a \
$(CANTERA_LIBDIR)/libctblas.a \
$(CANTERA_LIBDIR)/libctmath.a \
$(CANTERA_LIBDIR)/libtpx.a \
$(CANTERA_LIBDIR)/libconverters.a
# the directory where Cantera include files may be found.
ifeq ($(src_dir_tree), 1)
CANTERA_INCDIR=../../Cantera/src
else
CANTERA_INCDIR=@ctroot@/build/include/cantera
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@: Interface.h
$(CXX) -c $< -I$(CANTERA_INCDIR) @CXX_INCLUDES@ $(CXX_FLAGS)
# How to compile the dependency file
.cpp.d:
@CXX_DEPENDS@ -I$(CANTERA_INCDIR) $(CXX_FLAGS) $*.cpp > $*.d
# List of dependency files to be created
DEPENDS=$(OBJS:.o=.d)
# Program Name
PROGRAM = $(PROG_NAME)$(EXE_EXT)
# all rule makes a single program
all: $(PROGRAM)
# Rule to make the program
$(PROGRAM): $(OBJS) $(CANTERA_LIB_DEPS)
$(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
depends:
$(RM) *.d .depends
@MAKE@ .depends
.depends: $(DEPENDS)
cat *.d > .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 target -> clean up
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,81 @@
/**
* @file NASA9poly_test
* test problem for NASA 9 coefficient formulation
*/
#include <iostream>
#include <string>
#include <vector>
#include <string>
#include <iomanip>
using namespace std;
#define MAX(x,y) (( (x) > (y) ) ? (x) : (y))
/*****************************************************************/
/*****************************************************************/
#include "Cantera.h"
#include "transport.h"
#include "IdealGasMix.h"
#include "kernel/TransportFactory.h"
using namespace Cantera;
void printDbl(double val) {
if (fabs(val) < 5.0E-17) {
cout << " nil";
} else {
cout << val;
}
}
int main(int argc, char** argv) {
try {
IdealGasMix g("gasNASA9.xml", "gri30_mix");
int nsp = g.nSpecies();
double pres = 1.0E5;
vector_fp Xset(nsp, 0.0);
Xset[0] = 0.5 ;
Xset[1] = 0.5;
g.setState_TPX(1500.0, pres, DATA_PTR(Xset));
vector_fp cp_R(nsp, 0.0);
g.getCp_R(DATA_PTR(cp_R));
printf("Comparisons of H2 calculated via several equivalent classes:\n");
printf("1500 K and 1 atm:\n");
printf(" NasaThermo Nasa9 Nasa9_4reg \n");
printf(" cp/R: %11.6g %11.6g %11.6g\n", cp_R[0], cp_R[1], cp_R[2]);
vector_fp H_RT(nsp, 0.0);
g.getEnthalpy_RT(DATA_PTR(H_RT));
printf(" H/RT: %11.6g %11.6g %11.6g\n", H_RT[0], H_RT[1], H_RT[2]);
vector_fp S_R(nsp, 0.0);
g.getEntropy_R(DATA_PTR(S_R));
printf(" S/R: %11.6g %11.6g %11.6g\n", S_R[0], S_R[1], S_R[2]);
}
catch (CanteraError) {
showErrors(cout);
}
return 0;
}
/***********************************************************/

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
Comparisons of H2 calculated via several equivalent classes:
1500 K and 1 atm:
NasaThermo Nasa9 Nasa9_4reg
cp/R: 3.8823 3.8823 3.8823
H/RT: 2.91015 2.91015 2.91015
S/R: 21.5255 21.5255 21.5255

View file

@ -0,0 +1,34 @@
#!/bin/sh
#
#
temp_success="1"
/bin/rm -f output.txt outputa.txt
tname="NASA9poly_test"
#################################################################
#
#################################################################
CANTERA_DATA=${CANTERA_DATA:=../../data/inputs}; export CANTERA_DATA
CANTERA_BIN=${CANTERA_BIN:=../../bin}
./NASA9poly_test > output.txt
retnStat=$?
if [ $retnStat != "0" ]
then
temp_success="0"
echo "$tname ($tname test) returned with bad status, $retnStat, check output"
fi
../../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 $tname test"
else
echo "unsuccessful diff comparison on $tname test"
echo "FAILED" > csvCode.txt
temp_success="0"
fi

View file

@ -0,0 +1,10 @@
Makefile
ck2cti.log
ct2ctml.log
diff_test.out
runtest
sample.cti
samplea.cti
sampleb.cti
testdest.xml
testdest2.xml

View file

@ -0,0 +1,16 @@
#
# $Revision$
# $Author$
# $Date$
#
#
all:
test:
./runtest
clean:
../../bin/rm_cvsignore
depends:

View file

@ -0,0 +1,41 @@
#!/bin/sh
# $Id$
#
echo " "
echo "***************************************************"
echo " Testing CK2CTI on NASA9 Thermodynamics : using the build/bin version of ck2cti"
echo "***************************************************"
echo " "
BINDIR=@buildbin@
CK2CTI=$BINDIR/ck2cti
/bin/rm -f sample.cti
echo "...Test 1: Converting file sample.inp..."
$CK2CTI -i ./sample.inp -id sample -t sampleData.inp
#
# strip out variably dated stuff
#
cat sample.cti | sed '1,5s/^#.*$/#/' > samplea.cti
#
# Change all 3 character exponent expressions starting with 0
# into 2 character exponent expressions
# (MSVC++ defaults to 3, and I can't figure out how to change
# this behavior).
#
../../bin/exp3to2.sh samplea.cti > sampleb.cti
#
#
diff sampleb.cti sample_blessed.cti > diff_test.out
retnStat=$?
#
if [ $retnStat = "0" ]
then
echo "Successful diff comparison on ck2cti test (nasa9_reader/sample.inp)"
else
echo "########################################################"
echo "Unsuccessful diff comparison on ck2cti test (nasa9_reader/sample.inp)"
echo " For more information, see files:"
echo " test_problems/nasa9_reader/diff_test.out"
echo " test_problems/nasa9_reader/sampleb.cti"
echo " test_problems/nasa9_reader/sample_blessed.cti"
echo "########################################################"
fi

View file

@ -0,0 +1,10 @@
!
!
!
!
ELEMENTS
O H Al Cl E Ar
END
SPECIES
ALCL3 e- AR
END

View file

@ -0,0 +1,96 @@
<?xml version="1.0"?>
<ctml>
<validate reactions="yes" species="yes"/>
<!-- phase sample -->
<phase dim="3" id="sample">
<elementArray datasrc="elements.xml">O H Al Cl E Ar </elementArray>
<speciesArray datasrc="#species_data">ALCL3 e- AR </speciesArray>
<reactionArray datasrc="#reaction_data"/>
<state>
<temperature units="K">300.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="IdealGas"/>
<kinetics model="GasKinetics"/>
<transport model="None"/>
</phase>
<!-- species definitions -->
<speciesData id="species_data">
<!-- species ALCL3 -->
<species name="ALCL3">
<atomArray>Al:1 Cl:3 </atomArray>
<note>Gurvich,1996a pt1 p173 pt2 p134.</note>
<thermo>
<NASA9 Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="9">
7.750600970E+04, -1.440779717E+03, 1.401744141E+01, -6.381631240E-03,
5.871674720E-06, -2.908872278E-09, 5.994050890E-13, -6.579343180E+04
-4.494017799E+01</floatArray>
</NASA9>
<NASA9 Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="9">
-1.378630916E+05, -5.579207290E+01, 1.004190387E+01, -1.682165339E-05,
3.724664660E-09, -4.275526780E-13, 1.982341329E-17, -7.343407470E+04
-2.045130429E+01</floatArray>
</NASA9>
</thermo>
</species>
<!-- species e- -->
<species name="e-">
<atomArray>E:1 </atomArray>
<note>Ref-Species. Chase, 1998 3/82. </note>
<charge>-1</charge>
<thermo>
<NASA9 Tmax="1000.0" Tmin="298.14999999999998" P0="100000.0">
<floatArray name="coeffs" size="9">
0.000000000E+00, 0.000000000E+00, 2.500000000E+00, 0.000000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02
-1.172081224E+01</floatArray>
</NASA9>
<NASA9 Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="9">
0.000000000E+00, 0.000000000E+00, 2.500000000E+00, 0.000000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02
-1.172081224E+01</floatArray>
</NASA9>
<NASA9 Tmax="20000.0" Tmin="6000.0" P0="100000.0">
<floatArray name="coeffs" size="9">
0.000000000E+00, 0.000000000E+00, 2.500000000E+00, 0.000000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02
-1.172081224E+01</floatArray>
</NASA9>
</thermo>
</species>
<!-- species AR -->
<species name="AR">
<atomArray>Ar:1 </atomArray>
<note>Ref-Elm. Moore,1971. Gordon,1999.. </note>
<thermo>
<NASA9 Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="9">
0.000000000E+00, 0.000000000E+00, 2.500000000E+00, 0.000000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02
4.379674910E+00</floatArray>
</NASA9>
<NASA9 Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="9">
2.010538475E+01, -5.992661070E-02, 2.500069401E+00, -3.992141160E-08,
1.205272140E-11, -1.819015576E-15, 1.078576636E-19, -7.449939610E+02
4.379180110E+00</floatArray>
</NASA9>
<NASA9 Tmax="20000.0" Tmin="6000.0" P0="100000.0">
<floatArray name="coeffs" size="9">
-9.951265080E+08, 6.458887260E+05, -1.675894697E+02, 2.319933363E-02,
-1.721080911E-06, 6.531938460E-11, -9.740147729E-16, -5.078300340E+06
1.465298484E+03</floatArray>
</NASA9>
</thermo>
</species>
</speciesData>
<reactionData id="reaction_data"/>
</ctml>

View file

@ -0,0 +1,35 @@
thermo NASA9
200.00 1000.00 6000.00 20000. 3/19/02
e- Ref-Species. Chase, 1998 3/82.
3 912/98 E 1.00 0.00 0.00 0.00 0.00 0.000548579903 0.000
298.150 1000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 6197.428
0.000000000D+00 0.000000000D+00 2.500000000D+00 0.000000000D+00 0.000000000D+00
0.000000000D+00 0.000000000D+00 -7.453750000D+02-1.172081224D+01
1000.000 6000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 6197.428
0.000000000D+00 0.000000000D+00 2.500000000D+00 0.000000000D+00 0.000000000D+00
0.000000000D+00 0.000000000D+00 -7.453750000D+02-1.172081224D+01
6000.000 20000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 6197.428
0.000000000D+00 0.000000000D+00 2.500000000D+00 0.000000000D+00 0.000000000D+00
0.000000000D+00 0.000000000D+00 -7.453750000D+02-1.172081224D+01
ALCL3 Gurvich,1996a pt1 p173 pt2 p134.
2 tpis96 Al 1.00Cl 3.00 0.00 0.00 0.00 0 133.3405380 -584678.863
200.000 1000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 16400.803
7.750600970D+04-1.440779717D+03 1.401744141D+01-6.381631240D-03 5.871674720D-06
-2.908872278D-09 5.994050890D-13 -6.579343180D+04-4.494017799D+01
1000.000 6000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 16400.803
-1.378630916D+05-5.579207290D+01 1.004190387D+01-1.682165339D-05 3.724664660D-09
-4.275526780D-13 1.982341329D-17 -7.343407470D+04-2.045130429D+01
AR Ref-Elm. Moore,1971. Gordon,1999..
3 g 3/98 Ar 1.00 0.00 0.00 0.00 0.00 0 39.9480000 0.000
200.000 1000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 6197.428
0.000000000D+00 0.000000000D+00 2.500000000D+00 0.000000000D+00 0.000000000D+00
0.000000000D+00 0.000000000D+00 -7.453750000D+02 4.379674910D+00
1000.000 6000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 6197.428
2.010538475D+01-5.992661070D-02 2.500069401D+00-3.992141160D-08 1.205272140D-11
-1.819015576D-15 1.078576636D-19 -7.449939610D+02 4.379180110D+00
6000.000 20000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 6197.428
-9.951265080D+08 6.458887260D+05-1.675894697D+02 2.319933363D-02-1.721080911D-06
6.531938460D-11-9.740147729D-16 -5.078300340D+06 1.465298484D+03
END

View file

@ -0,0 +1,70 @@
#
#
#
#
units(length = "cm", time = "s", quantity = "mol", act_energy = "cal/mol")
ideal_gas(name = "sample",
elements = " O H Al Cl E Ar ",
species = """ ALCL3 e- AR """,
reactions = "all",
initial_state = state(temperature = 300.0,
pressure = OneAtm) )
#-------------------------------------------------------------------------------
# Species data
#-------------------------------------------------------------------------------
species(name = "ALCL3",
atoms = " Al:1 Cl:3 ",
thermo = (
NASA9( [ 200.00, 1000.00], [ 7.750600970E+04, -1.440779717E+03, 1.401744141E+01,
-6.381631240E-03, 5.871674720E-06, -2.908872278E-09,
5.994050890E-13, -6.579343180E+04, -4.494017799E+01] ),
NASA9( [ 1000.00, 6000.00], [ -1.378630916E+05, -5.579207290E+01, 1.004190387E+01,
-1.682165339E-05, 3.724664660E-09, -4.275526780E-13,
1.982341329E-17, -7.343407470E+04, -2.045130429E+01] )
),
note = " Gurvich,1996a pt1 p173 pt2 p134."
)
species(name = "e-",
atoms = " E:1 ",
thermo = (
NASA9( [ 298.15, 1000.00], [ 0.000000000E+00, 0.000000000E+00, 2.500000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
0.000000000E+00, -7.453750000E+02, -1.172081224E+01] ),
NASA9( [ 1000.00, 6000.00], [ 0.000000000E+00, 0.000000000E+00, 2.500000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
0.000000000E+00, -7.453750000E+02, -1.172081224E+01] ),
NASA9( [ 6000.00, 20000.00], [ 0.000000000E+00, 0.000000000E+00, 2.500000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
0.000000000E+00, -7.453750000E+02, -1.172081224E+01] )
),
note = " Ref-Species. Chase, 1998 3/82. "
)
species(name = "AR",
atoms = " Ar:1 ",
thermo = (
NASA9( [ 200.00, 1000.00], [ 0.000000000E+00, 0.000000000E+00, 2.500000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
0.000000000E+00, -7.453750000E+02, 4.379674910E+00] ),
NASA9( [ 1000.00, 6000.00], [ 2.010538475E+01, -5.992661070E-02, 2.500069401E+00,
-3.992141160E-08, 1.205272140E-11, -1.819015576E-15,
1.078576636E-19, -7.449939610E+02, 4.379180110E+00] ),
NASA9( [ 6000.00, 20000.00], [ -9.951265080E+08, 6.458887260E+05, -1.675894697E+02,
2.319933363E-02, -1.721080911E-06, 6.531938460E-11,
-9.740147729E-16, -5.078300340E+06, 1.465298484E+03] )
),
note = " Ref-Elm. Moore,1971. Gordon,1999.. "
)
#-------------------------------------------------------------------------------
# Reaction data
#-------------------------------------------------------------------------------