Example #1
0
 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)
Example #2
0
 def test_set_customary_units(self):
     tr1 = ct.GasTransportData()
     tr1.set_customary_units('nonlinear', 2.60, 572.40, 1.84, 0.0, 4.00)
     tr2 = self.gas.species('H2O').transport
     self.assertEqual(tr1.geometry, tr2.geometry)
     self.assertNear(tr1.diameter, tr2.diameter)
     self.assertNear(tr1.well_depth, tr2.well_depth)
     self.assertNear(tr1.dipole, tr2.dipole)
     self.assertNear(tr1.polarizability, tr2.polarizability)
     self.assertNear(tr1.rotational_relaxation, tr2.rotational_relaxation)
Example #3
0
    def to_cantera(self):
        """
        Returns a Cantera GasTransportData object.
    
        The Cantera usage is as follows:
        
        GasTransportData().set_customary_units(self, geometry, diameter, well_depth, dipole=0.0, polarizability=0.0, rotational_relaxation=0.0, acentric_factor=0.0)
        Set the parameters using customary units: diameter in Angstroms, well depth in Kelvin, dipole in Debye, rotational relaxiation at 298 K, and polarizability in Angstroms^3. 
        These are the units used in in CK-style input files.
        """
        import cantera as ct

        ct_transport = ct.GasTransportData()

        if self.shapeIndex == 0:
            geometry = 'atom'
        elif self.shapeIndex == 1:
            geometry = 'linear'
        elif self.shapeIndex == 2:
            geometry = 'nonlinear'

        # collision diameter in angstroms
        diameter = self.sigma.value_si * 1e10
        # Well depth in Kelvins
        well_depth = self.epsilon.value_si / constants.R
        # Dipole in debye
        dipole = self.dipoleMoment.value_si * constants.c * 1e21 if self.dipoleMoment else 0.0
        # polarizability in cubic angstroms
        polarizability = self.polarizability.value_si * 1e30 if self.polarizability else 0.0
        rotational_relaxation = self.rotrelaxcollnum if self.rotrelaxcollnum else 0.0
        acentric_factor = 0.0

        ct_transport.set_customary_units(geometry, diameter, well_depth,
                                         dipole, polarizability,
                                         rotational_relaxation,
                                         acentric_factor)

        return ct_transport