mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
Moved nasa9_reader test to Python
This commit is contained in:
@@ -27,13 +27,13 @@
|
||||
<NASA9 Tmax="1000.0" Tmin="200.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="9">
|
||||
7.750600970E+04, -1.440779717E+03, 1.401744141E+01, -6.381631240E-03,
|
||||
5.871674720E-06, -2.908872278E-09, 5.994050890E-13, -6.579343180E+04
|
||||
5.871674720E-06, -2.908872278E-09, 5.994050890E-13, -6.579343180E+04,
|
||||
-4.494017799E+01</floatArray>
|
||||
</NASA9>
|
||||
<NASA9 Tmax="6000.0" Tmin="1000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="9">
|
||||
-1.378630916E+05, -5.579207290E+01, 1.004190387E+01, -1.682165339E-05,
|
||||
3.724664660E-09, -4.275526780E-13, 1.982341329E-17, -7.343407470E+04
|
||||
3.724664660E-09, -4.275526780E-13, 1.982341329E-17, -7.343407470E+04,
|
||||
-2.045130429E+01</floatArray>
|
||||
</NASA9>
|
||||
</thermo>
|
||||
@@ -45,22 +45,22 @@
|
||||
<note>Ref-Species. Chase, 1998 3/82. </note>
|
||||
<charge>-1</charge>
|
||||
<thermo>
|
||||
<NASA9 Tmax="1000.0" Tmin="298.14999999999998" P0="100000.0">
|
||||
<NASA9 Tmax="1000.0" Tmin="298.15" P0="100000.0">
|
||||
<floatArray name="coeffs" size="9">
|
||||
0.000000000E+00, 0.000000000E+00, 2.500000000E+00, 0.000000000E+00,
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02,
|
||||
-1.172081224E+01</floatArray>
|
||||
</NASA9>
|
||||
<NASA9 Tmax="6000.0" Tmin="1000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="9">
|
||||
0.000000000E+00, 0.000000000E+00, 2.500000000E+00, 0.000000000E+00,
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02,
|
||||
-1.172081224E+01</floatArray>
|
||||
</NASA9>
|
||||
<NASA9 Tmax="20000.0" Tmin="6000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="9">
|
||||
0.000000000E+00, 0.000000000E+00, 2.500000000E+00, 0.000000000E+00,
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02,
|
||||
-1.172081224E+01</floatArray>
|
||||
</NASA9>
|
||||
</thermo>
|
||||
@@ -74,19 +74,19 @@
|
||||
<NASA9 Tmax="1000.0" Tmin="200.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="9">
|
||||
0.000000000E+00, 0.000000000E+00, 2.500000000E+00, 0.000000000E+00,
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00, -7.453750000E+02,
|
||||
4.379674910E+00</floatArray>
|
||||
</NASA9>
|
||||
<NASA9 Tmax="6000.0" Tmin="1000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="9">
|
||||
2.010538475E+01, -5.992661070E-02, 2.500069401E+00, -3.992141160E-08,
|
||||
1.205272140E-11, -1.819015576E-15, 1.078576636E-19, -7.449939610E+02
|
||||
1.205272140E-11, -1.819015576E-15, 1.078576636E-19, -7.449939610E+02,
|
||||
4.379180110E+00</floatArray>
|
||||
</NASA9>
|
||||
<NASA9 Tmax="20000.0" Tmin="6000.0" P0="100000.0">
|
||||
<floatArray name="coeffs" size="9">
|
||||
-9.951265080E+08, 6.458887260E+05, -1.675894697E+02, 2.319933363E-02,
|
||||
-1.721080911E-06, 6.531938460E-11, -9.740147729E-16, -5.078300340E+06
|
||||
-1.721080911E-06, 6.531938460E-11, -9.740147729E-16, -5.078300340E+06,
|
||||
1.465298484E+03</floatArray>
|
||||
</NASA9>
|
||||
</thermo>
|
||||
@@ -3,9 +3,10 @@ import unittest
|
||||
import numpy as np
|
||||
import ck2cti
|
||||
|
||||
import utilities
|
||||
import Cantera as ct
|
||||
|
||||
class chemkinConverterTest(unittest.TestCase):
|
||||
class chemkinConverterTest(utilities.CanteraTest):
|
||||
def checkConversion(self, refFile, testFile):
|
||||
ref = ct.IdealGasMix(refFile)
|
||||
gas = ct.IdealGasMix(testFile)
|
||||
@@ -55,3 +56,27 @@ class chemkinConverterTest(unittest.TestCase):
|
||||
self.assertRaises(ck2cti.InputParseError,
|
||||
lambda: ck2cti.convertMech('../data/h2o2_missingThermo.inp',
|
||||
quiet=True))
|
||||
|
||||
def test_nasa9(self):
|
||||
if os.path.exists('nasa9_test.cti'):
|
||||
os.remove('nasa9_test.cti')
|
||||
ck2cti.convertMech('../data/nasa9-test.inp',
|
||||
thermoFile='../data/nasa9-test-therm.dat',
|
||||
outName='nasa9_test.cti', quiet=True)
|
||||
|
||||
self.checkConversion('../data/nasa9-test.xml', 'nasa9_test.cti')
|
||||
|
||||
ref = ct.IdealGasMix('../data/nasa9-test.xml')
|
||||
gas = ct.IdealGasMix('nasa9_test.cti')
|
||||
|
||||
for T in [300, 500, 1200, 5000]:
|
||||
ref_cp = ref.cp_R()
|
||||
gas_cp = gas.cp_R()
|
||||
ref_h = ref.enthalpies_RT()
|
||||
gas_h = gas.enthalpies_RT()
|
||||
ref_s = ref.entropies_R()
|
||||
gas_s = gas.entropies_R()
|
||||
for i in range(gas.nSpecies()):
|
||||
self.assertNear(ref_cp[i], gas_cp[i], 1e-7)
|
||||
self.assertNear(ref_h[i], gas_h[i], 1e-7)
|
||||
self.assertNear(ref_s[i], gas_s[i], 1e-7)
|
||||
|
||||
@@ -249,11 +249,6 @@ CompileAndTest('mixGasTransport',
|
||||
CompileAndTest('multiGasTransport',
|
||||
'multiGasTransport', 'multiGasTransport', 'output_blessed.txt')
|
||||
CompileAndTest('NASA9poly', 'NASA9poly_test', 'NASA9poly_test', 'output_blessed.txt')
|
||||
Test('nasa9_reader', 'nasa9_reader', '#build/bin/ck2cti$PROGSUFFIX', None,
|
||||
options='-i sample.inp -id sample -t sampleData.inp',
|
||||
comparisons=[('sample_blessed.cti', 'sample.cti')],
|
||||
ignoreLines=['#'],
|
||||
artifacts=['ck2cti.log'])
|
||||
|
||||
negA = localenv.Program('negATest/negATest',
|
||||
mglob(env, 'negATest', 'cpp'),
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
TESTS = runtest
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo " "
|
||||
echo "***************************************************"
|
||||
echo " Testing CK2CTI on NASA9 Thermodynamics : using the build/bin version of ck2cti"
|
||||
echo "***************************************************"
|
||||
echo " "
|
||||
BINDIR=@buildbin@
|
||||
CK2CTI=$BINDIR/ck2cti
|
||||
/bin/rm -f sample.cti
|
||||
echo "...Test 1: Converting file sample.inp..."
|
||||
$CK2CTI -i ./sample.inp -id sample -t sampleData.inp
|
||||
#
|
||||
# strip out variably dated stuff
|
||||
#
|
||||
cat sample.cti | sed '1,5s/^#.*$/#/' > samplea.cti
|
||||
#
|
||||
# Change all 3 character exponent expressions starting with 0
|
||||
# into 2 character exponent expressions
|
||||
# (MSVC++ defaults to 3, and I can't figure out how to change
|
||||
# this behavior).
|
||||
#
|
||||
../../bin/exp3to2.sh samplea.cti > sampleb.cti
|
||||
#
|
||||
#
|
||||
diff sampleb.cti sample_blessed.cti > diff_test.out
|
||||
retnStat=$?
|
||||
#
|
||||
if [ $retnStat = "0" ]
|
||||
then
|
||||
echo "Successful diff comparison on ck2cti test (nasa9_reader/sample.inp)"
|
||||
return 0
|
||||
else
|
||||
echo "########################################################"
|
||||
echo "Unsuccessful diff comparison on ck2cti test (nasa9_reader/sample.inp)"
|
||||
echo " For more information, see files:"
|
||||
echo " test_problems/nasa9_reader/diff_test.out"
|
||||
echo " test_problems/nasa9_reader/sampleb.cti"
|
||||
echo " test_problems/nasa9_reader/sample_blessed.cti"
|
||||
echo "########################################################"
|
||||
return 1
|
||||
fi
|
||||
@@ -1,70 +0,0 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
units(length = "cm", time = "s", quantity = "mol", act_energy = "cal/mol")
|
||||
|
||||
|
||||
ideal_gas(name = "sample",
|
||||
elements = " O H Al Cl E Ar ",
|
||||
species = """ ALCL3 e- AR """,
|
||||
reactions = "all",
|
||||
initial_state = state(temperature = 300.0,
|
||||
pressure = OneAtm) )
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Species data
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
species(name = "ALCL3",
|
||||
atoms = " Al:1 Cl:3 ",
|
||||
thermo = (
|
||||
NASA9( [ 200.00, 1000.00], [ 7.750600970E+04, -1.440779717E+03, 1.401744141E+01,
|
||||
-6.381631240E-03, 5.871674720E-06, -2.908872278E-09,
|
||||
5.994050890E-13, -6.579343180E+04, -4.494017799E+01] ),
|
||||
NASA9( [ 1000.00, 6000.00], [ -1.378630916E+05, -5.579207290E+01, 1.004190387E+01,
|
||||
-1.682165339E-05, 3.724664660E-09, -4.275526780E-13,
|
||||
1.982341329E-17, -7.343407470E+04, -2.045130429E+01] )
|
||||
),
|
||||
note = " Gurvich,1996a pt1 p173 pt2 p134."
|
||||
)
|
||||
|
||||
species(name = "e-",
|
||||
atoms = " E:1 ",
|
||||
thermo = (
|
||||
NASA9( [ 298.15, 1000.00], [ 0.000000000E+00, 0.000000000E+00, 2.500000000E+00,
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
|
||||
0.000000000E+00, -7.453750000E+02, -1.172081224E+01] ),
|
||||
NASA9( [ 1000.00, 6000.00], [ 0.000000000E+00, 0.000000000E+00, 2.500000000E+00,
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
|
||||
0.000000000E+00, -7.453750000E+02, -1.172081224E+01] ),
|
||||
NASA9( [ 6000.00, 20000.00], [ 0.000000000E+00, 0.000000000E+00, 2.500000000E+00,
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
|
||||
0.000000000E+00, -7.453750000E+02, -1.172081224E+01] )
|
||||
),
|
||||
note = " Ref-Species. Chase, 1998 3/82. "
|
||||
)
|
||||
|
||||
species(name = "AR",
|
||||
atoms = " Ar:1 ",
|
||||
thermo = (
|
||||
NASA9( [ 200.00, 1000.00], [ 0.000000000E+00, 0.000000000E+00, 2.500000000E+00,
|
||||
0.000000000E+00, 0.000000000E+00, 0.000000000E+00,
|
||||
0.000000000E+00, -7.453750000E+02, 4.379674910E+00] ),
|
||||
NASA9( [ 1000.00, 6000.00], [ 2.010538475E+01, -5.992661070E-02, 2.500069401E+00,
|
||||
-3.992141160E-08, 1.205272140E-11, -1.819015576E-15,
|
||||
1.078576636E-19, -7.449939610E+02, 4.379180110E+00] ),
|
||||
NASA9( [ 6000.00, 20000.00], [ -9.951265080E+08, 6.458887260E+05, -1.675894697E+02,
|
||||
2.319933363E-02, -1.721080911E-06, 6.531938460E-11,
|
||||
-9.740147729E-16, -5.078300340E+06, 1.465298484E+03] )
|
||||
),
|
||||
note = " Ref-Elm. Moore,1971. Gordon,1999.. "
|
||||
)
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Reaction data
|
||||
#-------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user