Added a new test problem

This commit is contained in:
Harry Moffat 2003-08-20 19:36:43 +00:00
parent ff4720ef12
commit 89a7522ad6
8 changed files with 923 additions and 0 deletions

View file

@ -0,0 +1,8 @@
Makefile
csvCode.txt
diff_test.out
output.txt
runDiamond
ct2ctml.log
diamond.xml
xml_diff_test.out

View file

@ -0,0 +1,128 @@
#!/bin/sh
############################################################################
#
# Makefile input to compile the Particles library within Cantera.
#
#############################################################################
# the name of the executable program to be created
LIBP = libParticles.a
# the object files to be linked together. List those generated from Fortran
# and from C/C++ separately
LIBOBJS = GasParticle.o GasParticleMixture.o GasSectionParticle.o GSP_init.o \
GSP_src.o romberg.o romberg2D.o search.o \
IdealReactingGas.o sectionBF.o sectionBF1.o sectionBF2.o \
sectionBF1divv.o PartDiscGalerkin.o PartCoagulation.o \
romberg2DLinear.o \
PartInterfaceKinetics.o \
SurfRxnModels.o PartKineticsFactory.o ParticleSurfRxn.o \
PSR_InterfaceKinetics.o Placid.o\
IdealSolidSolnPhase.o SolidKinetics.o
# additional flags to be passed to the linker. If your program
# requires other external libraries, put them here
LINK_OPTIONS =
#############################################################################
# the Fortran compiler
FORT = @F77@
# Fortran compile flags
FORT_FLAGS = @FFLAGS@
# Fortran libraries
FORT_LIBS = @FLIBS@
# the C++ compiler
CXX = @CXX@
# C++ compile flags
CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT)
# external libraries
EXT_LIBS = @LOCAL_LIBS@
# Ending C++ linking libraries
LCXX_END_LIBS = @LCXX_END_LIBS@
#------ you probably don't have to change anything below this line -----
# The directory where the Cantera libraries are located
CANTERA_LIBDIR=@buildlib@
CANTERA_LIBDEP=$(CANTERA_LIBDIR)/libcantera.a
# Required Cantera libraries
CANTERA_LIBS = -ltransport -lcantera -lctcxx
# The directory where Cantera include files may be found.
# CANTERA_INCDIR=@CANTERA_INCDIR@
KERNEL_INCDIR= ../../src
CANTERA_INCDIR= ../../../include
# Flags passed to the C++ compiler/linker for the linking step
LCXX_FLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@
# How to compile C++ source files to object files
.@CXX_EXT@.@OBJ_EXT@:
$(CXX) -c $< -I../util_src -I$(KERNEL_INCDIR) $(CXX_FLAGS)
# How to compile Fortran source files to object files
.@F77_EXT@.@OBJ_EXT@:
$(FORT) -c $< -I../util_src $(FORT_FLAGS)
all: $(LIBOBJS) ISSPTester SK_ISSPTester ctitoxml xmlcopyTester
DEPENDS=$(LIBOBJS:.o=.d)
%.d:
g++ -MM -I../util_src -I$(KERNEL_INCDIR) $(CXX_FLAGS) $*.cpp > $*.d
$(LIBP): $(LIBOBJS)
@ARCHIVE@ $(LIBP) $(LIBOBJS)
####################################################################
# Executable Programs
####################################################################
ISSPTester: ISSPTester.o $(LIBP) $(CANTERA_LIBDEP)
$(CXX) -o ISSPTester ISSPTester.o -L. -lParticles \
-L$(CANTERA_LIBDIR) $(CANTERA_LIBS) -lcvode -lctlapack -lctblas \
-lgcc -lg2c -lstdc++ -lm
SK_ISSPTester: SK_ISSPTester.o $(LIBP) $(CANTERA_LIBDEP)
$(CXX) -o SK_ISSPTester SK_ISSPTester.o -L. -lParticles \
-L$(CANTERA_LIBDIR) $(CANTERA_LIBS) -lcvode -lctlapack -lctblas \
-lgcc -lg2c -lstdc++ -lm
ctitoxml: ctitoxml.o $(LIBP) $(CANTERA_LIBDEP)
$(CXX) -o ctitoxml ctitoxml.o \
-L$(CANTERA_LIBDIR) $(CANTERA_LIBS) -lcvode -lctlapack -lctblas \
-lgcc -lg2c -lstdc++ -lm
xmlcopyTester: xmlcopyTester.o $(LIBP) $(CANTERA_LIBDEP)
$(CXX) -o xmlcopyTester xmlcopyTester.o \
-L$(CANTERA_LIBDIR) $(CANTERA_LIBS) -lcvode -lctlapack -lctblas \
-lgcc -lg2c -lstdc++ -lm
clean:
$(RM) $(LIBOBJS) $(LIBGP)
depends: $(DEPENDS)
cat *.d > .depends
$(RM) $(DEPENDS)
TAGS:
etags *.h *.cpp
ifeq ($(wildcard .depends), .depends)
include .depends
endif

