From d295b01f9531e820521afef818570c4213a419d2 Mon Sep 17 00:00:00 2001 From: China Hagstrom Date: Fri, 5 Mar 2021 15:31:55 -0500 Subject: [PATCH 1/3] Add thermal conductivity to DustyGas in python. --- interfaces/cython/cantera/_cantera.pxd | 1 + interfaces/cython/cantera/transport.pyx | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/interfaces/cython/cantera/_cantera.pxd b/interfaces/cython/cantera/_cantera.pxd index cb9dce619f..ad02762bb0 100644 --- a/interfaces/cython/cantera/_cantera.pxd +++ b/interfaces/cython/cantera/_cantera.pxd @@ -526,6 +526,7 @@ cdef extern from "cantera/transport/DustyGasTransport.h" namespace "Cantera": void setMeanParticleDiameter(double) except +translate_exception void setPermeability(double) except +translate_exception void getMolarFluxes(double*, double*, double, double*) except +translate_exception + CxxTransport& gasTransport() except +translate_exception cdef extern from "cantera/transport/TransportData.h" namespace "Cantera": diff --git a/interfaces/cython/cantera/transport.pyx b/interfaces/cython/cantera/transport.pyx index 105f83818b..56ebd3f41e 100644 --- a/interfaces/cython/cantera/transport.pyx +++ b/interfaces/cython/cantera/transport.pyx @@ -276,6 +276,11 @@ cdef class DustyGasTransport(Transport): def __set__(self, value): (self.transport).setPermeability(value) + property thermal_conductivity: + def __get__(self): + return (self.transport).gasTransport().thermalConductivity() + + def molar_fluxes(self, T1, T2, rho1, rho2, Y1, Y2, delta): """ Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at From 80a3c89de03443e187ce4fff5dfb84b45cef7136 Mon Sep 17 00:00:00 2001 From: China Hagstrom Date: Tue, 30 Mar 2021 10:08:13 -0400 Subject: [PATCH 2/3] Added thermal conductivity example in dustygas python example script --- interfaces/cython/cantera/examples/transport/dusty_gas.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interfaces/cython/cantera/examples/transport/dusty_gas.py b/interfaces/cython/cantera/examples/transport/dusty_gas.py index 4f1c1ac564..424453b04a 100644 --- a/interfaces/cython/cantera/examples/transport/dusty_gas.py +++ b/interfaces/cython/cantera/examples/transport/dusty_gas.py @@ -4,7 +4,7 @@ The Dusty Gas model is a multicomponent transport model for gas transport through the pores of a stationary porous medium. This example shows how to create a transport manager that implements the Dusty Gas model and use it to -compute the multicomponent diffusion coefficients. +compute the multicomponent diffusion coefficients and thermal conductivity. Requires: cantera >= 2.5.0 """ @@ -29,6 +29,9 @@ # print the multicomponent diffusion coefficients print(g.multi_diff_coeffs) +# print the thermal conductivity of the gas phase +print(g.thermal_conductivity) + # compute molar species fluxes T1, rho1, Y1 = g.TDY From 3cd220bde5be0dca447cd041d2995fce9f7aab3f Mon Sep 17 00:00:00 2001 From: China Hagstrom Date: Wed, 7 Apr 2021 10:59:49 -0400 Subject: [PATCH 3/3] Added thermal conductivity test to TestDustyGas class --- interfaces/cython/cantera/test/test_transport.py | 5 +++++ interfaces/cython/cantera/transport.pyx | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/interfaces/cython/cantera/test/test_transport.py b/interfaces/cython/cantera/test/test_transport.py index 974f07c531..aaa3d4535d 100644 --- a/interfaces/cython/cantera/test/test_transport.py +++ b/interfaces/cython/cantera/test/test_transport.py @@ -309,6 +309,11 @@ def test_molar_fluxes(self): # Not sure why the following condition is not satisfied: # self.assertNear(sum(fluxes1) / sum(abs(fluxes1)), 0.0) + def test_thermal_conductivity(self): + gas1 = ct.Solution('h2o2.xml', transport_model='multicomponent') + gas1.TPX = self.phase.TPX + + self.assertEqual(self.phase.thermal_conductivity, gas1.thermal_conductivity) class TestWaterTransport(utilities.CanteraTest): """ diff --git a/interfaces/cython/cantera/transport.pyx b/interfaces/cython/cantera/transport.pyx index 56ebd3f41e..e6dedec1c8 100644 --- a/interfaces/cython/cantera/transport.pyx +++ b/interfaces/cython/cantera/transport.pyx @@ -182,7 +182,11 @@ cdef class Transport(_SolutionBase): return self.transport.electricalConductivity() property thermal_conductivity: - """Thermal conductivity. [W/m/K].""" + """ + Thermal conductivity. [W/m/K] + Returns thermal conductivity of the ideal gas object using the multicomponent + model. The value is not specific to the dusty gas model. + """ def __get__(self): return self.transport.thermalConductivity()