Added new test for ionized species.

This commit is contained in:
Harry Moffat 2007-01-01 21:23:42 +00:00
parent 857af1e25b
commit 847b8ee8b7
7 changed files with 2006 additions and 0 deletions

View file

@ -0,0 +1,7 @@
ionizedGasEquil
Makefile
desc.txt
output.txt
csvCode.txt
ct2ctml.log
diff_test.out

View file

@ -0,0 +1,110 @@
#!/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 = ionizedGasEquil
# the object files to be linked together. List those generated from Fortran
# and from C/C++ separately
OBJS = ionizedGasEquil.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
# 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@:
$(CXX) -c $< -I$(CANTERA_INCDIR) $(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: $(PROGRAM)
$(PROGRAM): $(OBJS) $(CANTERA_LIBDIR)/libcantera.a
$(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(LINK_OPTIONS) \
$(CANTERA_LIBS) @LIBS@ $(FORT_LIBS) \
$(LCXX_END_LIBS)
# depends target -> forces recalculation of dependencies
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:
$(RM) $(OBJS) $(PROGRAM) $(DEPENDS) .depends
../../bin/rm_cvsignore
(if test -d SunWS_cache ; then \
$(RM) -rf SunWS_cache ; \
fi )

View file

@ -0,0 +1,165 @@
#
# This is the NASA thermodynamic database, which is available for download
# from http://www.galcit.caltech.edu/EDL/public/thermo.html. The original
# sources are
#
# S. Gordon and B.J. McBride, "Computer Program for Calculation of Complex
# Chemical Equilibrium Composition, Rocket Performance, Incident and
# Reflected Shocks and Chapman-Jouguet Detonations", NASA Report SP-273, 1971.
#
# B.J. McBride, S. Gordon, and M.A. Reno, "Coefficients for Calculating
# Thermodynamic and Transport Properties of Individual Species", NASA
# Report TM-4513, October 1993.
#
#-----------------------------------------------------------------------------
ideal_gas(name = "air_below6000K",
elements = " N O E ",
species = """ N2 O2 N O NO NO+ Electron N+ O+ N2+ O2+ """,
reactions = "all",
initial_state = state(temperature = 298.15,
pressure = OneAtm,
mole_fractions = 'N2:0.78847, O2:0.21153') )
species(name = "Electron",
atoms = " E:1 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 2.500000000E+00, 0.000000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
-7.453750000E+02, -1.172469020E+01] ),
NASA( [ 1000.00, 6000.00], [ 2.500000000E+00, 0.000000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
-7.453750000E+02, -1.172469020E+01] )
),
note = "gas L10/92"
)
species(name = "N",
atoms = " N:1 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 2.500000000E+00, 0.000000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
5.610463780E+04, 4.193909320E+00] ),
NASA( [ 1000.00, 6000.00], [ 2.415942930E+00, 1.748906000E-04,
-1.190236670E-07, 3.022623870E-11, -2.036097900E-15,
5.613377480E+04, 4.649609860E+00] )
),
note = "L 6/88"
)
species(name = "N+",
atoms = " N:1 E:-1 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 2.802694450E+00, -1.447589110E-03,
2.771183800E-06, -2.401873520E-09, 7.808399310E-13,
2.255752440E+05, 3.578778350E+00] ),
NASA( [ 1000.00, 6000.00], [ 2.511129670E+00, 3.464417510E-06,
-1.594269380E-08, 7.248656630E-12, -6.445014260E-16,
2.256243400E+05, 4.927676610E+00] )
),
note = "L 7/88"
)
species(name = "NO",
atoms = " N:1 O:1 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 4.218598960E+00, -4.639881240E-03,
1.104430490E-05, -9.340555070E-09, 2.805548740E-12,
9.845099640E+03, 2.280610010E+00] ),
NASA( [ 1000.00, 6000.00], [ 3.260712340E+00, 1.191011350E-03,
-4.291226460E-07, 6.944814630E-11, -4.032956810E-15,
9.921431320E+03, 6.369005180E+00] )
),
note = "TPIS89"
)
species(name = "NO+",
atoms = " N:1 O:1 E:-1 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 3.693012310E+00, -1.342291580E-03,
2.673433950E-06, -1.026093080E-09, -6.956104920E-14,
1.181030550E+05, 3.091266980E+00] ),
NASA( [ 1000.00, 6000.00], [ 2.945877020E+00, 1.403252600E-03,
-4.955031960E-07, 7.959489730E-11, -4.720766680E-15,
1.182443400E+05, 6.706446410E+00] )
),
note = "TPIS89"
)
species(name = "N2",
atoms = " N:2 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 3.531005280E+00, -1.236609870E-04,
-5.029994370E-07, 2.435306120E-09, -1.408812350E-12,
-1.046976280E+03, 2.967474680E+00] ),
NASA( [ 1000.00, 6000.00], [ 2.952576260E+00, 1.396900570E-03,
-4.926316910E-07, 7.860103670E-11, -4.607553210E-15,
-9.239486450E+02, 5.871892520E+00] )
),
note = "TPIS78"
)
species(name = "N2+",
atoms = " N:2 E:-1 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 3.775407110E+00, -2.064591570E-03,
4.757523010E-06, -3.156642280E-09, 6.705099730E-13,
1.804811150E+05, 2.693221860E+00] ),
NASA( [ 1000.00, 6000.00], [ 3.586613630E+00, 2.530719490E-04,
1.847782140E-07, -4.552572230E-11, 3.268180290E-15,
1.803909940E+05, 3.095841500E+00] )
),
note = "TPIS89"
)
species(name = "O",
atoms = " O:1 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 3.168267100E+00, -3.279318840E-03,
6.643063960E-06, -6.128066240E-09, 2.112659710E-12,
2.912225920E+04, 2.051933460E+00] ),
NASA( [ 1000.00, 6000.00], [ 2.543636970E+00, -2.731624860E-05,
-4.190295200E-09, 4.954818450E-12, -4.795536940E-16,
2.922601200E+04, 4.922294570E+00] )
),
note = "L 1/90"
)
species(name = "O+",
atoms = " O:1 E:-1 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 2.500000000E+00, 0.000000000E+00,
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
1.879352910E+05, 4.393376890E+00] ),
NASA( [ 1000.00, 6000.00], [ 2.487733170E+00, 2.176600160E-05,
-1.089558060E-08, 1.259092120E-12, 1.373167200E-16,
1.879399650E+05, 4.461340910E+00] )
),
note = "L 1/90"
)
species(name = "O2",
atoms = " O:2 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 3.782456360E+00, -2.996734150E-03,
9.847302000E-06, -9.681295080E-09, 3.243728360E-12,
-1.063943560E+03, 3.657675730E+00] ),
NASA( [ 1000.00, 6000.00], [ 3.660960830E+00, 6.563655230E-04,
-1.411494850E-07, 2.057976580E-11, -1.299132480E-15,
-1.215977250E+03, 3.415361840E+00] )
),
note = "TPIS89"
)
species(name = "O2+",
atoms = " O:2 E:-1 ",
thermo = (
NASA( [ 200.00, 1000.00], [ 4.610171670E+00, -6.359519520E-03,
1.424256240E-05, -1.209979230E-08, 3.709568780E-12,
1.397422290E+05, -2.013268740E-01] ),
NASA( [ 1000.00, 6000.00], [ 3.316759220E+00, 1.115222440E-03,
-3.834925560E-07, 5.727846870E-11, -2.776483810E-15,
1.398768230E+05, 5.447264760E+00] )
),
note = "TPIS89"
)