View file

@ -0,0 +1,108 @@
# Trough mechanism from 'S. J. Harris and D. G. Goodwin, 'Growth on
# the reconstructed diamond (100) surface, 'J. Phys. Chem. vo. 97,
# 23-28 (1993). reactions a - t are taken directly from Table II,
# with thermochemistry from Table IV. Reaction u is added here.
units(length = 'cm', quantity = 'mol', act_energy = 'kcal/mol')
#------------- the gas -------------------------------------
ideal_gas(name = 'gas',
elements = 'H C',
species = 'gri30: H H2 CH3 CH4',
initial_state = state(temperature = 1200.0,
pressure = 20.0*OneAtm/760.0,
mole_fractions = 'H:0.002, H2:0.988, CH3:0.0002, CH4:0.01'))
#------------- bulk diamond -------------------------------------
pure_solid(name = 'diamond',
elements = 'C',
density = (3.52, 'g/cm3'),
species = 'C(d)')
species(name = 'C(d)',
atoms = 'C:1') #no thermo needed (rxn is ireversible)
#------------- the diamond surface -------------------------------------
ideal_interface(name = 'diamond_100',
elements = ' H C ',
species = 'c6HH c6H* c6*H c6** c6HM c6HM* c6*M c6B',
reactions = 'all',
phases = 'gas diamond',
site_density = (3.0E-9, 'mol/cm2'),
initial_state = state(temperature= 1200.0,
coverages = 'c6H*:0.1, c6HH:0.9'))
species(name = 'c6H*',
atoms = 'H:1',
thermo = const_cp(h0 = (51.7, 'kcal/mol'),
s0 = (19.5, 'cal/mol/K') ) )
species(name = 'c6*H',
atoms = 'H:1',
thermo = const_cp(h0 = (46.1, 'kcal/mol'),
s0 = (19.9, 'cal/mol/K') ) )
species(name = 'c6HH',
atoms = 'H:2',
thermo = const_cp(h0 = (11.4, 'kcal/mol'),
s0 = (21.0, 'cal/mol/K') ) )
species(name = 'c6HM',
atoms = 'C:1 H:4',
thermo = const_cp(h0 = (26.9, 'kcal/mol'),
s0 = (40.3, 'cal/mol/K') ) )
species(name = 'c6HM*',
atoms = 'C:1 H:3',
thermo = const_cp(h0 = (65.8, 'kcal/mol'),
s0 = (40.1, 'cal/mol/K') ) )
species(name = 'c6*M',
atoms = 'C:1 H:3',
thermo = const_cp(h0 = (53.3, 'kcal/mol'),
s0 = (38.9, 'cal/mol/K') ) )
species(name = 'c6**',
atoms = 'C:0',
thermo = const_cp(h0 = (90.0, 'kcal/mol'),
s0 = (18.4, 'cal/mol/K') ) )
species(name = 'c6B',
atoms = 'H:2 C:1',
thermo = const_cp(h0 = (40.9, 'kcal/mol'),
s0 = (26.9, 'cal/mol/K') ) )
surface_reaction( 'c6HH + H <=> c6H* + H2', [1.3E14, 0.0, 7.3]) #a
surface_reaction( 'c6H* + H <=> c6HH', [1.0E13, 0.0, 0.0]) #b
surface_reaction( 'c6H* + CH3 <=> c6HM', [5.0E12, 0.0, 0.0]) #c
surface_reaction( 'c6HM + H <=> c6*M + H2', [1.3E14, 0.0, 7.3]) #d
surface_reaction( 'c6*M + H <=> c6HM', [1.0E13, 0.0, 0.0]) #e
surface_reaction( 'c6HM + H <=> c6HM* + H2', [2.8E7, 0.0, 7.7]) #f
surface_reaction( 'c6HM* + H <=> c6HM', [1.0E13, 0.0, 0.0]) #g
surface_reaction( 'c6HM* <=> c6*M', [1.0E8, 0.0, 0.0]) #h
surface_reaction( 'c6HM* + H <=> c6H* + CH3', [3.0E13, 0.0, 0.0]) #i
surface_reaction( 'c6HM* + H <=> c6B + H2', [1.3E14, 0.0, 7.3]) #k
surface_reaction( 'c6*M + H <=> c6B + H2', [2.8E7, 2.0, 7.7]) #l
surface_reaction( 'c6HH + H <=> c6*H + H2', [1.3E14, 0.0, 7.3]) #m
surface_reaction( 'c6*H + H <=> c6HH', [1.0E13, 0.0, 0.0]) #m
surface_reaction( 'c6H* + H <=> c6** + H2', [1.3E14, 0.0, 7.3]) #o
surface_reaction( 'c6** + H <=> c6*H', [1.0E13, 0.0, 0.0]) #p
surface_reaction( 'c6*H + H <=> c6** + H2', [4.5E6, 2.0, 5.0]) #q
surface_reaction( 'c6** + CH3 <=> c6*M', [5.0E12, 0.0, 0.0]) #s
surface_reaction( 'c6H* <=> c6*H', [1.0E8, 0.0, 0.0]) #t
# reaction to add new carbon atom to bulk and regenerate a new site
#
surface_reaction( 'c6B <=> c6HH + C(d)', [1.0E9, 0.0, 0.0]) #u

