From 47591bcb00753fef45fabd397f7daf2cd57f7c7e Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 18 Mar 2009 23:35:34 +0000 Subject: [PATCH] Added dir files. --- .../equilibrium/simple_test/.cvsignore | 7 +++ .../equilibrium/simple_test/Makefile.in | 14 ++++++ .../examples/equilibrium/simple_test/cleanup | 5 ++ .../simple_test/output_blessed_0.txt | 37 ++++++++++++++ .../equilibrium/simple_test/runtest.in | 49 +++++++++++++++++++ .../equilibrium/simple_test/simple.py | 23 +++++++++ 6 files changed, 135 insertions(+) create mode 100644 Cantera/python/examples/equilibrium/simple_test/.cvsignore create mode 100644 Cantera/python/examples/equilibrium/simple_test/Makefile.in create mode 100755 Cantera/python/examples/equilibrium/simple_test/cleanup create mode 100644 Cantera/python/examples/equilibrium/simple_test/output_blessed_0.txt create mode 100755 Cantera/python/examples/equilibrium/simple_test/runtest.in create mode 100644 Cantera/python/examples/equilibrium/simple_test/simple.py diff --git a/Cantera/python/examples/equilibrium/simple_test/.cvsignore b/Cantera/python/examples/equilibrium/simple_test/.cvsignore new file mode 100644 index 000000000..51f734606 --- /dev/null +++ b/Cantera/python/examples/equilibrium/simple_test/.cvsignore @@ -0,0 +1,7 @@ +Makefile +runtest +ct2ctml.log +diff_out_0.txt +h2o2.xml +output_0.txt +transport_log.xml diff --git a/Cantera/python/examples/equilibrium/simple_test/Makefile.in b/Cantera/python/examples/equilibrium/simple_test/Makefile.in new file mode 100644 index 000000000..dd3f4361f --- /dev/null +++ b/Cantera/python/examples/equilibrium/simple_test/Makefile.in @@ -0,0 +1,14 @@ +#!/bin/sh + +PYTHON_CMD = @PYTHON_CMD@ + +run: + $(PYTHON_CMD) adiabatic.py + +test: + ./runtest +clean: + rm -f *.log *.csv *.xml + +# end of file + diff --git a/Cantera/python/examples/equilibrium/simple_test/cleanup b/Cantera/python/examples/equilibrium/simple_test/cleanup new file mode 100755 index 000000000..83f3d4dc6 --- /dev/null +++ b/Cantera/python/examples/equilibrium/simple_test/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 \ + equil_koh.csv diff --git a/Cantera/python/examples/equilibrium/simple_test/output_blessed_0.txt b/Cantera/python/examples/equilibrium/simple_test/output_blessed_0.txt new file mode 100644 index 000000000..4c31cb959 --- /dev/null +++ b/Cantera/python/examples/equilibrium/simple_test/output_blessed_0.txt @@ -0,0 +1,37 @@ + + ohmech: + + temperature 2000 K + pressure 10132.5 Pa + density 0.0117038 kg/m^3 + mean mol. weight 19.2076 amu + + 1 kg 1 kmol + ----------- ------------ + enthalpy -7.55312e+06 -1.451e+08 J + internal energy -8.41887e+06 -1.617e+08 J + entropy 14945.3 2.871e+05 J/K + Gibbs function -3.74437e+07 -7.192e+08 J + heat capacity c_p 2617.61 5.028e+04 J/K + heat capacity c_v 2184.73 4.196e+04 J/K + + X Y Chem. Pot. / RT + ------------- ------------ ------------ + H2 0.00273982 0.000287549 -27.6814 + H 0.000269379 1.41359e-05 -13.8407 + O 0.000632389 0.000526761 -16.7409 + O2 0.0894549 0.149027 -33.4819 + OH 0.00880602 0.00779726 -30.5817 + H2O 0.898095 0.842343 -44.4224 + HO2 2.52646e-06 4.3415e-06 -47.3226 + H2O2 1.58781e-07 2.81184e-07 -61.1633 + AR 0 0 + H2 0.00274 0.0002875 -4.603e+08 + H 0.0002694 1.414e-05 -2.302e+08 + O 0.0006324 0.0005268 -2.784e+08 + O2 0.08945 0.149 -5.568e+08 + OH 0.008806 0.007797 -5.085e+08 + H2O 0.8981 0.8423 -7.387e+08 + HO2 2.526e-06 4.342e-06 -7.869e+08 + H2O2 1.588e-07 2.812e-07 -1.017e+09 + AR 0 0 -1.188e+10 diff --git a/Cantera/python/examples/equilibrium/simple_test/runtest.in b/Cantera/python/examples/equilibrium/simple_test/runtest.in new file mode 100755 index 000000000..ee4524859 --- /dev/null +++ b/Cantera/python/examples/equilibrium/simple_test/runtest.in @@ -0,0 +1,49 @@ +#!/bin/sh +# +# +temp_success="1" +/bin/rm -f output_0.txt diff_csv.txt diff_out_0.txt + +########################################################################## +PYTHON_CMD=@PYTHON_CMD@ +prog=simple.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=$? + + +retnTotal=1 +if test $retnStat_0 = "0" +then + retnTotal=0 +fi + + +if test $retnTotal = "0" +then + echo "Successful test comparison on "`pwd` +else + echo "Unsuccessful test comparison on "`pwd` " test" + echo " files are different - see diff_out_0.txt" +fi + diff --git a/Cantera/python/examples/equilibrium/simple_test/simple.py b/Cantera/python/examples/equilibrium/simple_test/simple.py new file mode 100644 index 000000000..ea188e11f --- /dev/null +++ b/Cantera/python/examples/equilibrium/simple_test/simple.py @@ -0,0 +1,23 @@ +# homogeneous equilibrium of a gas. + +from Cantera import * + +# create an object representing the gas phase +gas = importPhase("h2o2.cti") + +# set the initial state +gas.set(T = 2000.0, P = 0.1*OneAtm, X = "H2:1.0, O2:0.6") + +# equilibrate the gas holding T and P fixed +gas.equilibrate("TP") + +# print a summary of the results +print gas + +# Individual properties can also be retrieved... +x = gas.moleFractions() +y = gas.massFractions() +mu = gas.chemPotentials() +names = gas.speciesNames() +for n in range(gas.nSpecies()): + print "%20s %10.4g %10.4g %10.4g " % (names[n], x[n], y[n], mu[n])