View file

@ -0,0 +1,228 @@
<?xml version="1.0"?>
<ctml>
<validate reactions="yes" species="yes"/>
<!-- phase air_below6000K -->
<phase dim="3" id="air_below6000K">
<elementArray datasrc="elements.xml">N O E </elementArray>
<speciesArray datasrc="#species_data">N2 O2 N O NO NO+ Electron N+ O+ N2+ O2+ </speciesArray>
<reactionArray datasrc="#reaction_data"/>
<state>
<temperature units="K">298.14999999999998</temperature>
<pressure units="Pa">101325.0</pressure>
<moleFractions>N2:0.78847, O2:0.21153</moleFractions>
</state>
<thermo model="IdealGas"/>
<kinetics model="GasKinetics"/>
<transport model="None"/>
</phase>
<!-- species definitions -->
<speciesData id="species_data">
<!-- species Electron -->
<species name="Electron">
<atomArray>E:1 </atomArray>
<note>gas L10/92</note>
<charge>-1</charge>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
0.000000000E+00, -7.453750000E+02, -1.172469020E+01</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
0.000000000E+00, -7.453750000E+02, -1.172469020E+01</floatArray>
</NASA>
</thermo>
</species>
<!-- species N -->
<species name="N">
<atomArray>N:1 </atomArray>
<note>L 6/88</note>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
0.000000000E+00, 5.610463780E+04, 4.193909320E+00</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.415942930E+00, 1.748906000E-04, -1.190236670E-07, 3.022623870E-11,
-2.036097900E-15, 5.613377480E+04, 4.649609860E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species N+ -->
<species name="N+">
<atomArray>E:-1 N:1 </atomArray>
<note>L 7/88</note>
<charge>1</charge>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.802694450E+00, -1.447589110E-03, 2.771183800E-06, -2.401873520E-09,
7.808399310E-13, 2.255752440E+05, 3.578778350E+00</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.511129670E+00, 3.464417510E-06, -1.594269380E-08, 7.248656630E-12,
-6.445014260E-16, 2.256243400E+05, 4.927676610E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species NO -->
<species name="NO">
<atomArray>O:1 N:1 </atomArray>
<note>TPIS89</note>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
4.218598960E+00, -4.639881240E-03, 1.104430490E-05, -9.340555070E-09,
2.805548740E-12, 9.845099640E+03, 2.280610010E+00</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.260712340E+00, 1.191011350E-03, -4.291226460E-07, 6.944814630E-11,
-4.032956810E-15, 9.921431320E+03, 6.369005180E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species NO+ -->
<species name="NO+">
<atomArray>E:-1 O:1 N:1 </atomArray>
<note>TPIS89</note>
<charge>1</charge>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.693012310E+00, -1.342291580E-03, 2.673433950E-06, -1.026093080E-09,
-6.956104920E-14, 1.181030550E+05, 3.091266980E+00</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.945877020E+00, 1.403252600E-03, -4.955031960E-07, 7.959489730E-11,
-4.720766680E-15, 1.182443400E+05, 6.706446410E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species N2 -->
<species name="N2">
<atomArray>N:2 </atomArray>
<note>TPIS78</note>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.531005280E+00, -1.236609870E-04, -5.029994370E-07, 2.435306120E-09,
-1.408812350E-12, -1.046976280E+03, 2.967474680E+00</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.952576260E+00, 1.396900570E-03, -4.926316910E-07, 7.860103670E-11,
-4.607553210E-15, -9.239486450E+02, 5.871892520E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species N2+ -->
<species name="N2+">
<atomArray>E:-1 N:2 </atomArray>
<note>TPIS89</note>
<charge>1</charge>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.775407110E+00, -2.064591570E-03, 4.757523010E-06, -3.156642280E-09,
6.705099730E-13, 1.804811150E+05, 2.693221860E+00</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.586613630E+00, 2.530719490E-04, 1.847782140E-07, -4.552572230E-11,
3.268180290E-15, 1.803909940E+05, 3.095841500E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species O -->
<species name="O">
<atomArray>O:1 </atomArray>
<note>L 1/90</note>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.168267100E+00, -3.279318840E-03, 6.643063960E-06, -6.128066240E-09,
2.112659710E-12, 2.912225920E+04, 2.051933460E+00</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.543636970E+00, -2.731624860E-05, -4.190295200E-09, 4.954818450E-12,
-4.795536940E-16, 2.922601200E+04, 4.922294570E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species O+ -->
<species name="O+">
<atomArray>E:-1 O:1 </atomArray>
<note>L 1/90</note>
<charge>1</charge>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
0.000000000E+00, 1.879352910E+05, 4.393376890E+00</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
2.487733170E+00, 2.176600160E-05, -1.089558060E-08, 1.259092120E-12,
1.373167200E-16, 1.879399650E+05, 4.461340910E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species O2 -->
<species name="O2">
<atomArray>O:2 </atomArray>
<note>TPIS89</note>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.782456360E+00, -2.996734150E-03, 9.847302000E-06, -9.681295080E-09,
3.243728360E-12, -1.063943560E+03, 3.657675730E+00</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.660960830E+00, 6.563655230E-04, -1.411494850E-07, 2.057976580E-11,
-1.299132480E-15, -1.215977250E+03, 3.415361840E+00</floatArray>
</NASA>
</thermo>
</species>
<!-- species O2+ -->
<species name="O2+">
<atomArray>E:-1 O:2 </atomArray>
<note>TPIS89</note>
<charge>1</charge>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
4.610171670E+00, -6.359519520E-03, 1.424256240E-05, -1.209979230E-08,
3.709568780E-12, 1.397422290E+05, -2.013268740E-01</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
3.316759220E+00, 1.115222440E-03, -3.834925560E-07, 5.727846870E-11,
-2.776483810E-15, 1.398768230E+05, 5.447264760E+00</floatArray>
</NASA>
</thermo>
</species>
</speciesData>
<reactionData id="reaction_data"/>
</ctml>

