Checking in example dir.

This commit is contained in:
Harry Moffat 2009-03-24 20:03:38 +00:00
parent c842a6423f
commit 48139f55b5
6 changed files with 113 additions and 0 deletions

View file

@ -0,0 +1,8 @@
Makefile
runtest
ct2ctml.log
diff_out_0.txt
h2o2.xml
liquidvapor.xml
output_0.txt
transport_log.xml

View file

@ -0,0 +1,15 @@
#!/bin/sh
PYTHON_CMD = @PYTHON_CMD@
run:
$(PYTHON_CMD) critProperties.py
test:
./runtest
clean:
rm -f *.log *.csv *.xml
./cleanup
# end of file

View file

@ -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*

View file

@ -0,0 +1,29 @@
"""
Print the critical state properties for the fluids for which Cantera has
built-in liquid/vapor equations of state.
"""
from Cantera import *
from Cantera.liquidvapor import *
fluids = {'water':Water(),
'nitrogen':Nitrogen(),
'methane':Methane(),
'hydrogen':Hydrogen(),
'oxygen':Oxygen(),
'carbondioxide':CarbonDioxide(),
'heptane':Heptane()
}
print 'Critical State Properties'
print '%20s %10s %10s %10s' % ('Fluid','Tc [K]', 'Pc [Pa]', 'Zc')
for name in fluids.keys():
f = fluids[name]
tc = f.critTemperature()
pc = f.critPressure()
rc = f.critDensity()
mw = f.meanMolecularWeight()
zc = pc*mw/(rc*GasConstant*tc)
print '%20s %10.4g %10.4G %10.4G' % (name, tc, pc, zc)

View file

@ -0,0 +1,9 @@
Critical State Properties
Fluid Tc [K] Pc [Pa] Zc
carbondioxide 304.2 7.384E+06 0.2769
oxygen 154.6 5.043E+06 0.2879
water 647.3 2.209E+07 0.2333
nitrogen 126.2 3.4E+06 0.2891
heptane 537.7 2.62E+06 0.2972
hydrogen 32.94 1.284E+06 0.3013
methane 190.6 4.599E+06 0.2904

View file

@ -0,0 +1,47 @@
#!/bin/sh
#
#
temp_success="1"
/bin/rm -f output_0.txt diff_csv.txt diff_out_0.txt
##########################################################################
PYTHON_CMD=@PYTHON_CMD@
prog=critProperties.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 of txt files on "`pwd` " test"
echo " see diff_outi_0.txt "
fi