diff --git a/interfaces/cython/cantera/examples/onedim/ion_flame.py b/interfaces/cython/cantera/examples/onedim/ion_flame.py index a15900489..7f467ae23 100644 --- a/interfaces/cython/cantera/examples/onedim/ion_flame.py +++ b/interfaces/cython/cantera/examples/onedim/ion_flame.py @@ -28,7 +28,7 @@ f.solve(loglevel=loglevel, auto=True) # stage two f.solve(loglevel=loglevel, stage=2, enable_energy=True) -f.save('CH4_adiabatic.xml', 'mix', 'solution with mixture-averaged transport') +f.save('CH4_adiabatic.xml', 'ion', 'solution with ionized gas transport') f.show_solution() print('mixture-averaged flamespeed = {0:7f} m/s'.format(f.u[0])) diff --git a/interfaces/cython/cantera/test/test_onedim.py b/interfaces/cython/cantera/test/test_onedim.py index 12919494c..7b837efde 100644 --- a/interfaces/cython/cantera/test/test_onedim.py +++ b/interfaces/cython/cantera/test/test_onedim.py @@ -942,6 +942,7 @@ class TestIonFlame(utilities.CanteraTest): self.sim.set_refine_criteria(ratio=4, slope=0.8, curve=1.0) # Ionized species may require tighter absolute tolerances self.sim.flame.set_steady_tolerances(Y=(1e-4, 1e-12)) + self.sim.transport_model = 'Ion' # stage one self.sim.solve(loglevel=0, auto=True) @@ -950,4 +951,4 @@ class TestIonFlame(utilities.CanteraTest): self.sim.solve(loglevel=0, stage=2, enable_energy=True) # Regression test - self.assertNear(max(self.sim.E), 114.4623, 1e-3) + self.assertNear(max(self.sim.E), 133.4795, 1e-3) diff --git a/interfaces/cython/cantera/test/test_transport.py b/interfaces/cython/cantera/test/test_transport.py index 318faa97a..840636bc5 100644 --- a/interfaces/cython/cantera/test/test_transport.py +++ b/interfaces/cython/cantera/test/test_transport.py @@ -47,6 +47,19 @@ class TestTransport(utilities.CanteraTest): self.assertArrayNear(Dbin1, Dbin2) self.assertArrayNear(Dbin1, Dbin1.T) + def test_ionGas(self): + # IonGasTransport gives the same result for a mixture + # without ionized species + self.phase.transport_model = 'Ion' + Dkm1 = self.phase.mix_diff_coeffs + Dbin1 = self.phase.binary_diff_coeffs + + self.phase.transport_model = 'Mix' + Dkm2 = self.phase.mix_diff_coeffs + Dbin2 = self.phase.binary_diff_coeffs + self.assertArrayNear(Dkm1, Dkm2) + self.assertArrayNear(Dbin1, Dbin2) + def test_multiComponent(self): with self.assertRaises(ct.CanteraError): self.phase.multi_diff_coeffs diff --git a/test/data/ch4_ion.cti b/test/data/ch4_ion.cti index 8b42063df..fbbbdc021 100644 --- a/test/data/ch4_ion.cti +++ b/test/data/ch4_ion.cti @@ -2,18 +2,151 @@ units(length='cm', time='s', quantity='mol', act_energy='cal/mol') ideal_gas(name='gas', elements='O H C N E', - species=['''gri30: H2 H O O2 OH H2O HO2 - H2O2 C CH CH2 CH2(S) CH3 CH4 - CO CO2 HCO CH2O CH3O N2''', - 'HCO+ H3O+ E'], + species=['''gri30: H O OH HO2 H2O2 C CH + CH2 CH2(S) CH3 HCO CH2O CH3O''', + '''H2 O2 H2O CH4 CO CO2 N2 + HCO+ H3O+ E'''], reactions=['gri30: all', 'all'], - transport='Mix', + transport='Ion', options=['skip_undeclared_species', 'skip_undeclared_third_bodies'], initial_state=state(temperature=300.0, pressure=OneAtm)) #------------------------------------------------------------------------------- # Species data #------------------------------------------------------------------------------- +species(name = "H2", + atoms = " H:2 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 2.344331120E+00, 7.980520750E-03, + -1.947815100E-05, 2.015720940E-08, -7.376117610E-12, + -9.179351730E+02, 6.830102380E-01] ), + NASA( [ 1000.00, 3500.00], [ 3.337279200E+00, -4.940247310E-05, + 4.994567780E-07, -1.795663940E-10, 2.002553760E-14, + -9.501589220E+02, -3.205023310E+00] ) + ), + transport = gas_transport( + geom = "linear", + diam = 2.92, + well_depth = 38.00, + polar = 0.455, + rot_relax = 280.00), + note = "TPIS78" + ) + +species(name = "O2", + atoms = " O:2 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 3.782456360E+00, -2.996734160E-03, + 9.847302010E-06, -9.681295090E-09, 3.243728370E-12, + -1.063943560E+03, 3.657675730E+00] ), + NASA( [ 1000.00, 3500.00], [ 3.282537840E+00, 1.483087540E-03, + -7.579666690E-07, 2.094705550E-10, -2.167177940E-14, + -1.088457720E+03, 5.453231290E+00] ) + ), + transport = gas_transport( + geom = "linear", + diam = 3.46, + well_depth = 107.40, + polar = 1.131, + rot_relax = 3.80), + note = "TPIS89" + ) + +species(name = "H2O", + atoms = " H:2 O:1 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 4.198640560E+00, -2.036434100E-03, + 6.520402110E-06, -5.487970620E-09, 1.771978170E-12, + -3.029372670E+04, -8.490322080E-01] ), + NASA( [ 1000.00, 3500.00], [ 3.033992490E+00, 2.176918040E-03, + -1.640725180E-07, -9.704198700E-11, 1.682009920E-14, + -3.000429710E+04, 4.966770100E+00] ) + ), + transport = gas_transport( + geom = "nonlinear", + diam = 2.60, + well_depth = 572.40, + dipole = 1.84, + polar = 1.053, + rot_relax = 4.00), + note = "L 8/89" + ) + +species(name = "CH4", + atoms = " C:1 H:4 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 5.149876130E+00, -1.367097880E-02, + 4.918005990E-05, -4.847430260E-08, 1.666939560E-11, + -1.024664760E+04, -4.641303760E+00] ), + NASA( [ 1000.00, 3500.00], [ 7.485149500E-02, 1.339094670E-02, + -5.732858090E-06, 1.222925350E-09, -1.018152300E-13, + -9.468344590E+03, 1.843731800E+01] ) + ), + transport = gas_transport( + geom = "nonlinear", + diam = 3.75, + well_depth = 141.40, + polar = 2.60, + rot_relax = 13.00), + note = "L 8/88" + ) + +species(name = "CO", + atoms = " C:1 O:1 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 3.579533470E+00, -6.103536800E-04, + 1.016814330E-06, 9.070058840E-10, -9.044244990E-13, + -1.434408600E+04, 3.508409280E+00] ), + NASA( [ 1000.00, 3500.00], [ 2.715185610E+00, 2.062527430E-03, + -9.988257710E-07, 2.300530080E-10, -2.036477160E-14, + -1.415187240E+04, 7.818687720E+00] ) + ), + transport = gas_transport( + geom = "linear", + diam = 3.65, + well_depth = 98.10, + polar = 1.95, + rot_relax = 1.80), + note = "TPIS79" + ) + +species(name = "CO2", + atoms = " C:1 O:2 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 2.356773520E+00, 8.984596770E-03, + -7.123562690E-06, 2.459190220E-09, -1.436995480E-13, + -4.837196970E+04, 9.901052220E+00] ), + NASA( [ 1000.00, 3500.00], [ 3.857460290E+00, 4.414370260E-03, + -2.214814040E-06, 5.234901880E-10, -4.720841640E-14, + -4.875916600E+04, 2.271638060E+00] ) + ), + transport = gas_transport( + geom = "linear", + diam = 3.76, + well_depth = 244.00, + polar = 2.65, + rot_relax = 2.10), + note = "L 7/88" + ) + +species(name = "N2", + atoms = " N:2 ", + thermo = ( + NASA( [ 300.00, 1000.00], [ 3.298677000E+00, 1.408240400E-03, + -3.963222000E-06, 5.641515000E-09, -2.444854000E-12, + -1.020899900E+03, 3.950372000E+00] ), + NASA( [ 1000.00, 5000.00], [ 2.926640000E+00, 1.487976800E-03, + -5.684760000E-07, 1.009703800E-10, -6.753351000E-15, + -9.227977000E+02, 5.980528000E+00] ) + ), + transport = gas_transport( + geom = "linear", + diam = 3.62, + well_depth = 97.53, + polar = 1.76, + rot_relax = 4.00), + note = "121286" + ) species(name = 'HCO+', atoms = ' H:1 C:1 O:1 E:-1 ',