View file

@ -0,0 +1,78 @@
/*
* $Author$
* $Date$
* $Revision$
*
*
*/
#ifdef SRCDIRTREE
#include "ct_defs.h"
#include "ThermoPhase.h"
#include "IdealGasMix.h"
#include "equil.h"
#else
#include "Cantera.h"
#include "IdealGasMix.h"
#include "equilibrium.h"
#endif
using namespace std;
using namespace Cantera;
#ifdef DEBUG_HKM_EPEQUIL
extern int debug_prnt_lvl;
#endif
int main(int argc, char **argv) {
#ifdef DEBUG_HKM_EPEQUIL
debug_prnt_lvl = 0;
#endif
try {
IdealGasPhase* gas = new IdealGasMix("air_below6000K.xml","air_below6000K");
vector_fp IndVar2(6, 0.0);
IndVar2[0] = 1.5E5;
IndVar2[1] = 3.0E5;
IndVar2[2] = 9.0E5;
IndVar2[3] = 2.7E6;
IndVar2[4] = 6.7E6;
IndVar2[5] = 1.0E7;
vector_fp IndVar1(7, 0.0);
IndVar1[0] = 1.0E-8;
IndVar1[1] = 1.0E-7;
IndVar1[2] = 1.0E-6;
IndVar1[3] = 1.0E-5;
IndVar1[4] = 1.0E-4;
IndVar1[5] = 1.0E-3;
IndVar1[6] = 1.0E-2;
int nj = 6;
int ni = 7;
for (int j=0; j<nj; j++) {
for (int i=0; i<ni; i++) {
double offset = -301471.39;
gas->setState_UV(IndVar2[j]+offset,1.0/IndVar1[i]);
double tkelvin = gas->temperature();
double pres = gas->pressure();
printf("Initial T = %g, pres = %g atm \n", tkelvin, pres/OneAtm);
beginLogGroup("topEquil", -1);
equilibrate(*gas,"UV", -1);
endLogGroup("topEquil");
cout << report(*gas) << endl;
tkelvin = gas->temperature();
pres = gas->pressure();
printf("Final T = %g, pres = %g atm\n", tkelvin, pres/OneAtm);
}
}
delete gas;
}
catch (CanteraError) {
showErrors();
}
return 0;
}

File diff suppressed because it is too large Load diff

View file

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