View file

@ -0,0 +1,434 @@
<ctml>
<validate reactions="yes" species="yes"/>
<!-- phase gas -->
<phase dim="3" id="gas">
<elementArray datasrc="elements.xml">H C</elementArray>
<speciesArray datasrc="gri30.xml#species_data"> H H2 CH3 CH4</speciesArray>
<state>
<temperature units="K">1200.0</temperature>
<pressure units="Pa">2666.4473684210525</pressure>
<moleFractions>H:0.002, H2:0.988, CH3:0.0002, CH4:0.01</moleFractions>
</state>
<thermo model="IdealGas"/>
<kinetics model="GasKinetics"/>
<transport model="None"/>
</phase>
<!-- phase diamond -->
<phase dim="3" id="diamond">
<elementArray datasrc="elements.xml">C</elementArray>
<speciesArray datasrc="#species_data">C(d)</speciesArray>
<thermo model="SolidCompound">
<density units="g/cm3">3.52</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<!-- phase diamond_100 -->
<phase dim="2" id="diamond_100">
<elementArray datasrc="elements.xml"> H C </elementArray>
<speciesArray datasrc="#species_data">c6HH c6H* c6*H c6** c6HM c6HM* c6*M c6B</speciesArray>
<reactionArray datasrc="#reaction_data"/>
<state>
<temperature units="K">1200.0</temperature>
<coverages>c6H*:0.1, c6HH:0.9</coverages>
</state>
<thermo model="Surface">
<site_density units="mol/cm2">3e-09</site_density>
</thermo>
<kinetics model="Interface"/>
<transport model="None"/>
<phaseArray>gas diamond</phaseArray>
</phase>
<!-- species definitions -->
<speciesData id="species_data">
<!-- species C(d) -->
<species name="C(d)">
<atomArray>C:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="J/mol">0.0</h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<!-- species c6H* -->
<species name="c6H*">
<atomArray>H:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="kcal/mol">51.700000000000003</h0>
<s0 units="cal/mol/K">19.5</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<!-- species c6*H -->
<species name="c6*H">
<atomArray>H:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="kcal/mol">46.100000000000001</h0>
<s0 units="cal/mol/K">19.899999999999999</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<!-- species c6HH -->
<species name="c6HH">
<atomArray>H:2 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="kcal/mol">11.4</h0>
<s0 units="cal/mol/K">21.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<!-- species c6HM -->
<species name="c6HM">
<atomArray>H:4 C:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="kcal/mol">26.899999999999999</h0>
<s0 units="cal/mol/K">40.299999999999997</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<!-- species c6HM* -->
<species name="c6HM*">
<atomArray>H:3 C:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="kcal/mol">65.799999999999997</h0>
<s0 units="cal/mol/K">40.100000000000001</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<!-- species c6*M -->
<species name="c6*M">
<atomArray>H:3 C:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="kcal/mol">53.299999999999997</h0>
<s0 units="cal/mol/K">38.899999999999999</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<!-- species c6** -->
<species name="c6**">
<atomArray>C:0 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="kcal/mol">90.0</h0>
<s0 units="cal/mol/K">18.399999999999999</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<!-- species c6B -->
<species name="c6B">
<atomArray>H:2 C:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="kcal/mol">40.899999999999999</h0>
<s0 units="cal/mol/K">26.899999999999999</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
</speciesData>
<reactionData id="reaction_data">
<!-- reaction 0001 -->
<reaction id="0001" reversible="yes" type="surface">
<equation>c6HH + H [=] c6H* + H2</equation>
<rateCoeff>
<Arrhenius>
<A> 1.300000E+11</A>
<b>0.0</b>
<E units="kcal/mol">7.300000</E>
</Arrhenius>
</rateCoeff>
<reactants>H:1 c6HH:1</reactants>
<products>H2:1 c6H*:1</products>
</reaction>
<!-- reaction 0002 -->
<reaction id="0002" reversible="yes" type="surface">
<equation>c6H* + H [=] c6HH</equation>
<rateCoeff>
<Arrhenius>
<A> 1.000000E+10</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6H*:1 H:1</reactants>
<products>c6HH:1</products>
</reaction>
<!-- reaction 0003 -->
<reaction id="0003" reversible="yes" type="surface">
<equation>c6H* + CH3 [=] c6HM</equation>
<rateCoeff>
<Arrhenius>
<A> 5.000000E+09</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6H*:1 CH3:1</reactants>
<products>c6HM:1</products>
</reaction>
<!-- reaction 0004 -->
<reaction id="0004" reversible="yes" type="surface">
<equation>c6HM + H [=] c6*M + H2</equation>
<rateCoeff>
<Arrhenius>
<A> 1.300000E+11</A>
<b>0.0</b>
<E units="kcal/mol">7.300000</E>
</Arrhenius>
</rateCoeff>
<reactants>H:1 c6HM:1</reactants>
<products>H2:1 c6*M:1</products>
</reaction>
<!-- reaction 0005 -->
<reaction id="0005" reversible="yes" type="surface">
<equation>c6*M + H [=] c6HM</equation>
<rateCoeff>
<Arrhenius>
<A> 1.000000E+10</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>H:1 c6*M:1</reactants>
<products>c6HM:1</products>
</reaction>
<!-- reaction 0006 -->
<reaction id="0006" reversible="yes" type="surface">
<equation>c6HM + H [=] c6HM* + H2</equation>
<rateCoeff>
<Arrhenius>
<A> 2.800000E+04</A>
<b>0.0</b>
<E units="kcal/mol">7.700000</E>
</Arrhenius>
</rateCoeff>
<reactants>H:1 c6HM:1</reactants>
<products>H2:1 c6HM*:1</products>
</reaction>
<!-- reaction 0007 -->
<reaction id="0007" reversible="yes" type="surface">
<equation>c6HM* + H [=] c6HM</equation>
<rateCoeff>
<Arrhenius>
<A> 1.000000E+10</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6HM*:1 H:1</reactants>
<products>c6HM:1</products>
</reaction>
<!-- reaction 0008 -->
<reaction id="0008" reversible="yes" type="surface">
<equation>c6HM* [=] c6*M</equation>
<rateCoeff>
<Arrhenius>
<A> 1.000000E+08</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6HM*:1</reactants>
<products>c6*M:1</products>
</reaction>
<!-- reaction 0009 -->
<reaction id="0009" reversible="yes" type="surface">
<equation>c6HM* + H [=] c6H* + CH3</equation>
<rateCoeff>
<Arrhenius>
<A> 3.000000E+10</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6HM*:1 H:1</reactants>
<products>c6H*:1 CH3:1</products>
</reaction>
<!-- reaction 0010 -->
<reaction id="0010" reversible="yes" type="surface">
<equation>c6HM* + H [=] c6B + H2</equation>
<rateCoeff>
<Arrhenius>
<A> 1.300000E+11</A>
<b>0.0</b>
<E units="kcal/mol">7.300000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6HM*:1 H:1</reactants>
<products>H2:1 c6B:1</products>
</reaction>
<!-- reaction 0011 -->
<reaction id="0011" reversible="yes" type="surface">
<equation>c6*M + H [=] c6B + H2</equation>
<rateCoeff>
<Arrhenius>
<A> 2.800000E+04</A>
<b>2.0</b>
<E units="kcal/mol">7.700000</E>
</Arrhenius>
</rateCoeff>
<reactants>H:1 c6*M:1</reactants>
<products>H2:1 c6B:1</products>
</reaction>
<!-- reaction 0012 -->
<reaction id="0012" reversible="yes" type="surface">
<equation>c6HH + H [=] c6*H + H2</equation>
<rateCoeff>
<Arrhenius>
<A> 1.300000E+11</A>
<b>0.0</b>
<E units="kcal/mol">7.300000</E>
</Arrhenius>
</rateCoeff>
<reactants>H:1 c6HH:1</reactants>
<products>H2:1 c6*H:1</products>
</reaction>
<!-- reaction 0013 -->
<reaction id="0013" reversible="yes" type="surface">
<equation>c6*H + H [=] c6HH</equation>
<rateCoeff>
<Arrhenius>
<A> 1.000000E+10</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6*H:1 H:1</reactants>
<products>c6HH:1</products>
</reaction>
<!-- reaction 0014 -->
<reaction id="0014" reversible="yes" type="surface">
<equation>c6H* + H [=] c6** + H2</equation>
<rateCoeff>
<Arrhenius>
<A> 1.300000E+11</A>
<b>0.0</b>
<E units="kcal/mol">7.300000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6H*:1 H:1</reactants>
<products>H2:1 c6**:1</products>
</reaction>
<!-- reaction 0015 -->
<reaction id="0015" reversible="yes" type="surface">
<equation>c6** + H [=] c6*H</equation>
<rateCoeff>
<Arrhenius>
<A> 1.000000E+10</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>H:1 c6**:1</reactants>
<products>c6*H:1</products>
</reaction>
<!-- reaction 0016 -->
<reaction id="0016" reversible="yes" type="surface">
<equation>c6*H + H [=] c6** + H2</equation>
<rateCoeff>
<Arrhenius>
<A> 4.500000E+03</A>
<b>2.0</b>
<E units="kcal/mol">5.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6*H:1 H:1</reactants>
<products>H2:1 c6**:1</products>
</reaction>
<!-- reaction 0017 -->
<reaction id="0017" reversible="yes" type="surface">
<equation>c6** + CH3 [=] c6*M</equation>
<rateCoeff>
<Arrhenius>
<A> 5.000000E+09</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>CH3:1 c6**:1</reactants>
<products>c6*M:1</products>
</reaction>
<!-- reaction 0018 -->
<reaction id="0018" reversible="yes" type="surface">
<equation>c6H* [=] c6*H</equation>
<rateCoeff>
<Arrhenius>
<A> 1.000000E+08</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6H*:1</reactants>
<products>c6*H:1</products>
</reaction>
<!-- reaction 0019 -->
<reaction id="0019" reversible="yes" type="surface">
<equation>c6B [=] c6HH + C(d)</equation>
<rateCoeff>
<Arrhenius>
<A> 1.000000E+09</A>
<b>0.0</b>
<E units="kcal/mol">0.000000</E>
</Arrhenius>
</rateCoeff>
<reactants>c6B:1</reactants>
<products>C(d):1 c6HH:1</products>
</reaction>
</reactionData>
</ctml>

