diff --git a/data/inputs/diamond.cti b/data/inputs/diamond.cti index e7d3f95b9..47166db61 100644 --- a/data/inputs/diamond.cti +++ b/data/inputs/diamond.cti @@ -1,96 +1,107 @@ -# simplified version of Harris and Goodwin diamond (100) growth -# mechanism, J. Phys. Chem., 1993. + +# Trough mechanism from 'S. J. Harris and D. G. Goodwin, 'Growth on +# the reconstructed diamond (100) surface, 'J. Phys. Chem. vol. 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 = 1.0e3, - mole_fractions = 'H:0.002, H2:1, CH4:0.01, CH3:0.0002')) + 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 ------------------------------------- stoichiometric_solid(name = 'diamond', - elements = 'C', - density = (3.52, 'g/cm3'), - species = 'C(d)') + elements = 'C', + density = (3.52, 'g/cm3'), + species = 'C(d)') + +species(name = 'C(d)', + atoms = 'C:1') # no thermo needed (reaction is irreversible) + +#------------- 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'), + site_density = (3.0E-9, 'mol/cm2'), initial_state = state(temperature = 1200.0, coverages = 'c6H*:0.1, c6HH:0.9')) -species(name = 'C(d)', - atoms = 'C:1', - thermo = const_cp() ) - # an empty surface site species(name = 'c6H*', atoms = 'H:1', - thermo = const_cp(h0 = (51.7, 'kcal/mol'), s0 = (19.5, 'cal/mol/K') ) ) + 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') ) ) + thermo = const_cp(h0 = (46.1, 'kcal/mol'), + s0 = (19.9, 'cal/mol/K'))) # a hydrogen-terminated site species(name = 'c6HH', atoms = 'H:2', - thermo = const_cp(t0 = 1200.0, h0 = (11.4, 'kcal/mol'), - s0 = (21.0, 'cal/mol/K')) - ) + 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') ) - ) + 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') ) - ) + 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') ) - ) + 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') ) - ) + 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') ) ) + 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, 2.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]) # n -surface_reaction('c6H* + H <=> c6** + H2', [1.3e14, 0.0, 7.3]) # o -surface_reaction('c6** + H <=> c6H*', [1.0e13, 0.0, 0.0]) # p -surface_reaction('c6*H + H <=> c6** + H2', [4.5e6, 2.0, 5.0]) # q -surface_reaction('c6** + H <=> c6*H', [1.0e13, 0.0, 0.0]) # r -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 -surface_reaction('c6B => c6HH + C(d)', [1.0e9, 0.0, 0.0]) +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, 2.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 <=> c6H*', [1.0E13, 0.0, 0.0]) # p +surface_reaction('c6*H + H <=> c6** + H2', [4.5E6, 2.0, 5.0]) # q +surface_reaction('c6** + H <=> c6*H', [1.0E13, 0.0, 0.0]) # r +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 diff --git a/interfaces/cython/cantera/examples/surface_chemistry/diamond_cvd.py b/interfaces/cython/cantera/examples/surface_chemistry/diamond_cvd.py index e9261a857..41ddf83b4 100644 --- a/interfaces/cython/cantera/examples/surface_chemistry/diamond_cvd.py +++ b/interfaces/cython/cantera/examples/surface_chemistry/diamond_cvd.py @@ -12,6 +12,7 @@ coverages as a function of [H] at the surface for fixed temperature and [CH3]. import csv import cantera as ct +import pandas as pd print('\n****** CVD Diamond Example ******\n') @@ -21,7 +22,6 @@ g, dbulk = ct.import_phases('diamond.cti', ['gas', 'diamond']) # import the model for the diamond (100) surface d = ct.Interface('diamond.cti', 'diamond_100', [g, dbulk]) -ns = d.n_species mw = dbulk.molecular_weights[0] t = 1200.0 @@ -32,23 +32,45 @@ g.TP = t, p ih = g.species_index('H') xh0 = x[ih] -f = open('diamond.csv', 'w') -writer = csv.writer(f) -writer.writerow(['H mole Fraction', 'Growth Rate (microns/hour)'] + - d.species_names) -iC = d.kinetics_species_index(dbulk.species_index('C(d)'), 1) +with open('diamond.csv', 'w', newline='') as f: + writer = csv.writer(f) + writer.writerow(['H mole Fraction', 'Growth Rate (microns/hour)'] + + d.species_names) -for n in range(20): - x[ih] /= 1.4 - g.TPX = t, p, x - d.advance_coverages(10.0) # integrate the coverages to steady state - carbon_dot = d.net_production_rates[iC] - mdot = mw * carbon_dot - rate = mdot / dbulk.density - writer.writerow([x[ih], rate * 1.0e6 * 3600.0] + list(d.coverages)) + iC = d.kinetics_species_index(dbulk.species_index('C(d)'), 1) -f.close() + for n in range(20): + x[ih] /= 1.4 + g.TPX = t, p, x + d.advance_coverages(10.0) # integrate the coverages to steady state + carbon_dot = d.net_production_rates[iC] + mdot = mw * carbon_dot + rate = mdot / dbulk.density + writer.writerow([x[ih], rate * 1.0e6 * 3600.0] + list(d.coverages)) -print('H concentration, growth rate, and surface coverages ' - 'written to file diamond.csv') + print('H concentration, growth rate, and surface coverages ' + 'written to file diamond.csv') + +try: + import matplotlib.pyplot as plt + data = pd.read_csv('diamond.csv') + + plt.figure() + plt.plot(data['H mole Fraction'], data['Growth Rate (microns/hour)']) + plt.xlabel('H Mole Fraction') + plt.ylabel('Growth Rate (microns/hr)') + plt.show() + + plt.figure() + for name in data: + if name.startswith('H mole') or name.startswith('Growth'): + continue + plt.plot(data['H mole Fraction'], data[name], label=name) + + plt.legend() + plt.xlabel('H Mole Fraction') + plt.ylabel('Coverage') + plt.show() +except ImportError: + print("Install matplotlib to plot the outputs") diff --git a/interfaces/cython/cantera/test/test_reactor.py b/interfaces/cython/cantera/test/test_reactor.py index 0c35523db..cbe490ce0 100644 --- a/interfaces/cython/cantera/test/test_reactor.py +++ b/interfaces/cython/cantera/test/test_reactor.py @@ -983,6 +983,7 @@ class TestSurfaceKinetics(utilities.CanteraTest): self.solid = ct.Solution('diamond.xml', 'diamond') self.interface = ct.Interface('diamond.xml', 'diamond_100', (self.gas, self.solid)) + self.gas.TPX = None, 1.0e3, 'H:0.002, H2:1, CH4:0.01, CH3:0.0002' self.r1 = ct.IdealGasReactor(self.gas) self.r1.volume = 0.01 self.net.add_reactor(self.r1) diff --git a/test_problems/diamondSurf/diamond.cti b/test_problems/diamondSurf/diamond.cti deleted file mode 100644 index f17ed90d3..000000000 --- a/test_problems/diamondSurf/diamond.cti +++ /dev/null @@ -1,107 +0,0 @@ - -# 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 ------------------------------------- - -stoichiometric_solid(name = 'diamond', - elements = 'H 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 <=> c6H*', [1.0E13, 0.0, 0.0]) #p -surface_reaction( 'c6*H + H <=> c6** + H2', [4.5E6, 2.0, 5.0]) #q -surface_reaction( 'c6** + H <=> c6*H', [1.0E13, 0.0, 0.0]) #r -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 diff --git a/test_problems/diamondSurf/diamond_blessed.xml b/test_problems/diamondSurf/diamond_blessed.xml index 812d61a8a..0607c6833 100644 --- a/test_problems/diamondSurf/diamond_blessed.xml +++ b/test_problems/diamondSurf/diamond_blessed.xml @@ -18,7 +18,7 @@ - H C + C C(d) 3.52 @@ -29,8 +29,8 @@ - H C - c6HH c6H* c6*H c6** c6HM c6HM* c6*M c6B + H C + c6HH c6H* c6*H c6** c6HM c6HM* c6*M c6B 1200.0 @@ -52,7 +52,7 @@ C:1 - 298.14999999999998 + 298.15 0.0 0.0 0.0 @@ -65,8 +65,8 @@ H:1 - 298.14999999999998 - 51.700000000000003 + 298.15 + 51.7 19.5 0.0 @@ -78,9 +78,9 @@ H:1 - 298.14999999999998 - 46.100000000000001 - 19.899999999999999 + 298.15 + 46.1 + 19.9 0.0 @@ -91,7 +91,7 @@ H:2 - 298.14999999999998 + 298.15 11.4 21.0 0.0 @@ -101,12 +101,12 @@ - H:4 C:1 + C:1 H:4 - 298.14999999999998 - 26.899999999999999 - 40.299999999999997 + 298.15 + 26.9 + 40.3 0.0 @@ -114,12 +114,12 @@ - H:3 C:1 + C:1 H:3 - 298.14999999999998 - 65.799999999999997 - 40.100000000000001 + 298.15 + 65.8 + 40.1 0.0 @@ -127,12 +127,12 @@ - H:3 C:1 + C:1 H:3 - 298.14999999999998 - 53.299999999999997 - 38.899999999999999 + 298.15 + 53.3 + 38.9 0.0 @@ -143,9 +143,9 @@ C:0 - 298.14999999999998 + 298.15 90.0 - 18.399999999999999 + 18.4 0.0 @@ -153,12 +153,12 @@ - H:2 C:1 + C:1 H:2 - 298.14999999999998 - 40.899999999999999 - 26.899999999999999 + 298.15 + 40.9 + 26.9 0.0 @@ -176,7 +176,7 @@ 7.300000 - H:1 c6HH:1.0 + c6HH:1.0 H:1 H2:1 c6H*:1.0 @@ -190,7 +190,7 @@ 0.000000 - c6H*:1.0 H:1 + H:1 c6H*:1.0 c6HH:1.0 @@ -204,7 +204,7 @@ 0.000000 - c6H*:1.0 CH3:1 + CH3:1 c6H*:1.0 c6HM:1.0 @@ -219,7 +219,7 @@ H:1 c6HM:1.0 - H2:1 c6*M:1.0 + c6*M:1.0 H2:1 @@ -232,7 +232,7 @@ 0.000000 - H:1 c6*M:1.0 + c6*M:1.0 H:1 c6HM:1.0 @@ -242,7 +242,7 @@ 2.800000E+04 - 0.0 + 2.0 7.700000 @@ -260,7 +260,7 @@ 0.000000 - c6HM*:1.0 H:1 + H:1 c6HM*:1.0 c6HM:1.0 @@ -288,8 +288,8 @@ 0.000000 - c6HM*:1.0 H:1 - c6H*:1.0 CH3:1 + H:1 c6HM*:1.0 + CH3:1 c6H*:1.0 @@ -302,8 +302,8 @@ 7.300000 - c6HM*:1.0 H:1 - H2:1 c6B:1.0 + H:1 c6HM*:1.0 + c6B:1.0 H2:1 @@ -316,8 +316,8 @@ 7.700000 - H:1 c6*M:1.0 - H2:1 c6B:1.0 + c6*M:1.0 H:1 + c6B:1.0 H2:1 @@ -330,8 +330,8 @@ 7.300000 - H:1 c6HH:1.0 - H2:1 c6*H:1.0 + c6HH:1.0 H:1 + c6*H:1.0 H2:1 @@ -358,7 +358,7 @@ 7.300000 - c6H*:1.0 H:1 + H:1 c6H*:1.0 H2:1 c6**:1.0 @@ -433,8 +433,8 @@ - - c6B [=] c6HH + C(d) + + c6B =] c6HH + C(d) 1.000000E+09 @@ -443,7 +443,7 @@ c6B:1.0 - C(d):1 c6HH:1.0 + c6HH:1.0 C(d):1 diff --git a/test_problems/diamondSurf/runDiamond_blessed.out b/test_problems/diamondSurf/runDiamond_blessed.out index 3bca4e239..c3df420d4 100644 --- a/test_problems/diamondSurf/runDiamond_blessed.out +++ b/test_problems/diamondSurf/runDiamond_blessed.out @@ -2,11 +2,11 @@ Number of species = 4 Number of species in diamond = 1 Number of species in diamond_100 = 8 Number of reactions = 20 -0 1 -8.95749e-05 -1 2 4.48403e-05 -2 3 -3.51539e-08 +0 1 -8.96e-05 +1 2 4.486e-05 +2 3 -3.801e-08 3 4 nil -4 0 3.51539e-08 +4 0 3.801e-08 5 2 nil 6 1 nil 7 1 nil @@ -16,13 +16,13 @@ Number of reactions = 20 11 3 nil 12 2 nil sum = nil -growth rate = 0.43183 microns per hour +growth rate = 0.4669 microns per hour Coverages: -0 c6HH 0.462262 -1 c6H* 0.037052 -2 c6*H 0.474283 -3 c6** 0.0219442 -4 c6HM 0.00174652 -5 c6HM* 2.56272e-05 -6 c6*M 0.00264858 -7 c6B 3.8171e-05 +0 c6HH 0.4622 +1 c6H* 0.03704 +2 c6*H 0.4742 +3 c6** 0.02194 +4 c6HM 0.001731 +5 c6HM* 2.772e-05 +6 c6*M 0.002864 +7 c6B 1.267e-09