From 5de6fde1c66e64499cf3f9a581086330d57b65f1 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Thu, 19 Mar 2009 19:22:27 +0000 Subject: [PATCH] Added new dir --- .../surface_chemistry/diamond_cvd/.cvsignore | 8 +++ .../surface_chemistry/diamond_cvd/Makefile.in | 15 +++++ .../surface_chemistry/diamond_cvd/cleanup | 5 ++ .../surface_chemistry/diamond_cvd/diamond.py | 48 ++++++++++++++ .../diamond_cvd/diamond_blessed_0.csv | 21 ++++++ .../diamond_cvd/output_blessed_0.txt | 4 ++ .../surface_chemistry/diamond_cvd/runtest.in | 64 +++++++++++++++++++ 7 files changed, 165 insertions(+) create mode 100644 Cantera/python/examples/surface_chemistry/diamond_cvd/.cvsignore create mode 100644 Cantera/python/examples/surface_chemistry/diamond_cvd/Makefile.in create mode 100755 Cantera/python/examples/surface_chemistry/diamond_cvd/cleanup create mode 100644 Cantera/python/examples/surface_chemistry/diamond_cvd/diamond.py create mode 100644 Cantera/python/examples/surface_chemistry/diamond_cvd/diamond_blessed_0.csv create mode 100644 Cantera/python/examples/surface_chemistry/diamond_cvd/output_blessed_0.txt create mode 100755 Cantera/python/examples/surface_chemistry/diamond_cvd/runtest.in diff --git a/Cantera/python/examples/surface_chemistry/diamond_cvd/.cvsignore b/Cantera/python/examples/surface_chemistry/diamond_cvd/.cvsignore new file mode 100644 index 000000000..d7ad744d9 --- /dev/null +++ b/Cantera/python/examples/surface_chemistry/diamond_cvd/.cvsignore @@ -0,0 +1,8 @@ +Makefile +ct2ctml.log +diamond.csv +diamond.xml +diff_csv.txt +diff_out_0.txt +output_0.txt +runtest diff --git a/Cantera/python/examples/surface_chemistry/diamond_cvd/Makefile.in b/Cantera/python/examples/surface_chemistry/diamond_cvd/Makefile.in new file mode 100644 index 000000000..995a87b24 --- /dev/null +++ b/Cantera/python/examples/surface_chemistry/diamond_cvd/Makefile.in @@ -0,0 +1,15 @@ +#!/bin/sh + +PYTHON_CMD = @PYTHON_CMD@ + +run: + $(PYTHON_CMD) catcomb.py + +test: + ./runtest +clean: + rm -f *.log *.csv *.xml + ./cleanup + +# end of file + diff --git a/Cantera/python/examples/surface_chemistry/diamond_cvd/cleanup b/Cantera/python/examples/surface_chemistry/diamond_cvd/cleanup new file mode 100755 index 000000000..40e1dbd9e --- /dev/null +++ b/Cantera/python/examples/surface_chemistry/diamond_cvd/cleanup @@ -0,0 +1,5 @@ +#!/bin/sh +# +/bin/rm -rf equilibrate_log*.html +/bin/rm -rf .cttmp* ct2ctml.log transport_log.xml vcs_equilibrate_res*.csv \ + catcomb.csv output_0.txt diff* diff --git a/Cantera/python/examples/surface_chemistry/diamond_cvd/diamond.py b/Cantera/python/examples/surface_chemistry/diamond_cvd/diamond.py new file mode 100644 index 000000000..c8c9f8a86 --- /dev/null +++ b/Cantera/python/examples/surface_chemistry/diamond_cvd/diamond.py @@ -0,0 +1,48 @@ +# A CVD example. This example computes the growth rate of a diamond +# film according to a simplified version of a particular published +# growth mechanism (see file diamond.cti for details). Only the +# surface coverage equations are solved here; the gas composition is +# fixed. (For an example of coupled gas-phase and surface, see +# catcomb.py.) Atomic hydrogen plays an important role in diamond +# CVD, and this example computes the growth rate and surface coverages +# as a function of [H] at the surface for fixed temperature and [CH3]. + +from Cantera import * +import math + +print '\n\b****** CVD Diamond Example ******\n' + +# import the models for the gas and bulk diamond +g, dbulk = importPhases('diamond.cti',['gas','diamond']) + +# import the model for the diamond (100) surface +d = importInterface('diamond.cti','diamond_100',phases = [g, dbulk]) + +ns = d.nSpecies() +mw = dbulk.molarMasses()[0] + +t = 1200.0 +x = g.moleFractions() +p = 20.0*OneAtm/760.0 # 20 Torr +g.set(T = t, P = p, X = x) + +ih = g.speciesIndex('H') + +xh0 = x[ih] +f = open('diamond.csv','w') +writeCSV(f, ['H mole Fraction', 'Growth Rate (microns/hour)']+d.speciesNames()) +for n in range(20): + x[ih] /= 1.4 + g.setState_TPX(t, p, x) + d.advanceCoverages(10.0) # iintegrate the coverages to steady state + carbon_dot = d.netProductionRates(phase = dbulk)[0] + mdot = mw*carbon_dot + rate = mdot/dbulk.density() + writeCSV(f,[x[ih],rate*1.0e6*3600.0]+list(d.coverages())) +f.close() + +print 'H concentration, growth rate, and surface coverages written to file diamond.csv' + + + + diff --git a/Cantera/python/examples/surface_chemistry/diamond_cvd/diamond_blessed_0.csv b/Cantera/python/examples/surface_chemistry/diamond_cvd/diamond_blessed_0.csv new file mode 100644 index 000000000..ff4b49fa3 --- /dev/null +++ b/Cantera/python/examples/surface_chemistry/diamond_cvd/diamond_blessed_0.csv @@ -0,0 +1,21 @@ +H mole Fraction, Growth Rate (microns/hour), c6HH, c6H*, c6*H, c6**, c6HM, c6HM*, c6*M, c6B, +0.0014113529229119034, 0.57142232831102846, 0.45481733599975122, 0.037451932196810568, 0.47936935093995953, 0.024101716790582935, 0.0017538224095557072, 2.4022947987785868e-05, 0.0024818171647621591, 1.5505898880153226e-09, +0.0010081092306513596, 0.46453684455146432, 0.46199649571418777, 0.037058797285699753, 0.4743685431927675, 0.022012129094318003, 0.0017132091636558103, 2.7326979458424738e-05, 0.0028234973093631097, 1.2605495061788686e-09, +0.00072007802189382841, 0.37460573418586735, 0.4716427348392136, 0.036512499612373787, 0.46739763281705277, 0.019580146208998356, 0.0016494133018900143, 3.0840357462450641e-05, 0.0031867318464931325, 1.0165158668861052e-09, +0.00051434144420987751, 0.29742961642815136, 0.48444529289693739, 0.035759185491177667, 0.45776977847126715, 0.016884702132066876, 0.0015652083080834665, 3.4272951414370457e-05, 0.0035415589419594382, 8.0709369021845163e-10, +0.00036738674586419824, 0.23066426212521424, 0.50118700115036441, 0.034735375698214034, 0.44467415872857169, 0.014057497145129607, 0.0014641274448941408, 3.7205157762279606e-05, 0.0038446340491419739, 6.2592176514179452e-10, +0.00026241910418871306, 0.17338739083360108, 0.52268071256451798, 0.033373549402321998, 0.42724767309131212, 0.011263262192841586, 0.0013501298992182492, 3.9148801032407897e-05, 0.0040455235782583115, 4.7049742653669001e-10, +0.00018744221727765221, 0.12545232461172048, 0.54963967820461213, 0.031613192917103239, 0.40471654750294966, 0.008666268185767512, 0.0012270425124739283, 3.9652734373240664e-05, 0.0040976176022975352, 3.4042265472179526e-10, +0.00013388729805546587, 0.086839794798906619, 0.58246948267727716, 0.029417440027807173, 0.37660948362690283, 0.0063962347757475363, 0.0010981493458524425, 3.8425292694071541e-05, 0.0039707840180737254, 2.3564516299268213e-10, +9.5633784325332774e-05, 0.05720360904715719, 0.62100800024470459, 0.02679268048177922, 0.3430087772914886, 0.004527089988248854, 0.00096623630952221708, 3.5435046915545676e-05, 0.0036617804821151797, 1.5522553696610924e-10, +6.8309845946666273e-05, 0.035693840744155193, 0.66430215056753594, 0.023804586951563626, 0.30475556157242689, 0.0030739617468731458, 0.00083404960814159482, 3.09541618545557e-05, 0.0031987352947468314, 9.6857448125812351e-11, +4.8792747104761624e-05, 0.021019924647484853, 0.71055714175629869, 0.020581213544316801, 0.26348951569883411, 0.0020046756428621164, 0.00070477818965130126, 2.5519760347575667e-05, 0.0026371553506507116, 5.7038867734782227e-11, +3.4851962217686878e-05, 0.011655560612087543, 0.75736269892639585, 0.01729620896446794, 0.22143397793263142, 0.0012579841044948409, 0.00058212204349405397, 1.9810740783620442e-05, 0.002047197256104253, 3.162808579369232e-11, +2.4894258726919201e-05, 0.0060829108866593202, 0.80216798098883246, 0.014134439623554167, 0.18095585152284246, 0.00076168360402431774, 0.00046981059293135601, 1.4474475435365655e-05, 0.0014957591758735242, 1.6506355532922605e-11, +1.7781613376370859e-05, 0.0029932764326392435, 0.842821301390695, 0.011253105753676058, 0.1440678035155504, 0.00044653903446940712, 0.0003708404527933976, 9.9715633391965867e-06, 0.0010304382813538598, 8.1224410362184493e-12, +1.2701152411693471e-05, 0.0013944216743240353, 0.87794575051152801, 0.0087545229545941353, 0.11207980758608514, 0.00025450011455922718, 0.00028687551785231238, 6.5033399812889824e-06, 0.00067203997161612277, 3.7838495989945972e-12, +9.0722517226381939e-06, 0.00061861748349723066, 0.90703027436747208, 0.0066791165436278603, 0.085509460799497228, 0.00014162282525307911, 0.00021808901325870433, 4.0391598799346975e-06, 0.000417397289332564, 1.678656865396729e-12, +6.4801798018844245e-06, 0.00026322879062952187, 0.93027764306884664, 0.0050157954905972408, 0.0642148025139999, 7.7278258857588794e-05, 0.00016342490164466045, 2.4061860130806934e-06, 0.00024864957932639381, 7.1428763064098416e-13, +4.6286998584888748e-06, 0.00010825455568959096, 0.94834124811995646, 0.0037204525969076691, 0.047631168996840965, 4.1515623896220465e-05, 0.0001210672829963004, 1.3853810958086378e-06, 0.00014316199801280168, 2.9375544333385767e-13, +3.3062141846349109e-06, 4.3353465889170528e-05, 0.96207198666333205, 0.0027339950045120868, 0.035002033941095016, 2.2038072334159012e-05, 8.8903353522867527e-05, 7.7673770125311597e-07, 8.0266227384864322e-05, 1.1764231547769505e-13, +2.3615815604535078e-06, 1.7025515669170322e-05, 0.9723365680075382, 0.0019954620954364616, 0.02554695392139341, 1.1596389470473949e-05, 6.486223158253653e-05, 4.2704976076465961e-07, 4.4130304771864307e-05, 4.6199791514783933e-14, diff --git a/Cantera/python/examples/surface_chemistry/diamond_cvd/output_blessed_0.txt b/Cantera/python/examples/surface_chemistry/diamond_cvd/output_blessed_0.txt new file mode 100644 index 000000000..3355e0b0a --- /dev/null +++ b/Cantera/python/examples/surface_chemistry/diamond_cvd/output_blessed_0.txt @@ -0,0 +1,4 @@ + +****** CVD Diamond Example ****** + +H concentration, growth rate, and surface coverages written to file diamond.csv diff --git a/Cantera/python/examples/surface_chemistry/diamond_cvd/runtest.in b/Cantera/python/examples/surface_chemistry/diamond_cvd/runtest.in new file mode 100755 index 000000000..ad1cba6e2 --- /dev/null +++ b/Cantera/python/examples/surface_chemistry/diamond_cvd/runtest.in @@ -0,0 +1,64 @@ +#!/bin/sh +# +# +temp_success="1" +/bin/rm -f output_0.txt diamond.csv diff_csv.txt diff_out_0.txt + +########################################################################## +PYTHON_CMD=@PYTHON_CMD@ +prog=diamond.py +if test ! -f $prog ; then + echo $prog ' does not exist' + exit -1 +fi +################################################################# +# +CANTERA_DATA=${CANTERA_DATA:=../../../data/inputs}; export CANTERA_DATA +CANTERA_BIN=${CANTERA_BIN:=../../../bin} + +################################################################# + +$PYTHON_CMD $prog > output_0.txt <<+ +1.0 ++ +retnStat=$? +if [ $retnStat != "0" ] +then + temp_success="0" + echo "$prog returned with bad status, $retnStat, check output" +fi + +diff -w output_blessed_0.txt output_0.txt > diff_out_0.txt +retnStat_0=$? + +csvdiff -a 1.0E-50 diamond_blessed_0.csv diamond.csv > diff_csv.txt +retnStat_csv_0=$? + +retnTotal=1 +if test $retnStat_0 = "0" +then + retnTotal=0 +fi + +retnCSVTotal=1 +if test $retnStat_csv_0 = "1" +then + retnCSVTotal=0 +fi + +if test $retnCSVTotal = "0" +then + echo "Successful test comparison on "`pwd` + if test $retnTotal = "1" + then + echo " But text files show differences. See diff_out_0.txt" + fi +else + echo "Unsuccessful test comparison of csv files on "`pwd` " test" + echo " see diff_csv.txt " + if test $retnTotal != "0" + then + echo " ASCII files are different too - see diff_test*.txt" + fi +fi +