View file

@ -0,0 +1,148 @@
/**
* @file example2.cpp
*
*/
// Example
//
// Read a mechanism and a thermodynamics file for the
// class IdealSolidSolnPhase in order to test that it's
// working correctly
//
#include <iostream>
#include <string>
#include <vector>
#include <string>
#include <iomanip>
using namespace std;
#ifdef DEBUG_HKM
int iDebug_HKM = 0;
#endif
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
static void printUsage()
{
}
#include "kernel/ct_defs.h"
#include "kernel/ctml.h"
#include "kernel/GasKinetics.h"
#include "kernel/importCTML.h"
#include "kernel/ThermoPhase.h"
#include "kernel/InterfaceKinetics.h"
using namespace Cantera;
int main(int argc, char** argv) {
int i, k;
string infile = "diamond.cti";
try {
XML_Node *xc = new XML_Node();
string path = findInputFile(infile);
ctml::get_CTML_Tree(xc, path);
XML_Node *xg = findXMLPhase(xc, "gas");
ThermoPhase *gasTP = newPhase(*xg);
int nsp = gasTP->nSpecies();
cout << "Number of species = " << nsp << endl;
XML_Node *xd = findXMLPhase(xc, "diamond");
ThermoPhase *diamondTP = newPhase(*xd);
int nsp_diamond = diamondTP->nSpecies();
cout << "Number of species in diamond = " << nsp_diamond << endl;
XML_Node *xs = findXMLPhase(xc, "diamond_100");
ThermoPhase *diamond100TP = newPhase(*xs);
int nsp_d100 = diamond100TP->nSpecies();
cout << "Number of species in diamond_100 = " << nsp_d100 << endl;
vector<ThermoPhase *> phaseList;
phaseList.push_back(gasTP);
phaseList.push_back(diamondTP);
phaseList.push_back(diamond100TP);
InterfaceKinetics *iKin_ptr = new InterfaceKinetics();
importKinetics(*xs, phaseList, iKin_ptr);
int nr = iKin_ptr->nReactions();
cout << "Number of reactions = " << nr << endl;
double x[20];
for (i = 0; i < 20; i++) x[i] = 0.0;
x[0] = 0.0010;
x[1] = 0.9888;
x[2] = 0.0002;
x[3] = 0.0100;
double p = 20.0*OneAtm/760.0;
gasTP->setState_TPX(1200., p, x);
for (i = 0; i < 20; i++) x[i] = 0.0;
int i0 = diamond100TP->speciesIndex("c6H*");
x[i0] = 0.1;
int i1 = diamond100TP->speciesIndex("c6HH");
x[i1] = 0.9;
diamond100TP->setState_TX(1200., x);
for (i = 0; i < 20; i++) x[i] = 0.0;
x[0] = 1.0;
diamondTP->setState_TPX(1200., p, x);
iKin_ptr->advanceCoverages(100.);
double src[20];
for (i = 0; i < 20; i++) src[i] = 0.0;
iKin_ptr->getNetProductionRates(src);
double sum = 0.0;
double naH;
for (k = 0; k < 13; k++) {
if (k < 4) {
naH = gasTP->nAtoms(k, 0);
} else if (k == 4) {
naH = 0;
} else if (k > 4) {
int itp = k - 5;
naH = diamond100TP->nAtoms(itp, 0);
}
cout << k << " " << naH << " " ;
if (fabs(src[k]) < 2.0E-17) {
cout << " nil" << endl;
} else {
cout << src[k] << endl;
}
sum += naH * src[k];
}
cout << "sum = " << sum << endl;
double mwd = diamondTP->molecularWeight(0);
double dens = diamondTP->density();
double gr = src[4] * mwd / dens;
gr *= 1.0E6 * 3600.;
cout << "growth rate = " << gr << " microns per hour" << endl;
diamond100TP->getMoleFractions(x);
cout << "Coverages:" << endl;
for (k = 0; k < 8; k++) {
int iii = 3;
cout << k << " " << diamond100TP->speciesName(k)
<< " "
<< x[k] << endl;
}
}
catch (CanteraError) {
showErrors(cout);
}
return 0;
}
/***********************************************************/

