Skip to content

Commit

Permalink
[Transport/Test] Add tests for IonTransport properties
Browse files Browse the repository at this point in the history
  • Loading branch information
BangShiuh authored and speth committed Jun 15, 2018
1 parent 1245a69 commit 5c783c7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 9 deletions.
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/test/test_onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,4 +951,4 @@ def test_ion_profile(self):
self.sim.solve(loglevel=0, stage=2, enable_energy=True)

# Regression test
self.assertNear(max(self.sim.E), 133.4795, 1e-3)
self.assertNear(max(self.sim.E), 131.9956, 1e-3)
42 changes: 42 additions & 0 deletions interfaces/cython/cantera/test/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,29 @@ def test_species_visosities(self):
visc)


class TestIonTransport(utilities.CanteraTest):
def setUp(self):
p = ct.one_atm
T = 2237
self.gas = ct.Solution('ch4_ion.cti')
self.gas.X = 'O2:0.7010, H2O:0.1885, CO2:9.558e-2'
self.gas.TP = T, p

def test_binary_diffusion(self):
ld = self.gas.n_species
i = self.gas.species_index("N2")
j = self.gas.species_index("H3O+")
bdiff = self.gas.binary_diff_coeffs[i][j]
# Regression test
self.assertNear(bdiff, 4.258e-4, 1e-4)

def test_mixture_diffusion(self):
j = self.gas.species_index("H3O+")
mdiff = self.gas.mix_diff_coeffs[j]
# Regression test
self.assertNear(mdiff, 5.057e-4, 1e-4)


class TestTransportGeometryFlags(utilities.CanteraTest):
phase_data = """
units(length="cm", time="s", quantity="mol", act_energy="cal/mol")
Expand Down Expand Up @@ -261,3 +284,22 @@ def test_set_customary_units(self):
self.assertNear(tr1.dipole, tr2.dipole)
self.assertNear(tr1.polarizability, tr2.polarizability)
self.assertNear(tr1.rotational_relaxation, tr2.rotational_relaxation)


class TestIonGasTransportData(utilities.CanteraTest):
def setUp(self):
self.gas = ct.Solution('ch4_ion.cti')

def test_read_ion(self):
tr = self.gas.species('N2').transport
self.assertNear(tr.dispersion_coefficient, 2.995e-50)
self.assertNear(tr.quadrupole_polarizability, 3.602e-50)

def test_set_customary_units(self):
tr1 = ct.GasTransportData()
tr1.set_customary_units('linear', 3.62, 97.53, 1.76,
dispersion_coefficient = 2.995,
quadrupole_polarizability = 3.602)
tr2 = self.gas.species('N2').transport
self.assertNear(tr1.dispersion_coefficient, tr2.dispersion_coefficient)
self.assertNear(tr1.quadrupole_polarizability, tr2.quadrupole_polarizability)
19 changes: 11 additions & 8 deletions test/data/ch4_ion.cti
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ species(name = "N2",
diam = 3.62,
well_depth = 97.53,
polar = 1.76,
rot_relax = 4.00),
rot_relax = 4.00,
disp_coeff = 2.995,
quad_polar = 3.602),
note = "121286"
)

Expand All @@ -161,8 +163,9 @@ species(name = 'HCO+',
transport=gas_transport(geom='linear',
diam=3.59,
well_depth=498.0,
polar=2.5,
rot_relax=0.0),
polar=1.356,
rot_relax=0.0,
disp_coeff = 0.416),
note = 'J12/70')

species(name = 'H3O+',
Expand All @@ -176,11 +179,11 @@ species(name = 'H3O+',
7.097291130E+04, 7.458507790E+00] )
),
transport=gas_transport(geom='nonlinear',
diam=2.605,
well_depth=572.4,
dipole=1.844,
polar=1.5,
rot_relax=2.1),
diam=3.15,
well_depth=106.2,
dipole=1.417,
polar=0.897,
rot_relax=0.0),
note = 'TPIS89')

species(name = 'E',
Expand Down

0 comments on commit 5c783c7

Please sign in to comment.