View file

@ -0,0 +1,28 @@
Number of species = 4
Number of species in diamond = 1
Number of species in diamond_100 = 8
Number of reactions = 19
0 1 -8.70671e-05
1 2 4.36087e-05
2 3 -5.01069e-08
3 4 nil
4 0 5.01069e-08
5 2 nil
6 1 nil
7 1 nil
8 0 nil
9 4 nil
10 3 nil
11 3 nil
12 2 nil
sum = -5.78482e-21
growth rate = 0.615512 microns per hour
Coverages:
0 c6HH 0.456002
1 c6H* 0.0365236
2 c6*H 0.467593
3 c6** 0.0339855
4 c6HM 0.002046
5 c6HM* 3.65232e-05
6 c6*M 0.00377568
7 c6B 3.76346e-05

View file

@ -0,0 +1,25 @@
from Cantera import *
# import the bulk phases
g, dbulk = importPhases('diamond.cti', ['gas','diamond'])
# import the interface
d = importInterface('diamond.cti', 'diamond_100', phases = [g, dbulk])
mw = dbulk.molarMasses()[0] #mol. wt. of carbin
t = g.temperature()
p = g.pressure()
x = g.moleFractions()
ih = g.speciesIndex('H')
f = open('d.csv', 'w')
for n in range (20):
x[ih] /= 1.4
g.setState_TPX(t, p, x)
# integrate the coverage equations to steady state
d.advanceCoverags(100.0)
cdot = d.netProductionRates(phase = dbulk) [0] #net rate of C(d production /m^2
mdot = mw * cdot
linear_rate = mdot/dbulk.density()
writeCSV(f, [x[ih], rate]+list(d.coverages()))
f.close()

View file

@ -0,0 +1,44 @@
#!/bin/sh
#
#
temp_success="1"
/bin/rm -f output.txt
#################################################################
#
#################################################################
CANTERA_BIN=${CANTERA_BIN:=../../bin}
./runDiamond > output.txt
retnStat=$?
if [ $retnStat != "0" ]
then
temp_success="0"
echo "runDiamond returned with bad status, $retnStat, check output"
fi
diff output.txt runDiamond_blessed.out > diff_test.out
retnStat=$?
if [ $retnStat = "0" ]
then
echo "successful diff comparison on diamond test"
else
echo "unsuccessful diff comparison on diamond test"
echo "FAILED" > csvCode.txt
temp_success="0"
fi
diff diamond.xml diamond_blessed.xml > xml_diff_test.out
retnStat=$?
if [ $retnStat = "0" ]
then
echo "successful diff comparison on diamond.xml test"
else
echo "unsuccessful diff comparison on diamond.xml test"
echo "FAILED" > csvCode.txt
temp_success="0"
fi